Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

CacheTest.java 2.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*
  2. * SonarSource :: IT :: SonarQube Runner
  3. * Copyright (C) 2009 SonarSource
  4. * sonarqube@googlegroups.com
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Lesser General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 3 of the License, or (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General Public
  17. * License along with this program; if not, write to the Free Software
  18. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
  19. */
  20. package com.sonar.runner.it;
  21. import com.sonar.orchestrator.build.BuildFailureException;
  22. import com.sonar.orchestrator.locator.ResourceLocation;
  23. import com.sonar.orchestrator.build.BuildResult;
  24. import com.sonar.orchestrator.build.SonarRunner;
  25. import org.junit.Test;
  26. import java.io.File;
  27. import static org.junit.Assert.*;
  28. import static org.junit.Assume.assumeTrue;
  29. public class CacheTest extends RunnerTestCase {
  30. @Test
  31. public void testOffline() {
  32. assumeTrue(orchestrator.getServer().version().isGreaterThanOrEquals("5.2"));
  33. orchestrator.getServer().restoreProfile(ResourceLocation.create("/sonar-way-profile.xml"));
  34. SonarRunner build = createRunner(true);
  35. BuildResult result = orchestrator.executeBuild(build);
  36. stopServer();
  37. build = createRunner(false);
  38. try {
  39. result = orchestrator.executeBuild(build, false);
  40. } catch (BuildFailureException e) {
  41. // expected
  42. }
  43. build = createRunner(true);
  44. result = orchestrator.executeBuild(build, false);
  45. assertTrue(result.isSuccess());
  46. }
  47. private SonarRunner createRunner(boolean enableOffline) {
  48. SonarRunner runner = newRunner(new File("projects/java-sample"))
  49. .setProperty("sonar.analysis.mode", "preview")
  50. .setProfile("sonar-way");
  51. if (enableOffline) {
  52. runner.setProperty("sonar.enableOffline", "true");
  53. }
  54. return runner;
  55. }
  56. }