kikocis/java-driver public
Changesets · Branches · Tags · Compare
| Changeset | 6650dc23785e47918f81fbd7c5b7ca62120bd8e4c4ef39d2789baf1f201e48e9 |
|---|---|
| Author | Andrew Tolbert <andrew.tolbert@datastax.com> · 2015-12-18 17:51 -06:00 |
| Committer | olim7t <omichallat+github@gmail.com> · 2016-01-04 17:46 +01:00 |
| Parents | 4569034a55a1 |
5 files changed
modified driver-core/src/test/java/com/datastax/driver/core/CCMBridge.java +179 −14
| @@ -51,9 +51,11 @@ | ||
| 51 | 51 | |
| 52 | 52 | public static final String IP_PREFIX; |
| 53 | 53 | |
| 54 | - static final String CASSANDRA_VERSION; | |
| 54 | + private static final String CASSANDRA_VERSION; | |
| 55 | 55 | |
| 56 | - static final String CASSANDRA_INSTALL_ARGS; | |
| 56 | + private static final String CASSANDRA_INSTALL_ARGS; | |
| 57 | + | |
| 58 | + private static final boolean IS_DSE; | |
| 57 | 59 | |
| 58 | 60 | public static final String DEFAULT_CLIENT_TRUSTSTORE_PASSWORD = "cassandra1sfun"; |
| 59 | 61 | public static final String DEFAULT_CLIENT_TRUSTSTORE_PATH = "/client.truststore"; |
| @@ -85,6 +87,49 @@ | ||
| 85 | 87 | */ |
| 86 | 88 | private static final Map<String, String> ENVIRONMENT_MAP; |
| 87 | 89 | |
| 90 | + /** | |
| 91 | + * A mapping of full DSE versions to their C* counterpart. This is not meant to be comprehensive. Used by | |
| 92 | + * {@link #getCassandraVersion()}. If C* version cannot be derived, the method makes a 'best guess'. | |
| 93 | + */ | |
| 94 | + private static final Map<String, String> dseToCassandraVersions = ImmutableMap.<String, String>builder() | |
| 95 | + .put("5.0", "3.0") | |
| 96 | + .put("4.8.3", "2.1.11") | |
| 97 | + .put("4.8.2", "2.1.11") | |
| 98 | + .put("4.8.1", "2.1.11") | |
| 99 | + .put("4.8", "2.1.9") | |
| 100 | + .put("4.7.6", "2.1.11") | |
| 101 | + .put("4.7.5", "2.1.11") | |
| 102 | + .put("4.7.4", "2.1.11") | |
| 103 | + .put("4.7.3", "2.1.8") | |
| 104 | + .put("4.7.2", "2.1.8") | |
| 105 | + .put("4.7.1", "2.1.5") | |
| 106 | + .put("4.6.11", "2.0.16") | |
| 107 | + .put("4.6.10", "2.0.16") | |
| 108 | + .put("4.6.9", "2.0.16") | |
| 109 | + .put("4.6.8", "2.0.16") | |
| 110 | + .put("4.6.7", "2.0.14") | |
| 111 | + .put("4.6.6", "2.0.14") | |
| 112 | + .put("4.6.5", "2.0.14") | |
| 113 | + .put("4.6.4", "2.0.14") | |
| 114 | + .put("4.6.3", "2.0.12") | |
| 115 | + .put("4.6.2", "2.0.12") | |
| 116 | + .put("4.6.1", "2.0.12") | |
| 117 | + .put("4.6", "2.0.11") | |
| 118 | + .put("4.5.9", "2.0.16") | |
| 119 | + .put("4.5.8", "2.0.14") | |
| 120 | + .put("4.5.7", "2.0.12") | |
| 121 | + .put("4.5.6", "2.0.12") | |
| 122 | + .put("4.5.5", "2.0.12") | |
| 123 | + .put("4.5.4", "2.0.11") | |
| 124 | + .put("4.5.3", "2.0.11") | |
| 125 | + .put("4.5.2", "2.0.10") | |
| 126 | + .put("4.5.1", "2.0.8") | |
| 127 | + .put("4.5", "2.0.8") | |
| 128 | + .put("4.0", "2.0") | |
| 129 | + .put("3.2", "1.2") | |
| 130 | + .put("3.1", "1.2") | |
| 131 | + .build(); | |
| 132 | + | |
| 88 | 133 | /** |
| 89 | 134 | * The command to use to launch CCM |
| 90 | 135 | */ |
| @@ -94,14 +139,30 @@ | ||
| 94 | 139 | CASSANDRA_VERSION = System.getProperty("cassandra.version"); |
| 95 | 140 | String installDirectory = System.getProperty("cassandra.directory"); |
| 96 | 141 | String branch = System.getProperty("cassandra.branch"); |
| 142 | + | |
| 143 | + String dseProperty = System.getProperty("dse"); | |
| 144 | + // If -Ddse, if the value is empty interpret it as enabled, | |
| 145 | + // otherwise if there is a value, parse as boolean. | |
| 146 | + IS_DSE = dseProperty != null && (dseProperty.isEmpty() || Boolean.parseBoolean(dseProperty)); | |
| 147 | + | |
| 148 | + StringBuilder installArgs = new StringBuilder(); | |
| 97 | 149 | if (installDirectory != null && !installDirectory.trim().isEmpty()) { |
| 98 | - CASSANDRA_INSTALL_ARGS = "--install-dir=" + new File(installDirectory).getAbsolutePath(); | |
| 150 | + installArgs.append("--install-dir="); | |
| 151 | + installArgs.append(new File(installDirectory).getAbsolutePath()); | |
| 99 | 152 | } else if (branch != null && !branch.trim().isEmpty()) { |
| 100 | - CASSANDRA_INSTALL_ARGS = "-v git:" + branch; | |
| 153 | + installArgs.append("-v git:"); | |
| 154 | + installArgs.append(branch.trim().replaceAll("\"", "")); | |
| 101 | 155 | } else { |
| 102 | - CASSANDRA_INSTALL_ARGS = "-v " + CASSANDRA_VERSION; | |
| 156 | + installArgs.append("-v"); | |
| 157 | + installArgs.append(CASSANDRA_VERSION); | |
| 103 | 158 | } |
| 104 | 159 | |
| 160 | + if (IS_DSE) { | |
| 161 | + installArgs.append(" --dse"); | |
| 162 | + } | |
| 163 | + | |
| 164 | + CASSANDRA_INSTALL_ARGS = installArgs.toString(); | |
| 165 | + | |
| 105 | 166 | String ip_prefix = System.getProperty("ipprefix"); |
| 106 | 167 | if (ip_prefix == null || ip_prefix.isEmpty()) { |
| 107 | 168 | ip_prefix = "127.0.1."; |
| @@ -132,6 +193,14 @@ | ||
| 132 | 193 | envMap.put("JAVA_HOME", ccmJavaHome); |
| 133 | 194 | } |
| 134 | 195 | ENVIRONMENT_MAP = ImmutableMap.copyOf(envMap); |
| 196 | + | |
| 197 | + if (CCMBridge.isDSE()) { | |
| 198 | + logger.info("Tests requiring CCM will use DSE version {} (C* {}, install arguments: {})", | |
| 199 | + CCMBridge.getDSEVersion(), CCMBridge.getCassandraVersion(), CCMBridge.getInstallArguments()); | |
| 200 | + } else { | |
| 201 | + logger.info("Tests requiring CCM will use Cassandra version {} (install arguments: {})", | |
| 202 | + CCMBridge.getCassandraVersion(), CCMBridge.getInstallArguments()); | |
| 203 | + } | |
| 135 | 204 | } |
| 136 | 205 | |
| 137 | 206 | /** |
| @@ -147,8 +216,68 @@ | ||
| 147 | 216 | |
| 148 | 217 | private final File ccmDir; |
| 149 | 218 | |
| 150 | - private CCMBridge() { | |
| 219 | + private final boolean isDSE; | |
| 220 | + | |
| 221 | + private CCMBridge(boolean isDSE) { | |
| 151 | 222 | this.ccmDir = Files.createTempDir(); |
| 223 | + this.isDSE = isDSE; | |
| 224 | + } | |
| 225 | + | |
| 226 | + /** | |
| 227 | + * @return The configured cassandra version. If -Ddse=true was used, this value is derived from the | |
| 228 | + * DSE version provided. If the DSE version can't be derived the following logic is used: | |
| 229 | + * <ol> | |
| 230 | + * <li>If <= 3.X, use C* 1.2</li> | |
| 231 | + * <li>If 4.X, use 2.1 for >= 4.7, 2.0 otherwise.</li> | |
| 232 | + * <li>Otherwise 3.0</li> | |
| 233 | + * </ol> | |
| 234 | + */ | |
| 235 | + public static String getCassandraVersion() { | |
| 236 | + if (isDSE()) { | |
| 237 | + String cassandraVersion = dseToCassandraVersions.get(CASSANDRA_VERSION); | |
| 238 | + if (cassandraVersion != null) { | |
| 239 | + return cassandraVersion; | |
| 240 | + } else if (CASSANDRA_VERSION.startsWith("3.") || CASSANDRA_VERSION.compareTo("3") <= 0) { | |
| 241 | + return "1.2"; | |
| 242 | + } else if (CASSANDRA_VERSION.startsWith("4.")) { | |
| 243 | + if (CASSANDRA_VERSION.compareTo("4.7") >= 0) { | |
| 244 | + return "2.1"; | |
| 245 | + } else { | |
| 246 | + return "2.0"; | |
| 247 | + } | |
| 248 | + } else { | |
| 249 | + // Fallback on 3.0 by default. | |
| 250 | + return "3.0"; | |
| 251 | + } | |
| 252 | + | |
| 253 | + } else { | |
| 254 | + return CASSANDRA_VERSION; | |
| 255 | + } | |
| 256 | + } | |
| 257 | + | |
| 258 | + /** | |
| 259 | + * @return The configured DSE version if '-Ddse=true' specified, otherwise null. | |
| 260 | + */ | |
| 261 | + public static String getDSEVersion() { | |
| 262 | + if (isDSE()) { | |
| 263 | + return CASSANDRA_VERSION; | |
| 264 | + } else { | |
| 265 | + return null; | |
| 266 | + } | |
| 267 | + } | |
| 268 | + | |
| 269 | + /** | |
| 270 | + * @return Whether or not DSE was configured via '-Ddse=true'. | |
| 271 | + */ | |
| 272 | + public static boolean isDSE() { | |
| 273 | + return IS_DSE; | |
| 274 | + } | |
| 275 | + | |
| 276 | + /** | |
| 277 | + * @return The install arguments to pass to CCM when creating the cluster. | |
| 278 | + */ | |
| 279 | + public static String getInstallArguments() { | |
| 280 | + return CASSANDRA_INSTALL_ARGS; | |
| 152 | 281 | } |
| 153 | 282 | |
| 154 | 283 | /** |
| @@ -216,9 +345,14 @@ | ||
| 216 | 345 | execute(CCM_COMMAND + " node%d start --wait-other-notice --wait-for-binary-proto", n); |
| 217 | 346 | } |
| 218 | 347 | |
| 219 | - public void start(int n, String jvmArg) { | |
| 220 | - logger.info("Starting: " + IP_PREFIX + n + " with " + jvmArg); | |
| 221 | - execute(CCM_COMMAND + " node%d start --wait-other-notice --wait-for-binary-proto --jvm_arg=%s", n, jvmArg); | |
| 348 | + public void start(int n, String... jvmArg) { | |
| 349 | + StringBuilder jvmArgs = new StringBuilder(""); | |
| 350 | + for (int i = 0; i < jvmArg.length; i++) { | |
| 351 | + jvmArgs.append(" --jvm_arg="); | |
| 352 | + jvmArgs.append(jvmArg[i]); | |
| 353 | + } | |
| 354 | + logger.info("Starting: " + IP_PREFIX + n + " with " + jvmArgs); | |
| 355 | + execute(CCM_COMMAND + " node%d start --wait-other-notice --wait-for-binary-proto %s", n, jvmArgs.toString()); | |
| 222 | 356 | } |
| 223 | 357 | |
| 224 | 358 | public void stop(int n) { |
| @@ -257,9 +391,9 @@ | ||
| 257 | 391 | |
| 258 | 392 | public void bootstrapNode(int n, String dc) { |
| 259 | 393 | if (dc == null) |
| 260 | - execute(CCM_COMMAND + " add node%d -i %s%d -j %d -r %d -b -s", n, IP_PREFIX, n, 7000 + 100 * n, 8000 + 100 * n); | |
| 394 | + execute(CCM_COMMAND + " add node%d -i %s%d -j %d -r %d -b -s" + (isDSE ? " --dse" : ""), n, IP_PREFIX, n, 7000 + 100 * n, 8000 + 100 * n); | |
| 261 | 395 | else |
| 262 | - execute(CCM_COMMAND + " add node%d -i %s%d -j %d -b -d %s -s", n, IP_PREFIX, n, 7000 + 100 * n, dc); | |
| 396 | + execute(CCM_COMMAND + " add node%d -i %s%d -j %d -b -d %s -s" + (isDSE ? " --dse" : ""), n, IP_PREFIX, n, 7000 + 100 * n, dc); | |
| 263 | 397 | execute(CCM_COMMAND + " node%d start --wait-other-notice --wait-for-binary-proto", n); |
| 264 | 398 | } |
| 265 | 399 | |
| @@ -268,7 +402,7 @@ | ||
| 268 | 402 | String storageItf = IP_PREFIX + n + ":" + storagePort; |
| 269 | 403 | String binaryItf = IP_PREFIX + n + ":" + binaryPort; |
| 270 | 404 | String remoteLogItf = IP_PREFIX + n + ":" + remoteDebugPort; |
| 271 | - execute(CCM_COMMAND + " add node%d -i %s%d -b -t %s -l %s --binary-itf %s -j %d -r %s -s", | |
| 405 | + execute(CCM_COMMAND + " add node%d -i %s%d -b -t %s -l %s --binary-itf %s -j %d -r %s -s" + (isDSE ? " --dse" : ""), | |
| 272 | 406 | n, IP_PREFIX, n, thriftItf, storageItf, binaryItf, jmxPort, remoteLogItf); |
| 273 | 407 | execute(CCM_COMMAND + " node%d start --wait-other-notice --wait-for-binary-proto", n); |
| 274 | 408 | } |
| @@ -285,6 +419,18 @@ | ||
| 285 | 419 | execute(CCM_COMMAND + " updateconf " + confStr); |
| 286 | 420 | } |
| 287 | 421 | |
| 422 | + public void updateDSEConfig(Map<String, String> configs) { | |
| 423 | + StringBuilder confStr = new StringBuilder(); | |
| 424 | + for (Map.Entry<String, String> entry : configs.entrySet()) { | |
| 425 | + confStr.append(entry.getKey() + ":" + entry.getValue() + " "); | |
| 426 | + } | |
| 427 | + execute(CCM_COMMAND + " updatedseconf " + confStr); | |
| 428 | + } | |
| 429 | + | |
| 430 | + public void setWorkload(int node, String workload) { | |
| 431 | + execute(CCM_COMMAND + " node%d setworkload %s", node, workload); | |
| 432 | + } | |
| 433 | + | |
| 288 | 434 | private void execute(String command, Object... args) { |
| 289 | 435 | |
| 290 | 436 | String fullCommand = String.format(command, args) + " --config-dir=" + ccmDir; |
| @@ -618,10 +764,14 @@ | ||
| 618 | 764 | private final String clusterName; |
| 619 | 765 | private Integer[] nodes = {1}; |
| 620 | 766 | private boolean start = true; |
| 767 | + private boolean isDSE = IS_DSE; | |
| 621 | 768 | private String cassandraInstallArgs = CASSANDRA_INSTALL_ARGS; |
| 622 | 769 | private String[] startOptions = new String[0]; |
| 770 | + | |
| 623 | 771 | private Map<String, String> cassandraConfiguration = Maps.newHashMap(); |
| 624 | 772 | |
| 773 | + private Map<String, String> dseConfiguration = Maps.newHashMap(); | |
| 774 | + | |
| 625 | 775 | |
| 626 | 776 | Builder(String clusterName) { |
| 627 | 777 | this.clusterName = clusterName; |
| @@ -665,6 +815,13 @@ | ||
| 665 | 815 | */ |
| 666 | 816 | public Builder withCassandraVersion(String cassandraVersion) { |
| 667 | 817 | this.cassandraInstallArgs = "-v " + cassandraVersion; |
| 818 | + this.isDSE = false; | |
| 819 | + return this; | |
| 820 | + } | |
| 821 | + | |
| 822 | + public Builder withDSEVersion(String dseVersion) { | |
| 823 | + this.cassandraInstallArgs = "-v " + dseVersion + " --dse"; | |
| 824 | + this.isDSE = true; | |
| 668 | 825 | return this; |
| 669 | 826 | } |
| 670 | 827 | |
| @@ -684,10 +841,18 @@ | ||
| 684 | 841 | return this; |
| 685 | 842 | } |
| 686 | 843 | |
| 844 | + public Builder withDSEConfiguration(String key, String value) { | |
| 845 | + this.dseConfiguration.put(key, value); | |
| 846 | + return this; | |
| 847 | + } | |
| 848 | + | |
| 687 | 849 | public CCMBridge build() { |
| 688 | - CCMBridge ccm = new CCMBridge(); | |
| 850 | + CCMBridge ccm = new CCMBridge(isDSE); | |
| 689 | 851 | ccm.execute(buildCreateCommand()); |
| 690 | - ccm.updateConfig(cassandraConfiguration); | |
| 852 | + if (!cassandraConfiguration.isEmpty()) | |
| 853 | + ccm.updateConfig(cassandraConfiguration); | |
| 854 | + if (!dseConfiguration.isEmpty()) | |
| 855 | + ccm.updateDSEConfig(dseConfiguration); | |
| 691 | 856 | if (start) |
| 692 | 857 | ccm.start(); |
| 693 | 858 | return ccm; |
modified driver-core/src/test/java/com/datastax/driver/core/TestListener.java +47 −10
| @@ -16,6 +16,7 @@ | ||
| 16 | 16 | package com.datastax.driver.core; |
| 17 | 17 | |
| 18 | 18 | import com.datastax.driver.core.utils.CassandraVersion; |
| 19 | +import com.datastax.driver.core.utils.DseVersion; | |
| 19 | 20 | import org.testng.*; |
| 20 | 21 | import org.testng.internal.ConstructorOrMethod; |
| 21 | 22 | |
| @@ -27,10 +28,6 @@ | ||
| 27 | 28 | private long start_time = System.nanoTime(); |
| 28 | 29 | private int test_index = 0; |
| 29 | 30 | |
| 30 | - static { | |
| 31 | - System.out.println("[CCMBridge] Using Cassandra version: " + CCMBridge.CASSANDRA_VERSION + " (install arguments: " + CCMBridge.CASSANDRA_INSTALL_ARGS + ")"); | |
| 32 | - } | |
| 33 | - | |
| 34 | 31 | @Override |
| 35 | 32 | public void onTestFailure(ITestResult tr) { |
| 36 | 33 | long elapsedTime = TimeUnit.NANOSECONDS.toSeconds((System.nanoTime() - start_time)); |
| @@ -90,15 +87,27 @@ | ||
| 90 | 87 | ConstructorOrMethod constructorOrMethod = testNgMethod.getConstructorOrMethod(); |
| 91 | 88 | |
| 92 | 89 | Class<?> clazz = testNgMethod.getInstance().getClass(); |
| 93 | - if (clazz != null && clazz.isAnnotationPresent(CassandraVersion.class)) { | |
| 94 | - CassandraVersion cassandraVersion = clazz.getAnnotation(CassandraVersion.class); | |
| 95 | - TestUtils.versionCheck(cassandraVersion.major(), cassandraVersion.minor(), cassandraVersion.description()); | |
| 90 | + if (clazz != null) { | |
| 91 | + if (clazz.isAnnotationPresent(CassandraVersion.class)) { | |
| 92 | + CassandraVersion cassandraVersion = clazz.getAnnotation(CassandraVersion.class); | |
| 93 | + cassandraVersionCheck(cassandraVersion); | |
| 94 | + } | |
| 95 | + if (clazz.isAnnotationPresent(DseVersion.class)) { | |
| 96 | + DseVersion dseVersion = clazz.getAnnotation(DseVersion.class); | |
| 97 | + dseVersionCheck(dseVersion); | |
| 98 | + } | |
| 96 | 99 | } |
| 97 | 100 | |
| 98 | 101 | Method method = constructorOrMethod.getMethod(); |
| 99 | - if (method != null && method.isAnnotationPresent(CassandraVersion.class)) { | |
| 100 | - CassandraVersion cassandraVersion = method.getAnnotation(CassandraVersion.class); | |
| 101 | - TestUtils.versionCheck(cassandraVersion.major(), cassandraVersion.minor(), cassandraVersion.description()); | |
| 102 | + if (method != null) { | |
| 103 | + if (method.isAnnotationPresent(CassandraVersion.class)) { | |
| 104 | + CassandraVersion cassandraVersion = method.getAnnotation(CassandraVersion.class); | |
| 105 | + cassandraVersionCheck(cassandraVersion); | |
| 106 | + } | |
| 107 | + if (method.isAnnotationPresent(DseVersion.class)) { | |
| 108 | + DseVersion dseVersion = method.getAnnotation(DseVersion.class); | |
| 109 | + dseVersionCheck(dseVersion); | |
| 110 | + } | |
| 102 | 111 | } |
| 103 | 112 | } |
| 104 | 113 | |
| @@ -106,4 +115,32 @@ | ||
| 106 | 115 | public void afterInvocation(IInvokedMethod testMethod, ITestResult testResult) { |
| 107 | 116 | // Do nothing |
| 108 | 117 | } |
| 118 | + | |
| 119 | + private static void cassandraVersionCheck(CassandraVersion version) { | |
| 120 | + versionCheck(CCMBridge.getCassandraVersion(), version.major(), version.minor(), version.description()); | |
| 121 | + } | |
| 122 | + | |
| 123 | + private static void dseVersionCheck(DseVersion version) { | |
| 124 | + if (CCMBridge.isDSE()) { | |
| 125 | + versionCheck(CCMBridge.getDSEVersion(), version.major(), version.minor(), version.description()); | |
| 126 | + } else { | |
| 127 | + throw new SkipException("Skipping test because not configured for DataStax Enterprise cluster."); | |
| 128 | + } | |
| 129 | + } | |
| 130 | + | |
| 131 | + private static void versionCheck(String version, double majorCheck, int minorCheck, String skipString) { | |
| 132 | + if (version == null) { | |
| 133 | + throw new SkipException("Skipping test because provided version is null"); | |
| 134 | + } else { | |
| 135 | + String[] versionArray = version.split("\\.|-"); | |
| 136 | + double major = Double.parseDouble(versionArray[0] + "." + versionArray[1]); | |
| 137 | + // If there is no minor version, assume latest version of whatever was provided. | |
| 138 | + int minor = versionArray.length >= 3 ? Integer.parseInt(versionArray[2]) : Integer.MAX_VALUE; | |
| 139 | + | |
| 140 | + if (major < majorCheck || (major == majorCheck && minor < minorCheck)) { | |
| 141 | + throw new SkipException("Version >= " + majorCheck + "." + minorCheck + " required. " + | |
| 142 | + "Description: " + skipString); | |
| 143 | + } | |
| 144 | + } | |
| 145 | + } | |
| 109 | 146 | } |
modified driver-core/src/test/java/com/datastax/driver/core/TestUtils.java +0 −11
| @@ -24,7 +24,6 @@ | ||
| 24 | 24 | import org.scassandra.ScassandraFactory; |
| 25 | 25 | import org.slf4j.Logger; |
| 26 | 26 | import org.slf4j.LoggerFactory; |
| 27 | -import org.testng.SkipException; | |
| 28 | 27 | |
| 29 | 28 | import java.io.IOException; |
| 30 | 29 | import java.math.BigDecimal; |
| @@ -392,16 +391,6 @@ | ||
| 392 | 391 | return testForDown ? !host.isUp() : host.isUp(); |
| 393 | 392 | } |
| 394 | 393 | |
| 395 | - public static void versionCheck(double majorCheck, int minorCheck, String skipString) { | |
| 396 | - String version = System.getProperty("cassandra.version"); | |
| 397 | - String[] versionArray = version.split("\\.|-"); | |
| 398 | - double major = Double.parseDouble(versionArray[0] + "." + versionArray[1]); | |
| 399 | - int minor = Integer.parseInt(versionArray[2]); | |
| 400 | - | |
| 401 | - if (major < majorCheck || (major == majorCheck && minor < minorCheck)) { | |
| 402 | - throw new SkipException("Version >= " + majorCheck + "." + minorCheck + " required. Description: " + skipString); | |
| 403 | - } | |
| 404 | - } | |
| 405 | 394 | |
| 406 | 395 | public static Host findOrWaitForHost(Cluster cluster, int node, long duration, TimeUnit unit) { |
| 407 | 396 | return findOrWaitForHost(cluster, CCMBridge.ipOfNode(node), duration, unit); |
modified driver-core/src/test/java/com/datastax/driver/core/utils/CassandraVersion.java +4 −4
| @@ -19,7 +19,7 @@ | ||
| 19 | 19 | import java.lang.annotation.RetentionPolicy; |
| 20 | 20 | |
| 21 | 21 | /** |
| 22 | - * <p>Annotation for a Class or Method that defines a Cassandra Version requirement. If the cassandra verison in used | |
| 22 | + * <p>Annotation for a Class or Method that defines a Cassandra Version requirement. If the cassandra version in use | |
| 23 | 23 | * does not meet the version requirement, the test is skipped.</p> |
| 24 | 24 | * |
| 25 | 25 | * @see {@link com.datastax.driver.core.TestListener#beforeInvocation(org.testng.IInvokedMethod, org.testng.ITestResult)} for usage. |
| @@ -29,15 +29,15 @@ | ||
| 29 | 29 | /** |
| 30 | 30 | * @return The major version required to execute this test, i.e. "2.0" |
| 31 | 31 | */ |
| 32 | - public double major(); | |
| 32 | + double major(); | |
| 33 | 33 | |
| 34 | 34 | /** |
| 35 | 35 | * @return The minor version required to execute this test, i.e. "0" |
| 36 | 36 | */ |
| 37 | - public int minor() default 0; | |
| 37 | + int minor() default 0; | |
| 38 | 38 | |
| 39 | 39 | /** |
| 40 | 40 | * @return The description returned if this version requirement is not met. |
| 41 | 41 | */ |
| 42 | - public String description() default "Does not meet minimum version requirement."; | |
| 42 | + String description() default "Does not meet minimum version requirement."; | |
| 43 | 43 | } |
added driver-core/src/test/java/com/datastax/driver/core/utils/DseVersion.java +43 −0
| @@ -0,0 +1,43 @@ | ||
| 1 | +/* | |
| 2 | + * Copyright (C) 2012-2015 DataStax Inc. | |
| 3 | + * | |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | |
| 5 | + * you may not use this file except in compliance with the License. | |
| 6 | + * You may obtain a copy of the License at | |
| 7 | + * | |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | |
| 9 | + * | |
| 10 | + * Unless required by applicable law or agreed to in writing, software | |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 13 | + * See the License for the specific language governing permissions and | |
| 14 | + * limitations under the License. | |
| 15 | + */ | |
| 16 | +package com.datastax.driver.core.utils; | |
| 17 | + | |
| 18 | +import java.lang.annotation.Retention; | |
| 19 | +import java.lang.annotation.RetentionPolicy; | |
| 20 | + | |
| 21 | +/** | |
| 22 | + * <p>Annotation for a Class or Method that defines a DataStax Enterprise Version requirement. | |
| 23 | + * If the version in use does not meet the version requirement or DSE is not used, the test is skipped.</p> | |
| 24 | + * | |
| 25 | + * @see {@link com.datastax.driver.core.TestListener#beforeInvocation(org.testng.IInvokedMethod, org.testng.ITestResult)} for usage. | |
| 26 | + */ | |
| 27 | +@Retention(RetentionPolicy.RUNTIME) | |
| 28 | +public @interface DseVersion { | |
| 29 | + /** | |
| 30 | + * @return The major version required to execute this test, i.e. "4.8" | |
| 31 | + */ | |
| 32 | + double major() default 0.0; | |
| 33 | + | |
| 34 | + /** | |
| 35 | + * @return The minor version required to execute this test, i.e. "3" | |
| 36 | + */ | |
| 37 | + int minor() default 0; | |
| 38 | + | |
| 39 | + /** | |
| 40 | + * @return The description returned if this version requirement is not met. | |
| 41 | + */ | |
| 42 | + String description() default "Does not meet minimum version requirement."; | |
| 43 | +} |