diff options
author | Stephane Gamard <stephane.gamard@searchbox.com> | 2014-08-07 13:55:12 +0200 |
---|---|---|
committer | Stephane Gamard <stephane.gamard@searchbox.com> | 2014-08-07 14:01:17 +0200 |
commit | b4695eb44ce28f23e302b33bb95eafbdfefe6a2e (patch) | |
tree | 99c2f8049d2e87b25d6f561e037cf2ed2ac19096 /server/sonar-search/src/test | |
parent | 0dc1822dc8342b18bd4063373ba43754a5e76e81 (diff) | |
download | sonarqube-b4695eb44ce28f23e302b33bb95eafbdfefe6a2e.tar.gz sonarqube-b4695eb44ce28f23e302b33bb95eafbdfefe6a2e.zip |
SONAR-4898 - Created a DummyOKApplication for Unit test of ProcessWrapper
Diffstat (limited to 'server/sonar-search/src/test')
-rw-r--r-- | server/sonar-search/src/test/java/org/sonar/search/SearchServerTest.java | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/server/sonar-search/src/test/java/org/sonar/search/SearchServerTest.java b/server/sonar-search/src/test/java/org/sonar/search/SearchServerTest.java index 05b073a1a51..8bc1f4bca66 100644 --- a/server/sonar-search/src/test/java/org/sonar/search/SearchServerTest.java +++ b/server/sonar-search/src/test/java/org/sonar/search/SearchServerTest.java @@ -80,6 +80,34 @@ public class SearchServerTest { } @Test + public void server_fail_to_start() throws Exception { + Properties properties = new Properties(); + properties.setProperty(MonitoredProcess.NAME_PROPERTY, "ES"); + + + searchServer = new SearchServer(new Props(properties)); + new Thread(new Runnable() { + @Override + public void run() { + searchServer.start(); + } + }).start(); + assertThat(searchServer.isReady()).isFalse(); + + int count = 0; + while (!searchServer.isReady() && count < 100) { + try { + Thread.sleep(500); + } catch (InterruptedException e) { + e.printStackTrace(); + } + count++; + } + assertThat(count).isEqualTo(100); + + } + + @Test public void can_connect() throws Exception { Properties properties = new Properties(); properties.setProperty(MonitoredProcess.NAME_PROPERTY, "ES"); |