for (Map.Entry<String, String> property : properties.entrySet()) {
props.put(property.getKey(), property.getValue());
}
+ props.put(Process.SONAR_HOME, workDir);
+ props.put(Process.NAME_PROPERTY, this.getName());
+ props.put(Process.PORT_PROPERTY, Integer.toString(port));
+
OutputStream out = new FileOutputStream(propertyFile);
props.store(out, "Temporary properties file for Process [" + getName() + "]");
out.close();
.get()
.getStatus() != ClusterHealthStatus.RED);
} catch (Exception e) {
+ //LOGGER.warn("ES is not ready yet.", e);
return false;
}
}
node = NodeBuilder.nodeBuilder()
.settings(esSettings)
- .build();
+ .build().start();
- while (!node.isClosed()) {
+ while (node != null && !node.isClosed()) {
try {
- Thread.sleep(1000);
+ Thread.sleep(100);
} catch (InterruptedException e) {
e.printStackTrace();
}
}).start();
assertThat(elasticSearch.isReady()).isFalse();
- while (!elasticSearch.isReady()) {
+ int count = 0;
+ while (!elasticSearch.isReady() && count < 100) {
try {
- Thread.sleep(200);
+ Thread.sleep(500);
} catch (InterruptedException e) {
e.printStackTrace();
}
+ count++;
}
+ assertThat(count).isLessThan(100);
Settings settings = ImmutableSettings.settingsBuilder()
.put("cluster.name", "sonarqube")
--- /dev/null
+#Temporary properties file for Process [ES]
+#Fri Jul 18 15:05:56 CEST 2014
+SONAR_HOME=/Volumes/data/sonar/sonarqube/sonar-start/target/sonarqube-4.5-SNAPSHOT/
+esHome=/Volumes/data/sonar/sonarqube/sonar-start/target/sonarqube-4.5-SNAPSHOT/.
+esDebug=true
+esPort=57013
+pName=ES
+#pPort=57011
public static void main(String... args) throws InterruptedException, IOException, URISyntaxException {
- //String home = System.getenv(SONAR_HOME);
- String home = "/Volumes/data/sonar/sonarqube/sonar-start/target/sonarqube-4.5-SNAPSHOT";
+ String home = System.getenv(SONAR_HOME);
+ //String home = "/Volumes/data/sonar/sonarqube/sonar-start/target/sonarqube-4.5-SNAPSHOT";
//Check if we have a SONAR_HOME
if (StringUtils.isEmpty(home)) {