diff options
author | Simon Brandhof <simon.brandhof@sonarsource.com> | 2014-12-15 21:59:49 +0100 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@sonarsource.com> | 2014-12-15 21:59:56 +0100 |
commit | 6962446f69eab08e83f120b98a315b1aef6c11ca (patch) | |
tree | 4c7d03c1db9ea30f778fe0dbffed32f41211f8e4 | |
parent | 628f851869b99d557b29d74d8ce9fead1ec76cfe (diff) | |
download | sonarqube-6962446f69eab08e83f120b98a315b1aef6c11ca.tar.gz sonarqube-6962446f69eab08e83f120b98a315b1aef6c11ca.zip |
Improve SearchServerTest to prepare upgrade to ES 1.4
-rw-r--r-- | server/sonar-search/src/test/java/org/sonar/search/SearchServerTest.java | 6 | ||||
-rw-r--r-- | server/sonar-server/src/main/java/org/sonar/server/es/EsClient.java | 4 |
2 files changed, 6 insertions, 4 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 f2be9704667..8a9823eccc6 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 @@ -40,6 +40,7 @@ import org.sonar.process.Props; import java.util.Properties; import static org.fest.assertions.Assertions.assertThat; +import static org.fest.assertions.Fail.fail; public class SearchServerTest { @@ -84,9 +85,10 @@ public class SearchServerTest { searchServer.awaitStop(); searchServer = null; try { - assertThat(client.admin().cluster().prepareClusterStats().get().getStatus()).isNotEqualTo(ClusterHealthStatus.GREEN); + client.admin().cluster().prepareClusterStats().get(); + fail(); } catch (NoNodeAvailableException exception) { - assertThat(exception.getMessage()).isEqualTo("No node available"); + // ok } } diff --git a/server/sonar-server/src/main/java/org/sonar/server/es/EsClient.java b/server/sonar-server/src/main/java/org/sonar/server/es/EsClient.java index 1af8a7b0f37..2508fd64191 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/es/EsClient.java +++ b/server/sonar-server/src/main/java/org/sonar/server/es/EsClient.java @@ -48,8 +48,6 @@ import org.elasticsearch.search.aggregations.AggregationBuilders; import org.elasticsearch.search.aggregations.metrics.max.Max; import org.picocontainer.Startable; import org.sonar.core.profiling.Profiling; -import org.sonar.server.search.ClusterHealth; -import org.sonar.server.search.SearchClient; import org.sonar.server.es.request.ProxyBulkRequestBuilder; import org.sonar.server.es.request.ProxyClusterHealthRequestBuilder; import org.sonar.server.es.request.ProxyClusterStateRequestBuilder; @@ -69,6 +67,8 @@ import org.sonar.server.es.request.ProxyPutMappingRequestBuilder; import org.sonar.server.es.request.ProxyRefreshRequestBuilder; import org.sonar.server.es.request.ProxySearchRequestBuilder; import org.sonar.server.es.request.ProxySearchScrollRequestBuilder; +import org.sonar.server.search.ClusterHealth; +import org.sonar.server.search.SearchClient; /** * Facade to connect to Elasticsearch node. Handles correctly errors (logging + exceptions |