kikocis/java-driver public
Changesets · Branches · Tags · Compare
| Changeset | db0a78f782ac6945a8879a98fd06e87fd853459cd8683f88413bd3cc6190fd10 |
|---|---|
| Author | Andrew Tolbert <andrew.tolbert@datastax.com> · 2016-03-15 10:56 -05:00 |
| Committer | Andrew Tolbert <andrew.tolbert@datastax.com> · 2016-03-15 10:56 -05:00 |
| Parents | c3395b80b593, 605634f891ea |
14 files changed
modified driver-core/pom.xml +0 −141
| @@ -304,66 +304,6 @@ | ||
| 304 | 304 | </build> |
| 305 | 305 | |
| 306 | 306 | <profiles> |
| 307 | - <profile> | |
| 308 | - <id>default</id> | |
| 309 | - <properties> | |
| 310 | - <env>default</env> | |
| 311 | - </properties> | |
| 312 | - <activation> | |
| 313 | - <activeByDefault>true</activeByDefault> | |
| 314 | - </activation> | |
| 315 | - <build> | |
| 316 | - <plugins> | |
| 317 | - <plugin> | |
| 318 | - <groupId>org.apache.maven.plugins</groupId> | |
| 319 | - <artifactId>maven-surefire-plugin</artifactId> | |
| 320 | - <version>2.16</version> | |
| 321 | - <configuration> | |
| 322 | - <groups>unit</groups> | |
| 323 | - <useFile>false</useFile> | |
| 324 | - <systemPropertyVariables> | |
| 325 | - <cassandra.version>${cassandra.version}</cassandra.version> | |
| 326 | - <ipprefix>${ipprefix}</ipprefix> | |
| 327 | - <com.datastax.driver.NEW_NODE_DELAY_SECONDS>60</com.datastax.driver.NEW_NODE_DELAY_SECONDS> | |
| 328 | - </systemPropertyVariables> | |
| 329 | - <classpathDependencyExcludes> | |
| 330 | - <classpathDependencyExcludes>io.netty:netty-transport-native-epoll</classpathDependencyExcludes> | |
| 331 | - </classpathDependencyExcludes> | |
| 332 | - <!--May be needed for debugging--> | |
| 333 | - <!--<forkMode>never</forkMode>--> | |
| 334 | - </configuration> | |
| 335 | - </plugin> | |
| 336 | - </plugins> | |
| 337 | - </build> | |
| 338 | - </profile> | |
| 339 | - | |
| 340 | - <profile> | |
| 341 | - <id>short</id> | |
| 342 | - <properties> | |
| 343 | - <env>default</env> | |
| 344 | - </properties> | |
| 345 | - <build> | |
| 346 | - <plugins> | |
| 347 | - <plugin> | |
| 348 | - <groupId>org.apache.maven.plugins</groupId> | |
| 349 | - <artifactId>maven-surefire-plugin</artifactId> | |
| 350 | - <version>2.16</version> | |
| 351 | - <configuration> | |
| 352 | - <groups>unit,short</groups> | |
| 353 | - <useFile>false</useFile> | |
| 354 | - <systemPropertyVariables> | |
| 355 | - <cassandra.version>${cassandra.version}</cassandra.version> | |
| 356 | - <ipprefix>${ipprefix}</ipprefix> | |
| 357 | - </systemPropertyVariables> | |
| 358 | - <classpathDependencyExcludes> | |
| 359 | - <classpathDependencyExcludes>io.netty:netty-transport-native-epoll</classpathDependencyExcludes> | |
| 360 | - </classpathDependencyExcludes> | |
| 361 | - </configuration> | |
| 362 | - </plugin> | |
| 363 | - </plugins> | |
| 364 | - </build> | |
| 365 | - </profile> | |
| 366 | - | |
| 367 | 307 | <profile> |
| 368 | 308 | <id>isolated</id> |
| 369 | 309 | <properties> |
| @@ -388,87 +328,6 @@ | ||
| 388 | 328 | </plugins> |
| 389 | 329 | </build> |
| 390 | 330 | </profile> |
| 391 | - | |
| 392 | - <profile> | |
| 393 | - <id>long</id> | |
| 394 | - <properties> | |
| 395 | - <env>default</env> | |
| 396 | - </properties> | |
| 397 | - <build> | |
| 398 | - <plugins> | |
| 399 | - <plugin> | |
| 400 | - <groupId>org.apache.maven.plugins</groupId> | |
| 401 | - <artifactId>maven-surefire-plugin</artifactId> | |
| 402 | - <version>2.16</version> | |
| 403 | - <configuration> | |
| 404 | - <groups>unit,short,long</groups> | |
| 405 | - <useFile>false</useFile> | |
| 406 | - <systemPropertyVariables> | |
| 407 | - <cassandra.version>${cassandra.version}</cassandra.version> | |
| 408 | - <ipprefix>${ipprefix}</ipprefix> | |
| 409 | - </systemPropertyVariables> | |
| 410 | - <classpathDependencyExcludes> | |
| 411 | - <classpathDependencyExcludes>io.netty:netty-transport-native-epoll</classpathDependencyExcludes> | |
| 412 | - </classpathDependencyExcludes> | |
| 413 | - </configuration> | |
| 414 | - </plugin> | |
| 415 | - </plugins> | |
| 416 | - </build> | |
| 417 | - </profile> | |
| 418 | - | |
| 419 | - <profile> | |
| 420 | - <id>duration</id> | |
| 421 | - <properties> | |
| 422 | - <env>default</env> | |
| 423 | - </properties> | |
| 424 | - <build> | |
| 425 | - <plugins> | |
| 426 | - <plugin> | |
| 427 | - <groupId>org.apache.maven.plugins</groupId> | |
| 428 | - <artifactId>maven-surefire-plugin</artifactId> | |
| 429 | - <version>2.16</version> | |
| 430 | - <configuration> | |
| 431 | - <groups>unit,short,long,duration</groups> | |
| 432 | - <useFile>false</useFile> | |
| 433 | - <systemPropertyVariables> | |
| 434 | - <cassandra.version>${cassandra.version}</cassandra.version> | |
| 435 | - <ipprefix>${ipprefix}</ipprefix> | |
| 436 | - </systemPropertyVariables> | |
| 437 | - <classpathDependencyExcludes> | |
| 438 | - <classpathDependencyExcludes>io.netty:netty-transport-native-epoll</classpathDependencyExcludes> | |
| 439 | - </classpathDependencyExcludes> | |
| 440 | - </configuration> | |
| 441 | - </plugin> | |
| 442 | - </plugins> | |
| 443 | - </build> | |
| 444 | - </profile> | |
| 445 | - | |
| 446 | - <profile> | |
| 447 | - <id>doc</id> | |
| 448 | - <properties> | |
| 449 | - <env>default</env> | |
| 450 | - </properties> | |
| 451 | - <build> | |
| 452 | - <plugins> | |
| 453 | - <plugin> | |
| 454 | - <groupId>org.apache.maven.plugins</groupId> | |
| 455 | - <artifactId>maven-surefire-plugin</artifactId> | |
| 456 | - <version>2.16</version> | |
| 457 | - <configuration> | |
| 458 | - <groups>unit,doc</groups> | |
| 459 | - <useFile>false</useFile> | |
| 460 | - <systemPropertyVariables> | |
| 461 | - <cassandra.version>${cassandra.version}</cassandra.version> | |
| 462 | - <ipprefix>${ipprefix}</ipprefix> | |
| 463 | - </systemPropertyVariables> | |
| 464 | - <classpathDependencyExcludes> | |
| 465 | - <classpathDependencyExcludes>io.netty:netty-transport-native-epoll</classpathDependencyExcludes> | |
| 466 | - </classpathDependencyExcludes> | |
| 467 | - </configuration> | |
| 468 | - </plugin> | |
| 469 | - </plugins> | |
| 470 | - </build> | |
| 471 | - </profile> | |
| 472 | 331 | </profiles> |
| 473 | 332 | |
| 474 | 333 | <licenses> |
modified driver-core/src/test/java/com/datastax/driver/core/CCMBridge.java +58 −35
| @@ -31,6 +31,8 @@ | ||
| 31 | 31 | import java.net.InetSocketAddress; |
| 32 | 32 | import java.util.*; |
| 33 | 33 | import java.util.concurrent.TimeUnit; |
| 34 | +import java.util.regex.Matcher; | |
| 35 | +import java.util.regex.Pattern; | |
| 34 | 36 | |
| 35 | 37 | import static com.datastax.driver.core.TestUtils.executeNoFail; |
| 36 | 38 | import static com.datastax.driver.core.TestUtils.findAvailablePort; |
| @@ -659,22 +661,25 @@ | ||
| 659 | 661 | * use {@link #builder()} to get an instance |
| 660 | 662 | */ |
| 661 | 663 | public static class Builder { |
| 662 | - private final String clusterName = TestUtils.generateIdentifier("cluster_"); | |
| 664 | + | |
| 665 | + public static final String RANDOM_PORT = "__RANDOM_PORT__"; | |
| 666 | + private static final Pattern RANDOM_PORT_PATTERN = Pattern.compile(RANDOM_PORT); | |
| 667 | + | |
| 663 | 668 | int[] nodes = {1}; |
| 664 | 669 | private boolean start = true; |
| 665 | 670 | private boolean isDSE = isDSE(); |
| 666 | 671 | private String version = getCassandraVersion(); |
| 667 | - private Set<String> createOptions = new HashSet<String>(getInstallArguments()); | |
| 672 | + private Set<String> createOptions = new LinkedHashSet<String>(getInstallArguments()); | |
| 668 | 673 | private Set<String> jvmArgs = new LinkedHashSet<String>(); |
| 669 | - private final Map<String, Object> cassandraConfiguration = Maps.newHashMap(); | |
| 670 | - private final Map<String, Object> dseConfiguration = Maps.newHashMap(); | |
| 671 | - // -1 means random | |
| 672 | - private int thriftPort = -1; | |
| 673 | - private int binaryPort = -1; | |
| 674 | - private int storagePort = -1; | |
| 674 | + private final Map<String, Object> cassandraConfiguration = Maps.newLinkedHashMap(); | |
| 675 | + private final Map<String, Object> dseConfiguration = Maps.newLinkedHashMap(); | |
| 675 | 676 | private Map<Integer, Workload> workloads = new HashMap<Integer, Workload>(); |
| 676 | 677 | |
| 677 | 678 | private Builder() { |
| 679 | + cassandraConfiguration.put("start_rpc", false); | |
| 680 | + cassandraConfiguration.put("storage_port", RANDOM_PORT); | |
| 681 | + cassandraConfiguration.put("rpc_port", RANDOM_PORT); | |
| 682 | + cassandraConfiguration.put("native_transport_port", RANDOM_PORT); | |
| 678 | 683 | } |
| 679 | 684 | |
| 680 | 685 | /** |
| @@ -781,17 +786,17 @@ | ||
| 781 | 786 | } |
| 782 | 787 | |
| 783 | 788 | public Builder withStoragePort(int port) { |
| 784 | - storagePort = port; | |
| 789 | + cassandraConfiguration.put("storage_port", port); | |
| 785 | 790 | return this; |
| 786 | 791 | } |
| 787 | 792 | |
| 788 | 793 | public Builder withThriftPort(int port) { |
| 789 | - thriftPort = port; | |
| 794 | + cassandraConfiguration.put("rpc_port", port); | |
| 790 | 795 | return this; |
| 791 | 796 | } |
| 792 | 797 | |
| 793 | 798 | public Builder withBinaryPort(int port) { |
| 794 | - binaryPort = port; | |
| 799 | + cassandraConfiguration.put("native_transport_port", port); | |
| 795 | 800 | return this; |
| 796 | 801 | } |
| 797 | 802 | |
| @@ -809,10 +814,13 @@ | ||
| 809 | 814 | |
| 810 | 815 | public CCMBridge build() { |
| 811 | 816 | // be careful NOT to alter internal state (hashCode/equals) during build! |
| 812 | - int storagePort = this.storagePort == -1 ? findAvailablePort() : this.storagePort; | |
| 813 | - int thriftPort = this.thriftPort == -1 ? findAvailablePort() : this.thriftPort; | |
| 814 | - int binaryPort = this.binaryPort == -1 ? findAvailablePort() : this.binaryPort; | |
| 817 | + String clusterName = TestUtils.generateIdentifier("ccm_"); | |
| 818 | + Map<String, Object> cassandraConfiguration = randomizePorts(this.cassandraConfiguration); | |
| 819 | + Map<String, Object> dseConfiguration = randomizePorts(this.dseConfiguration); | |
| 815 | 820 | VersionNumber version = VersionNumber.parse(this.version); |
| 821 | + int storagePort = Integer.parseInt(cassandraConfiguration.get("storage_port").toString()); | |
| 822 | + int thriftPort = Integer.parseInt(cassandraConfiguration.get("rpc_port").toString()); | |
| 823 | + int binaryPort = Integer.parseInt(cassandraConfiguration.get("native_transport_port").toString()); | |
| 816 | 824 | final CCMBridge ccm = new CCMBridge(clusterName, isDSE, version, storagePort, thriftPort, binaryPort, joinJvmArgs()); |
| 817 | 825 | Runtime.getRuntime().addShutdownHook(new Thread() { |
| 818 | 826 | @Override |
| @@ -820,14 +828,9 @@ | ||
| 820 | 828 | ccm.close(); |
| 821 | 829 | } |
| 822 | 830 | }); |
| 823 | - ccm.execute(buildCreateCommand()); | |
| 831 | + ccm.execute(buildCreateCommand(clusterName)); | |
| 824 | 832 | updateNodeConf(ccm); |
| 825 | - HashMap<String, Object> config = new HashMap<String, Object>(cassandraConfiguration); | |
| 826 | - config.put("start_rpc", false); | |
| 827 | - config.put("storage_port", storagePort); | |
| 828 | - config.put("rpc_port", thriftPort); | |
| 829 | - config.put("native_transport_port", binaryPort); | |
| 830 | - ccm.updateConfig(config); | |
| 833 | + ccm.updateConfig(cassandraConfiguration); | |
| 831 | 834 | if (!dseConfiguration.isEmpty()) |
| 832 | 835 | ccm.updateDSEConfig(dseConfiguration); |
| 833 | 836 | for (Map.Entry<Integer, Workload> entry : workloads.entrySet()) { |
| @@ -851,12 +854,12 @@ | ||
| 851 | 854 | StringBuilder allJvmArgs = new StringBuilder(""); |
| 852 | 855 | for (String jvmArg : jvmArgs) { |
| 853 | 856 | allJvmArgs.append(" --jvm_arg="); |
| 854 | - allJvmArgs.append(jvmArg); | |
| 857 | + allJvmArgs.append(randomizePorts(jvmArg)); | |
| 855 | 858 | } |
| 856 | 859 | return allJvmArgs.toString(); |
| 857 | 860 | } |
| 858 | 861 | |
| 859 | - private String buildCreateCommand() { | |
| 862 | + private String buildCreateCommand(String clusterName) { | |
| 860 | 863 | StringBuilder result = new StringBuilder(CCM_COMMAND + " create"); |
| 861 | 864 | result.append(" ").append(clusterName); |
| 862 | 865 | result.append(" -i ").append(TestUtils.IP_PREFIX); |
| @@ -870,7 +873,7 @@ | ||
| 870 | 873 | result.append(node); |
| 871 | 874 | } |
| 872 | 875 | } |
| 873 | - result.append(" ").append(Joiner.on(" ").join(createOptions)); | |
| 876 | + result.append(" ").append(Joiner.on(" ").join(randomizePorts(createOptions))); | |
| 874 | 877 | return result.toString(); |
| 875 | 878 | } |
| 876 | 879 | |
| @@ -888,7 +891,7 @@ | ||
| 888 | 891 | for (int i = 0; i < nodesInDc; i++) { |
| 889 | 892 | int jmxPort = findAvailablePort(); |
| 890 | 893 | int debugPort = findAvailablePort(); |
| 891 | - logger.trace("Node {} in cluster {} using JMX port {} and debug port {}", n, clusterName, jmxPort, debugPort); | |
| 894 | + logger.trace("Node {} in cluster {} using JMX port {} and debug port {}", n, ccm.getClusterName(), jmxPort, debugPort); | |
| 892 | 895 | File nodeConf = new File(ccm.getNodeDir(n), "node.conf"); |
| 893 | 896 | File nodeConf2 = new File(ccm.getNodeDir(n), "node.conf.tmp"); |
| 894 | 897 | BufferedReader br = closer.register(new BufferedReader(new FileReader(nodeConf))); |
| @@ -923,6 +926,36 @@ | ||
| 923 | 926 | } |
| 924 | 927 | } |
| 925 | 928 | |
| 929 | + private Set<String> randomizePorts(Set<String> set) { | |
| 930 | + Set<String> randomized = new LinkedHashSet<String>(); | |
| 931 | + for (String value : set) { | |
| 932 | + randomized.add(randomizePorts(value)); | |
| 933 | + } | |
| 934 | + return randomized; | |
| 935 | + } | |
| 936 | + | |
| 937 | + private Map<String, Object> randomizePorts(Map<String, Object> map) { | |
| 938 | + Map<String, Object> randomized = new HashMap<String, Object>(); | |
| 939 | + for (Map.Entry<String, Object> entry : map.entrySet()) { | |
| 940 | + Object value = entry.getValue(); | |
| 941 | + if (value instanceof CharSequence) { | |
| 942 | + value = randomizePorts((CharSequence) value); | |
| 943 | + } | |
| 944 | + randomized.put(entry.getKey(), value); | |
| 945 | + } | |
| 946 | + return randomized; | |
| 947 | + } | |
| 948 | + | |
| 949 | + private String randomizePorts(CharSequence str) { | |
| 950 | + Matcher matcher = RANDOM_PORT_PATTERN.matcher(str); | |
| 951 | + StringBuffer sb = new StringBuffer(); | |
| 952 | + while (matcher.find()) { | |
| 953 | + matcher.appendReplacement(sb, Integer.toString(TestUtils.findAvailablePort())); | |
| 954 | + } | |
| 955 | + matcher.appendTail(sb); | |
| 956 | + return sb.toString(); | |
| 957 | + } | |
| 958 | + | |
| 926 | 959 | @Override |
| 927 | 960 | @SuppressWarnings("SimplifiableIfStatement") |
| 928 | 961 | public boolean equals(Object o) { |
| @@ -932,9 +965,6 @@ | ||
| 932 | 965 | if (o == null || getClass() != o.getClass()) return false; |
| 933 | 966 | Builder builder = (Builder) o; |
| 934 | 967 | if (isDSE != builder.isDSE) return false; |
| 935 | - if (thriftPort != builder.thriftPort) return false; | |
| 936 | - if (binaryPort != builder.binaryPort) return false; | |
| 937 | - if (storagePort != builder.storagePort) return false; | |
| 938 | 968 | if (!Arrays.equals(nodes, builder.nodes)) return false; |
| 939 | 969 | if (!createOptions.equals(builder.createOptions)) return false; |
| 940 | 970 | if (!jvmArgs.equals(builder.jvmArgs)) return false; |
| @@ -955,17 +985,10 @@ | ||
| 955 | 985 | result = 31 * result + cassandraConfiguration.hashCode(); |
| 956 | 986 | result = 31 * result + dseConfiguration.hashCode(); |
| 957 | 987 | result = 31 * result + workloads.hashCode(); |
| 958 | - result = 31 * result + thriftPort; | |
| 959 | - result = 31 * result + binaryPort; | |
| 960 | - result = 31 * result + storagePort; | |
| 961 | 988 | result = 31 * result + version.hashCode(); |
| 962 | 989 | return result; |
| 963 | 990 | } |
| 964 | 991 | |
| 965 | - @Override | |
| 966 | - public String toString() { | |
| 967 | - return String.format("%s (%s nodes)", clusterName, weight()); | |
| 968 | - } | |
| 969 | 992 | } |
| 970 | 993 | |
| 971 | 994 | } |
modified driver-core/src/test/java/com/datastax/driver/core/CCMCache.java +24 −5
| @@ -22,6 +22,7 @@ | ||
| 22 | 22 | |
| 23 | 23 | import java.io.File; |
| 24 | 24 | import java.net.InetSocketAddress; |
| 25 | +import java.util.Iterator; | |
| 25 | 26 | import java.util.Map; |
| 26 | 27 | import java.util.concurrent.ExecutionException; |
| 27 | 28 | import java.util.concurrent.atomic.AtomicInteger; |
| @@ -247,20 +248,23 @@ | ||
| 247 | 248 | */ |
| 248 | 249 | private static final LoadingCache<CCMBridge.Builder, CachedCCMAccess> CACHE; |
| 249 | 250 | |
| 251 | + // The amount of memory one CCM node takes in MB. | |
| 252 | + private static final int ONE_CCM_NODE_MB = 800; | |
| 253 | + | |
| 250 | 254 | static { |
| 251 | 255 | long maximumWeight; |
| 252 | 256 | String numberOfNodes = System.getProperty("ccm.maxNumberOfNodes"); |
| 253 | 257 | if (numberOfNodes == null) { |
| 254 | 258 | long freeMemoryMB = TestUtils.getFreeMemoryMB(); |
| 255 | - if (freeMemoryMB < 1000) | |
| 256 | - LOGGER.warn("Available memory below 1GB: {}MB, CCM clusters might fail to start", freeMemoryMB); | |
| 259 | + if (freeMemoryMB < ONE_CCM_NODE_MB) | |
| 260 | + LOGGER.warn("Not enough available memory: {} MB, CCM clusters might fail to start", freeMemoryMB); | |
| 257 | 261 | // CCM nodes are started with -Xms500M -Xmx500M |
| 258 | 262 | // and allocate up to 100MB non-heap memory in the general case, |
| 259 | 263 | // to be conservative we treat 1 "slot" as 800Mb. |
| 260 | 264 | // We leave 2 slots out to avoid starving system memory, |
| 261 | 265 | // and we pick a value with a minimum of 1 slot and a maximum of 8 slots. |
| 262 | 266 | // For example, an 8GB VM with ~6.5GB currently available heap will yield 6 slots ((6500/800) - 2 = 6). |
| 263 | - long slotsAvailable = (freeMemoryMB / 800) - 2; | |
| 267 | + long slotsAvailable = (freeMemoryMB / ONE_CCM_NODE_MB) - 2; | |
| 264 | 268 | maximumWeight = Math.min(8, Math.max(1, slotsAvailable)); |
| 265 | 269 | } else { |
| 266 | 270 | maximumWeight = Integer.parseInt(numberOfNodes); |
| @@ -272,6 +276,7 @@ | ||
| 272 | 276 | .maximumWeight(maximumWeight) |
| 273 | 277 | .weigher(new CCMAccessWeigher()) |
| 274 | 278 | .removalListener(new CCMAccessRemovalListener()) |
| 279 | + .recordStats() | |
| 275 | 280 | .build(new CCMAccessLoader()); |
| 276 | 281 | } |
| 277 | 282 | |
| @@ -304,8 +309,22 @@ | ||
| 304 | 309 | } |
| 305 | 310 | |
| 306 | 311 | private static void logCache() { |
| 307 | - if (LOGGER.isDebugEnabled()) | |
| 308 | - LOGGER.debug("Free memory: {}, Cache {}", TestUtils.getFreeMemoryMB(), CACHE.asMap().keySet()); | |
| 312 | + if (LOGGER.isDebugEnabled()) { | |
| 313 | + LOGGER.debug("Free memory: {} MB", TestUtils.getFreeMemoryMB()); | |
| 314 | + StringBuilder sb = new StringBuilder(); | |
| 315 | + Iterator<Map.Entry<CCMBridge.Builder, CachedCCMAccess>> iterator = CACHE.asMap().entrySet().iterator(); | |
| 316 | + while (iterator.hasNext()) { | |
| 317 | + Map.Entry<CCMBridge.Builder, CachedCCMAccess> entry = iterator.next(); | |
| 318 | + sb.append(entry.getValue().getClusterName()) | |
| 319 | + .append(" (") | |
| 320 | + .append(entry.getKey().weight()) | |
| 321 | + .append(")"); | |
| 322 | + if (iterator.hasNext()) | |
| 323 | + sb.append(", "); | |
| 324 | + } | |
| 325 | + LOGGER.debug("Cache contents: {{}}", sb.toString()); | |
| 326 | + LOGGER.debug("Cache stats: {}", CACHE.stats()); | |
| 327 | + } | |
| 309 | 328 | } |
| 310 | 329 | |
| 311 | 330 | } |
modified driver-core/src/test/java/com/datastax/driver/core/CCMTestsSupport.java +26 −26
| @@ -417,32 +417,32 @@ | ||
| 417 | 417 | ccmBuilder = ccmProvider(testInstance); |
| 418 | 418 | if (ccmBuilder == null) { |
| 419 | 419 | ccmBuilder = CCMBridge.builder().withNodes(numberOfNodes()).notStarted(); |
| 420 | - if (version() != null) | |
| 421 | - ccmBuilder.withVersion(version()); | |
| 422 | - if (dse()) | |
| 423 | - ccmBuilder.withDSE(); | |
| 424 | - if (ssl()) | |
| 425 | - ccmBuilder.withSSL(); | |
| 426 | - if (auth()) | |
| 427 | - ccmBuilder.withAuth(); | |
| 428 | - for (Map.Entry<String, Object> entry : config().entrySet()) { | |
| 429 | - ccmBuilder.withCassandraConfiguration(entry.getKey(), entry.getValue()); | |
| 430 | - } | |
| 431 | - for (Map.Entry<String, Object> entry : dseConfig().entrySet()) { | |
| 432 | - ccmBuilder.withDSEConfiguration(entry.getKey(), entry.getValue()); | |
| 433 | - } | |
| 434 | - for (String option : startOptions()) { | |
| 435 | - ccmBuilder.withCreateOptions(option); | |
| 436 | - } | |
| 437 | - for (String arg : jvmArgs()) { | |
| 438 | - ccmBuilder.withJvmArgs(arg); | |
| 439 | - } | |
| 440 | - List<Workload> workloads = workloads(); | |
| 441 | - for (int i = 0; i < workloads.size(); i++) { | |
| 442 | - Workload workload = workloads.get(i); | |
| 443 | - if (workload != null) | |
| 444 | - ccmBuilder.withWorkload(i + 1, workload); | |
| 445 | - } | |
| 420 | + } | |
| 421 | + if (version() != null) | |
| 422 | + ccmBuilder.withVersion(version()); | |
| 423 | + if (dse()) | |
| 424 | + ccmBuilder.withDSE(); | |
| 425 | + if (ssl()) | |
| 426 | + ccmBuilder.withSSL(); | |
| 427 | + if (auth()) | |
| 428 | + ccmBuilder.withAuth(); | |
| 429 | + for (Map.Entry<String, Object> entry : config().entrySet()) { | |
| 430 | + ccmBuilder.withCassandraConfiguration(entry.getKey(), entry.getValue()); | |
| 431 | + } | |
| 432 | + for (Map.Entry<String, Object> entry : dseConfig().entrySet()) { | |
| 433 | + ccmBuilder.withDSEConfiguration(entry.getKey(), entry.getValue()); | |
| 434 | + } | |
| 435 | + for (String option : startOptions()) { | |
| 436 | + ccmBuilder.withCreateOptions(option); | |
| 437 | + } | |
| 438 | + for (String arg : jvmArgs()) { | |
| 439 | + ccmBuilder.withJvmArgs(arg); | |
| 440 | + } | |
| 441 | + List<Workload> workloads = workloads(); | |
| 442 | + for (int i = 0; i < workloads.size(); i++) { | |
| 443 | + Workload workload = workloads.get(i); | |
| 444 | + if (workload != null) | |
| 445 | + ccmBuilder.withWorkload(i + 1, workload); | |
| 446 | 446 | } |
| 447 | 447 | } |
| 448 | 448 | return ccmBuilder; |
modified driver-core/src/test/java/com/datastax/driver/core/ConsistencyTest.java +8 −9
| @@ -49,10 +49,9 @@ | ||
| 49 | 49 | createKeyspace = false, |
| 50 | 50 | config = { |
| 51 | 51 | // tests fail often with write or read timeouts |
| 52 | - "hinted_handoff_enabled:true", | |
| 53 | 52 | "phi_convict_threshold:5", |
| 54 | - "read_request_timeout_in_ms:100000", | |
| 55 | - "write_request_timeout_in_ms:100000" | |
| 53 | + "read_request_timeout_in_ms:200000", | |
| 54 | + "write_request_timeout_in_ms:200000" | |
| 56 | 55 | } |
| 57 | 56 | ) |
| 58 | 57 | public class ConsistencyTest extends AbstractPoliciesTest { |
| @@ -61,40 +60,40 @@ | ||
| 61 | 60 | |
| 62 | 61 | private Cluster.Builder tokenAwareRoundRobin() { |
| 63 | 62 | return Cluster.builder() |
| 64 | - .withSocketOptions(new SocketOptions().setReadTimeoutMillis(120000)) | |
| 63 | + .withSocketOptions(new SocketOptions().setReadTimeoutMillis(300000)) | |
| 65 | 64 | .withLoadBalancingPolicy(new TokenAwarePolicy(new RoundRobinPolicy())); |
| 66 | 65 | } |
| 67 | 66 | |
| 68 | 67 | private Cluster.Builder tokenAwareRoundRobinNoShuffle() { |
| 69 | 68 | return Cluster.builder() |
| 70 | - .withSocketOptions(new SocketOptions().setReadTimeoutMillis(120000)) | |
| 69 | + .withSocketOptions(new SocketOptions().setReadTimeoutMillis(300000)) | |
| 71 | 70 | .withLoadBalancingPolicy(new TokenAwarePolicy(new RoundRobinPolicy(), false)); |
| 72 | 71 | } |
| 73 | 72 | |
| 74 | 73 | private Cluster.Builder tokenAwareRoundRobinDowngrading() { |
| 75 | 74 | return Cluster.builder() |
| 76 | - .withSocketOptions(new SocketOptions().setReadTimeoutMillis(120000)) | |
| 75 | + .withSocketOptions(new SocketOptions().setReadTimeoutMillis(300000)) | |
| 77 | 76 | .withLoadBalancingPolicy(new TokenAwarePolicy(new RoundRobinPolicy())) |
| 78 | 77 | .withRetryPolicy(DowngradingConsistencyRetryPolicy.INSTANCE); |
| 79 | 78 | } |
| 80 | 79 | |
| 81 | 80 | private Cluster.Builder tokenAwareRoundRobinNoShuffleDowngrading() { |
| 82 | 81 | return Cluster.builder() |
| 83 | - .withSocketOptions(new SocketOptions().setReadTimeoutMillis(120000)) | |
| 82 | + .withSocketOptions(new SocketOptions().setReadTimeoutMillis(300000)) | |
| 84 | 83 | .withLoadBalancingPolicy(new TokenAwarePolicy(new RoundRobinPolicy(), false)) |
| 85 | 84 | .withRetryPolicy(DowngradingConsistencyRetryPolicy.INSTANCE); |
| 86 | 85 | } |
| 87 | 86 | |
| 88 | 87 | private Cluster.Builder roundRobinDowngrading() { |
| 89 | 88 | return Cluster.builder() |
| 90 | - .withSocketOptions(new SocketOptions().setReadTimeoutMillis(120000)) | |
| 89 | + .withSocketOptions(new SocketOptions().setReadTimeoutMillis(300000)) | |
| 91 | 90 | .withLoadBalancingPolicy(new RoundRobinPolicy()) |
| 92 | 91 | .withRetryPolicy(DowngradingConsistencyRetryPolicy.INSTANCE); |
| 93 | 92 | } |
| 94 | 93 | |
| 95 | 94 | private Cluster.Builder tokenAwareDCAwareRoundRobinNoShuffleDowngrading() { |
| 96 | 95 | return Cluster.builder() |
| 97 | - .withSocketOptions(new SocketOptions().setReadTimeoutMillis(120000)) | |
| 96 | + .withSocketOptions(new SocketOptions().setReadTimeoutMillis(300000)) | |
| 98 | 97 | .withLoadBalancingPolicy(new TokenAwarePolicy(DCAwareRoundRobinPolicy.builder().withLocalDc("dc2").build(), false)) |
| 99 | 98 | .withRetryPolicy(DowngradingConsistencyRetryPolicy.INSTANCE); |
| 100 | 99 | } |
modified driver-core/src/test/java/com/datastax/driver/core/MissingRpcAddressTest.java +2 −2
| @@ -20,7 +20,6 @@ | ||
| 20 | 20 | import com.google.common.collect.Lists; |
| 21 | 21 | import org.testng.annotations.Test; |
| 22 | 22 | |
| 23 | -import java.net.InetAddress; | |
| 24 | 23 | import java.net.InetSocketAddress; |
| 25 | 24 | |
| 26 | 25 | import static com.datastax.driver.core.CreateCCM.TestMode.PER_METHOD; |
| @@ -64,9 +63,10 @@ | ||
| 64 | 63 | .build()); |
| 65 | 64 | Session session = cluster.connect(); |
| 66 | 65 | String deleteStmt = String.format("DELETE rpc_address FROM system.peers WHERE peer = '%s'", |
| 67 | - InetAddress.getByName(TestUtils.IP_PREFIX + "2").getHostName()); | |
| 66 | + ccm().addressOfNode(2).getHostName()); | |
| 68 | 67 | session.execute(deleteStmt); |
| 69 | 68 | session.close(); |
| 69 | + cluster.close(); | |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | } |
modified driver-core/src/test/java/com/datastax/driver/core/TestUtils.java +17 −35
| @@ -18,6 +18,7 @@ | ||
| 18 | 18 | import com.datastax.driver.core.policies.RoundRobinPolicy; |
| 19 | 19 | import com.datastax.driver.core.policies.WhiteListPolicy; |
| 20 | 20 | import com.google.common.base.Predicate; |
| 21 | +import com.google.common.base.Throwables; | |
| 21 | 22 | import com.google.common.util.concurrent.Futures; |
| 22 | 23 | import com.google.common.util.concurrent.Uninterruptibles; |
| 23 | 24 | import com.sun.management.OperatingSystemMXBean; |
| @@ -39,7 +40,6 @@ | ||
| 39 | 40 | import java.util.*; |
| 40 | 41 | import java.util.concurrent.*; |
| 41 | 42 | import java.util.concurrent.atomic.AtomicInteger; |
| 42 | -import java.util.concurrent.locks.ReentrantLock; | |
| 43 | 43 | |
| 44 | 44 | import static com.datastax.driver.core.ConditionChecker.check; |
| 45 | 45 | import static java.util.concurrent.TimeUnit.MINUTES; |
| @@ -489,47 +489,29 @@ | ||
| 489 | 489 | return prefix + seq.incrementAndGet(); |
| 490 | 490 | } |
| 491 | 491 | |
| 492 | - // use ports in the ephemeral range | |
| 493 | - private static int nextPort = 50000; | |
| 494 | - | |
| 495 | - private static final ReentrantLock PORT_LOCK = new ReentrantLock(); | |
| 496 | - | |
| 497 | 492 | /** |
| 498 | - * Find an available port in the ephemeral range. | |
| 493 | + * Finds an available port in the ephemeral range. | |
| 494 | + * This is loosely inspired by Apache MINA's AvailablePortFinder. | |
| 499 | 495 | * |
| 500 | 496 | * @return A local port that is currently unused. |
| 501 | 497 | */ |
| 502 | - public static int findAvailablePort() { | |
| 503 | - PORT_LOCK.lock(); | |
| 498 | + public synchronized static int findAvailablePort() throws RuntimeException { | |
| 499 | + ServerSocket ss = null; | |
| 504 | 500 | try { |
| 505 | - for (int i = 0; i < 3; i++) { | |
| 506 | - int port = nextPort; | |
| 507 | - ServerSocket s = null; | |
| 508 | - for (int j = 0; j < 100; j++) { | |
| 509 | - try { | |
| 510 | - s = new ServerSocket(port); | |
| 511 | - s.close(); | |
| 512 | - nextPort = port + 1; | |
| 513 | - return port; | |
| 514 | - } catch (IOException e) { | |
| 515 | - // ok | |
| 516 | - } finally { | |
| 517 | - port++; | |
| 518 | - if (s != null) { | |
| 519 | - try { | |
| 520 | - s.close(); | |
| 521 | - } catch (IOException e) { | |
| 522 | - // ok | |
| 523 | - } | |
| 524 | - } | |
| 525 | - } | |
| 501 | + // let the system pick an ephemeral port | |
| 502 | + ss = new ServerSocket(0); | |
| 503 | + ss.setReuseAddress(true); | |
| 504 | + return ss.getLocalPort(); | |
| 505 | + } catch (IOException e) { | |
| 506 | + throw Throwables.propagate(e); | |
| 507 | + } finally { | |
| 508 | + if (ss != null) { | |
| 509 | + try { | |
| 510 | + ss.close(); | |
| 511 | + } catch (IOException e) { | |
| 512 | + Throwables.propagate(e); | |
| 526 | 513 | } |
| 527 | - logger.warn("Could not acquire an available port after 100 attempts, sleeping for 1 minute"); | |
| 528 | - Uninterruptibles.sleepUninterruptibly(1, TimeUnit.MINUTES); | |
| 529 | 514 | } |
| 530 | - throw new RuntimeException(String.format("Could not acquire an available port within range: %s-%s", nextPort, nextPort + 100)); | |
| 531 | - } finally { | |
| 532 | - PORT_LOCK.unlock(); | |
| 533 | 515 | } |
| 534 | 516 | } |
| 535 | 517 |
modified driver-core/src/test/java/com/datastax/driver/core/UserTypesTest.java +27 −9
| @@ -28,8 +28,11 @@ | ||
| 28 | 28 | import java.net.InetAddress; |
| 29 | 29 | import java.nio.ByteBuffer; |
| 30 | 30 | import java.util.*; |
| 31 | +import java.util.concurrent.Callable; | |
| 31 | 32 | |
| 33 | +import static com.datastax.driver.core.ConditionChecker.check; | |
| 32 | 34 | import static com.datastax.driver.core.Metadata.quote; |
| 35 | +import static java.util.concurrent.TimeUnit.MINUTES; | |
| 33 | 36 | import static org.testng.Assert.assertEquals; |
| 34 | 37 | import static org.testng.Assert.assertNotEquals; |
| 35 | 38 | |
| @@ -37,15 +40,29 @@ | ||
| 37 | 40 | public class UserTypesTest extends CCMTestsSupport { |
| 38 | 41 | |
| 39 | 42 | private final static List<DataType> DATA_TYPE_PRIMITIVES = new ArrayList<DataType>(DataType.allPrimitiveTypes()); |
| 43 | + | |
| 44 | + static { | |
| 45 | + DATA_TYPE_PRIMITIVES.remove(DataType.counter()); | |
| 46 | + } | |
| 47 | + | |
| 40 | 48 | private final static List<DataType.Name> DATA_TYPE_NON_PRIMITIVE_NAMES = |
| 41 | 49 | new ArrayList<DataType.Name>(EnumSet.of(DataType.Name.LIST, DataType.Name.SET, DataType.Name.MAP, DataType.Name.TUPLE)); |
| 42 | 50 | |
| 51 | + private final Callable<Boolean> userTableExists = new Callable<Boolean>() { | |
| 52 | + @Override | |
| 53 | + public Boolean call() throws Exception { | |
| 54 | + return cluster().getMetadata().getKeyspace(keyspace).getTable("user") != null; | |
| 55 | + } | |
| 56 | + }; | |
| 57 | + | |
| 43 | 58 | @Override |
| 44 | 59 | public void onTestContextInitialized() { |
| 45 | 60 | String type1 = "CREATE TYPE phone (alias text, number text)"; |
| 46 | - String type2 = "CREATE TYPE address (street text, \"ZIP\" int, phones set<frozen<phone>>)"; | |
| 47 | - String table = "CREATE TABLE user (id int PRIMARY KEY, addr frozen<address>)"; | |
| 61 | + String type2 = "CREATE TYPE \"\"\"User Address\"\"\" (street text, \"ZIP\"\"\" int, phones set<frozen<phone>>)"; | |
| 62 | + String table = "CREATE TABLE user (id int PRIMARY KEY, addr frozen<\"\"\"User Address\"\"\">)"; | |
| 48 | 63 | execute(type1, type2, table); |
| 64 | + // Ci tests fail with "unconfigured columnfamily user" | |
| 65 | + check().that(userTableExists).before(5, MINUTES).becomesTrue(); | |
| 49 | 66 | } |
| 50 | 67 | |
| 51 | 68 | /** |
| @@ -59,13 +76,13 @@ | ||
| 59 | 76 | PreparedStatement ins = session().prepare("INSERT INTO user(id, addr) VALUES (?, ?)"); |
| 60 | 77 | PreparedStatement sel = session().prepare("SELECT * FROM user WHERE id=?"); |
| 61 | 78 | |
| 62 | - UserType addrDef = cluster().getMetadata().getKeyspace(keyspace).getUserType("address"); | |
| 79 | + UserType addrDef = cluster().getMetadata().getKeyspace(keyspace).getUserType(quote("\"User Address\"")); | |
| 63 | 80 | UserType phoneDef = cluster().getMetadata().getKeyspace(keyspace).getUserType("phone"); |
| 64 | 81 | |
| 65 | 82 | UDTValue phone1 = phoneDef.newValue().setString("alias", "home").setString("number", "0123548790"); |
| 66 | 83 | UDTValue phone2 = phoneDef.newValue().setString("alias", "work").setString("number", "0698265251"); |
| 67 | 84 | |
| 68 | - UDTValue addr = addrDef.newValue().setString("street", "1600 Pennsylvania Ave NW").setInt(quote("ZIP"), 20500).setSet("phones", ImmutableSet.of(phone1, phone2)); | |
| 85 | + UDTValue addr = addrDef.newValue().setString("street", "1600 Pennsylvania Ave NW").setInt(quote("ZIP\""), 20500).setSet("phones", ImmutableSet.of(phone1, phone2)); | |
| 69 | 86 | |
| 70 | 87 | session().execute(ins.bind(userId, addr)); |
| 71 | 88 | |
| @@ -83,13 +100,14 @@ | ||
| 83 | 100 | @Test(groups = "short") |
| 84 | 101 | public void simpleUnpreparedWriteReadTest() throws Exception { |
| 85 | 102 | int userId = 1; |
| 86 | - UserType addrDef = cluster().getMetadata().getKeyspace(keyspace).getUserType("address"); | |
| 103 | + session().execute("USE " + keyspace); | |
| 104 | + UserType addrDef = cluster().getMetadata().getKeyspace(keyspace).getUserType(quote("\"User Address\"")); | |
| 87 | 105 | UserType phoneDef = cluster().getMetadata().getKeyspace(keyspace).getUserType("phone"); |
| 88 | 106 | |
| 89 | 107 | UDTValue phone1 = phoneDef.newValue().setString("alias", "home").setString("number", "0123548790"); |
| 90 | 108 | UDTValue phone2 = phoneDef.newValue().setString("alias", "work").setString("number", "0698265251"); |
| 91 | 109 | |
| 92 | - UDTValue addr = addrDef.newValue().setString("street", "1600 Pennsylvania Ave NW").setInt(quote("ZIP"), 20500).setSet("phones", ImmutableSet.of(phone1, phone2)); | |
| 110 | + UDTValue addr = addrDef.newValue().setString("street", "1600 Pennsylvania Ave NW").setInt(quote("ZIP\""), 20500).setSet("phones", ImmutableSet.of(phone1, phone2)); | |
| 93 | 111 | |
| 94 | 112 | session().execute("INSERT INTO user(id, addr) VALUES (?, ?)", userId, addr); |
| 95 | 113 | |
| @@ -111,7 +129,7 @@ | ||
| 111 | 129 | assertEquals(addrDef, null); |
| 112 | 130 | assertEquals(phoneDef, null); |
| 113 | 131 | |
| 114 | - addrDef = cluster().getMetadata().getKeyspace(keyspace).getUserType("address"); | |
| 132 | + addrDef = cluster().getMetadata().getKeyspace(keyspace).getUserType(quote("\"User Address\"")); | |
| 115 | 133 | phoneDef = cluster().getMetadata().getKeyspace(keyspace).getUserType("phone"); |
| 116 | 134 | assertNotEquals(addrDef, null); |
| 117 | 135 | assertNotEquals(phoneDef, null); |
| @@ -122,14 +140,14 @@ | ||
| 122 | 140 | "WITH replication = { 'class' : 'SimpleStrategy', 'replication_factor': '1'}"); |
| 123 | 141 | session().execute("USE " + nonExistingKeyspace); |
| 124 | 142 | |
| 125 | - addrDef = cluster().getMetadata().getKeyspace(nonExistingKeyspace).getUserType("address"); | |
| 143 | + addrDef = cluster().getMetadata().getKeyspace(nonExistingKeyspace).getUserType(quote("\"User Address\"")); | |
| 126 | 144 | phoneDef = cluster().getMetadata().getKeyspace(nonExistingKeyspace).getUserType("phone"); |
| 127 | 145 | assertEquals(addrDef, null); |
| 128 | 146 | assertEquals(phoneDef, null); |
| 129 | 147 | |
| 130 | 148 | session().execute("USE " + keyspace); |
| 131 | 149 | |
| 132 | - addrDef = cluster().getMetadata().getKeyspace(keyspace).getUserType("address"); | |
| 150 | + addrDef = cluster().getMetadata().getKeyspace(keyspace).getUserType(quote("\"User Address\"")); | |
| 133 | 151 | phoneDef = cluster().getMetadata().getKeyspace(keyspace).getUserType("phone"); |
| 134 | 152 | assertNotEquals(addrDef, null); |
| 135 | 153 | assertNotEquals(phoneDef, null); |
modified driver-examples/osgi/pom.xml +4 −77
| @@ -138,7 +138,7 @@ | ||
| 138 | 138 | <plugin> |
| 139 | 139 | <groupId>org.apache.maven.plugins</groupId> |
| 140 | 140 | <artifactId>maven-failsafe-plugin</artifactId> |
| 141 | - <version>2.18.1</version> | |
| 141 | + <version>2.16</version> | |
| 142 | 142 | <executions> |
| 143 | 143 | <execution> |
| 144 | 144 | <goals> |
| @@ -196,14 +196,15 @@ | ||
| 196 | 196 | <plugin> |
| 197 | 197 | <groupId>org.apache.maven.plugins</groupId> |
| 198 | 198 | <artifactId>maven-surefire-plugin</artifactId> |
| 199 | - <version>2.14</version> | |
| 199 | + <version>2.16</version> | |
| 200 | 200 | <configuration> |
| 201 | + <skip>true</skip> | |
| 201 | 202 | </configuration> |
| 202 | 203 | </plugin> |
| 203 | 204 | <plugin> |
| 204 | 205 | <groupId>org.apache.maven.plugins</groupId> |
| 205 | 206 | <artifactId>maven-failsafe-plugin</artifactId> |
| 206 | - <version>2.18.1</version> | |
| 207 | + <version>2.16</version> | |
| 207 | 208 | <configuration> |
| 208 | 209 | <skip>true</skip> |
| 209 | 210 | </configuration> |
| @@ -219,80 +220,6 @@ | ||
| 219 | 220 | </plugins> |
| 220 | 221 | </build> |
| 221 | 222 | </profile> |
| 222 | - | |
| 223 | - <profile> | |
| 224 | - <id>short</id> | |
| 225 | - <properties> | |
| 226 | - <env>default</env> | |
| 227 | - </properties> | |
| 228 | - <build> | |
| 229 | - <plugins> | |
| 230 | - <plugin> | |
| 231 | - <groupId>org.apache.maven.plugins</groupId> | |
| 232 | - <artifactId>maven-surefire-plugin</artifactId> | |
| 233 | - <version>2.14</version> | |
| 234 | - <configuration> | |
| 235 | - <groups>unit,short</groups> | |
| 236 | - <useFile>false</useFile> | |
| 237 | - <systemPropertyVariables> | |
| 238 | - <cassandra.version>${cassandra.version}</cassandra.version> | |
| 239 | - <ipprefix>${ipprefix}</ipprefix> | |
| 240 | - </systemPropertyVariables> | |
| 241 | - </configuration> | |
| 242 | - </plugin> | |
| 243 | - <plugin> | |
| 244 | - <groupId>org.apache.maven.plugins</groupId> | |
| 245 | - <artifactId>maven-failsafe-plugin</artifactId> | |
| 246 | - <version>2.18.1</version> | |
| 247 | - <configuration> | |
| 248 | - <groups>unit,short</groups> | |
| 249 | - <useFile>false</useFile> | |
| 250 | - <systemPropertyVariables> | |
| 251 | - <cassandra.version>${cassandra.version}</cassandra.version> | |
| 252 | - <ipprefix>${ipprefix}</ipprefix> | |
| 253 | - </systemPropertyVariables> | |
| 254 | - </configuration> | |
| 255 | - </plugin> | |
| 256 | - </plugins> | |
| 257 | - </build> | |
| 258 | - </profile> | |
| 259 | - | |
| 260 | - <profile> | |
| 261 | - <id>long</id> | |
| 262 | - <properties> | |
| 263 | - <env>default</env> | |
| 264 | - </properties> | |
| 265 | - <build> | |
| 266 | - <plugins> | |
| 267 | - <plugin> | |
| 268 | - <groupId>org.apache.maven.plugins</groupId> | |
| 269 | - <artifactId>maven-surefire-plugin</artifactId> | |
| 270 | - <version>2.16</version> | |
| 271 | - <configuration> | |
| 272 | - <groups>unit,short,long</groups> | |
| 273 | - <useFile>false</useFile> | |
| 274 | - <systemPropertyVariables> | |
| 275 | - <cassandra.version>${cassandra.version}</cassandra.version> | |
| 276 | - <ipprefix>${ipprefix}</ipprefix> | |
| 277 | - </systemPropertyVariables> | |
| 278 | - </configuration> | |
| 279 | - </plugin> | |
| 280 | - <plugin> | |
| 281 | - <groupId>org.apache.maven.plugins</groupId> | |
| 282 | - <artifactId>maven-failsafe-plugin</artifactId> | |
| 283 | - <version>2.18.1</version> | |
| 284 | - <configuration> | |
| 285 | - <groups>unit,short,long</groups> | |
| 286 | - <useFile>false</useFile> | |
| 287 | - <systemPropertyVariables> | |
| 288 | - <cassandra.version>${cassandra.version}</cassandra.version> | |
| 289 | - <ipprefix>${ipprefix}</ipprefix> | |
| 290 | - </systemPropertyVariables> | |
| 291 | - </configuration> | |
| 292 | - </plugin> | |
| 293 | - </plugins> | |
| 294 | - </build> | |
| 295 | - </profile> | |
| 296 | 223 | </profiles> |
| 297 | 224 | |
| 298 | 225 | <licenses> |
modified driver-mapping/pom.xml +0 −87
| @@ -126,93 +126,6 @@ | ||
| 126 | 126 | </plugin> |
| 127 | 127 | </plugins> |
| 128 | 128 | </build> |
| 129 | - | |
| 130 | - <profiles> | |
| 131 | - <profile> | |
| 132 | - <id>default</id> | |
| 133 | - <properties> | |
| 134 | - <env>default</env> | |
| 135 | - </properties> | |
| 136 | - <activation> | |
| 137 | - <activeByDefault>true</activeByDefault> | |
| 138 | - </activation> | |
| 139 | - <build> | |
| 140 | - <plugins> | |
| 141 | - <plugin> | |
| 142 | - <groupId>org.apache.maven.plugins</groupId> | |
| 143 | - <artifactId>maven-surefire-plugin</artifactId> | |
| 144 | - <version>2.14</version> | |
| 145 | - <configuration> | |
| 146 | - <groups>unit</groups> | |
| 147 | - <useFile>false</useFile> | |
| 148 | - <systemPropertyVariables> | |
| 149 | - <cassandra.version>${cassandra.version}</cassandra.version> | |
| 150 | - <ipprefix>${ipprefix}</ipprefix> | |
| 151 | - </systemPropertyVariables> | |
| 152 | - </configuration> | |
| 153 | - </plugin> | |
| 154 | - <plugin> | |
| 155 | - <artifactId>maven-compiler-plugin</artifactId> | |
| 156 | - <configuration> | |
| 157 | - <compilerArgument>-Xlint:all</compilerArgument> | |
| 158 | - <showWarnings>true</showWarnings> | |
| 159 | - <showDeprecation>true</showDeprecation> | |
| 160 | - </configuration> | |
| 161 | - </plugin> | |
| 162 | - </plugins> | |
| 163 | - </build> | |
| 164 | - </profile> | |
| 165 | - | |
| 166 | - <profile> | |
| 167 | - <id>short</id> | |
| 168 | - <properties> | |
| 169 | - <env>default</env> | |
| 170 | - </properties> | |
| 171 | - <build> | |
| 172 | - <plugins> | |
| 173 | - <plugin> | |
| 174 | - <groupId>org.apache.maven.plugins</groupId> | |
| 175 | - <artifactId>maven-surefire-plugin</artifactId> | |
| 176 | - <version>2.14</version> | |
| 177 | - <configuration> | |
| 178 | - <groups>unit,short</groups> | |
| 179 | - <useFile>false</useFile> | |
| 180 | - <systemPropertyVariables> | |
| 181 | - <cassandra.version>${cassandra.version}</cassandra.version> | |
| 182 | - <ipprefix>${ipprefix}</ipprefix> | |
| 183 | - </systemPropertyVariables> | |
| 184 | - </configuration> | |
| 185 | - </plugin> | |
| 186 | - </plugins> | |
| 187 | - </build> | |
| 188 | - </profile> | |
| 189 | - | |
| 190 | - <profile> | |
| 191 | - <id>long</id> | |
| 192 | - <properties> | |
| 193 | - <env>default</env> | |
| 194 | - </properties> | |
| 195 | - <build> | |
| 196 | - <plugins> | |
| 197 | - <plugin> | |
| 198 | - <groupId>org.apache.maven.plugins</groupId> | |
| 199 | - <artifactId>maven-surefire-plugin</artifactId> | |
| 200 | - <version>2.14</version> | |
| 201 | - <configuration> | |
| 202 | - <groups>unit,short,long</groups> | |
| 203 | - <useFile>false</useFile> | |
| 204 | - <systemPropertyVariables> | |
| 205 | - <cassandra.version>${cassandra.version}</cassandra.version> | |
| 206 | - <ipprefix>${ipprefix}</ipprefix> | |
| 207 | - </systemPropertyVariables> | |
| 208 | - </configuration> | |
| 209 | - </plugin> | |
| 210 | - </plugins> | |
| 211 | - </build> | |
| 212 | - </profile> | |
| 213 | - | |
| 214 | - </profiles> | |
| 215 | - | |
| 216 | 129 | <licenses> |
| 217 | 130 | <license> |
| 218 | 131 | <name>Apache 2</name> |
modified driver-mapping/src/test/java/com/datastax/driver/mapping/MapperTest.java +4 −0
| @@ -468,6 +468,7 @@ | ||
| 468 | 468 | * @test_category object_mapper |
| 469 | 469 | */ |
| 470 | 470 | @Test(groups = "short") |
| 471 | + @CassandraVersion(major = 2.0) | |
| 471 | 472 | public void should_flag_statement_as_idempotent() { |
| 472 | 473 | MappingManager manager = new MappingManager(session()); |
| 473 | 474 | PostAccessor post = manager.createAccessor(PostAccessor.class); |
| @@ -484,6 +485,7 @@ | ||
| 484 | 485 | * @test_category object_mapper |
| 485 | 486 | */ |
| 486 | 487 | @Test(groups = "short") |
| 488 | + @CassandraVersion(major = 2.0) | |
| 487 | 489 | public void should_flag_statement_as_non_idempotent() { |
| 488 | 490 | MappingManager manager = new MappingManager(session()); |
| 489 | 491 | PostAccessor post = manager.createAccessor(PostAccessor.class); |
| @@ -500,6 +502,7 @@ | ||
| 500 | 502 | * @test_category object_mapper |
| 501 | 503 | */ |
| 502 | 504 | @Test(groups = "short") |
| 505 | + @CassandraVersion(major = 2.0) | |
| 503 | 506 | public void should_flag_statement_with_null_idempotence() { |
| 504 | 507 | MappingManager manager = new MappingManager(session()); |
| 505 | 508 | PostAccessor post = manager.createAccessor(PostAccessor.class); |
| @@ -515,6 +518,7 @@ | ||
| 515 | 518 | * @test_category object_mapper |
| 516 | 519 | */ |
| 517 | 520 | @Test(groups = "short") |
| 521 | + @CassandraVersion(major = 2.0) | |
| 518 | 522 | public void should_flag_all_mapper_generated_statements_as_idempotent() { |
| 519 | 523 | MappingManager manager = new MappingManager(session()); |
| 520 | 524 | Mapper<User> mapper = manager.mapper(User.class); |
modified driver-mapping/src/test/java/com/datastax/driver/mapping/MapperUDTCollectionsTest.java +2 −0
| @@ -16,6 +16,7 @@ | ||
| 16 | 16 | package com.datastax.driver.mapping; |
| 17 | 17 | |
| 18 | 18 | import com.datastax.driver.core.CCMTestsSupport; |
| 19 | +import com.datastax.driver.core.utils.CassandraVersion; | |
| 19 | 20 | import com.datastax.driver.mapping.annotations.*; |
| 20 | 21 | import com.google.common.base.Objects; |
| 21 | 22 | import com.google.common.collect.ImmutableMap; |
| @@ -33,6 +34,7 @@ | ||
| 33 | 34 | * Tests mapping of collections of UDTs. |
| 34 | 35 | */ |
| 35 | 36 | @SuppressWarnings("unused") |
| 37 | +@CassandraVersion(major = 2.1) | |
| 36 | 38 | public class MapperUDTCollectionsTest extends CCMTestsSupport { |
| 37 | 39 | |
| 38 | 40 | @Override |
modified driver-mapping/src/test/java/com/datastax/driver/mapping/MapperUDTTest.java +2 −0
| @@ -17,6 +17,7 @@ | ||
| 17 | 17 | |
| 18 | 18 | import com.datastax.driver.core.CCMTestsSupport; |
| 19 | 19 | import com.datastax.driver.core.ResultSet; |
| 20 | +import com.datastax.driver.core.utils.CassandraVersion; | |
| 20 | 21 | import com.datastax.driver.mapping.annotations.*; |
| 21 | 22 | import com.google.common.base.Objects; |
| 22 | 23 | import com.google.common.collect.Maps; |
| @@ -29,6 +30,7 @@ | ||
| 29 | 30 | import static org.testng.Assert.*; |
| 30 | 31 | |
| 31 | 32 | @SuppressWarnings("unused") |
| 33 | +@CassandraVersion(major = 2.1) | |
| 32 | 34 | public class MapperUDTTest extends CCMTestsSupport { |
| 33 | 35 | |
| 34 | 36 | @Override |
modified pom.xml +91 −10
| @@ -64,6 +64,8 @@ | ||
| 64 | 64 | <mockito.version>1.10.8</mockito.version> |
| 65 | 65 | <scassandra.version>0.11.0</scassandra.version> |
| 66 | 66 | <main.basedir>${project.basedir}</main.basedir> |
| 67 | + <ipprefix>127.0.1.</ipprefix> | |
| 68 | + <test.groups>unit</test.groups> | |
| 67 | 69 | </properties> |
| 68 | 70 | |
| 69 | 71 | <dependencies> |
| @@ -83,6 +85,16 @@ | ||
| 83 | 85 | </dependencies> |
| 84 | 86 | |
| 85 | 87 | <profiles> |
| 88 | + <profile> | |
| 89 | + <id>default</id> | |
| 90 | + <properties> | |
| 91 | + <env>default</env> | |
| 92 | + <test.groups>unit</test.groups> | |
| 93 | + </properties> | |
| 94 | + <activation> | |
| 95 | + <activeByDefault>true</activeByDefault> | |
| 96 | + </activation> | |
| 97 | + </profile> | |
| 86 | 98 | <profile> |
| 87 | 99 | <id>doclint-java8-disable</id> |
| 88 | 100 | <activation> |
| @@ -93,10 +105,39 @@ | ||
| 93 | 105 | </properties> |
| 94 | 106 | </profile> |
| 95 | 107 | <profile> |
| 96 | - <!-- default profile settings for 'isolated' test group, will skip tests unless overriden in child module. --> | |
| 108 | + <id>short</id> | |
| 109 | + <properties> | |
| 110 | + <env>default</env> | |
| 111 | + <test.groups>unit,short</test.groups> | |
| 112 | + </properties> | |
| 113 | + </profile> | |
| 114 | + <profile> | |
| 115 | + <id>long</id> | |
| 116 | + <properties> | |
| 117 | + <env>default</env> | |
| 118 | + <test.groups>unit,short,long</test.groups> | |
| 119 | + </properties> | |
| 120 | + </profile> | |
| 121 | + <profile> | |
| 122 | + <id>duration</id> | |
| 123 | + <properties> | |
| 124 | + <env>default</env> | |
| 125 | + <test.groups>unit,short,long,duration</test.groups> | |
| 126 | + </properties> | |
| 127 | + </profile> | |
| 128 | + <profile> | |
| 129 | + <id>doc</id> | |
| 130 | + <properties> | |
| 131 | + <env>default</env> | |
| 132 | + <test.groups>unit,doc</test.groups> | |
| 133 | + </properties> | |
| 134 | + </profile> | |
| 135 | + <profile> | |
| 136 | + <!-- default profile settings for 'isolated' test group, will skip tests unless overridden in child module. --> | |
| 97 | 137 | <id>isolated</id> |
| 98 | 138 | <properties> |
| 99 | 139 | <env>default</env> |
| 140 | + <test.groups>isolated</test.groups> | |
| 100 | 141 | </properties> |
| 101 | 142 | <build> |
| 102 | 143 | <plugins> |
| @@ -108,16 +149,7 @@ | ||
| 108 | 149 | <skip>true</skip> |
| 109 | 150 | <forkCount>1</forkCount> |
| 110 | 151 | <reuseForks>false</reuseForks> |
| 111 | - <groups>isolated</groups> | |
| 112 | 152 | <reportNameSuffix>isolated</reportNameSuffix> |
| 113 | - <useFile>false</useFile> | |
| 114 | - <systemPropertyVariables> | |
| 115 | - <cassandra.version>${cassandra.version}</cassandra.version> | |
| 116 | - <ipprefix>${ipprefix}</ipprefix> | |
| 117 | - </systemPropertyVariables> | |
| 118 | - <classpathDependencyExcludes> | |
| 119 | - <classpathDependencyExcludes>io.netty:netty-transport-native-epoll</classpathDependencyExcludes> | |
| 120 | - </classpathDependencyExcludes> | |
| 121 | 153 | <!-- This requires includes to be explicitly specified by implementing classes. |
| 122 | 154 | This is needed to prevent creating a JVM fork for each test, even those that don't |
| 123 | 155 | have the isolated group. --> |
| @@ -242,7 +274,56 @@ | ||
| 242 | 274 | </execution> |
| 243 | 275 | </executions> |
| 244 | 276 | </plugin> |
| 277 | + <plugin> | |
| 278 | + <groupId>org.apache.maven.plugins</groupId> | |
| 279 | + <artifactId>maven-surefire-plugin</artifactId> | |
| 280 | + <version>2.16</version> | |
| 281 | + <configuration> | |
| 282 | + <groups>${test.groups}</groups> | |
| 283 | + <useFile>false</useFile> | |
| 284 | + <systemPropertyVariables> | |
| 285 | + <cassandra.version>${cassandra.version}</cassandra.version> | |
| 286 | + <ipprefix>${ipprefix}</ipprefix> | |
| 287 | + <com.datastax.driver.NEW_NODE_DELAY_SECONDS>60</com.datastax.driver.NEW_NODE_DELAY_SECONDS> | |
| 288 | + </systemPropertyVariables> | |
| 289 | + <classpathDependencyExcludes> | |
| 290 | + <classpathDependencyExcludes>io.netty:netty-transport-native-epoll</classpathDependencyExcludes> | |
| 291 | + </classpathDependencyExcludes> | |
| 292 | + <properties> | |
| 293 | + <property> | |
| 294 | + <!-- Don't skip tests after a @Before method throws a SkipException --> | |
| 295 | + <name>configfailurepolicy</name> | |
| 296 | + <value>continue</value> | |
| 297 | + </property> | |
| 298 | + </properties> | |
| 299 | + </configuration> | |
| 300 | + </plugin> | |
| 301 | + <plugin> | |
| 302 | + <groupId>org.apache.maven.plugins</groupId> | |
| 303 | + <artifactId>maven-failsafe-plugin</artifactId> | |
| 304 | + <version>2.16</version> | |
| 305 | + <configuration> | |
| 306 | + <groups>${test.groups}</groups> | |
| 307 | + <useFile>false</useFile> | |
| 308 | + <systemPropertyVariables> | |
| 309 | + <cassandra.version>${cassandra.version}</cassandra.version> | |
| 310 | + <ipprefix>${ipprefix}</ipprefix> | |
| 311 | + <com.datastax.driver.NEW_NODE_DELAY_SECONDS>60</com.datastax.driver.NEW_NODE_DELAY_SECONDS> | |
| 312 | + </systemPropertyVariables> | |
| 313 | + <classpathDependencyExcludes> | |
| 314 | + <classpathDependencyExcludes>io.netty:netty-transport-native-epoll</classpathDependencyExcludes> | |
| 315 | + </classpathDependencyExcludes> | |
| 316 | + <properties> | |
| 317 | + <property> | |
| 318 | + <!-- Don't skip tests after a @Before method throws a SkipException --> | |
| 319 | + <name>configfailurepolicy</name> | |
| 320 | + <value>continue</value> | |
| 321 | + </property> | |
| 322 | + </properties> | |
| 323 | + </configuration> | |
| 324 | + </plugin> | |
| 245 | 325 | </plugins> |
| 326 | + | |
| 246 | 327 | </build> |
| 247 | 328 | |
| 248 | 329 | <licenses> |