diff --git a/Jenkinsfile-datastax b/Jenkinsfile-datastax index 9e7b92bed4f..c6d2624a58d 100644 --- a/Jenkinsfile-datastax +++ b/Jenkinsfile-datastax @@ -220,67 +220,61 @@ pipeline { ''') choice( name: 'ADHOC_BUILD_AND_EXECUTE_TESTS_SERVER_VERSION', - choices: ['2.1', // Legacy Apache CassandraⓇ - '2.2', // Legacy Apache CassandraⓇ - '3.0', // Previous Apache CassandraⓇ - '3.11', // Current Apache CassandraⓇ - '4.0', // Development Apache CassandraⓇ - 'dse-5.1', // Legacy DataStax Enterprise - 'dse-6.0', // Previous DataStax Enterprise - 'dse-6.7', // Previous DataStax Enterprise - 'dse-6.8.0', // Current DataStax Enterprise + choices: ['4.0', + '4.1', + '5.0', + 'dse-5.1.35', + 'dse-6.0.18', + 'dse-6.7.17', + 'dse-6.8.30', + 'dse-6.9.0', + 'hcd-1.0.0', 'ALL'], description: '''Apache Cassandra® or DataStax Enterprise server version to use for adhoc BUILD-AND-EXECUTE-TESTS builds - - - - - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + +
ChoiceDescription
2.1Apache Cassandra® v2.1.x4.0Apache Cassandra® v4.0.x
2.2Apache Cassandra® v2.2.x4.1Apache Cassandra® v4.1.x
3.0Apache Cassandra® v3.0.x5.0Apache Cassandra® v5.0.x
3.11Apache Cassandra® v3.11.xdse-5.1.35DataStax Enterprise v5.1.35
4.0Apache Cassandra® v4.x (CURRENTLY UNDER DEVELOPMENT)dse-6.0.18DataStax Enterprise v6.0.18
dse-5.1DataStax Enterprise v5.1.xdse-6.7.17DataStax Enterprise v6.7.17
dse-6.0DataStax Enterprise v6.0.xdse-6.8.30DataStax Enterprise v6.8.30
dse-6.7DataStax Enterprise v6.7.xdse-6.9.0DataStax Enterprise v6.9.0
dse-6.8.0DataStax Enterprise v6.8.0hcd-1.0.0DataStax HCD v1.0.0
''') choice( name: 'ADHOC_BUILD_AND_EXECUTE_TESTS_JABBA_VERSION', - choices: ['zulu@1.6', // Zulu JDK 1.6 - 'zulu@1.7', // Zulu JDK 1.7 - '1.8', // Oracle JDK version 1.8 (current default) - 'openjdk@1.11'], // OpenJDK version 11 + choices: ['1.8', + 'openjdk@1.11'], description: '''JDK version to use for TESTING when running adhoc BUILD-AND-EXECUTE-TESTS builds. All builds will use JDK8 for building the driver @@ -289,14 +283,6 @@ pipeline { - - - - - - - - @@ -341,7 +327,7 @@ pipeline { } environment { - OS_VERSION = 'ubuntu/jammy64/java-driver' + OS_VERSION = 'ubuntu/focal64/java-driver' JABBA_SHELL = '/usr/lib/jabba/jabba.sh' CCM_ENVIRONMENT_SHELL = '/usr/local/bin/ccm_environment.sh' } @@ -367,8 +353,9 @@ pipeline { axes { axis { name 'SERVER_VERSION' - values '3.11', // Current Apache CassandraⓇ - '4.0' // Development Apache CassandraⓇ + values '4.0', + '4.1', + '5.0' } } @@ -474,14 +461,15 @@ pipeline { axes { axis { name 'SERVER_VERSION' - values '2.1', // Legacy Apache CassandraⓇ - '3.0', // Previous Apache CassandraⓇ - '3.11', // Current Apache CassandraⓇ - '4.0', // Development Apache CassandraⓇ - 'dse-5.1', // Legacy DataStax Enterprise - 'dse-6.0', // Previous DataStax Enterprise - 'dse-6.7', // Previous DataStax Enterprise - 'dse-6.8.0' // Current DataStax Enterprise + values '4.0', + '4.1', + '5.0', + 'dse-5.1.35', + 'dse-6.0.18', + 'dse-6.7.17', + 'dse-6.8.30', + 'dse-6.9.0', + 'hcd-1.0.0' } } when { diff --git a/driver-core/pom.xml b/driver-core/pom.xml index 45aff62c17d..c1e1de9c392 100644 --- a/driver-core/pom.xml +++ b/driver-core/pom.xml @@ -76,7 +76,7 @@ - org.lz4 + at.yawk.lz4 lz4-java true diff --git a/driver-core/src/main/java/com/datastax/driver/core/VersionNumber.java b/driver-core/src/main/java/com/datastax/driver/core/VersionNumber.java index debf049ce9b..5b8ea3600e5 100644 --- a/driver-core/src/main/java/com/datastax/driver/core/VersionNumber.java +++ b/driver-core/src/main/java/com/datastax/driver/core/VersionNumber.java @@ -21,6 +21,7 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; +import java.util.Objects; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -39,6 +40,17 @@ public class VersionNumber implements Comparable { "(\\d+)\\.(\\d+)(\\.\\d+)?(\\.\\d+)?([~\\-]\\w[.\\w]*(?:\\-\\w[.\\w]*)*)?(\\+[.\\w]+)?"; private static final Pattern pattern = Pattern.compile(VERSION_REGEXP); + public static final VersionNumber V1_0_0 = Objects.requireNonNull(parse("1.0.0")); + public static final VersionNumber V2_1_0 = Objects.requireNonNull(parse("2.1.0")); + public static final VersionNumber V2_2_0 = Objects.requireNonNull(parse("2.2.0")); + public static final VersionNumber V3_0_0 = Objects.requireNonNull(parse("3.0.0")); + public static final VersionNumber V4_0_0 = Objects.requireNonNull(parse("4.0.0")); + public static final VersionNumber V4_1_0 = Objects.requireNonNull(parse("4.1.0")); + public static final VersionNumber V5_0_0 = Objects.requireNonNull(parse("5.0.0")); + public static final VersionNumber V6_7_0 = Objects.requireNonNull(parse("6.7.0")); + public static final VersionNumber V6_8_0 = Objects.requireNonNull(parse("6.8.0")); + public static final VersionNumber V6_9_0 = Objects.requireNonNull(parse("6.9.0")); + private final int major; private final int minor; private final int patch; diff --git a/driver-core/src/test/java/com/datastax/driver/core/CCMBridge.java b/driver-core/src/test/java/com/datastax/driver/core/CCMBridge.java index 5070e673070..fb0198f5204 100644 --- a/driver-core/src/test/java/com/datastax/driver/core/CCMBridge.java +++ b/driver-core/src/test/java/com/datastax/driver/core/CCMBridge.java @@ -682,11 +682,54 @@ public void decommission(int n) { @Override public void updateConfig(Map configs) { - StringBuilder confStr = new StringBuilder(); + VersionNumber cassandraVersion = getCassandraVersion(); for (Map.Entry entry : configs.entrySet()) { - confStr.append(entry.getKey()).append(":").append(entry.getValue()).append(" "); + + String originalKey = entry.getKey(); + Object originalValue = entry.getValue(); + + String updateString = String.join( + ":", + getConfigKey(originalKey, originalValue, cassandraVersion), + getConfigValue(originalKey, originalValue, cassandraVersion)); + execute( + CCM_COMMAND + " updateconf %s", + updateString); } - execute(CCM_COMMAND + " updateconf " + confStr); + } + + private static String IN_MS_STR = "_in_ms"; + private static int IN_MS_STR_LENGTH = IN_MS_STR.length(); + private static String ENABLE_STR = "enable_"; + private static int ENABLE_STR_LENGTH = ENABLE_STR.length(); + private static String IN_KB_STR = "_in_kb"; + private static int IN_KB_STR_LENGTH = IN_KB_STR.length(); + + private static String getConfigKey( + String originalKey, Object originalValue, VersionNumber cassandraVersion) { + + // At least for now we won't support substitutions on nested keys. This requires an extra + // traversal of the string + // but we'll live with that for now + if (originalKey.contains(".")) return originalKey; + if (cassandraVersion.compareTo(VersionNumber.V4_1_0) < 0) return originalKey; + if (originalKey.endsWith(IN_MS_STR)) + return originalKey.substring(0, originalKey.length() - IN_MS_STR_LENGTH); + if (originalKey.startsWith(ENABLE_STR)) + return originalKey.substring(ENABLE_STR_LENGTH) + "_enabled"; + if (originalKey.endsWith(IN_KB_STR)) + return originalKey.substring(0, originalKey.length() - IN_KB_STR_LENGTH); + return originalKey; + } + + private static String getConfigValue( + String originalKey, Object originalValue, VersionNumber cassandraVersion) { + + String originalValueStr = originalValue.toString(); + if (cassandraVersion.compareTo(VersionNumber.V4_1_0) < 0) return originalValueStr; + if (originalKey.endsWith(IN_MS_STR)) return originalValueStr + "ms"; + if (originalKey.endsWith(IN_KB_STR)) return originalValueStr + "KiB"; + return originalValueStr; } @Override @@ -1081,11 +1124,11 @@ public CCMBridge build() { if (!dse) { if (isMaterializedViewsDisabledByDefault(cassandraVersion)) { // enable materialized views - cassandraConfiguration.put("enable_materialized_views", true); + cassandraConfiguration.put(getConfigKey("enable_materialized_views",true,cassandraVersion), true); } if (isSasiConfigEnablementRequired(cassandraVersion)) { // enable SASI indexing in config (disabled by default in C* 4.0) - cassandraConfiguration.put("enable_sasi_indexes", true); + cassandraConfiguration.put(getConfigKey("enable_sasi_indexes",true,cassandraVersion), true); } } final CCMBridge ccm = diff --git a/driver-core/src/test/java/com/datastax/driver/core/CCMTestsSupport.java b/driver-core/src/test/java/com/datastax/driver/core/CCMTestsSupport.java index 8e8add392e6..400860d3707 100644 --- a/driver-core/src/test/java/com/datastax/driver/core/CCMTestsSupport.java +++ b/driver-core/src/test/java/com/datastax/driver/core/CCMTestsSupport.java @@ -29,7 +29,6 @@ import com.datastax.driver.core.CreateCCM.TestMode; import com.datastax.driver.core.exceptions.InvalidQueryException; import com.google.common.base.Throwables; -import com.google.common.collect.ImmutableMap; import com.google.common.collect.Lists; import com.google.common.io.Closer; import com.google.common.util.concurrent.Uninterruptibles; @@ -75,14 +74,6 @@ public class CCMTestsSupport { private static final List TEST_GROUPS = Lists.newArrayList("isolated", "short", "long", "stress", "duration"); - // A mapping of cassandra.yaml config options to their version requirements. - // If a config is passed containing one of these options and the version requirement cannot be met - // the option is simply filtered. - private static final Map configVersionRequirements = - ImmutableMap.builder() - .put("enable_user_defined_functions", VersionNumber.parse("2.2.0")) - .build(); - private static class ReadOnlyCCMAccess implements CCMAccess { private final CCMAccess delegate; @@ -386,21 +377,6 @@ private void addConfigOptions(String[] conf, Map config) { if (tokens.length != 2) fail("Wrong configuration option: " + aConf); String key = tokens[0]; String value = tokens[1]; - // If we've detected a property with a version requirement, skip it if the version - // requirement - // cannot be met. - if (configVersionRequirements.containsKey(key)) { - VersionNumber requirement = configVersionRequirements.get(key); - if (version != null && version.compareTo(requirement) < 0) { - LOGGER.debug( - "Skipping inclusion of '{}' in cassandra.yaml since it requires >= C* {} and {} " - + "was detected.", - aConf, - requirement, - version); - continue; - } - } config.put(key, value); } } diff --git a/driver-core/src/test/java/com/datastax/driver/core/ExportAsStringTest.java b/driver-core/src/test/java/com/datastax/driver/core/ExportAsStringTest.java index 934bfba791f..7486e633067 100644 --- a/driver-core/src/test/java/com/datastax/driver/core/ExportAsStringTest.java +++ b/driver-core/src/test/java/com/datastax/driver/core/ExportAsStringTest.java @@ -34,7 +34,6 @@ import org.slf4j.LoggerFactory; import org.testng.annotations.Test; -@CassandraVersion("2.0") @CCMConfig(config = "enable_user_defined_functions:true") public class ExportAsStringTest extends CCMTestsSupport { diff --git a/driver-core/src/test/java/com/datastax/driver/core/TableMetadataTest.java b/driver-core/src/test/java/com/datastax/driver/core/TableMetadataTest.java index 88717c72dd5..cf2a38bd461 100644 --- a/driver-core/src/test/java/com/datastax/driver/core/TableMetadataTest.java +++ b/driver-core/src/test/java/com/datastax/driver/core/TableMetadataTest.java @@ -299,15 +299,38 @@ public void should_parse_compact_table_with_multiple_clustering_columns() { public void should_parse_table_options() { VersionNumber version = ccm().getCassandraVersion(); VersionNumber dseVersion = ccm().getDSEVersion(); - boolean isRealCassandra4 = - version.getMajor() > 3 - && (dseVersion == null || dseVersion.compareTo(VersionNumber.parse("6.8")) >= 0); + boolean isOSSCassandra5 = + version.getMajor() > 4 && dseVersion == null; // given String cql; - // Cassandra 4.0 + - if (isRealCassandra4) { + // Cassandra 5.0.x + if (isOSSCassandra5) { + cql = + String.format( + "CREATE TABLE %s.with_options (\n" + + " k text,\n" + + " c1 int,\n" + + " c2 int,\n" + + " i int,\n" + + " PRIMARY KEY (k, c1, c2)\n" + + ") WITH CLUSTERING ORDER BY (c1 DESC, c2 ASC)\n" + + " AND additional_write_policy = '99p'\n" + + " AND read_repair = 'BLOCKING'\n" + + " AND speculative_retry = '99.9p'\n" + + " AND gc_grace_seconds = 42\n" + + " AND bloom_filter_fp_chance = 0.01\n" + + " AND caching = { 'keys' : 'ALL', 'rows_per_partition' : 10 }\n" + + " AND comment = 'My awesome table'\n" + + " AND compaction = { 'class' : 'org.apache.cassandra.db.compaction.LeveledCompactionStrategy', 'sstable_size_in_mb' : 15 }\n" + + " AND compression = { 'class' : 'org.apache.cassandra.io.compress.SnappyCompressor', 'chunk_length_in_kb' : 128 }\n" + + " AND crc_check_chance = 0.5\n" // available from C* 3.0 + + " AND memtable_flush_period_in_ms = 1000;", + keyspace); + } + // Cassandra 4.0.x or 4.1.x + else { cql = String.format( "CREATE TABLE %s.with_options (\n" @@ -329,76 +352,6 @@ public void should_parse_table_options() { + " AND crc_check_chance = 0.5\n" // available from C* 3.0 + " AND memtable_flush_period_in_ms = 1000;", keyspace); - - // Cassandra 3.0 + - } else if (version.compareTo(VersionNumber.parse("3.0")) >= 0) { - cql = - String.format( - "CREATE TABLE %s.with_options (\n" - + " k text,\n" - + " c1 int,\n" - + " c2 int,\n" - + " i int,\n" - + " PRIMARY KEY (k, c1, c2)\n" - + ") WITH CLUSTERING ORDER BY (c1 DESC, c2 ASC)\n" - + " AND read_repair_chance = 0.5\n" - + " AND dclocal_read_repair_chance = 0.6\n" - + " AND speculative_retry = '99.9PERCENTILE'\n" - // replicate_on_write not supported anymore in 3.0 - + " AND gc_grace_seconds = 42\n" - + " AND bloom_filter_fp_chance = 0.01\n" - // older caching formats not supported anymore in 3.0 - + " AND caching = { 'keys' : 'ALL', 'rows_per_partition' : 10 }\n" - + " AND comment = 'My awesome table'\n" - + " AND compaction = { 'class' : 'org.apache.cassandra.db.compaction.LeveledCompactionStrategy', 'sstable_size_in_mb' : 15 }\n" - + " AND compression = { 'sstable_compression' : 'org.apache.cassandra.io.compress.SnappyCompressor', 'chunk_length_kb' : 128 }\n" - + " AND crc_check_chance = 0.5\n" // available from C* 3.0 - + " AND memtable_flush_period_in_ms = 1000;", - keyspace); - - // Cassandra 2.0 + - } else if (version.getMajor() > 1) { - cql = - String.format( - "CREATE TABLE %s.with_options (\n" - + " k text,\n" - + " c1 int,\n" - + " c2 int,\n" - + " i int,\n" - + " PRIMARY KEY (k, c1, c2)\n" - + ") WITH CLUSTERING ORDER BY (c1 DESC, c2 ASC)\n" - + " AND read_repair_chance = 0.5\n" - + " AND dclocal_read_repair_chance = 0.6\n" - + " AND replicate_on_write = true\n" - + " AND gc_grace_seconds = 42\n" - + " AND bloom_filter_fp_chance = 0.01\n" - + " AND caching = 'ALL'\n" - + " AND comment = 'My awesome table'\n" - + " AND compaction = { 'class' : 'org.apache.cassandra.db.compaction.LeveledCompactionStrategy', 'sstable_size_in_mb' : 15 }\n" - + " AND compression = { 'sstable_compression' : 'org.apache.cassandra.io.compress.SnappyCompressor', 'chunk_length_kb' : 128 }\n" - + " AND memtable_flush_period_in_ms = 1000;", - keyspace); - // older versions - } else { - cql = - String.format( - "CREATE TABLE %s.with_options (\n" - + " k text,\n" - + " c1 int,\n" - + " c2 int,\n" - + " i int,\n" - + " PRIMARY KEY (k, c1, c2)\n" - + ") WITH CLUSTERING ORDER BY (c1 DESC, c2 ASC)\n" - + " AND read_repair_chance = 0.5\n" - + " AND dclocal_read_repair_chance = 0.6\n" - + " AND replicate_on_write = true\n" - + " AND gc_grace_seconds = 42\n" - + " AND bloom_filter_fp_chance = 0.01\n" - + " AND caching = 'ALL'\n" - + " AND comment = 'My awesome table'\n" - + " AND compaction = { 'class' : 'org.apache.cassandra.db.compaction.LeveledCompactionStrategy', 'sstable_size_in_mb' : 15 }\n" - + " AND compression = { 'sstable_compression' : 'org.apache.cassandra.io.compress.SnappyCompressor', 'chunk_length_kb' : 128 };", - keyspace); } // when @@ -431,36 +384,33 @@ public void should_parse_table_options() { .hasType(cint()); assertThat(table); - // Cassandra 4.0 + - if (isRealCassandra4) { - - assertThat(table.getOptions().getGcGraceInSeconds()).isEqualTo(42); - assertThat(table.getOptions().getBloomFilterFalsePositiveChance()).isEqualTo(0.01); - assertThat(table.getOptions().getComment()).isEqualTo("My awesome table"); - assertThat(table.getOptions().getCaching()).contains(entry("keys", "ALL")); - assertThat(table.getOptions().getCaching()).contains(entry("rows_per_partition", "10")); - assertThat(table.getOptions().getCompaction()) + assertThat(table.getOptions().getGcGraceInSeconds()).isEqualTo(42); + assertThat(table.getOptions().getBloomFilterFalsePositiveChance()).isEqualTo(0.01); + assertThat(table.getOptions().getComment()).isEqualTo("My awesome table"); + assertThat(table.getOptions().getCaching()).contains(entry("keys", "ALL")); + assertThat(table.getOptions().getCaching()).contains(entry("rows_per_partition", "10")); + assertThat(table.getOptions().getCompaction()) .contains(entry("class", "org.apache.cassandra.db.compaction.LeveledCompactionStrategy")); - assertThat(table.getOptions().getCompaction()).contains(entry("sstable_size_in_mb", "15")); - assertThat(table.getOptions().getCompression()) + assertThat(table.getOptions().getCompaction()).contains(entry("sstable_size_in_mb", "15")); + assertThat(table.getOptions().getCompression()) .contains( entry( "class", "org.apache.cassandra.io.compress.SnappyCompressor")); // sstable_compression - // becomes class - assertThat(table.getOptions().getCompression()) + // becomes class + assertThat(table.getOptions().getCompression()) .contains(entry("chunk_length_in_kb", "128")); // note the "in" prefix - assertThat(table.getOptions().getDefaultTimeToLive()).isEqualTo(0); - assertThat(table.getOptions().getSpeculativeRetry()) + assertThat(table.getOptions().getDefaultTimeToLive()).isEqualTo(0); + assertThat(table.getOptions().getSpeculativeRetry()) .isEqualTo(dseVersion == null ? "99.9p" : "99.9PERCENTILE"); - assertThat(table.getOptions().getIndexInterval()).isNull(); - assertThat(table.getOptions().getMinIndexInterval()).isEqualTo(128); - assertThat(table.getOptions().getMaxIndexInterval()).isEqualTo(2048); - assertThat(table.getOptions().getReplicateOnWrite()).isTrue(); // default - assertThat(table.getOptions().getCrcCheckChance()).isEqualTo(0.5); - assertThat(table.getOptions().getExtensions()).isEmpty(); // default - assertThat(table.getOptions().getMemtableFlushPeriodInMs()).isEqualTo(1000); - assertThat(table.asCQLQuery()) + assertThat(table.getOptions().getIndexInterval()).isNull(); + assertThat(table.getOptions().getMinIndexInterval()).isEqualTo(128); + assertThat(table.getOptions().getMaxIndexInterval()).isEqualTo(2048); + assertThat(table.getOptions().getReplicateOnWrite()).isTrue(); // default + assertThat(table.getOptions().getCrcCheckChance()).isEqualTo(0.5); + assertThat(table.getOptions().getExtensions()).isEmpty(); // default + assertThat(table.getOptions().getMemtableFlushPeriodInMs()).isEqualTo(1000); + assertThat(table.asCQLQuery()) .contains("additional_write_policy = '99p'") .contains("read_repair = 'BLOCKING'") .contains("gc_grace_seconds = 42") @@ -485,250 +435,6 @@ public void should_parse_table_options() { .contains("memtable_flush_period_in_ms = 1000") .doesNotContain(" index_interval") .doesNotContain("replicate_on_write"); - // Cassandra 3.8 + - } else if (version.compareTo(VersionNumber.parse("3.8")) >= 0) { - - assertThat(table.getOptions().getReadRepairChance()).isEqualTo(0.5); - assertThat(table.getOptions().getLocalReadRepairChance()).isEqualTo(0.6); - assertThat(table.getOptions().getGcGraceInSeconds()).isEqualTo(42); - assertThat(table.getOptions().getBloomFilterFalsePositiveChance()).isEqualTo(0.01); - assertThat(table.getOptions().getComment()).isEqualTo("My awesome table"); - assertThat(table.getOptions().getCaching()).contains(entry("keys", "ALL")); - assertThat(table.getOptions().getCaching()).contains(entry("rows_per_partition", "10")); - assertThat(table.getOptions().getCompaction()) - .contains(entry("class", "org.apache.cassandra.db.compaction.LeveledCompactionStrategy")); - assertThat(table.getOptions().getCompaction()).contains(entry("sstable_size_in_mb", "15")); - assertThat(table.getOptions().getCompression()) - .contains( - entry( - "class", - "org.apache.cassandra.io.compress.SnappyCompressor")); // sstable_compression - // becomes class - assertThat(table.getOptions().getCompression()) - .contains(entry("chunk_length_in_kb", "128")); // note the "in" prefix - assertThat(table.getOptions().getDefaultTimeToLive()).isEqualTo(0); - assertThat(table.getOptions().getSpeculativeRetry()).isEqualTo("99.9PERCENTILE"); - assertThat(table.getOptions().getIndexInterval()).isNull(); - assertThat(table.getOptions().getMinIndexInterval()).isEqualTo(128); - assertThat(table.getOptions().getMaxIndexInterval()).isEqualTo(2048); - assertThat(table.getOptions().getReplicateOnWrite()).isTrue(); // default - assertThat(table.getOptions().getCrcCheckChance()).isEqualTo(0.5); - assertThat(table.getOptions().getExtensions()).isEmpty(); // default - assertThat(table.getOptions().getMemtableFlushPeriodInMs()).isEqualTo(1000); - assertThat(table.asCQLQuery()) - .contains("read_repair_chance = 0.5") - .contains("dclocal_read_repair_chance = 0.6") - .contains("gc_grace_seconds = 42") - .contains("bloom_filter_fp_chance = 0.01") - .contains("comment = 'My awesome table'") - .contains("'keys' : 'ALL'") - .contains("'rows_per_partition' : 10") - .contains("'class' : 'org.apache.cassandra.db.compaction.LeveledCompactionStrategy'") - .contains("'sstable_size_in_mb' : 15") - .contains( - "'class' : 'org.apache.cassandra.io.compress.SnappyCompressor'") // sstable_compression becomes class - .contains("'chunk_length_in_kb' : 128") // note the "in" prefix - .contains("default_time_to_live = 0") - .contains("speculative_retry = '99.9PERCENTILE'") - .contains("min_index_interval = 128") - .contains("max_index_interval = 2048") - .contains("crc_check_chance = 0.5") - .contains("cdc = false") - .contains("memtable_flush_period_in_ms = 1000") - .doesNotContain(" index_interval") - .doesNotContain("replicate_on_write"); - // Cassandra 3.0 + - } else if (version.compareTo(VersionNumber.parse("3.0")) >= 0) { - - assertThat(table.getOptions().getReadRepairChance()).isEqualTo(0.5); - assertThat(table.getOptions().getLocalReadRepairChance()).isEqualTo(0.6); - assertThat(table.getOptions().getGcGraceInSeconds()).isEqualTo(42); - assertThat(table.getOptions().getBloomFilterFalsePositiveChance()).isEqualTo(0.01); - assertThat(table.getOptions().getComment()).isEqualTo("My awesome table"); - assertThat(table.getOptions().getCaching()).contains(entry("keys", "ALL")); - assertThat(table.getOptions().getCaching()).contains(entry("rows_per_partition", "10")); - assertThat(table.getOptions().getCompaction()) - .contains(entry("class", "org.apache.cassandra.db.compaction.LeveledCompactionStrategy")); - assertThat(table.getOptions().getCompaction()).contains(entry("sstable_size_in_mb", "15")); - assertThat(table.getOptions().getCompression()) - .contains( - entry( - "class", - "org.apache.cassandra.io.compress.SnappyCompressor")); // sstable_compression - // becomes class - assertThat(table.getOptions().getCompression()) - .contains(entry("chunk_length_in_kb", "128")); // note the "in" prefix - assertThat(table.getOptions().getDefaultTimeToLive()).isEqualTo(0); - assertThat(table.getOptions().getSpeculativeRetry()).isEqualTo("99.9PERCENTILE"); - assertThat(table.getOptions().getIndexInterval()).isNull(); - assertThat(table.getOptions().getMinIndexInterval()).isEqualTo(128); - assertThat(table.getOptions().getMaxIndexInterval()).isEqualTo(2048); - assertThat(table.getOptions().getReplicateOnWrite()).isTrue(); // default - assertThat(table.getOptions().getCrcCheckChance()).isEqualTo(0.5); - assertThat(table.getOptions().getExtensions()).isEmpty(); // default - assertThat(table.getOptions().getMemtableFlushPeriodInMs()).isEqualTo(1000); - assertThat(table.asCQLQuery()) - .contains("read_repair_chance = 0.5") - .contains("dclocal_read_repair_chance = 0.6") - .contains("gc_grace_seconds = 42") - .contains("bloom_filter_fp_chance = 0.01") - .contains("comment = 'My awesome table'") - .contains("'keys' : 'ALL'") - .contains("'rows_per_partition' : 10") - .contains("'class' : 'org.apache.cassandra.db.compaction.LeveledCompactionStrategy'") - .contains("'sstable_size_in_mb' : 15") - .contains( - "'class' : 'org.apache.cassandra.io.compress.SnappyCompressor'") // sstable_compression becomes class - .contains("'chunk_length_in_kb' : 128") // note the "in" prefix - .contains("default_time_to_live = 0") - .contains("speculative_retry = '99.9PERCENTILE'") - .contains("min_index_interval = 128") - .contains("max_index_interval = 2048") - .contains("crc_check_chance = 0.5") - .contains("memtable_flush_period_in_ms = 1000") - .doesNotContain(" index_interval") - .doesNotContain("replicate_on_write") - .doesNotContain("cdc"); // 3.8+ - - // Cassandra 2.1 and 2.2 - } else if (version.getMajor() == 2 && version.getMinor() > 0) { - - // With 2.1 we have different options, the caching option changes and replicate_on_write - // disappears - assertThat(table.getOptions().getReadRepairChance()).isEqualTo(0.5); - assertThat(table.getOptions().getLocalReadRepairChance()).isEqualTo(0.6); - assertThat(table.getOptions().getGcGraceInSeconds()).isEqualTo(42); - assertThat(table.getOptions().getBloomFilterFalsePositiveChance()).isEqualTo(0.01); - assertThat(table.getOptions().getComment()).isEqualTo("My awesome table"); - assertThat(table.getOptions().getCaching()).contains(entry("keys", "ALL")); - assertThat(table.getOptions().getCaching()).contains(entry("rows_per_partition", "ALL")); - assertThat(table.getOptions().getCompaction()) - .contains(entry("class", "org.apache.cassandra.db.compaction.LeveledCompactionStrategy")); - assertThat(table.getOptions().getCompaction()).contains(entry("sstable_size_in_mb", "15")); - assertThat(table.getOptions().getCompression()) - .contains( - entry("sstable_compression", "org.apache.cassandra.io.compress.SnappyCompressor")); - assertThat(table.getOptions().getCompression()).contains(entry("chunk_length_kb", "128")); - assertThat(table.getOptions().getDefaultTimeToLive()).isEqualTo(0); - assertThat(table.getOptions().getSpeculativeRetry()).isEqualTo("99.0PERCENTILE"); - assertThat(table.getOptions().getIndexInterval()).isNull(); - assertThat(table.getOptions().getMinIndexInterval()).isEqualTo(128); - assertThat(table.getOptions().getMaxIndexInterval()).isEqualTo(2048); - assertThat(table.getOptions().getReplicateOnWrite()).isTrue(); // default - assertThat(table.getOptions().getExtensions()).isEmpty(); - assertThat(table.getOptions().getMemtableFlushPeriodInMs()).isEqualTo(1000); - assertThat(table.asCQLQuery()) - .contains("read_repair_chance = 0.5") - .contains("dclocal_read_repair_chance = 0.6") - .contains("gc_grace_seconds = 42") - .contains("bloom_filter_fp_chance = 0.01") - .contains("comment = 'My awesome table'") - .contains("'keys' : 'ALL'") - .contains("'rows_per_partition' : 'ALL'") - .contains("'class' : 'org.apache.cassandra.db.compaction.LeveledCompactionStrategy'") - .contains("'sstable_size_in_mb' : 15") - .contains("'sstable_compression' : 'org.apache.cassandra.io.compress.SnappyCompressor'") - .contains("'chunk_length_kb' : 128") - .contains("default_time_to_live = 0") - .contains("speculative_retry = '99.0PERCENTILE'") - .contains("min_index_interval = 128") - .contains("max_index_interval = 2048") - .contains("memtable_flush_period_in_ms = 1000") - .doesNotContain(" index_interval") - .doesNotContain("replicate_on_write") - .doesNotContain("cdc"); - - // Cassandra 2.0 - } else if (version.getMajor() == 2 && version.getMinor() == 0) { - - assertThat(table.getOptions().getReadRepairChance()).isEqualTo(0.5); - assertThat(table.getOptions().getLocalReadRepairChance()).isEqualTo(0.6); - assertThat(table.getOptions().getGcGraceInSeconds()).isEqualTo(42); - assertThat(table.getOptions().getBloomFilterFalsePositiveChance()).isEqualTo(0.01); - assertThat(table.getOptions().getComment()).isEqualTo("My awesome table"); - assertThat(table.getOptions().getCaching()).contains(entry("keys", "ALL")); - assertThat(table.getOptions().getCaching()) - .doesNotContain(entry("rows_per_partition", "ALL")); // 2.1 + - assertThat(table.getOptions().getCompaction()) - .contains(entry("class", "org.apache.cassandra.db.compaction.LeveledCompactionStrategy")); - assertThat(table.getOptions().getCompaction()).contains(entry("sstable_size_in_mb", "15")); - assertThat(table.getOptions().getCompression()) - .contains( - entry("sstable_compression", "org.apache.cassandra.io.compress.SnappyCompressor")); - assertThat(table.getOptions().getCompression()).contains(entry("chunk_length_kb", "128")); - assertThat(table.getOptions().getDefaultTimeToLive()).isEqualTo(0); - assertThat(table.getOptions().getSpeculativeRetry()).isEqualTo("99.0PERCENTILE"); // default - assertThat(table.getOptions().getIndexInterval()).isEqualTo(128); - assertThat(table.getOptions().getMinIndexInterval()).isNull(); - assertThat(table.getOptions().getMaxIndexInterval()).isNull(); - assertThat(table.getOptions().getReplicateOnWrite()).isTrue(); // explicitly set - assertThat(table.getOptions().getExtensions()).isEmpty(); - assertThat(table.getOptions().getMemtableFlushPeriodInMs()).isEqualTo(1000); - assertThat(table.asCQLQuery()) - .contains("read_repair_chance = 0.5") - .contains("dclocal_read_repair_chance = 0.6") - .contains("gc_grace_seconds = 42") - .contains("bloom_filter_fp_chance = 0.01") - .contains("comment = 'My awesome table'") - .contains("caching = 'ALL'") - .contains("'class' : 'org.apache.cassandra.db.compaction.LeveledCompactionStrategy'") - .contains("'sstable_size_in_mb' : 15") - .contains("'sstable_compression' : 'org.apache.cassandra.io.compress.SnappyCompressor'") - .contains("'chunk_length_kb' : 128") - .contains("replicate_on_write = true") - .contains("index_interval = 128") - .contains("speculative_retry = '99.0PERCENTILE'") - .contains("default_time_to_live = 0") - .contains("memtable_flush_period_in_ms = 1000") - .doesNotContain("min_index_interval") // 2.1 + - .doesNotContain("max_index_interval") // 2.1 + - .doesNotContain("cdc"); - - // Cassandra 1.2 - } else { - - assertThat(table.getOptions().getReadRepairChance()).isEqualTo(0.5); - assertThat(table.getOptions().getLocalReadRepairChance()).isEqualTo(0.6); - assertThat(table.getOptions().getGcGraceInSeconds()).isEqualTo(42); - assertThat(table.getOptions().getBloomFilterFalsePositiveChance()).isEqualTo(0.01); - assertThat(table.getOptions().getComment()).isEqualTo("My awesome table"); - assertThat(table.getOptions().getCaching()).contains(entry("keys", "ALL")); - assertThat(table.getOptions().getCaching()) - .doesNotContain(entry("rows_per_partition", "ALL")); // 2.1 + - assertThat(table.getOptions().getCompaction()) - .contains(entry("class", "org.apache.cassandra.db.compaction.LeveledCompactionStrategy")); - assertThat(table.getOptions().getCompaction()).contains(entry("sstable_size_in_mb", "15")); - assertThat(table.getOptions().getCompression()) - .contains( - entry("sstable_compression", "org.apache.cassandra.io.compress.SnappyCompressor")); - assertThat(table.getOptions().getCompression()).contains(entry("chunk_length_kb", "128")); - assertThat(table.getOptions().getDefaultTimeToLive()).isEqualTo(0); // default - assertThat(table.getOptions().getSpeculativeRetry()).isEqualTo("NONE"); // default - assertThat(table.getOptions().getIndexInterval()).isNull(); - assertThat(table.getOptions().getMinIndexInterval()).isNull(); - assertThat(table.getOptions().getMaxIndexInterval()).isNull(); - assertThat(table.getOptions().getReplicateOnWrite()).isTrue(); // explicitly set - assertThat(table.getOptions().getExtensions()).isEmpty(); - assertThat(table.asCQLQuery()) - .contains("read_repair_chance = 0.5") - .contains("dclocal_read_repair_chance = 0.6") - .contains("gc_grace_seconds = 42") - .contains("bloom_filter_fp_chance = 0.01") - .contains("comment = 'My awesome table'") - .contains("caching = 'ALL'") - .contains("'class' : 'org.apache.cassandra.db.compaction.LeveledCompactionStrategy'") - .contains("'sstable_size_in_mb' : 15") - .contains("'sstable_compression' : 'org.apache.cassandra.io.compress.SnappyCompressor'") - .contains("'chunk_length_kb' : 128") - .contains("replicate_on_write = true") - .doesNotContain("index_interval") // 2.0 - .doesNotContain("min_index_interval") // 2.1 + - .doesNotContain("max_index_interval") // 2.1 + - .doesNotContain("speculative_retry") // 2.0 + - .doesNotContain("default_time_to_live") // 2.0 + - .doesNotContain("cdc") - .doesNotContain("memtable_flush_period_in_ms"); // 2.0 + - } // Also check that the generated CQL is valid and creates an identical table session().execute("DROP TABLE " + table.getName()); diff --git a/driver-core/src/test/java/com/datastax/driver/core/VirtualTableMetadataTest.java b/driver-core/src/test/java/com/datastax/driver/core/VirtualTableMetadataTest.java index 55b99cdf93b..a0e5525a677 100644 --- a/driver-core/src/test/java/com/datastax/driver/core/VirtualTableMetadataTest.java +++ b/driver-core/src/test/java/com/datastax/driver/core/VirtualTableMetadataTest.java @@ -51,7 +51,7 @@ public void should_parse_virtual_metadata() { assertThat(tm).isNotNull(); assertThat(tm.getName()).isEqualTo("clients"); assertThat(tm.isVirtual()).isTrue(); - assertThat(tm.getColumns().size()).isEqualTo(12); + assertThat(tm.getColumns().size()).isEqualTo(expectedColumnCount()); assertThat(tm.getPartitionKey().size()).isEqualTo(1); assertThat(tm.getPartitionKey().get(0).getName()).isEqualTo("address"); assertThat(tm.getClusteringColumns().size()).isEqualTo(1); @@ -63,12 +63,7 @@ public void should_parse_virtual_metadata() { assertThat(tm.getId()).isEqualTo(new UUID(0L, 0L)); assertThat(tm.getOptions()).isNull(); assertThat(tm.getKeyspace()).isEqualTo(km); - assertThat(tm.asCQLQuery()) - .isEqualTo( - "/* VIRTUAL TABLE system_views.clients (address inet, port int, " - + "connection_stage text, driver_name text, driver_version text, hostname text, protocol_version int, " - + "request_count bigint, ssl_cipher_suite text, ssl_enabled boolean, ssl_protocol text, username text, " - + "PRIMARY KEY (address, port)) */"); + assertThat(tm.asCQLQuery()).isEqualTo(expectedCQLQuery()); // ColumnMetadata is as expected ColumnMetadata cm = tm.getColumn("driver_name"); assertThat(cm).isNotNull(); @@ -76,4 +71,30 @@ public void should_parse_virtual_metadata() { assertThat(cm.getType()).isEqualTo(DataType.text()); assertThat(cm.getName()).isEqualTo("driver_name"); } + + private int expectedColumnCount() { + if (isCassandraVersionOrHigher("5.0.0")) + return 14; + if (isCassandraVersionOrHigher("4.1.0")) + return 13; + return 12; + } + + private String expectedCQLQuery() { + if (isCassandraVersionOrHigher("5.0.0")) + return "/* VIRTUAL TABLE system_views.clients (address inet, port int, client_options frozen>, " + + "connection_stage text, driver_name text, driver_version text, hostname text, keyspace_name text, " + + "protocol_version int, request_count bigint, ssl_cipher_suite text, ssl_enabled boolean, " + + "ssl_protocol text, username text, PRIMARY KEY (address, port)) */"; + if (isCassandraVersionOrHigher("4.1.0")) + return "/* VIRTUAL TABLE system_views.clients (address inet, port int, client_options frozen>, " + + "connection_stage text, driver_name text, driver_version text, hostname text, protocol_version int, " + + "request_count bigint, ssl_cipher_suite text, ssl_enabled boolean, ssl_protocol text, username text, " + + "PRIMARY KEY (address, port)) */"; + return "/* VIRTUAL TABLE system_views.clients (address inet, port int, " + + "connection_stage text, driver_name text, driver_version text, hostname text, protocol_version int, " + + "request_count bigint, ssl_cipher_suite text, ssl_enabled boolean, ssl_protocol text, username text, " + + "PRIMARY KEY (address, port)) */"; + + } } diff --git a/driver-core/src/test/java/com/datastax/driver/core/cloud/CloudTest.java b/driver-core/src/test/java/com/datastax/driver/core/cloud/CloudTest.java deleted file mode 100644 index 7e91543861c..00000000000 --- a/driver-core/src/test/java/com/datastax/driver/core/cloud/CloudTest.java +++ /dev/null @@ -1,259 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.datastax.driver.core.cloud; - -import static com.datastax.driver.core.cloud.SniProxyServer.CERTS_BUNDLE_SUFFIX; -import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; -import static com.github.tomakehurst.wiremock.client.WireMock.any; -import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; -import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.fail; - -import com.datastax.driver.core.Cluster; -import com.datastax.driver.core.EndPoint; -import com.datastax.driver.core.PlainTextAuthProvider; -import com.datastax.driver.core.ProtocolVersion; -import com.datastax.driver.core.ResultSet; -import com.datastax.driver.core.Session; -import com.datastax.driver.core.exceptions.AuthenticationException; -import com.github.tomakehurst.wiremock.WireMockServer; -import java.io.File; -import java.io.IOException; -import java.net.InetSocketAddress; -import java.net.URL; -import org.parboiled.common.FileUtils; -import org.testng.annotations.AfterClass; -import org.testng.annotations.AfterMethod; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.Test; - -public class CloudTest { - - private SniProxyServer proxy = new SniProxyServer(); - - private WireMockServer wireMockServer; - - @BeforeClass(groups = "short") - public void startProxy() { - proxy.startProxy(); - } - - @BeforeMethod(groups = "short") - public void startWireMock() { - wireMockServer = new WireMockServer(wireMockConfig().dynamicPort().dynamicHttpsPort()); - wireMockServer.start(); - } - - @AfterMethod(groups = "short") - public void stopWireMock() { - wireMockServer.stop(); - } - - @AfterClass(groups = "short", alwaysRun = true) - public void stopProxy() throws Exception { - proxy.stopProxy(); - } - - @Test(groups = "short") - public void should_connect_to_proxy_using_absolute_path() { - Session session = - Cluster.builder() - .withCloudSecureConnectBundle(proxy.getSecureBundleFile()) - .withProtocolVersion(ProtocolVersion.V4) - .build() - .connect(); - ResultSet set = session.execute("select * from system.local"); - assertThat(set).isNotNull(); - } - - @Test(groups = "short") - public void should_connect_to_proxy_using_non_normalized_path() { - String path = - String.format("%s/%s", proxy.getProxyRootPath(), "certs/bundles/../bundles/creds-v1.zip"); - Session session = - Cluster.builder() - .withCloudSecureConnectBundle(new File(path)) - .withProtocolVersion(ProtocolVersion.V4) - .build() - .connect(); - ResultSet set = session.execute("select * from system.local"); - assertThat(set).isNotNull(); - } - - @Test(groups = "short") - public void should_connect_to_proxy_using_file_provided_by_the_http_URL() throws IOException { - // given - wireMockServer.stubFor( - any(urlEqualTo(CERTS_BUNDLE_SUFFIX)) - .willReturn( - aResponse() - .withStatus(200) - .withHeader("Content-Type", "application/octet-stream") - .withBody(FileUtils.readAllBytes(proxy.getSecureBundleFile())))); - - URL configFile = - new URL(String.format("http://localhost:%d%s", wireMockServer.port(), CERTS_BUNDLE_SUFFIX)); - - // when - Session session = - Cluster.builder() - .withCloudSecureConnectBundle(configFile) - .withProtocolVersion(ProtocolVersion.V4) - .build() - .connect(); - - // then - ResultSet set = session.execute("select * from system.local"); - assertThat(set).isNotNull(); - } - - @Test(groups = "short") - public void should_connect_to_proxy_using_file_provided_by_input_stream() throws IOException { - // given - wireMockServer.stubFor( - any(urlEqualTo(CERTS_BUNDLE_SUFFIX)) - .willReturn( - aResponse() - .withStatus(200) - .withHeader("Content-Type", "application/octet-stream") - .withBody(FileUtils.readAllBytes(proxy.getSecureBundleFile())))); - - URL configFile = - new URL(String.format("http://localhost:%d%s", wireMockServer.port(), CERTS_BUNDLE_SUFFIX)); - - // when - Session session = - Cluster.builder() - .withCloudSecureConnectBundle(configFile.openStream()) - .withProtocolVersion(ProtocolVersion.V4) - .build() - .connect(); - - // then - ResultSet set = session.execute("select * from system.local"); - assertThat(set).isNotNull(); - } - - @Test(groups = "short") - public void should_connect_to_proxy_using_auth_provider() { - Session session = - Cluster.builder() - .withCloudSecureConnectBundle(proxy.getSecureBundleNoCredsPath()) - .withAuthProvider(new PlainTextAuthProvider("cassandra", "cassandra")) - .withProtocolVersion(ProtocolVersion.V4) - .build() - .connect(); - ResultSet set = session.execute("select * from system.local"); - assertThat(set).isNotNull(); - } - - @Test(groups = "short") - public void should_not_connect_to_proxy_bad_creds() { - try { - Session session = - Cluster.builder() - .withCloudSecureConnectBundle(proxy.getSecureBundleNoCredsPath()) - .withProtocolVersion(ProtocolVersion.V4) - .build() - .connect(); - fail("Expected an AuthenticationException"); - } catch (AuthenticationException e) { - assertThat(e).hasMessageStartingWith("Authentication error on host"); - } - } - - @Test(groups = "short") - public void should_not_connect_to_proxy() { - try { - Session session = - Cluster.builder() - .withCloudSecureConnectBundle(proxy.getSecureBundleUnreachable()) - .withProtocolVersion(ProtocolVersion.V4) - .build() - .connect(); - fail("Expected an IllegalStateException"); - } catch (IllegalStateException e) { - assertThat(e).hasMessageStartingWith("Cannot construct cloud config from the cloudConfigUrl"); - } - } - - @Test(groups = "short") - public void should_not_allow_contact_points_and_cloud() { - try { - Session session = - Cluster.builder() - .addContactPoint("127.0.0.1") - .withCloudSecureConnectBundle(proxy.getSecureBundleNoCredsPath()) - .withCredentials("cassandra", "cassandra") - .withProtocolVersion(ProtocolVersion.V4) - .build() - .connect(); - fail("Expected an IllegalStateException"); - } catch (IllegalStateException e) { - assertThat(e) - .hasMessageStartingWith( - "Can't use withCloudSecureConnectBundle if you've already called addContactPoint(s)"); - } - } - - @Test(groups = "short") - public void should_not_allow_cloud_with_contact_points_string() { - try { - Session session = - Cluster.builder() - .withCloudSecureConnectBundle(proxy.getSecureBundleNoCredsPath()) - .addContactPoint("127.0.0.1") - .withCredentials("cassandra", "cassandra") - .withProtocolVersion(ProtocolVersion.V4) - .build() - .connect(); - fail("Expected an IllegalStateException"); - } catch (IllegalStateException e) { - assertThat(e) - .hasMessageStartingWith( - "Can't use addContactPoint(s) if you've already called withCloudSecureConnectBundle"); - } - } - - @Test(groups = "short") - public void should_not_allow_cloud_with_contact_points_endpoint() { - try { - Session session = - Cluster.builder() - .withCloudSecureConnectBundle(proxy.getSecureBundleNoCredsPath()) - .addContactPoint( - new EndPoint() { - @Override - public InetSocketAddress resolve() { - return null; - } - }) - .withCredentials("cassandra", "cassandra") - .withProtocolVersion(ProtocolVersion.V4) - .build() - .connect(); - fail("Expected an IllegalStateException"); - } catch (IllegalStateException e) { - assertThat(e) - .hasMessageStartingWith( - "Can't use addContactPoint(s) if you've already called withCloudSecureConnectBundle"); - } - } -} diff --git a/driver-core/src/test/java/com/datastax/driver/core/cloud/SniProxyServer.java b/driver-core/src/test/java/com/datastax/driver/core/cloud/SniProxyServer.java deleted file mode 100644 index 59c3e0c51e4..00000000000 --- a/driver-core/src/test/java/com/datastax/driver/core/cloud/SniProxyServer.java +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.datastax.driver.core.cloud; - -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.IOException; -import java.util.concurrent.TimeUnit; -import org.apache.commons.exec.CommandLine; -import org.apache.commons.exec.DefaultExecutor; -import org.apache.commons.exec.ExecuteStreamHandler; -import org.apache.commons.exec.ExecuteWatchdog; -import org.apache.commons.exec.Executor; -import org.apache.commons.exec.LogOutputStream; -import org.apache.commons.exec.PumpStreamHandler; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class SniProxyServer { - private static final Logger logger = LoggerFactory.getLogger(SniProxyServer.class); - private final File proxyPath; - private boolean isRunning = false; - - static final String CERTS_BUNDLE_SUFFIX = "/certs/bundles/creds-v1.zip"; - - public SniProxyServer() { - proxyPath = new File(System.getProperty("proxy.path", "./")); - } - - public void startProxy() { - CommandLine run = CommandLine.parse(proxyPath + "/run.sh"); - execute(run); - isRunning = true; - } - - public void stopProxy() { - if (isRunning) { - CommandLine findImageId = - CommandLine.parse("docker ps -a -q --filter ancestor=single_endpoint"); - String id = execute(findImageId); - CommandLine stop = CommandLine.parse("docker kill " + id); - execute(stop); - isRunning = false; - } - } - - public boolean isRunning() { - return isRunning; - } - - public File getProxyRootPath() { - return proxyPath; - } - - public File getSecureBundleFile() { - return new File(proxyPath + CERTS_BUNDLE_SUFFIX); - } - - public File getSecureBundleNoCredsPath() { - return new File(proxyPath + "/certs/bundles/creds-v1-wo-creds.zip"); - } - - public File getSecureBundleUnreachable() { - return new File(proxyPath + "/certs/bundles/creds-v1-unreachable.zip"); - } - - private String execute(CommandLine cli) { - logger.debug("Executing: " + cli); - ExecuteWatchdog watchDog = new ExecuteWatchdog(TimeUnit.MINUTES.toMillis(10)); - ByteArrayOutputStream outStream = new ByteArrayOutputStream(); - LogOutputStream errStream = - new LogOutputStream() { - @Override - protected void processLine(String line, int logLevel) { - logger.error("sniendpointerr> {}", line); - } - }; - try { - Executor executor = new DefaultExecutor(); - ExecuteStreamHandler streamHandler = new PumpStreamHandler(outStream, errStream); - executor.setStreamHandler(streamHandler); - executor.setWatchdog(watchDog); - executor.setWorkingDirectory(proxyPath); - int retValue = executor.execute(cli); - if (retValue != 0) { - logger.error( - "Non-zero exit code ({}) returned from executing ccm command: {}", retValue, cli); - } - return outStream.toString(); - } catch (IOException ex) { - if (watchDog.killedProcess()) { - throw new RuntimeException("The command '" + cli + "' was killed after 10 minutes"); - } else { - throw new RuntimeException("The command '" + cli + "' failed to execute", ex); - } - } - } -} diff --git a/driver-core/src/test/resources/export_as_string_test_2.0.cql b/driver-core/src/test/resources/export_as_string_test_2.0.cql deleted file mode 100644 index a2e180ad8af..00000000000 --- a/driver-core/src/test/resources/export_as_string_test_2.0.cql +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -CREATE KEYSPACE complex_ks WITH REPLICATION = { 'class' : 'org.apache.cassandra.locator.SimpleStrategy', 'replication_factor': '1' } AND DURABLE_WRITES = true; - -CREATE TABLE complex_ks.rank_by_year_and_name ( - race_year int, - race_name text, - rank int, - cyclist_name text, - PRIMARY KEY ((race_year, race_name), rank) -) WITH CLUSTERING ORDER BY (rank ASC) - AND read_repair_chance = 0.0 - AND dclocal_read_repair_chance = 0.1 - AND replicate_on_write = true - AND gc_grace_seconds = 864000 - AND bloom_filter_fp_chance = 0.01 - AND caching = 'KEYS_ONLY' - AND comment = '' - AND compaction = { 'class' : 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy' } - AND compression = { 'sstable_compression' : 'org.apache.cassandra.io.compress.LZ4Compressor' } - AND default_time_to_live = 0 - AND speculative_retry = '99.0PERCENTILE' - AND index_interval = 128 - AND memtable_flush_period_in_ms = 0; - -CREATE INDEX rrank ON complex_ks.rank_by_year_and_name (rank); - -CREATE INDEX ryear ON complex_ks.rank_by_year_and_name (race_year); - -CREATE TABLE complex_ks.ztable ( - zkey text, - a int, - PRIMARY KEY (zkey) -) WITH read_repair_chance = 0.0 - AND dclocal_read_repair_chance = 0.1 - AND replicate_on_write = true - AND gc_grace_seconds = 864000 - AND bloom_filter_fp_chance = 0.1 - AND caching = 'KEYS_ONLY' - AND comment = '' - AND compaction = { 'class' : 'org.apache.cassandra.db.compaction.LeveledCompactionStrategy', 'sstable_size_in_mb' : 95 } - AND compression = { 'sstable_compression' : 'org.apache.cassandra.io.compress.LZ4Compressor' } - AND default_time_to_live = 0 - AND speculative_retry = '99.0PERCENTILE' - AND index_interval = 128 - AND memtable_flush_period_in_ms = 0; diff --git a/driver-core/src/test/resources/export_as_string_test_2.1.cql b/driver-core/src/test/resources/export_as_string_test_2.1.cql deleted file mode 100644 index 71257fbdfd8..00000000000 --- a/driver-core/src/test/resources/export_as_string_test_2.1.cql +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -CREATE KEYSPACE complex_ks WITH REPLICATION = { 'class' : 'org.apache.cassandra.locator.SimpleStrategy', 'replication_factor': '1' } AND DURABLE_WRITES = true; - -CREATE TYPE complex_ks.btype ( - a text -); - -CREATE TYPE complex_ks.xtype ( - d text -); - -CREATE TYPE complex_ks.ztype ( - c text, - a int -); - -CREATE TYPE complex_ks.ctype ( - "Z" frozen, - x frozen -); - -CREATE TYPE complex_ks.atype ( - c frozen -); - -CREATE TABLE complex_ks.rank_by_year_and_name ( - race_year int, - race_name text, - rank int, - cyclist_name text, - PRIMARY KEY ((race_year, race_name), rank) -) WITH CLUSTERING ORDER BY (rank ASC) - AND read_repair_chance = 0.0 - AND dclocal_read_repair_chance = 0.1 - AND gc_grace_seconds = 864000 - AND bloom_filter_fp_chance = 0.01 - AND caching = { 'keys' : 'ALL', 'rows_per_partition' : 'NONE' } - AND comment = '' - AND compaction = { 'class' : 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy' } - AND compression = { 'sstable_compression' : 'org.apache.cassandra.io.compress.LZ4Compressor' } - AND default_time_to_live = 0 - AND speculative_retry = '99.0PERCENTILE' - AND min_index_interval = 128 - AND max_index_interval = 2048 - AND memtable_flush_period_in_ms = 0; - -CREATE INDEX rrank ON complex_ks.rank_by_year_and_name (rank); - -CREATE INDEX ryear ON complex_ks.rank_by_year_and_name (race_year); - -CREATE TABLE complex_ks.ztable ( - zkey text, - a frozen, - PRIMARY KEY (zkey) -) WITH read_repair_chance = 0.0 - AND dclocal_read_repair_chance = 0.1 - AND gc_grace_seconds = 864000 - AND bloom_filter_fp_chance = 0.1 - AND caching = { 'keys' : 'ALL', 'rows_per_partition' : 'NONE' } - AND comment = '' - AND compaction = { 'class' : 'org.apache.cassandra.db.compaction.LeveledCompactionStrategy', 'sstable_size_in_mb' : 95 } - AND compression = { 'sstable_compression' : 'org.apache.cassandra.io.compress.LZ4Compressor' } - AND default_time_to_live = 0 - AND speculative_retry = '99.0PERCENTILE' - AND min_index_interval = 128 - AND max_index_interval = 2048 - AND memtable_flush_period_in_ms = 0; diff --git a/driver-core/src/test/resources/export_as_string_test_2.2.cql b/driver-core/src/test/resources/export_as_string_test_2.2.cql deleted file mode 100644 index b86ee43b132..00000000000 --- a/driver-core/src/test/resources/export_as_string_test_2.2.cql +++ /dev/null @@ -1,132 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -CREATE KEYSPACE complex_ks WITH REPLICATION = { 'class' : 'org.apache.cassandra.locator.SimpleStrategy', 'replication_factor': '1' } AND DURABLE_WRITES = true; - -CREATE TYPE complex_ks.btype ( - a text -); - -CREATE TYPE complex_ks.xtype ( - d text -); - -CREATE TYPE complex_ks.ztype ( - c text, - a int -); - -CREATE TYPE complex_ks.ctype ( - "Z" frozen, - x frozen -); - -CREATE TYPE complex_ks.atype ( - c frozen -); - -CREATE TABLE complex_ks.cyclist_mv ( - cid uuid, - age int, - birthday date, - country text, - name text, - PRIMARY KEY (cid) -) WITH read_repair_chance = 0.0 - AND dclocal_read_repair_chance = 0.1 - AND gc_grace_seconds = 864000 - AND bloom_filter_fp_chance = 0.01 - AND caching = { 'keys' : 'ALL', 'rows_per_partition' : 'NONE' } - AND comment = '' - AND compaction = { 'class' : 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy' } - AND compression = { 'sstable_compression' : 'org.apache.cassandra.io.compress.LZ4Compressor' } - AND default_time_to_live = 0 - AND speculative_retry = '99.0PERCENTILE' - AND min_index_interval = 128 - AND max_index_interval = 2048 - AND memtable_flush_period_in_ms = 0; - -CREATE INDEX cyclist_by_country ON complex_ks.cyclist_mv (country); - -CREATE TABLE complex_ks.rank_by_year_and_name ( - race_year int, - race_name text, - rank int, - cyclist_name text, - PRIMARY KEY ((race_year, race_name), rank) -) WITH CLUSTERING ORDER BY (rank ASC) - AND read_repair_chance = 0.0 - AND dclocal_read_repair_chance = 0.1 - AND gc_grace_seconds = 864000 - AND bloom_filter_fp_chance = 0.01 - AND caching = { 'keys' : 'ALL', 'rows_per_partition' : 'NONE' } - AND comment = '' - AND compaction = { 'class' : 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy' } - AND compression = { 'sstable_compression' : 'org.apache.cassandra.io.compress.LZ4Compressor' } - AND default_time_to_live = 0 - AND speculative_retry = '99.0PERCENTILE' - AND min_index_interval = 128 - AND max_index_interval = 2048 - AND memtable_flush_period_in_ms = 0; - -CREATE INDEX rrank ON complex_ks.rank_by_year_and_name (rank); - -CREATE INDEX ryear ON complex_ks.rank_by_year_and_name (race_year); - -CREATE TABLE complex_ks.ztable ( - zkey text, - a frozen, - PRIMARY KEY (zkey) -) WITH read_repair_chance = 0.0 - AND dclocal_read_repair_chance = 0.1 - AND gc_grace_seconds = 864000 - AND bloom_filter_fp_chance = 0.1 - AND caching = { 'keys' : 'ALL', 'rows_per_partition' : 'NONE' } - AND comment = '' - AND compaction = { 'class' : 'org.apache.cassandra.db.compaction.LeveledCompactionStrategy', 'sstable_size_in_mb' : 95 } - AND compression = { 'sstable_compression' : 'org.apache.cassandra.io.compress.LZ4Compressor' } - AND default_time_to_live = 0 - AND speculative_retry = '99.0PERCENTILE' - AND min_index_interval = 128 - AND max_index_interval = 2048 - AND memtable_flush_period_in_ms = 0; - -CREATE FUNCTION complex_ks.avgfinal(state tuple) - CALLED ON NULL INPUT - RETURNS double - LANGUAGE java - AS 'double r = 0; if (state.getInt(0) == 0) return null; r = state.getLong(1); r /= state.getInt(0); return Double.valueOf(r);'; - -CREATE FUNCTION complex_ks.avgstate(state tuple,val int) - CALLED ON NULL INPUT - RETURNS tuple - LANGUAGE java - AS 'if (val !=null) { state.setInt(0, state.getInt(0)+1); state.setLong(1, state.getLong(1)+val.intValue()); } return state;'; - -CREATE AGGREGATE complex_ks.average(int) - SFUNC avgstate - STYPE tuple - FINALFUNC avgfinal - INITCOND (0,0); - -CREATE AGGREGATE complex_ks.mean(int) - SFUNC avgstate - STYPE tuple - FINALFUNC avgfinal - INITCOND (0,0); diff --git a/driver-core/src/test/resources/export_as_string_test_3.0.cql b/driver-core/src/test/resources/export_as_string_test_3.0.cql deleted file mode 100644 index 90a91603e26..00000000000 --- a/driver-core/src/test/resources/export_as_string_test_3.0.cql +++ /dev/null @@ -1,198 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -CREATE KEYSPACE complex_ks WITH REPLICATION = { 'class' : 'org.apache.cassandra.locator.SimpleStrategy', 'replication_factor': '1' } AND DURABLE_WRITES = true; - -CREATE TYPE complex_ks.btype ( - a text -); - -CREATE TYPE complex_ks.xtype ( - d text -); - -CREATE TYPE complex_ks.ztype ( - c text, - a int -); - -CREATE TYPE complex_ks.ctype ( - "Z" frozen, - x frozen -); - -CREATE TYPE complex_ks.atype ( - c frozen -); - -CREATE TABLE complex_ks.cyclist_mv ( - cid uuid, - age int, - birthday date, - country text, - name text, - PRIMARY KEY (cid) -) WITH read_repair_chance = 0.0 - AND dclocal_read_repair_chance = 0.1 - AND gc_grace_seconds = 864000 - AND bloom_filter_fp_chance = 0.01 - AND caching = { 'keys' : 'ALL', 'rows_per_partition' : 'NONE' } - AND comment = '' - AND compaction = { 'class' : 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy', 'max_threshold' : 32, 'min_threshold' : 4 } - AND compression = { 'chunk_length_in_kb' : 64, 'class' : 'org.apache.cassandra.io.compress.LZ4Compressor' } - AND default_time_to_live = 0 - AND speculative_retry = '99PERCENTILE' - AND min_index_interval = 128 - AND max_index_interval = 2048 - AND crc_check_chance = 1.0 - AND memtable_flush_period_in_ms = 0; - -CREATE INDEX cyclist_by_country ON complex_ks.cyclist_mv (country); - -CREATE MATERIALIZED VIEW complex_ks.cyclist_by_a_age AS - SELECT * - FROM complex_ks.cyclist_mv - WHERE age IS NOT NULL AND cid IS NOT NULL - PRIMARY KEY (age, cid) - WITH CLUSTERING ORDER BY (cid ASC) - AND read_repair_chance = 0.0 - AND dclocal_read_repair_chance = 0.1 - AND gc_grace_seconds = 864000 - AND bloom_filter_fp_chance = 0.01 - AND caching = { 'keys' : 'ALL', 'rows_per_partition' : 'NONE' } - AND comment = '' - AND compaction = { 'class' : 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy', 'max_threshold' : 32, 'min_threshold' : 4 } - AND compression = { 'chunk_length_in_kb' : 64, 'class' : 'org.apache.cassandra.io.compress.LZ4Compressor' } - AND default_time_to_live = 0 - AND speculative_retry = '99PERCENTILE' - AND min_index_interval = 128 - AND max_index_interval = 2048 - AND crc_check_chance = 1.0 - AND memtable_flush_period_in_ms = 0; - -CREATE MATERIALIZED VIEW complex_ks.cyclist_by_age AS - SELECT age, cid, birthday, country, name - FROM complex_ks.cyclist_mv - WHERE age IS NOT NULL AND cid IS NOT NULL - PRIMARY KEY (age, cid) - WITH CLUSTERING ORDER BY (cid ASC) - AND read_repair_chance = 0.0 - AND dclocal_read_repair_chance = 0.1 - AND gc_grace_seconds = 864000 - AND bloom_filter_fp_chance = 0.01 - AND caching = { 'keys' : 'ALL', 'rows_per_partition' : 'NONE' } - AND comment = 'simple view' - AND compaction = { 'class' : 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy', 'max_threshold' : 32, 'min_threshold' : 4 } - AND compression = { 'chunk_length_in_kb' : 64, 'class' : 'org.apache.cassandra.io.compress.LZ4Compressor' } - AND default_time_to_live = 0 - AND speculative_retry = '99PERCENTILE' - AND min_index_interval = 128 - AND max_index_interval = 2048 - AND crc_check_chance = 1.0 - AND memtable_flush_period_in_ms = 0; - -CREATE MATERIALIZED VIEW complex_ks.cyclist_by_r_age AS - SELECT age, cid, birthday, country, name - FROM complex_ks.cyclist_mv - WHERE age IS NOT NULL AND cid IS NOT NULL - PRIMARY KEY (age, cid) - WITH CLUSTERING ORDER BY (cid DESC) - AND read_repair_chance = 0.0 - AND dclocal_read_repair_chance = 0.1 - AND gc_grace_seconds = 864000 - AND bloom_filter_fp_chance = 0.01 - AND caching = { 'keys' : 'ALL', 'rows_per_partition' : 'NONE' } - AND comment = '' - AND compaction = { 'class' : 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy', 'max_threshold' : 32, 'min_threshold' : 4 } - AND compression = { 'chunk_length_in_kb' : 64, 'class' : 'org.apache.cassandra.io.compress.LZ4Compressor' } - AND default_time_to_live = 0 - AND speculative_retry = '99PERCENTILE' - AND min_index_interval = 128 - AND max_index_interval = 2048 - AND crc_check_chance = 1.0 - AND memtable_flush_period_in_ms = 0; - -CREATE TABLE complex_ks.rank_by_year_and_name ( - race_year int, - race_name text, - rank int, - cyclist_name text, - PRIMARY KEY ((race_year, race_name), rank) -) WITH CLUSTERING ORDER BY (rank ASC) - AND read_repair_chance = 0.0 - AND dclocal_read_repair_chance = 0.1 - AND gc_grace_seconds = 864000 - AND bloom_filter_fp_chance = 0.01 - AND caching = { 'keys' : 'ALL', 'rows_per_partition' : 'NONE' } - AND comment = '' - AND compaction = { 'class' : 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy', 'max_threshold' : 32, 'min_threshold' : 4 } - AND compression = { 'chunk_length_in_kb' : 64, 'class' : 'org.apache.cassandra.io.compress.LZ4Compressor' } - AND default_time_to_live = 0 - AND speculative_retry = '99PERCENTILE' - AND min_index_interval = 128 - AND max_index_interval = 2048 - AND crc_check_chance = 1.0 - AND memtable_flush_period_in_ms = 0; - -CREATE INDEX rrank ON complex_ks.rank_by_year_and_name (rank); - -CREATE INDEX ryear ON complex_ks.rank_by_year_and_name (race_year); - -CREATE TABLE complex_ks.ztable ( - zkey text, - a frozen, - PRIMARY KEY (zkey) -) WITH read_repair_chance = 0.0 - AND dclocal_read_repair_chance = 0.1 - AND gc_grace_seconds = 864000 - AND bloom_filter_fp_chance = 0.1 - AND caching = { 'keys' : 'ALL', 'rows_per_partition' : 'NONE' } - AND comment = '' - AND compaction = { 'class' : 'org.apache.cassandra.db.compaction.LeveledCompactionStrategy', 'sstable_size_in_mb' : 95 } - AND compression = { 'chunk_length_in_kb' : 64, 'class' : 'org.apache.cassandra.io.compress.LZ4Compressor' } - AND default_time_to_live = 0 - AND speculative_retry = '99PERCENTILE' - AND min_index_interval = 128 - AND max_index_interval = 2048 - AND crc_check_chance = 1.0 - AND memtable_flush_period_in_ms = 0; - -CREATE FUNCTION complex_ks.avgfinal(state tuple) - CALLED ON NULL INPUT - RETURNS double - LANGUAGE java - AS 'double r = 0; if (state.getInt(0) == 0) return null; r = state.getLong(1); r /= state.getInt(0); return Double.valueOf(r);'; - -CREATE FUNCTION complex_ks.avgstate(state tuple,val int) - CALLED ON NULL INPUT - RETURNS tuple - LANGUAGE java - AS 'if (val !=null) { state.setInt(0, state.getInt(0)+1); state.setLong(1, state.getLong(1)+val.intValue()); } return state;'; - -CREATE AGGREGATE complex_ks.average(int) - SFUNC avgstate - STYPE tuple - FINALFUNC avgfinal - INITCOND (0,0); - -CREATE AGGREGATE complex_ks.mean(int) - SFUNC avgstate - STYPE tuple - FINALFUNC avgfinal - INITCOND (0,0); diff --git a/driver-core/src/test/resources/export_as_string_test_3.11.cql b/driver-core/src/test/resources/export_as_string_test_3.11.cql deleted file mode 100644 index c7edb57bae0..00000000000 --- a/driver-core/src/test/resources/export_as_string_test_3.11.cql +++ /dev/null @@ -1,204 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -CREATE KEYSPACE complex_ks WITH REPLICATION = { 'class' : 'org.apache.cassandra.locator.SimpleStrategy', 'replication_factor': '1' } AND DURABLE_WRITES = true; - -CREATE TYPE complex_ks.btype ( - a text -); - -CREATE TYPE complex_ks.xtype ( - d text -); - -CREATE TYPE complex_ks.ztype ( - c text, - a int -); - -CREATE TYPE complex_ks.ctype ( - "Z" frozen, - x frozen -); - -CREATE TYPE complex_ks.atype ( - c frozen -); - -CREATE TABLE complex_ks.cyclist_mv ( - cid uuid, - age int, - birthday date, - country text, - name text, - PRIMARY KEY (cid) -) WITH read_repair_chance = 0.0 - AND dclocal_read_repair_chance = 0.1 - AND gc_grace_seconds = 864000 - AND bloom_filter_fp_chance = 0.01 - AND caching = { 'keys' : 'ALL', 'rows_per_partition' : 'NONE' } - AND comment = '' - AND compaction = { 'class' : 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy', 'max_threshold' : 32, 'min_threshold' : 4 } - AND compression = { 'chunk_length_in_kb' : 64, 'class' : 'org.apache.cassandra.io.compress.LZ4Compressor' } - AND default_time_to_live = 0 - AND speculative_retry = '99PERCENTILE' - AND min_index_interval = 128 - AND max_index_interval = 2048 - AND crc_check_chance = 1.0 - AND cdc = false - AND memtable_flush_period_in_ms = 0; - -CREATE INDEX cyclist_by_country ON complex_ks.cyclist_mv (country); - -CREATE MATERIALIZED VIEW complex_ks.cyclist_by_a_age AS - SELECT * - FROM complex_ks.cyclist_mv - WHERE age IS NOT NULL AND cid IS NOT NULL - PRIMARY KEY (age, cid) - WITH CLUSTERING ORDER BY (cid ASC) - AND read_repair_chance = 0.0 - AND dclocal_read_repair_chance = 0.1 - AND gc_grace_seconds = 864000 - AND bloom_filter_fp_chance = 0.01 - AND caching = { 'keys' : 'ALL', 'rows_per_partition' : 'NONE' } - AND comment = '' - AND compaction = { 'class' : 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy', 'max_threshold' : 32, 'min_threshold' : 4 } - AND compression = { 'chunk_length_in_kb' : 64, 'class' : 'org.apache.cassandra.io.compress.LZ4Compressor' } - AND default_time_to_live = 0 - AND speculative_retry = '99PERCENTILE' - AND min_index_interval = 128 - AND max_index_interval = 2048 - AND crc_check_chance = 1.0 - AND cdc = false - AND memtable_flush_period_in_ms = 0; - -CREATE MATERIALIZED VIEW complex_ks.cyclist_by_age AS - SELECT age, cid, birthday, country, name - FROM complex_ks.cyclist_mv - WHERE age IS NOT NULL AND cid IS NOT NULL - PRIMARY KEY (age, cid) - WITH CLUSTERING ORDER BY (cid ASC) - AND read_repair_chance = 0.0 - AND dclocal_read_repair_chance = 0.1 - AND gc_grace_seconds = 864000 - AND bloom_filter_fp_chance = 0.01 - AND caching = { 'keys' : 'ALL', 'rows_per_partition' : 'NONE' } - AND comment = 'simple view' - AND compaction = { 'class' : 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy', 'max_threshold' : 32, 'min_threshold' : 4 } - AND compression = { 'chunk_length_in_kb' : 64, 'class' : 'org.apache.cassandra.io.compress.LZ4Compressor' } - AND default_time_to_live = 0 - AND speculative_retry = '99PERCENTILE' - AND min_index_interval = 128 - AND max_index_interval = 2048 - AND crc_check_chance = 1.0 - AND cdc = false - AND memtable_flush_period_in_ms = 0; - -CREATE MATERIALIZED VIEW complex_ks.cyclist_by_r_age AS - SELECT age, cid, birthday, country, name - FROM complex_ks.cyclist_mv - WHERE age IS NOT NULL AND cid IS NOT NULL - PRIMARY KEY (age, cid) - WITH CLUSTERING ORDER BY (cid DESC) - AND read_repair_chance = 0.0 - AND dclocal_read_repair_chance = 0.1 - AND gc_grace_seconds = 864000 - AND bloom_filter_fp_chance = 0.01 - AND caching = { 'keys' : 'ALL', 'rows_per_partition' : 'NONE' } - AND comment = '' - AND compaction = { 'class' : 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy', 'max_threshold' : 32, 'min_threshold' : 4 } - AND compression = { 'chunk_length_in_kb' : 64, 'class' : 'org.apache.cassandra.io.compress.LZ4Compressor' } - AND default_time_to_live = 0 - AND speculative_retry = '99PERCENTILE' - AND min_index_interval = 128 - AND max_index_interval = 2048 - AND crc_check_chance = 1.0 - AND cdc = false - AND memtable_flush_period_in_ms = 0; - -CREATE TABLE complex_ks.rank_by_year_and_name ( - race_year int, - race_name text, - rank int, - cyclist_name text, - PRIMARY KEY ((race_year, race_name), rank) -) WITH CLUSTERING ORDER BY (rank ASC) - AND read_repair_chance = 0.0 - AND dclocal_read_repair_chance = 0.1 - AND gc_grace_seconds = 864000 - AND bloom_filter_fp_chance = 0.01 - AND caching = { 'keys' : 'ALL', 'rows_per_partition' : 'NONE' } - AND comment = '' - AND compaction = { 'class' : 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy', 'max_threshold' : 32, 'min_threshold' : 4 } - AND compression = { 'chunk_length_in_kb' : 64, 'class' : 'org.apache.cassandra.io.compress.LZ4Compressor' } - AND default_time_to_live = 0 - AND speculative_retry = '99PERCENTILE' - AND min_index_interval = 128 - AND max_index_interval = 2048 - AND crc_check_chance = 1.0 - AND cdc = false - AND memtable_flush_period_in_ms = 0; - -CREATE INDEX rrank ON complex_ks.rank_by_year_and_name (rank); - -CREATE INDEX ryear ON complex_ks.rank_by_year_and_name (race_year); - -CREATE TABLE complex_ks.ztable ( - zkey text, - a frozen, - PRIMARY KEY (zkey) -) WITH read_repair_chance = 0.0 - AND dclocal_read_repair_chance = 0.1 - AND gc_grace_seconds = 864000 - AND bloom_filter_fp_chance = 0.1 - AND caching = { 'keys' : 'ALL', 'rows_per_partition' : 'NONE' } - AND comment = '' - AND compaction = { 'class' : 'org.apache.cassandra.db.compaction.LeveledCompactionStrategy', 'sstable_size_in_mb' : 95 } - AND compression = { 'chunk_length_in_kb' : 64, 'class' : 'org.apache.cassandra.io.compress.LZ4Compressor' } - AND default_time_to_live = 0 - AND speculative_retry = '99PERCENTILE' - AND min_index_interval = 128 - AND max_index_interval = 2048 - AND crc_check_chance = 1.0 - AND cdc = false - AND memtable_flush_period_in_ms = 0; - -CREATE FUNCTION complex_ks.avgfinal(state tuple) - CALLED ON NULL INPUT - RETURNS double - LANGUAGE java - AS 'double r = 0; if (state.getInt(0) == 0) return null; r = state.getLong(1); r /= state.getInt(0); return Double.valueOf(r);'; - -CREATE FUNCTION complex_ks.avgstate(state tuple,val int) - CALLED ON NULL INPUT - RETURNS tuple - LANGUAGE java - AS 'if (val !=null) { state.setInt(0, state.getInt(0)+1); state.setLong(1, state.getLong(1)+val.intValue()); } return state;'; - -CREATE AGGREGATE complex_ks.average(int) - SFUNC avgstate - STYPE tuple - FINALFUNC avgfinal - INITCOND (0,0); - -CREATE AGGREGATE complex_ks.mean(int) - SFUNC avgstate - STYPE tuple - FINALFUNC avgfinal - INITCOND (0,0); diff --git a/driver-examples/pom.xml b/driver-examples/pom.xml index a5508fa9d9b..a160e11743a 100644 --- a/driver-examples/pom.xml +++ b/driver-examples/pom.xml @@ -47,7 +47,6 @@ - com.fasterxml.jackson.core jackson-annotations diff --git a/driver-tests/osgi/common/src/test/java/com/datastax/driver/osgi/BundleOptions.java b/driver-tests/osgi/common/src/test/java/com/datastax/driver/osgi/BundleOptions.java index e4d9ef9aaa0..8186b8a4c07 100644 --- a/driver-tests/osgi/common/src/test/java/com/datastax/driver/osgi/BundleOptions.java +++ b/driver-tests/osgi/common/src/test/java/com/datastax/driver/osgi/BundleOptions.java @@ -97,7 +97,7 @@ public static CompositeOption lz4Bundle() { public Option[] getOptions() { return options( systemProperty("cassandra.compression").value(ProtocolOptions.Compression.LZ4.name()), - mavenBundle("org.lz4", "lz4-java", getVersion("lz4.version"))); + mavenBundle("at.yawk.lz4", "lz4-java", getVersion("lz4.version"))); } }; } @@ -182,13 +182,13 @@ public Option[] getOptions() { mavenBundle( "com.fasterxml.jackson.core", "jackson-databind", - getVersion("jackson-databind.version")), + getVersion("jackson.version")), mavenBundle( "com.fasterxml.jackson.core", "jackson-core", getVersion("jackson.version")), mavenBundle( "com.fasterxml.jackson.core", "jackson-annotations", - getVersion("jackson.version")), + getVersion("jackson-annotations.version")), mavenBundle("org.testng", "testng", getVersion("testng.version")), systemPackages( "org.testng", diff --git a/driver-tests/osgi/pom.xml b/driver-tests/osgi/pom.xml index 8609753a8c9..34a96f6d84d 100644 --- a/driver-tests/osgi/pom.xml +++ b/driver-tests/osgi/pom.xml @@ -166,7 +166,7 @@ ${testng.version} ${jsr353-api.version} ${jackson.version} - ${jackson-databind.version} + ${jackson-annotations.version} ${ipprefix} false diff --git a/manual/compression/README.md b/manual/compression/README.md index 6b25b5e5c69..3872699cc01 100644 --- a/manual/compression/README.md +++ b/manual/compression/README.md @@ -47,9 +47,9 @@ Maven dependency: ```xml - org.lz4 + at.yawk.lz4 lz4-java - 1.4.1 + 1.10.1 ``` diff --git a/pom.xml b/pom.xml index d179f45d04f..f8ddb7d2ec9 100644 --- a/pom.xml +++ b/pom.xml @@ -53,20 +53,19 @@ UTF-8 UTF-8 3.11.2 - 1.6 + 1.8 1.2.17 - 1.7.25 - 1.7.25 + 1.7.26 + 1.7.26 19.0 - 4.1.119.Final - 2.0.70.Final + 4.1.130.Final + 2.0.74.Final 3.2.2 1.1.2.6 - 1.4.1 + 1.10.1 2.1.10 - 2.8.11 - - 2.7.9.7 + 2.20.1 + 2.20 2.9.9 1.0 1.0.4 @@ -88,7 +87,7 @@ 2.25.0 1.3 1.1.2 - 1.2.3 + 1.2.13 3.0.8 127.0.1. @@ -176,7 +175,7 @@ - org.lz4 + at.yawk.lz4 lz4-java ${lz4.version} @@ -202,13 +201,13 @@ com.fasterxml.jackson.core jackson-databind - ${jackson-databind.version} + ${jackson.version} com.fasterxml.jackson.core jackson-annotations - ${jackson.version} + ${jackson-annotations.version} @@ -665,23 +664,6 @@ limitations under the License. animal-sniffer-maven-plugin 1.16 - - check-jdk6 - process-classes - - check - - - - org.codehaus.mojo.signature - java16 - 1.0 - - - com.datastax.driver.core.IgnoreJDK6Requirement - - - check-jdk8 @@ -1006,18 +988,6 @@ limitations under the License. true - - - - - - modern-jdks - - [1.8,) - - - - com.coveo fmt-maven-plugin @@ -1031,39 +1001,11 @@ limitations under the License. - - org.apache.maven.plugins - maven-javadoc-plugin - - none - - - - - - - - legacy-jdks - - [,1.8) - - - - - maven-surefire-plugin - - - **/jdk8/*.java - **/Jdk8*.java - + org.apache.maven.plugins + maven-javadoc-plugin + + none
Choice Description
zulu@1.6Zulu JDK version 1.6
zulu@1.7Zulu JDK version 1.7
1.8 Oracle JDK version 1.8 (Used for compiling regardless of choice)