Skip to content

Commit 289a019

Browse files
author
Saurabh Agarwal
authored
Merge pull request #1128 from saurabhagas/fixes
Fixes
2 parents 95f9f9d + 0ed14b7 commit 289a019

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

galvan-support/src/main/java/org/terracotta/testing/config/DefaultStartupCommandBuilder.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import java.io.InputStream;
2323
import java.nio.file.Files;
2424
import java.nio.file.Path;
25+
import java.nio.file.Paths;
2526

2627
import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;
2728
import static org.terracotta.testing.demos.TestHelpers.isWindows;
@@ -84,13 +85,22 @@ protected void installServer() throws IOException {
8485
}
8586
}
8687

88+
/**
89+
* Returns a normalized absolute path to the shell/bat script, and quotes the windows path to avoid issues with special path chars.
90+
* @param scriptPath path to the script from the base kit
91+
* @return string representation of processed path
92+
*/
93+
protected String getAbsolutePath(Path scriptPath) {
94+
Path basePath = getServerWorkingDir().resolve(getKitDir()).resolve(scriptPath).toAbsolutePath().normalize();
95+
return isWindows() ? "\"" + basePath + ".bat\"" : basePath + ".sh";
96+
}
97+
8798
@Override
8899
public String[] build() {
89100
if (builtCommand == null) {
90101
try {
91102
installServer();
92-
Path basePath = serverWorkingDir.resolve(kitDir).resolve("server").resolve("bin").resolve("start-tc-server").toAbsolutePath().normalize();
93-
String startScript = isWindows() ? "\"" + basePath + ".bat\"" : basePath + ".sh";
103+
String startScript = getAbsolutePath(Paths.get("server","bin", "start-tc-server"));
94104
if (consistentStartup) {
95105
builtCommand = new String[]{startScript, "-c", "-f", tcConfig.toString(), "-n", serverName};
96106
} else {

galvan-support/src/main/java/org/terracotta/testing/config/TcConfigBuilder.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
*/
1616
package org.terracotta.testing.config;
1717

18-
import java.nio.file.Path;
19-
import java.nio.file.Paths;
2018
import java.util.List;
2119
import java.util.Map;
2220
import java.util.Properties;
@@ -66,7 +64,7 @@ public String build() {
6664
Integer groupPort = serverGroupPorts.get(i);
6765
String oneServer =
6866
" <server host=\"localhost\" name=\"" + serverName + "\">\n"
69-
+ " <logs>" + Paths.get(serverName, "logs").toString() + "</logs>\n"
67+
+ " <logs>logs</logs>\n"
7068
+ " <tsa-port>" + port + "</tsa-port>\n"
7169
+ " <tsa-group-port>" + groupPort + "</tsa-group-port>\n"
7270
+ " </server>\n";

0 commit comments

Comments
 (0)