]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-8798 make integration tests run
authorDaniel Schwarz <daniel.schwarz@sonarsource.com>
Tue, 18 Jul 2017 09:38:48 +0000 (11:38 +0200)
committerDaniel Schwarz <bartfastiel@users.noreply.github.com>
Wed, 9 Aug 2017 13:09:54 +0000 (15:09 +0200)
Elasticsearch http is always enabled, default port is 9010

server/sonar-search/src/main/java/org/sonar/search/EsSettings.java
server/sonar-search/src/main/java/org/sonar/search/SearchServer.java

index ce8c668f5282b1d7a24b124384dfda000a8a3b01..4998c6007f10900b26229a921d8dae7c89e59495 100644 (file)
@@ -63,7 +63,7 @@ public class EsSettings implements EsSettingsMBean {
 
   @Override
   public int getHttpPort() {
-    return props.valueAsInt(ProcessProperties.SEARCH_HTTP_PORT, -1);
+    return props.valueAsInt(ProcessProperties.SEARCH_HTTP_PORT, 9010);
   }
 
   @Override
@@ -128,16 +128,15 @@ public class EsSettings implements EsSettingsMBean {
     int httpPort = getHttpPort();
     if (httpPort < 0) {
       // standard configuration
-      builder.put("http.enabled", String.valueOf(false));
-    } else {
-      LOGGER.warn("Elasticsearch HTTP connector is enabled on port {}. MUST NOT BE USED FOR PRODUCTION", httpPort);
-      // see https://github.com/lmenezes/elasticsearch-kopf/issues/195
-      builder.put("http.cors.enabled", String.valueOf(true));
-      builder.put("http.cors.allow-origin", "*");
-      builder.put("http.enabled", String.valueOf(true));
-      builder.put("http.host", host.getHostAddress());
-      builder.put("http.port", String.valueOf(httpPort));
+      httpPort = 9010;
     }
+
+    // see https://github.com/lmenezes/elasticsearch-kopf/issues/195
+    builder.put("http.cors.enabled", String.valueOf(true));
+    builder.put("http.cors.allow-origin", "*");
+    builder.put("http.enabled", String.valueOf(true));
+    builder.put("http.host", host.getHostAddress());
+    builder.put("http.port", String.valueOf(httpPort));
   }
 
   private InetAddress readHost() {
index 550675f63a2d0403ab0668f154ab120ca080b713..e87008f3c482d24a387bb67fada004cdbf8e7526 100644 (file)
@@ -162,7 +162,7 @@ public class SearchServer implements Monitored {
         }
       }
     } catch (MalformedURLException e) {
-      e.printStackTrace();
+      throw new RuntimeException(String.format("Cannot contact local Elasticsearch instance via url '%s'", urlString), e);
     } catch (IOException e) {
       e.printStackTrace();
     }