diff options
author | Sébastien Lesaint <sebastien.lesaint@sonarsource.com> | 2016-01-14 18:31:20 +0100 |
---|---|---|
committer | Sébastien Lesaint <sebastien.lesaint@sonarsource.com> | 2016-01-18 11:16:44 +0100 |
commit | ce63bf3bcfaabf6ce33e80224531cb7004a4bd98 (patch) | |
tree | 368777631ccc3b915c78ccd0711320656b74393e /it/it-tests | |
parent | 91ac20e2d89e3d5d5df1d9627e1471288a315a54 (diff) | |
download | sonarqube-ce63bf3bcfaabf6ce33e80224531cb7004a4bd98.tar.gz sonarqube-ce63bf3bcfaabf6ce33e80224531cb7004a4bd98.zip |
SONAR-7168 add system().restart() to WsClient
Diffstat (limited to 'it/it-tests')
-rw-r--r-- | it/it-tests/src/test/java/it/serverSystem/RestartTest.java | 9 | ||||
-rw-r--r-- | it/it-tests/src/test/java/util/ItUtils.java | 9 |
2 files changed, 14 insertions, 4 deletions
diff --git a/it/it-tests/src/test/java/it/serverSystem/RestartTest.java b/it/it-tests/src/test/java/it/serverSystem/RestartTest.java index 021a928aa89..949f8f193a2 100644 --- a/it/it-tests/src/test/java/it/serverSystem/RestartTest.java +++ b/it/it-tests/src/test/java/it/serverSystem/RestartTest.java @@ -32,6 +32,8 @@ import org.junit.rules.Timeout; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.Assert.fail; +import static util.ItUtils.newAdminWsClient; +import static util.ItUtils.newWsClient; /** * This class starts a new orchestrator on each test case @@ -45,6 +47,7 @@ public class RestartTest { @Rule public TestRule globalTimeout = new DisableOnDebug(Timeout.seconds(120)); + @After public void stop() { if (orchestrator != null) { @@ -62,13 +65,13 @@ public class RestartTest { orchestrator.start(); try { - orchestrator.getServer().wsClient().systemClient().restart(); + newWsClient(orchestrator).system().restart(); fail(); } catch (Exception e) { assertThat(e.getMessage()).contains("403"); } - orchestrator.getServer().adminWsClient().systemClient().restart(); + newAdminWsClient(orchestrator).system().restart(); // we just wait five seconds, for a lack of a better approach to waiting for the restart process to start in SQ Thread.sleep(5000); @@ -90,7 +93,7 @@ public class RestartTest { .build(); orchestrator.start(); - orchestrator.getServer().adminWsClient().systemClient().restart(); + newAdminWsClient(orchestrator).system().restart(); assertThat(FileUtils.readFileToString(orchestrator.getServer().getLogs())) .contains("Fast restarting WebServer...") .contains("WebServer restarted"); diff --git a/it/it-tests/src/test/java/util/ItUtils.java b/it/it-tests/src/test/java/util/ItUtils.java index 834545b7b32..060b434fbd7 100644 --- a/it/it-tests/src/test/java/util/ItUtils.java +++ b/it/it-tests/src/test/java/util/ItUtils.java @@ -103,6 +103,13 @@ public class ItUtils { .build()); } + public static WsClient newWsClient(Orchestrator orchestrator) { + Server server = orchestrator.getServer(); + return new HttpWsClient(new HttpConnector.Builder() + .url(server.getUrl()) + .build()); + } + /** * Locate the directory of sample project * @@ -223,7 +230,7 @@ public class ItUtils { setServerProperty(orchestrator, null, key, value); } - public static void setServerProperty(Orchestrator orchestrator, @Nullable String componentKey, String key, @Nullable String value) { + public static void setServerProperty(Orchestrator orchestrator, @Nullable String componentKey, String key, @Nullable String value) { if (value == null) { orchestrator.getServer().getAdminWsClient().delete(new PropertyDeleteQuery(key).setResourceKeyOrId(componentKey)); } else { |