kikocis/java-driver public
Changesets · Branches · Tags · Compare
| Changeset | 801e028e39fe06be0c6be0585c6408611e7c5f54d28411c4d5e884f697c89598 |
|---|---|
| Author | Olivier Michallat <olim7t@users.noreply.github.com> · 2015-09-29 16:42 -07:00 |
| Committer | Olivier Michallat <olim7t@users.noreply.github.com> · 2015-09-29 16:42 -07:00 |
| Parents | 9e2d831fa720, acbdda3ac0cc |
2 files changed
modified driver-core/src/test/java/com/datastax/driver/core/CCMBridge.java +13 −12
| @@ -53,10 +53,10 @@ | ||
| 53 | 53 | |
| 54 | 54 | public static final String IP_PREFIX; |
| 55 | 55 | |
| 56 | - private static final String CASSANDRA_VERSION_REGEXP = "\\d\\.\\d\\.\\d+(-\\w+)?"; | |
| 57 | - static final File CASSANDRA_DIR; | |
| 58 | 56 | static final String CASSANDRA_VERSION; |
| 59 | 57 | |
| 58 | + static final String CASSANDRA_INSTALL_ARGS; | |
| 59 | + | |
| 60 | 60 | public static final String DEFAULT_CLIENT_TRUSTSTORE_PASSWORD = "cassandra1sfun"; |
| 61 | 61 | public static final String DEFAULT_CLIENT_TRUSTSTORE_PATH = "/client.truststore"; |
| 62 | 62 | |
| @@ -89,13 +89,15 @@ | ||
| 89 | 89 | private static final String CCM_COMMAND; |
| 90 | 90 | |
| 91 | 91 | static { |
| 92 | - String version = System.getProperty("cassandra.version"); | |
| 93 | - if (version.matches(CASSANDRA_VERSION_REGEXP)) { | |
| 94 | - CASSANDRA_DIR = null; | |
| 95 | - CASSANDRA_VERSION = "-v " + version; | |
| 92 | + CASSANDRA_VERSION = System.getProperty("cassandra.version"); | |
| 93 | + String installDirectory = System.getProperty("cassandra.directory"); | |
| 94 | + String branch = System.getProperty("cassandra.branch"); | |
| 95 | + if (installDirectory != null && !installDirectory.trim().isEmpty()) { | |
| 96 | + CASSANDRA_INSTALL_ARGS = "--install-dir=" + new File(installDirectory).getAbsolutePath(); | |
| 97 | + } else if(branch != null && !branch.trim().isEmpty()) { | |
| 98 | + CASSANDRA_INSTALL_ARGS = "-v git:" + branch; | |
| 96 | 99 | } else { |
| 97 | - CASSANDRA_DIR = new File(version); | |
| 98 | - CASSANDRA_VERSION = ""; | |
| 100 | + CASSANDRA_INSTALL_ARGS = "-v " + CASSANDRA_VERSION; | |
| 99 | 101 | } |
| 100 | 102 | |
| 101 | 103 | String ip_prefix = System.getProperty("ipprefix"); |
| @@ -286,7 +288,6 @@ | ||
| 286 | 288 | logger.debug("Executing: " + fullCommand); |
| 287 | 289 | CommandLine cli = CommandLine.parse(fullCommand); |
| 288 | 290 | Executor executor = new DefaultExecutor(); |
| 289 | - executor.setWorkingDirectory(CASSANDRA_DIR); | |
| 290 | 291 | |
| 291 | 292 | LogOutputStream outStream = new LogOutputStream() { |
| 292 | 293 | @Override protected void processLine(String line, int logLevel) { |
| @@ -594,7 +595,7 @@ | ||
| 594 | 595 | private final String clusterName; |
| 595 | 596 | private Integer[] nodes = { 1 }; |
| 596 | 597 | private boolean start = true; |
| 597 | - private String cassandraVersion = CASSANDRA_VERSION; | |
| 598 | + private String cassandraInstallArgs = CASSANDRA_INSTALL_ARGS; | |
| 598 | 599 | private String[] startOptions = new String[0]; |
| 599 | 600 | private Map<String, String> cassandraConfiguration = Maps.newHashMap(); |
| 600 | 601 | |
| @@ -634,7 +635,7 @@ | ||
| 634 | 635 | |
| 635 | 636 | /** Defaults to system property cassandra.version */ |
| 636 | 637 | public Builder withCassandraVersion(String cassandraVersion) { |
| 637 | - this.cassandraVersion = "-v " + cassandraVersion; | |
| 638 | + this.cassandraInstallArgs = "-v " + cassandraVersion; | |
| 638 | 639 | return this; |
| 639 | 640 | } |
| 640 | 641 | |
| @@ -663,7 +664,7 @@ | ||
| 663 | 664 | StringBuilder result = new StringBuilder(CCM_COMMAND + " create"); |
| 664 | 665 | result.append(" " + clusterName); |
| 665 | 666 | result.append(" -i" + IP_PREFIX); |
| 666 | - result.append(" " + cassandraVersion); | |
| 667 | + result.append(" " + cassandraInstallArgs); | |
| 667 | 668 | if (nodes.length > 0) |
| 668 | 669 | result.append(" -n " + Joiner.on(":").join(nodes)); |
| 669 | 670 | if (startOptions.length > 0) |
modified driver-core/src/test/java/com/datastax/driver/core/TestListener.java +1 −1
| @@ -30,7 +30,7 @@ | ||
| 30 | 30 | private int test_index = 0; |
| 31 | 31 | |
| 32 | 32 | static { |
| 33 | - System.out.println("[CCMBridge] Using Cassandra version: " + CCMBridge.CASSANDRA_VERSION); | |
| 33 | + System.out.println("[CCMBridge] Using Cassandra version: " + CCMBridge.CASSANDRA_VERSION + " (install arguments: " + CCMBridge.CASSANDRA_INSTALL_ARGS + ")"); | |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | @Override |