]> source.dussan.org Git - sonarqube.git/commitdiff
NO-JIRA fixed EsKeyStoreCliTest to work on Windows
authorLukasz Jarocki <lukasz.jarocki@sonarsource.com>
Wed, 16 Mar 2022 10:08:17 +0000 (11:08 +0100)
committersonartech <sonartech@sonarsource.com>
Wed, 16 Mar 2022 20:03:28 +0000 (20:03 +0000)
server/sonar-main/src/test/java/org/sonar/application/es/EsKeyStoreCliTest.java

index 197d38d166ccbf51225623c8861e8fc4ad767b2c..089200e62b426e47dffbd20aaa7d1f2d3301a867 100644 (file)
@@ -22,6 +22,7 @@ package org.sonar.application.es;
 import java.io.File;
 import java.io.InputStream;
 import java.io.OutputStream;
+import java.nio.file.Paths;
 import java.util.concurrent.TimeUnit;
 import org.junit.Rule;
 import org.junit.Test;
@@ -60,16 +61,20 @@ public class EsKeyStoreCliTest {
     MockProcess process = (MockProcess) underTest.executeWith(EsKeyStoreCliTest::mockLaunch);
 
     JavaCommand<?> executedCommand = process.getExecutedCommand();
+
+    String expectedHomeLibPath = Paths.get(homeDir.toString(), "lib") + "/*";
+    String expectedHomeKeystorePath = Paths.get(homeDir.toString(), "lib", "tools", "keystore-cli") + "/*";
+
     assertThat(executedCommand.getClassName()).isEqualTo("org.elasticsearch.common.settings.KeyStoreCli");
     assertThat(executedCommand.getClasspath())
-      .containsExactly(homeDir.getAbsolutePath() + "/lib/*", homeDir.getAbsolutePath() + "/lib/tools/keystore-cli/*");
+      .containsExactly(expectedHomeLibPath, expectedHomeKeystorePath);
     assertThat(executedCommand.getParameters()).containsExactly("add", "-x", "-f", "test.property1", "test.property2", "test.property3");
     assertThat(executedCommand.getJvmOptions().getAll()).containsExactly(
       "-Xshare:auto",
       "-Xms4m",
       "-Xmx64m",
-      "-Des.path.home=" + homeDir.getAbsolutePath(),
-      "-Des.path.conf=" + confDir.getAbsolutePath(),
+      "-Des.path.home=" + homeDir.toPath(),
+      "-Des.path.conf=" + confDir.toPath(),
       "-Des.distribution=default",
       "-Des.distribution.type=tar");