kikocis/java-driver public
Changesets · Branches · Tags · Compare
| Changeset | 1316e514ed9195d8ae5c6fe461bb09c6ebf1269954918634de39e3523528b939 |
|---|---|
| Author | Andrew Tolbert <andrew.tolbert@datastax.com> · 2016-03-15 10:56 -05:00 |
| Committer | olim7t <omichallat+github@gmail.com> · 2016-04-01 17:57 +02:00 |
| Parents | d2bae80385ee |
14 files changed
modified driver-core/pom.xml +0 −150
| @@ -295,72 +295,6 @@ | ||
| 295 | 295 | </build> |
| 296 | 296 | |
| 297 | 297 | <profiles> |
| 298 | - <profile> | |
| 299 | - <id>unit</id> | |
| 300 | - <properties> | |
| 301 | - <env>default</env> | |
| 302 | - </properties> | |
| 303 | - <!-- do not use activeByDefault as other profiles might be active --> | |
| 304 | - <activation> | |
| 305 | - <property> | |
| 306 | - <name>!activateUnitTests</name> | |
| 307 | - </property> | |
| 308 | - </activation> | |
| 309 | - <build> | |
| 310 | - <plugins> | |
| 311 | - <plugin> | |
| 312 | - <groupId>org.apache.maven.plugins</groupId> | |
| 313 | - <artifactId>maven-surefire-plugin</artifactId> | |
| 314 | - <version>2.16</version> | |
| 315 | - <configuration> | |
| 316 | - <groups>unit</groups> | |
| 317 | - <useFile>false</useFile> | |
| 318 | - <systemPropertyVariables> | |
| 319 | - <cassandra.version>${cassandra.version}</cassandra.version> | |
| 320 | - <ipprefix>${ipprefix}</ipprefix> | |
| 321 | - <com.datastax.driver.NEW_NODE_DELAY_SECONDS>60 | |
| 322 | - </com.datastax.driver.NEW_NODE_DELAY_SECONDS> | |
| 323 | - </systemPropertyVariables> | |
| 324 | - <classpathDependencyExcludes> | |
| 325 | - <classpathDependencyExcludes>io.netty:netty-transport-native-epoll | |
| 326 | - </classpathDependencyExcludes> | |
| 327 | - </classpathDependencyExcludes> | |
| 328 | - <!--May be needed for debugging--> | |
| 329 | - <!--<forkMode>never</forkMode>--> | |
| 330 | - </configuration> | |
| 331 | - </plugin> | |
| 332 | - </plugins> | |
| 333 | - </build> | |
| 334 | - </profile> | |
| 335 | - | |
| 336 | - <profile> | |
| 337 | - <id>short</id> | |
| 338 | - <properties> | |
| 339 | - <env>default</env> | |
| 340 | - </properties> | |
| 341 | - <build> | |
| 342 | - <plugins> | |
| 343 | - <plugin> | |
| 344 | - <groupId>org.apache.maven.plugins</groupId> | |
| 345 | - <artifactId>maven-surefire-plugin</artifactId> | |
| 346 | - <version>2.16</version> | |
| 347 | - <configuration> | |
| 348 | - <groups>unit,short</groups> | |
| 349 | - <useFile>false</useFile> | |
| 350 | - <systemPropertyVariables> | |
| 351 | - <cassandra.version>${cassandra.version}</cassandra.version> | |
| 352 | - <ipprefix>${ipprefix}</ipprefix> | |
| 353 | - </systemPropertyVariables> | |
| 354 | - <classpathDependencyExcludes> | |
| 355 | - <classpathDependencyExcludes>io.netty:netty-transport-native-epoll | |
| 356 | - </classpathDependencyExcludes> | |
| 357 | - </classpathDependencyExcludes> | |
| 358 | - </configuration> | |
| 359 | - </plugin> | |
| 360 | - </plugins> | |
| 361 | - </build> | |
| 362 | - </profile> | |
| 363 | - | |
| 364 | 298 | <profile> |
| 365 | 299 | <id>isolated</id> |
| 366 | 300 | <properties> |
| @@ -384,90 +318,6 @@ | ||
| 384 | 318 | </plugins> |
| 385 | 319 | </build> |
| 386 | 320 | </profile> |
| 387 | - | |
| 388 | - <profile> | |
| 389 | - <id>long</id> | |
| 390 | - <properties> | |
| 391 | - <env>default</env> | |
| 392 | - </properties> | |
| 393 | - <build> | |
| 394 | - <plugins> | |
| 395 | - <plugin> | |
| 396 | - <groupId>org.apache.maven.plugins</groupId> | |
| 397 | - <artifactId>maven-surefire-plugin</artifactId> | |
| 398 | - <version>2.16</version> | |
| 399 | - <configuration> | |
| 400 | - <groups>unit,short,long</groups> | |
| 401 | - <useFile>false</useFile> | |
| 402 | - <systemPropertyVariables> | |
| 403 | - <cassandra.version>${cassandra.version}</cassandra.version> | |
| 404 | - <ipprefix>${ipprefix}</ipprefix> | |
| 405 | - </systemPropertyVariables> | |
| 406 | - <classpathDependencyExcludes> | |
| 407 | - <classpathDependencyExcludes>io.netty:netty-transport-native-epoll | |
| 408 | - </classpathDependencyExcludes> | |
| 409 | - </classpathDependencyExcludes> | |
| 410 | - </configuration> | |
| 411 | - </plugin> | |
| 412 | - </plugins> | |
| 413 | - </build> | |
| 414 | - </profile> | |
| 415 | - | |
| 416 | - <profile> | |
| 417 | - <id>duration</id> | |
| 418 | - <properties> | |
| 419 | - <env>default</env> | |
| 420 | - </properties> | |
| 421 | - <build> | |
| 422 | - <plugins> | |
| 423 | - <plugin> | |
| 424 | - <groupId>org.apache.maven.plugins</groupId> | |
| 425 | - <artifactId>maven-surefire-plugin</artifactId> | |
| 426 | - <version>2.16</version> | |
| 427 | - <configuration> | |
| 428 | - <groups>unit,short,long,duration</groups> | |
| 429 | - <useFile>false</useFile> | |
| 430 | - <systemPropertyVariables> | |
| 431 | - <cassandra.version>${cassandra.version}</cassandra.version> | |
| 432 | - <ipprefix>${ipprefix}</ipprefix> | |
| 433 | - </systemPropertyVariables> | |
| 434 | - <classpathDependencyExcludes> | |
| 435 | - <classpathDependencyExcludes>io.netty:netty-transport-native-epoll | |
| 436 | - </classpathDependencyExcludes> | |
| 437 | - </classpathDependencyExcludes> | |
| 438 | - </configuration> | |
| 439 | - </plugin> | |
| 440 | - </plugins> | |
| 441 | - </build> | |
| 442 | - </profile> | |
| 443 | - | |
| 444 | - <profile> | |
| 445 | - <id>doc</id> | |
| 446 | - <properties> | |
| 447 | - <env>default</env> | |
| 448 | - </properties> | |
| 449 | - <build> | |
| 450 | - <plugins> | |
| 451 | - <plugin> | |
| 452 | - <groupId>org.apache.maven.plugins</groupId> | |
| 453 | - <artifactId>maven-surefire-plugin</artifactId> | |
| 454 | - <version>2.16</version> | |
| 455 | - <configuration> | |
| 456 | - <groups>unit,doc</groups> | |
| 457 | - <useFile>false</useFile> | |
| 458 | - <systemPropertyVariables> | |
| 459 | - <cassandra.version>${cassandra.version}</cassandra.version> | |
| 460 | - <ipprefix>${ipprefix}</ipprefix> | |
| 461 | - </systemPropertyVariables> | |
| 462 | - <classpathDependencyExcludes> | |
| 463 | - <classpathDependencyExcludes>io.netty:netty-transport-native-epoll | |
| 464 | - </classpathDependencyExcludes> | |
| 465 | - </classpathDependencyExcludes> | |
| 466 | - </configuration> | |
| 467 | - </plugin> | |
| 468 | - </plugins> | |
| 469 | - </build> | |
| 470 | - </profile> | |
| 471 | 321 | </profiles> |
| 472 | 322 | |
| 473 | 323 | <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; |
| @@ -663,22 +665,25 @@ | ||
| 663 | 665 | * use {@link #builder()} to get an instance |
| 664 | 666 | */ |
| 665 | 667 | public static class Builder { |
| 666 | - private final String clusterName = TestUtils.generateIdentifier("cluster_"); | |
| 668 | + | |
| 669 | + public static final String RANDOM_PORT = "__RANDOM_PORT__"; | |
| 670 | + private static final Pattern RANDOM_PORT_PATTERN = Pattern.compile(RANDOM_PORT); | |
| 671 | + | |
| 667 | 672 | int[] nodes = {1}; |
| 668 | 673 | private boolean start = true; |
| 669 | 674 | private boolean isDSE = isDSE(); |
| 670 | 675 | private String version = getCassandraVersion(); |
| 671 | - private Set<String> createOptions = new HashSet<String>(getInstallArguments()); | |
| 676 | + private Set<String> createOptions = new LinkedHashSet<String>(getInstallArguments()); | |
| 672 | 677 | private Set<String> jvmArgs = new LinkedHashSet<String>(); |
| 673 | - private final Map<String, Object> cassandraConfiguration = Maps.newHashMap(); | |
| 674 | - private final Map<String, Object> dseConfiguration = Maps.newHashMap(); | |
| 675 | - // -1 means random | |
| 676 | - private int thriftPort = -1; | |
| 677 | - private int binaryPort = -1; | |
| 678 | - private int storagePort = -1; | |
| 678 | + private final Map<String, Object> cassandraConfiguration = Maps.newLinkedHashMap(); | |
| 679 | + private final Map<String, Object> dseConfiguration = Maps.newLinkedHashMap(); | |
| 679 | 680 | private Map<Integer, Workload> workloads = new HashMap<Integer, Workload>(); |
| 680 | 681 | |
| 681 | 682 | private Builder() { |
| 683 | + cassandraConfiguration.put("start_rpc", false); | |
| 684 | + cassandraConfiguration.put("storage_port", RANDOM_PORT); | |
| 685 | + cassandraConfiguration.put("rpc_port", RANDOM_PORT); | |
| 686 | + cassandraConfiguration.put("native_transport_port", RANDOM_PORT); | |
| 682 | 687 | } |
| 683 | 688 | |
| 684 | 689 | /** |
| @@ -785,17 +790,17 @@ | ||
| 785 | 790 | } |
| 786 | 791 | |
| 787 | 792 | public Builder withStoragePort(int port) { |
| 788 | - storagePort = port; | |
| 793 | + cassandraConfiguration.put("storage_port", port); | |
| 789 | 794 | return this; |
| 790 | 795 | } |
| 791 | 796 | |
| 792 | 797 | public Builder withThriftPort(int port) { |
| 793 | - thriftPort = port; | |
| 798 | + cassandraConfiguration.put("rpc_port", port); | |
| 794 | 799 | return this; |
| 795 | 800 | } |
| 796 | 801 | |
| 797 | 802 | public Builder withBinaryPort(int port) { |
| 798 | - binaryPort = port; | |
| 803 | + cassandraConfiguration.put("native_transport_port", port); | |
| 799 | 804 | return this; |
| 800 | 805 | } |
| 801 | 806 | |
| @@ -813,10 +818,13 @@ | ||
| 813 | 818 | |
| 814 | 819 | public CCMBridge build() { |
| 815 | 820 | // be careful NOT to alter internal state (hashCode/equals) during build! |
| 816 | - int storagePort = this.storagePort == -1 ? findAvailablePort() : this.storagePort; | |
| 817 | - int thriftPort = this.thriftPort == -1 ? findAvailablePort() : this.thriftPort; | |
| 818 | - int binaryPort = this.binaryPort == -1 ? findAvailablePort() : this.binaryPort; | |
| 821 | + String clusterName = TestUtils.generateIdentifier("ccm_"); | |
| 822 | + Map<String, Object> cassandraConfiguration = randomizePorts(this.cassandraConfiguration); | |
| 823 | + Map<String, Object> dseConfiguration = randomizePorts(this.dseConfiguration); | |
| 819 | 824 | VersionNumber version = VersionNumber.parse(this.version); |
| 825 | + int storagePort = Integer.parseInt(cassandraConfiguration.get("storage_port").toString()); | |
| 826 | + int thriftPort = Integer.parseInt(cassandraConfiguration.get("rpc_port").toString()); | |
| 827 | + int binaryPort = Integer.parseInt(cassandraConfiguration.get("native_transport_port").toString()); | |
| 820 | 828 | final CCMBridge ccm = new CCMBridge(clusterName, isDSE, version, storagePort, thriftPort, binaryPort, joinJvmArgs()); |
| 821 | 829 | Runtime.getRuntime().addShutdownHook(new Thread() { |
| 822 | 830 | @Override |
| @@ -824,14 +832,9 @@ | ||
| 824 | 832 | ccm.close(); |
| 825 | 833 | } |
| 826 | 834 | }); |
| 827 | - ccm.execute(buildCreateCommand()); | |
| 835 | + ccm.execute(buildCreateCommand(clusterName)); | |
| 828 | 836 | updateNodeConf(ccm); |
| 829 | - HashMap<String, Object> config = new HashMap<String, Object>(cassandraConfiguration); | |
| 830 | - config.put("start_rpc", false); | |
| 831 | - config.put("storage_port", storagePort); | |
| 832 | - config.put("rpc_port", thriftPort); | |
| 833 | - config.put("native_transport_port", binaryPort); | |
| 834 | - ccm.updateConfig(config); | |
| 837 | + ccm.updateConfig(cassandraConfiguration); | |
| 835 | 838 | if (!dseConfiguration.isEmpty()) |
| 836 | 839 | ccm.updateDSEConfig(dseConfiguration); |
| 837 | 840 | for (Map.Entry<Integer, Workload> entry : workloads.entrySet()) { |
| @@ -855,12 +858,12 @@ | ||
| 855 | 858 | StringBuilder allJvmArgs = new StringBuilder(""); |
| 856 | 859 | for (String jvmArg : jvmArgs) { |
| 857 | 860 | allJvmArgs.append(" --jvm_arg="); |
| 858 | - allJvmArgs.append(jvmArg); | |
| 861 | + allJvmArgs.append(randomizePorts(jvmArg)); | |
| 859 | 862 | } |
| 860 | 863 | return allJvmArgs.toString(); |
| 861 | 864 | } |
| 862 | 865 | |
| 863 | - private String buildCreateCommand() { | |
| 866 | + private String buildCreateCommand(String clusterName) { | |
| 864 | 867 | StringBuilder result = new StringBuilder(CCM_COMMAND + " create"); |
| 865 | 868 | result.append(" ").append(clusterName); |
| 866 | 869 | result.append(" -i ").append(TestUtils.IP_PREFIX); |
| @@ -874,7 +877,7 @@ | ||
| 874 | 877 | result.append(node); |
| 875 | 878 | } |
| 876 | 879 | } |
| 877 | - result.append(" ").append(Joiner.on(" ").join(createOptions)); | |
| 880 | + result.append(" ").append(Joiner.on(" ").join(randomizePorts(createOptions))); | |
| 878 | 881 | return result.toString(); |
| 879 | 882 | } |
| 880 | 883 | |
| @@ -892,7 +895,7 @@ | ||
| 892 | 895 | for (int i = 0; i < nodesInDc; i++) { |
| 893 | 896 | int jmxPort = findAvailablePort(); |
| 894 | 897 | int debugPort = findAvailablePort(); |
| 895 | - logger.trace("Node {} in cluster {} using JMX port {} and debug port {}", n, clusterName, jmxPort, debugPort); | |
| 898 | + logger.trace("Node {} in cluster {} using JMX port {} and debug port {}", n, ccm.getClusterName(), jmxPort, debugPort); | |
| 896 | 899 | File nodeConf = new File(ccm.getNodeDir(n), "node.conf"); |
| 897 | 900 | File nodeConf2 = new File(ccm.getNodeDir(n), "node.conf.tmp"); |
| 898 | 901 | BufferedReader br = closer.register(new BufferedReader(new FileReader(nodeConf))); |
| @@ -927,6 +930,36 @@ | ||
| 927 | 930 | } |
| 928 | 931 | } |
| 929 | 932 | |
| 933 | + private Set<String> randomizePorts(Set<String> set) { | |
| 934 | + Set<String> randomized = new LinkedHashSet<String>(); | |
| 935 | + for (String value : set) { | |
| 936 | + randomized.add(randomizePorts(value)); | |
| 937 | + } | |
| 938 | + return randomized; | |
| 939 | + } | |
| 940 | + | |
| 941 | + private Map<String, Object> randomizePorts(Map<String, Object> map) { | |
| 942 | + Map<String, Object> randomized = new HashMap<String, Object>(); | |
| 943 | + for (Map.Entry<String, Object> entry : map.entrySet()) { | |
| 944 | + Object value = entry.getValue(); | |
| 945 | + if (value instanceof CharSequence) { | |
| 946 | + value = randomizePorts((CharSequence) value); | |
| 947 | + } | |
| 948 | + randomized.put(entry.getKey(), value); | |
| 949 | + } | |
| 950 | + return randomized; | |
| 951 | + } | |
| 952 | + | |
| 953 | + private String randomizePorts(CharSequence str) { | |
| 954 | + Matcher matcher = RANDOM_PORT_PATTERN.matcher(str); | |
| 955 | + StringBuffer sb = new StringBuffer(); | |
| 956 | + while (matcher.find()) { | |
| 957 | + matcher.appendReplacement(sb, Integer.toString(TestUtils.findAvailablePort())); | |
| 958 | + } | |
| 959 | + matcher.appendTail(sb); | |
| 960 | + return sb.toString(); | |
| 961 | + } | |
| 962 | + | |
| 930 | 963 | @Override |
| 931 | 964 | @SuppressWarnings("SimplifiableIfStatement") |
| 932 | 965 | public boolean equals(Object o) { |
| @@ -936,9 +969,6 @@ | ||
| 936 | 969 | if (o == null || getClass() != o.getClass()) return false; |
| 937 | 970 | Builder builder = (Builder) o; |
| 938 | 971 | if (isDSE != builder.isDSE) return false; |
| 939 | - if (thriftPort != builder.thriftPort) return false; | |
| 940 | - if (binaryPort != builder.binaryPort) return false; | |
| 941 | - if (storagePort != builder.storagePort) return false; | |
| 942 | 972 | if (!Arrays.equals(nodes, builder.nodes)) return false; |
| 943 | 973 | if (!createOptions.equals(builder.createOptions)) return false; |
| 944 | 974 | if (!jvmArgs.equals(builder.jvmArgs)) return false; |
| @@ -959,17 +989,10 @@ | ||
| 959 | 989 | result = 31 * result + cassandraConfiguration.hashCode(); |
| 960 | 990 | result = 31 * result + dseConfiguration.hashCode(); |
| 961 | 991 | result = 31 * result + workloads.hashCode(); |
| 962 | - result = 31 * result + thriftPort; | |
| 963 | - result = 31 * result + binaryPort; | |
| 964 | - result = 31 * result + storagePort; | |
| 965 | 992 | result = 31 * result + version.hashCode(); |
| 966 | 993 | return result; |
| 967 | 994 | } |
| 968 | 995 | |
| 969 | - @Override | |
| 970 | - public String toString() { | |
| 971 | - return String.format("%s (%s nodes)", clusterName, weight()); | |
| 972 | - } | |
| 973 | 996 | } |
| 974 | 997 | |
| 975 | 998 | } |
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; |
| @@ -63,9 +62,10 @@ | ||
| 63 | 62 | .build()); |
| 64 | 63 | Session session = cluster.connect(); |
| 65 | 64 | String deleteStmt = String.format("DELETE rpc_address FROM system.peers WHERE peer = '%s'", |
| 66 | - InetAddress.getByName(TestUtils.IP_PREFIX + "2").getHostName()); | |
| 65 | + ccm().addressOfNode(2).getHostName()); | |
| 67 | 66 | session.execute(deleteStmt); |
| 68 | 67 | session.close(); |
| 68 | + cluster.close(); | |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | } |
modified driver-core/src/test/java/com/datastax/driver/core/TestUtils.java +16 −35
| @@ -37,7 +37,6 @@ | ||
| 37 | 37 | import java.util.*; |
| 38 | 38 | import java.util.concurrent.*; |
| 39 | 39 | import java.util.concurrent.atomic.AtomicInteger; |
| 40 | -import java.util.concurrent.locks.ReentrantLock; | |
| 41 | 40 | |
| 42 | 41 | import static com.datastax.driver.core.ConditionChecker.check; |
| 43 | 42 | import static java.util.concurrent.TimeUnit.MINUTES; |
| @@ -672,47 +671,29 @@ | ||
| 672 | 671 | return prefix + seq.incrementAndGet(); |
| 673 | 672 | } |
| 674 | 673 | |
| 675 | - // use ports in the ephemeral range | |
| 676 | - private static int nextPort = 50000; | |
| 677 | - | |
| 678 | - private static final ReentrantLock PORT_LOCK = new ReentrantLock(); | |
| 679 | - | |
| 680 | 674 | /** |
| 681 | - * Find an available port in the ephemeral range. | |
| 675 | + * Finds an available port in the ephemeral range. | |
| 676 | + * This is loosely inspired by Apache MINA's AvailablePortFinder. | |
| 682 | 677 | * |
| 683 | 678 | * @return A local port that is currently unused. |
| 684 | 679 | */ |
| 685 | - public static int findAvailablePort() { | |
| 686 | - PORT_LOCK.lock(); | |
| 680 | + public synchronized static int findAvailablePort() throws RuntimeException { | |
| 681 | + ServerSocket ss = null; | |
| 687 | 682 | try { |
| 688 | - for (int i = 0; i < 3; i++) { | |
| 689 | - int port = nextPort; | |
| 690 | - ServerSocket s = null; | |
| 691 | - for (int j = 0; j < 100; j++) { | |
| 692 | - try { | |
| 693 | - s = new ServerSocket(port); | |
| 694 | - s.close(); | |
| 695 | - nextPort = port + 1; | |
| 696 | - return port; | |
| 697 | - } catch (IOException e) { | |
| 698 | - // ok | |
| 699 | - } finally { | |
| 700 | - port++; | |
| 701 | - if (s != null) { | |
| 702 | - try { | |
| 703 | - s.close(); | |
| 704 | - } catch (IOException e) { | |
| 705 | - // ok | |
| 706 | - } | |
| 707 | - } | |
| 708 | - } | |
| 683 | + // let the system pick an ephemeral port | |
| 684 | + ss = new ServerSocket(0); | |
| 685 | + ss.setReuseAddress(true); | |
| 686 | + return ss.getLocalPort(); | |
| 687 | + } catch (IOException e) { | |
| 688 | + throw Throwables.propagate(e); | |
| 689 | + } finally { | |
| 690 | + if (ss != null) { | |
| 691 | + try { | |
| 692 | + ss.close(); | |
| 693 | + } catch (IOException e) { | |
| 694 | + Throwables.propagate(e); | |
| 709 | 695 | } |
| 710 | - logger.warn("Could not acquire an available port after 100 attempts, sleeping for 1 minute"); | |
| 711 | - Uninterruptibles.sleepUninterruptibly(1, TimeUnit.MINUTES); | |
| 712 | 696 | } |
| 713 | - throw new RuntimeException(String.format("Could not acquire an available port within range: %s-%s", nextPort, nextPort + 100)); | |
| 714 | - } finally { | |
| 715 | - PORT_LOCK.unlock(); | |
| 716 | 697 | } |
| 717 | 698 | } |
| 718 | 699 |
modified driver-core/src/test/java/com/datastax/driver/core/UserTypesTest.java +12 −0
| @@ -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 | |
| @@ -45,12 +48,21 @@ | ||
| 45 | 48 | private final static List<DataType.Name> DATA_TYPE_NON_PRIMITIVE_NAMES = |
| 46 | 49 | new ArrayList<DataType.Name>(EnumSet.of(DataType.Name.LIST, DataType.Name.SET, DataType.Name.MAP, DataType.Name.TUPLE)); |
| 47 | 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 | + | |
| 48 | 58 | @Override |
| 49 | 59 | public void onTestContextInitialized() { |
| 50 | 60 | String type1 = "CREATE TYPE phone (alias text, number text)"; |
| 51 | 61 | String type2 = "CREATE TYPE \"\"\"User Address\"\"\" (street text, \"ZIP\"\"\" int, phones set<frozen<phone>>)"; |
| 52 | 62 | String table = "CREATE TABLE user (id int PRIMARY KEY, addr frozen<\"\"\"User Address\"\"\">)"; |
| 53 | 63 | execute(type1, type2, table); |
| 64 | + // Ci tests fail with "unconfigured columnfamily user" | |
| 65 | + check().that(userTableExists).before(5, MINUTES).becomesTrue(); | |
| 54 | 66 | } |
| 55 | 67 | |
| 56 | 68 | /** |
modified driver-examples/osgi/pom.xml +5 −77
| @@ -15,7 +15,8 @@ | ||
| 15 | 15 | limitations under the License. |
| 16 | 16 | |
| 17 | 17 | --> |
| 18 | -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | |
| 18 | +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
| 19 | + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | |
| 19 | 20 | <modelVersion>4.0.0</modelVersion> |
| 20 | 21 | <parent> |
| 21 | 22 | <groupId>com.datastax.cassandra</groupId> |
| @@ -137,7 +138,7 @@ | ||
| 137 | 138 | <plugin> |
| 138 | 139 | <groupId>org.apache.maven.plugins</groupId> |
| 139 | 140 | <artifactId>maven-failsafe-plugin</artifactId> |
| 140 | - <version>2.18.1</version> | |
| 141 | + <version>2.16</version> | |
| 141 | 142 | <executions> |
| 142 | 143 | <execution> |
| 143 | 144 | <goals> |
| @@ -195,90 +196,17 @@ | ||
| 195 | 196 | <plugin> |
| 196 | 197 | <groupId>org.apache.maven.plugins</groupId> |
| 197 | 198 | <artifactId>maven-surefire-plugin</artifactId> |
| 198 | - <version>2.14</version> | |
| 199 | - <configuration> | |
| 200 | - </configuration> | |
| 201 | - </plugin> | |
| 202 | - <plugin> | |
| 203 | - <groupId>org.apache.maven.plugins</groupId> | |
| 204 | - <artifactId>maven-failsafe-plugin</artifactId> | |
| 205 | - <version>2.18.1</version> | |
| 199 | + <version>2.16</version> | |
| 206 | 200 | <configuration> |
| 207 | 201 | <skip>true</skip> |
| 208 | 202 | </configuration> |
| 209 | 203 | </plugin> |
| 210 | - </plugins> | |
| 211 | - </build> | |
| 212 | - </profile> | |
| 213 | - | |
| 214 | - <profile> | |
| 215 | - <id>short</id> | |
| 216 | - <properties> | |
| 217 | - <env>default</env> | |
| 218 | - </properties> | |
| 219 | - <build> | |
| 220 | - <plugins> | |
| 221 | - <plugin> | |
| 222 | - <groupId>org.apache.maven.plugins</groupId> | |
| 223 | - <artifactId>maven-surefire-plugin</artifactId> | |
| 224 | - <version>2.14</version> | |
| 225 | - <configuration> | |
| 226 | - <groups>unit,short</groups> | |
| 227 | - <useFile>false</useFile> | |
| 228 | - <systemPropertyVariables> | |
| 229 | - <cassandra.version>${cassandra.version}</cassandra.version> | |
| 230 | - <ipprefix>${ipprefix}</ipprefix> | |
| 231 | - </systemPropertyVariables> | |
| 232 | - </configuration> | |
| 233 | - </plugin> | |
| 234 | 204 | <plugin> |
| 235 | 205 | <groupId>org.apache.maven.plugins</groupId> |
| 236 | 206 | <artifactId>maven-failsafe-plugin</artifactId> |
| 237 | - <version>2.18.1</version> | |
| 238 | - <configuration> | |
| 239 | - <groups>unit,short</groups> | |
| 240 | - <useFile>false</useFile> | |
| 241 | - <systemPropertyVariables> | |
| 242 | - <cassandra.version>${cassandra.version}</cassandra.version> | |
| 243 | - <ipprefix>${ipprefix}</ipprefix> | |
| 244 | - </systemPropertyVariables> | |
| 245 | - </configuration> | |
| 246 | - </plugin> | |
| 247 | - </plugins> | |
| 248 | - </build> | |
| 249 | - </profile> | |
| 250 | - | |
| 251 | - <profile> | |
| 252 | - <id>long</id> | |
| 253 | - <properties> | |
| 254 | - <env>default</env> | |
| 255 | - </properties> | |
| 256 | - <build> | |
| 257 | - <plugins> | |
| 258 | - <plugin> | |
| 259 | - <groupId>org.apache.maven.plugins</groupId> | |
| 260 | - <artifactId>maven-surefire-plugin</artifactId> | |
| 261 | 207 | <version>2.16</version> |
| 262 | 208 | <configuration> |
| 263 | - <groups>unit,short,long</groups> | |
| 264 | - <useFile>false</useFile> | |
| 265 | - <systemPropertyVariables> | |
| 266 | - <cassandra.version>${cassandra.version}</cassandra.version> | |
| 267 | - <ipprefix>${ipprefix}</ipprefix> | |
| 268 | - </systemPropertyVariables> | |
| 269 | - </configuration> | |
| 270 | - </plugin> | |
| 271 | - <plugin> | |
| 272 | - <groupId>org.apache.maven.plugins</groupId> | |
| 273 | - <artifactId>maven-failsafe-plugin</artifactId> | |
| 274 | - <version>2.18.1</version> | |
| 275 | - <configuration> | |
| 276 | - <groups>unit,short,long</groups> | |
| 277 | - <useFile>false</useFile> | |
| 278 | - <systemPropertyVariables> | |
| 279 | - <cassandra.version>${cassandra.version}</cassandra.version> | |
| 280 | - <ipprefix>${ipprefix}</ipprefix> | |
| 281 | - </systemPropertyVariables> | |
| 209 | + <skip>true</skip> | |
| 282 | 210 | </configuration> |
| 283 | 211 | </plugin> |
| 284 | 212 | </plugins> |
modified driver-mapping/pom.xml +2 −82
| @@ -15,7 +15,8 @@ | ||
| 15 | 15 | limitations under the License. |
| 16 | 16 | |
| 17 | 17 | --> |
| 18 | -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | |
| 18 | +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
| 19 | + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | |
| 19 | 20 | <modelVersion>4.0.0</modelVersion> |
| 20 | 21 | <parent> |
| 21 | 22 | <groupId>com.datastax.cassandra</groupId> |
| @@ -127,87 +128,6 @@ | ||
| 127 | 128 | </plugins> |
| 128 | 129 | </build> |
| 129 | 130 | |
| 130 | - <profiles> | |
| 131 | - <profile> | |
| 132 | - <id>unit</id> | |
| 133 | - <properties> | |
| 134 | - <env>default</env> | |
| 135 | - </properties> | |
| 136 | - <!-- do not use activeByDefault as other profiles might be active --> | |
| 137 | - <activation> | |
| 138 | - <property> | |
| 139 | - <name>!activateUnitTests</name> | |
| 140 | - </property> | |
| 141 | - </activation> | |
| 142 | - <build> | |
| 143 | - <plugins> | |
| 144 | - <plugin> | |
| 145 | - <groupId>org.apache.maven.plugins</groupId> | |
| 146 | - <artifactId>maven-surefire-plugin</artifactId> | |
| 147 | - <version>2.14</version> | |
| 148 | - <configuration> | |
| 149 | - <groups>unit</groups> | |
| 150 | - <useFile>false</useFile> | |
| 151 | - <systemPropertyVariables> | |
| 152 | - <cassandra.version>${cassandra.version}</cassandra.version> | |
| 153 | - <ipprefix>${ipprefix}</ipprefix> | |
| 154 | - </systemPropertyVariables> | |
| 155 | - </configuration> | |
| 156 | - </plugin> | |
| 157 | - </plugins> | |
| 158 | - </build> | |
| 159 | - </profile> | |
| 160 | - | |
| 161 | - <profile> | |
| 162 | - <id>short</id> | |
| 163 | - <properties> | |
| 164 | - <env>default</env> | |
| 165 | - </properties> | |
| 166 | - <build> | |
| 167 | - <plugins> | |
| 168 | - <plugin> | |
| 169 | - <groupId>org.apache.maven.plugins</groupId> | |
| 170 | - <artifactId>maven-surefire-plugin</artifactId> | |
| 171 | - <version>2.14</version> | |
| 172 | - <configuration> | |
| 173 | - <groups>unit,short</groups> | |
| 174 | - <useFile>false</useFile> | |
| 175 | - <systemPropertyVariables> | |
| 176 | - <cassandra.version>${cassandra.version}</cassandra.version> | |
| 177 | - <ipprefix>${ipprefix}</ipprefix> | |
| 178 | - </systemPropertyVariables> | |
| 179 | - </configuration> | |
| 180 | - </plugin> | |
| 181 | - </plugins> | |
| 182 | - </build> | |
| 183 | - </profile> | |
| 184 | - | |
| 185 | - <profile> | |
| 186 | - <id>long</id> | |
| 187 | - <properties> | |
| 188 | - <env>default</env> | |
| 189 | - </properties> | |
| 190 | - <build> | |
| 191 | - <plugins> | |
| 192 | - <plugin> | |
| 193 | - <groupId>org.apache.maven.plugins</groupId> | |
| 194 | - <artifactId>maven-surefire-plugin</artifactId> | |
| 195 | - <version>2.14</version> | |
| 196 | - <configuration> | |
| 197 | - <groups>unit,short,long</groups> | |
| 198 | - <useFile>false</useFile> | |
| 199 | - <systemPropertyVariables> | |
| 200 | - <cassandra.version>${cassandra.version}</cassandra.version> | |
| 201 | - <ipprefix>${ipprefix}</ipprefix> | |
| 202 | - </systemPropertyVariables> | |
| 203 | - </configuration> | |
| 204 | - </plugin> | |
| 205 | - </plugins> | |
| 206 | - </build> | |
| 207 | - </profile> | |
| 208 | - | |
| 209 | - </profiles> | |
| 210 | - | |
| 211 | 131 | <licenses> |
| 212 | 132 | <license> |
| 213 | 133 | <name>Apache 2</name> |
modified driver-mapping/src/test/java/com/datastax/driver/mapping/MapperTest.java +4 −0
| @@ -440,6 +440,7 @@ | ||
| 440 | 440 | * @test_category object_mapper |
| 441 | 441 | */ |
| 442 | 442 | @Test(groups = "short") |
| 443 | + @CassandraVersion(major = 2.0) | |
| 443 | 444 | public void should_flag_statement_as_idempotent() { |
| 444 | 445 | MappingManager manager = new MappingManager(session()); |
| 445 | 446 | PostAccessor post = manager.createAccessor(PostAccessor.class); |
| @@ -456,6 +457,7 @@ | ||
| 456 | 457 | * @test_category object_mapper |
| 457 | 458 | */ |
| 458 | 459 | @Test(groups = "short") |
| 460 | + @CassandraVersion(major = 2.0) | |
| 459 | 461 | public void should_flag_statement_as_non_idempotent() { |
| 460 | 462 | MappingManager manager = new MappingManager(session()); |
| 461 | 463 | PostAccessor post = manager.createAccessor(PostAccessor.class); |
| @@ -472,6 +474,7 @@ | ||
| 472 | 474 | * @test_category object_mapper |
| 473 | 475 | */ |
| 474 | 476 | @Test(groups = "short") |
| 477 | + @CassandraVersion(major = 2.0) | |
| 475 | 478 | public void should_flag_statement_with_null_idempotence() { |
| 476 | 479 | MappingManager manager = new MappingManager(session()); |
| 477 | 480 | PostAccessor post = manager.createAccessor(PostAccessor.class); |
| @@ -487,6 +490,7 @@ | ||
| 487 | 490 | * @test_category object_mapper |
| 488 | 491 | */ |
| 489 | 492 | @Test(groups = "short") |
| 493 | + @CassandraVersion(major = 2.0) | |
| 490 | 494 | public void should_flag_all_mapper_generated_statements_as_idempotent() { |
| 491 | 495 | MappingManager manager = new MappingManager(session()); |
| 492 | 496 | 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.*; |
| 19 | 19 | import com.datastax.driver.core.exceptions.CodecNotFoundException; |
| 20 | +import com.datastax.driver.core.utils.CassandraVersion; | |
| 20 | 21 | import com.datastax.driver.core.utils.UUIDs; |
| 21 | 22 | import com.datastax.driver.mapping.annotations.*; |
| 22 | 23 | import com.google.common.base.Objects; |
| @@ -32,6 +33,7 @@ | ||
| 32 | 33 | import static org.testng.Assert.*; |
| 33 | 34 | |
| 34 | 35 | @SuppressWarnings("unused") |
| 36 | +@CassandraVersion(major = 2.1) | |
| 35 | 37 | public class MapperUDTTest extends CCMTestsSupport { |
| 36 | 38 | |
| 37 | 39 | @Override |
modified pom.xml +93 −13
| @@ -15,13 +15,14 @@ | ||
| 15 | 15 | limitations under the License. |
| 16 | 16 | |
| 17 | 17 | --> |
| 18 | -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | |
| 18 | +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
| 19 | + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | |
| 19 | 20 | <modelVersion>4.0.0</modelVersion> |
| 20 | 21 | <parent> |
| 21 | 22 | <groupId>org.sonatype.oss</groupId> |
| 22 | 23 | <artifactId>oss-parent</artifactId> |
| 23 | 24 | <version>7</version> |
| 24 | - <relativePath /> | |
| 25 | + <relativePath/> | |
| 25 | 26 | </parent> |
| 26 | 27 | |
| 27 | 28 | <groupId>com.datastax.cassandra</groupId> |
| @@ -68,8 +69,9 @@ | ||
| 68 | 69 | <scassandra.version>0.11.0</scassandra.version> |
| 69 | 70 | <main.basedir>${project.basedir}</main.basedir> |
| 70 | 71 | <ipprefix>127.0.1.</ipprefix> |
| 72 | + <test.groups>unit</test.groups> | |
| 71 | 73 | <!-- Set default javadoc.opts, overriden by profiles --> |
| 72 | - <javadoc.opts /> | |
| 74 | + <javadoc.opts/> | |
| 73 | 75 | </properties> |
| 74 | 76 | |
| 75 | 77 | <dependencies> |
| @@ -89,6 +91,16 @@ | ||
| 89 | 91 | </dependencies> |
| 90 | 92 | |
| 91 | 93 | <profiles> |
| 94 | + <profile> | |
| 95 | + <id>default</id> | |
| 96 | + <properties> | |
| 97 | + <env>default</env> | |
| 98 | + <test.groups>unit</test.groups> | |
| 99 | + </properties> | |
| 100 | + <activation> | |
| 101 | + <activeByDefault>true</activeByDefault> | |
| 102 | + </activation> | |
| 103 | + </profile> | |
| 92 | 104 | |
| 93 | 105 | <profile> |
| 94 | 106 | <id>doclint-java8-disable</id> |
| @@ -101,10 +113,39 @@ | ||
| 101 | 113 | </profile> |
| 102 | 114 | |
| 103 | 115 | <profile> |
| 104 | - <!-- default profile settings for 'isolated' test group, will skip tests unless overriden in child module. --> | |
| 116 | + <id>short</id> | |
| 117 | + <properties> | |
| 118 | + <env>default</env> | |
| 119 | + <test.groups>unit,short</test.groups> | |
| 120 | + </properties> | |
| 121 | + </profile> | |
| 122 | + <profile> | |
| 123 | + <id>long</id> | |
| 124 | + <properties> | |
| 125 | + <env>default</env> | |
| 126 | + <test.groups>unit,short,long</test.groups> | |
| 127 | + </properties> | |
| 128 | + </profile> | |
| 129 | + <profile> | |
| 130 | + <id>duration</id> | |
| 131 | + <properties> | |
| 132 | + <env>default</env> | |
| 133 | + <test.groups>unit,short,long,duration</test.groups> | |
| 134 | + </properties> | |
| 135 | + </profile> | |
| 136 | + <profile> | |
| 137 | + <id>doc</id> | |
| 138 | + <properties> | |
| 139 | + <env>default</env> | |
| 140 | + <test.groups>unit,doc</test.groups> | |
| 141 | + </properties> | |
| 142 | + </profile> | |
| 143 | + <profile> | |
| 144 | + <!-- default profile settings for 'isolated' test group, will skip tests unless overridden in child module. --> | |
| 105 | 145 | <id>isolated</id> |
| 106 | 146 | <properties> |
| 107 | 147 | <env>default</env> |
| 148 | + <test.groups>isolated</test.groups> | |
| 108 | 149 | </properties> |
| 109 | 150 | <build> |
| 110 | 151 | <plugins> |
| @@ -116,16 +157,7 @@ | ||
| 116 | 157 | <skip>true</skip> |
| 117 | 158 | <forkCount>1</forkCount> |
| 118 | 159 | <reuseForks>false</reuseForks> |
| 119 | - <groups>isolated</groups> | |
| 120 | 160 | <reportNameSuffix>isolated</reportNameSuffix> |
| 121 | - <useFile>false</useFile> | |
| 122 | - <systemPropertyVariables> | |
| 123 | - <cassandra.version>${cassandra.version}</cassandra.version> | |
| 124 | - <ipprefix>${ipprefix}</ipprefix> | |
| 125 | - </systemPropertyVariables> | |
| 126 | - <classpathDependencyExcludes> | |
| 127 | - <classpathDependencyExcludes>io.netty:netty-transport-native-epoll</classpathDependencyExcludes> | |
| 128 | - </classpathDependencyExcludes> | |
| 129 | 161 | <!-- This requires includes to be explicitly specified by implementing classes. |
| 130 | 162 | This is needed to prevent creating a JVM fork for each test, even those that don't |
| 131 | 163 | have the isolated group. --> |
| @@ -343,6 +375,54 @@ | ||
| 343 | 375 | </execution> |
| 344 | 376 | </executions> |
| 345 | 377 | </plugin> |
| 378 | + <plugin> | |
| 379 | + <groupId>org.apache.maven.plugins</groupId> | |
| 380 | + <artifactId>maven-surefire-plugin</artifactId> | |
| 381 | + <version>2.16</version> | |
| 382 | + <configuration> | |
| 383 | + <groups>${test.groups}</groups> | |
| 384 | + <useFile>false</useFile> | |
| 385 | + <systemPropertyVariables> | |
| 386 | + <cassandra.version>${cassandra.version}</cassandra.version> | |
| 387 | + <ipprefix>${ipprefix}</ipprefix> | |
| 388 | + <com.datastax.driver.NEW_NODE_DELAY_SECONDS>60</com.datastax.driver.NEW_NODE_DELAY_SECONDS> | |
| 389 | + </systemPropertyVariables> | |
| 390 | + <classpathDependencyExcludes> | |
| 391 | + <classpathDependencyExcludes>io.netty:netty-transport-native-epoll</classpathDependencyExcludes> | |
| 392 | + </classpathDependencyExcludes> | |
| 393 | + <properties> | |
| 394 | + <property> | |
| 395 | + <!-- Don't skip tests after a @Before method throws a SkipException --> | |
| 396 | + <name>configfailurepolicy</name> | |
| 397 | + <value>continue</value> | |
| 398 | + </property> | |
| 399 | + </properties> | |
| 400 | + </configuration> | |
| 401 | + </plugin> | |
| 402 | + <plugin> | |
| 403 | + <groupId>org.apache.maven.plugins</groupId> | |
| 404 | + <artifactId>maven-failsafe-plugin</artifactId> | |
| 405 | + <version>2.16</version> | |
| 406 | + <configuration> | |
| 407 | + <groups>${test.groups}</groups> | |
| 408 | + <useFile>false</useFile> | |
| 409 | + <systemPropertyVariables> | |
| 410 | + <cassandra.version>${cassandra.version}</cassandra.version> | |
| 411 | + <ipprefix>${ipprefix}</ipprefix> | |
| 412 | + <com.datastax.driver.NEW_NODE_DELAY_SECONDS>60</com.datastax.driver.NEW_NODE_DELAY_SECONDS> | |
| 413 | + </systemPropertyVariables> | |
| 414 | + <classpathDependencyExcludes> | |
| 415 | + <classpathDependencyExcludes>io.netty:netty-transport-native-epoll</classpathDependencyExcludes> | |
| 416 | + </classpathDependencyExcludes> | |
| 417 | + <properties> | |
| 418 | + <property> | |
| 419 | + <!-- Don't skip tests after a @Before method throws a SkipException --> | |
| 420 | + <name>configfailurepolicy</name> | |
| 421 | + <value>continue</value> | |
| 422 | + </property> | |
| 423 | + </properties> | |
| 424 | + </configuration> | |
| 425 | + </plugin> | |
| 346 | 426 | </plugins> |
| 347 | 427 | </build> |
| 348 | 428 |