Elffuss BraidHub

kikocis/java-driver public

Enhance CCMBridge to better support Windows

Use powershell instead of cmd.

Quotes jvmArgs as windows is a bit more picky about quotes.

Use --quiet-windows on start, this is required for C* versions post
2.2.4* to limit stderr/stdout output from C* on windows.

Also upgrades scassandra to 1.0.9 for better windows support.  See:
https://github.com/scassandra/scassandra-server/pull/157 for more
details.
Changesetb6f0ef60ba18632763445ddb9008d53dc5e724f0d5720c93083c3b7b3d8002de
AuthorAndrew Tolbert <andrew.tolbert@datastax.com> · 2016-03-10 09:36 -06:00
Committerolim7t <omichallat+github@gmail.com> · 2016-07-13 13:12 -07:00
Parents4a805f55f128

Browse the files at this changeset

2 files changed

modified driver-core/src/test/java/com/datastax/driver/core/CCMBridge.java +17 −4
@@ -167,7 +167,7 @@
167167 }
168168
169169 if (isWindows()) {
170- CCM_COMMAND = "cmd /c ccm.py";
170+ CCM_COMMAND = "powershell.exe -ExecutionPolicy Unrestricted ccm.py";
171171 } else {
172172 CCM_COMMAND = "ccm";
173173 }
@@ -386,7 +386,11 @@
386386 if (logger.isDebugEnabled())
387387 logger.debug("Starting: {} - free memory: {} MB", this, TestUtils.getFreeMemoryMB());
388388 try {
389- execute(CCM_COMMAND + " start --wait-other-notice --wait-for-binary-proto" + jvmArgs);
389+ String cmd = CCM_COMMAND + " start --wait-other-notice --wait-for-binary-proto" + jvmArgs;
390+ if (isWindows() && this.version.compareTo(VersionNumber.parse("2.2.4")) >= 0) {
391+ cmd += " --quiet-windows";
392+ }
393+ execute(cmd);
390394 } catch (CCMException e) {
391395 logger.error("Could not start " + this, e);
392396 logger.error("CCM output:\n{}", e.getOut());
@@ -444,7 +448,11 @@
444448 public void start(int n) {
445449 logger.debug(String.format("Starting: node %s (%s%s:%s) in %s", n, TestUtils.IP_PREFIX, n, binaryPort, this));
446450 try {
447- execute(CCM_COMMAND + " node%d start --wait-other-notice --wait-for-binary-proto" + jvmArgs, n);
451+ String cmd = CCM_COMMAND + " node%d start --wait-other-notice --wait-for-binary-proto" + jvmArgs;
452+ if (isWindows() && this.version.compareTo(VersionNumber.parse("2.2.4")) >= 0) {
453+ cmd += " --quiet-windows";
454+ }
455+ execute(cmd, n);
448456 } catch (CCMException e) {
449457 logger.error(String.format("Could not start node %s in %s", n, this), e);
450458 logger.error("CCM output:\n{}", e.getOut());
@@ -875,9 +883,14 @@
875883
876884 private String joinJvmArgs() {
877885 StringBuilder allJvmArgs = new StringBuilder("");
886+ String quote = isWindows() ? "\"" : "";
878887 for (String jvmArg : jvmArgs) {
879- allJvmArgs.append(" --jvm_arg=");
888+ // Windows requires jvm arguments to be quoted, while *nix requires unquoted.
889+ allJvmArgs.append(" ");
890+ allJvmArgs.append(quote);
891+ allJvmArgs.append("--jvm_arg=");
880892 allJvmArgs.append(randomizePorts(jvmArg));
893+ allJvmArgs.append(quote);
881894 }
882895 return allJvmArgs.toString();
883896 }
modified pom.xml +1 −1
@@ -66,7 +66,7 @@
6666 <assertj.version>1.7.0</assertj.version>
6767 <mockito.version>1.10.8</mockito.version>
6868 <commons-exec.version>1.3</commons-exec.version>
69- <scassandra.version>1.0.3</scassandra.version>
69+ <scassandra.version>1.0.9</scassandra.version>
7070 <main.basedir>${project.basedir}</main.basedir>
7171 <ipprefix>127.0.1.</ipprefix>
7272 <test.groups>unit</test.groups>