Skip to content

Commit a7044d5

Browse files
authored
Merge pull request apache#805 from datastax/consistentTestVersioning
Backport apache#791 and remove ambiguity in Cassandra and DSE versions in tests
2 parents 9f5878f + 202770e commit a7044d5

89 files changed

Lines changed: 554 additions & 555 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

driver-core/src/test/java/com/datastax/driver/core/AggregateMetadataTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
import static com.datastax.driver.core.DataType.text;
2525
import static com.datastax.driver.core.TestUtils.serializeForDynamicCompositeType;
2626

27-
@CassandraVersion(major = 2.2)
27+
@CassandraVersion("2.2.0")
2828
@CCMConfig(config = "enable_user_defined_functions:true")
2929
public class AggregateMetadataTest extends CCMTestsSupport {
3030

@@ -183,9 +183,9 @@ public void should_parse_and_format_aggregate_with_udts() {
183183
* @since 3.0.1
184184
*/
185185
@Test(groups = "short")
186-
@CassandraVersion(major = 2.2)
186+
@CassandraVersion("2.2.0")
187187
public void should_parse_and_format_aggregate_with_composite_type_literal_initcond() {
188-
VersionNumber ver = VersionNumber.parse(CCMBridge.getCassandraVersion());
188+
VersionNumber ver = ccm().getCassandraVersion();
189189
if (ver.getMajor() == 3) {
190190
if ((ver.getMinor() >= 1 && ver.getMinor() < 4) || (ver.getMinor() == 0 && ver.getPatch() < 4)) {
191191
throw new SkipException("Requires C* 2.2.X, 3.0.4+ or 3.4.X+");
@@ -204,9 +204,9 @@ public void should_parse_and_format_aggregate_with_composite_type_literal_initco
204204
* @since 3.0.1
205205
*/
206206
@Test(groups = "short")
207-
@CassandraVersion(major = 3.0, minor = 4)
207+
@CassandraVersion("3.4")
208208
public void should_parse_and_format_aggregate_with_composite_type_hex_initcond() {
209-
VersionNumber ver = VersionNumber.parse(CCMBridge.getCassandraVersion());
209+
VersionNumber ver = ccm().getCassandraVersion();
210210
if ((ver.getMinor() >= 1 && ver.getMinor() < 4)) {
211211
throw new SkipException("Requires 3.0.4+ or 3.4.X+");
212212
}

driver-core/src/test/java/com/datastax/driver/core/AsyncQueryTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ public Thread apply(ResultSet input) {
166166
}
167167

168168
@Test(groups = "short")
169-
@CassandraVersion(major = 2.0, description = "Paging is not supported until 2.0")
169+
@CassandraVersion(value = "2.0.0", description = "Paging is not supported until 2.0")
170170
public void should_fail_when_auto_paging_on_io_thread() throws Exception {
171171
for (int i = 0; i < 1000; i++) {
172172
Statement statement = new SimpleStatement("select v from asyncquerytest.foo where k = 1");

driver-core/src/test/java/com/datastax/driver/core/AsyncResultSetTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
import static org.assertj.core.api.Assertions.assertThat;
2929

30-
@CassandraVersion(major = 2.0, description = "uses paging")
30+
@CassandraVersion(value = "2.0.0", description = "uses paging")
3131
public class AsyncResultSetTest extends CCMTestsSupport {
3232

3333
@Override

driver-core/src/test/java/com/datastax/driver/core/AuthenticationTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public class AuthenticationTest extends CCMTestsSupport {
4141
public void sleepIf12() {
4242
// For C* 1.2, sleep before attempting to connect as there is a small delay between
4343
// user being created.
44-
if (ccm().getVersion().getMajor() < 2) {
44+
if (ccm().getCassandraVersion().getMajor() < 2) {
4545
Uninterruptibles.sleepUninterruptibly(1, TimeUnit.SECONDS);
4646
}
4747
}

driver-core/src/test/java/com/datastax/driver/core/BatchStatementTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public void simpleBatchTest() {
7171
}
7272

7373
@Test(groups = "short")
74-
@CassandraVersion(major = 2.0, minor = 9, description = "This will only work with C* 2.0.9 (CASSANDRA-7337)")
74+
@CassandraVersion(value = "2.0.9", description = "This will only work with C* 2.0.9 (CASSANDRA-7337)")
7575
public void casBatchTest() {
7676
PreparedStatement st = session().prepare("INSERT INTO test (k, v) VALUES (?, ?) IF NOT EXISTS");
7777

driver-core/src/test/java/com/datastax/driver/core/CCMAccess.java

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,21 @@ enum Workload {cassandra, solr, hadoop, spark, cfs, graph}
3232
String getClusterName();
3333

3434
/**
35-
* Returns the Cassandra version of this CCM cluster.
35+
* Returns the Cassandra version of this CCM cluster. If {@link #getDSEVersion()} is non-null it is assumed
36+
* that this value is only used for representing the compatible Cassandra version for that DSE version.
3637
* <p/>
37-
* By default the version is equal to {@link CCMBridge#getCassandraVersion()}.
3838
*
3939
* @return The version of this CCM cluster.
4040
*/
41-
VersionNumber getVersion();
41+
VersionNumber getCassandraVersion();
42+
43+
/**
44+
* Returns the DSE version of this CCM cluster if this is a DSE cluster, otherwise null.
45+
* <p/>
46+
*
47+
* @return The version of this CCM cluster.
48+
*/
49+
VersionNumber getDSEVersion();
4250

4351
/**
4452
* @return The config directory for this CCM cluster.
@@ -236,4 +244,19 @@ enum Workload {cassandra, solr, hadoop, spark, cfs, graph}
236244
*/
237245
void waitForDown(int node);
238246

247+
/**
248+
* @return The target protocolVersion to use when connecting to this CCM cluster.
249+
* <p/>
250+
* This should be based on the highest protocol version that both the cluster and driver support.
251+
* <p/>
252+
* For example, C* 2.0.17 should return {@link ProtocolVersion#V2} since C* supports up to V2 and the driver
253+
* supports that version.
254+
*/
255+
ProtocolVersion getProtocolVersion();
256+
257+
/**
258+
* @param maximumAllowed The maximum protocol version to use.
259+
* @return The target protocolVersion or maximumAllowed if {@link #getProtocolVersion} is greater.
260+
*/
261+
ProtocolVersion getProtocolVersion(ProtocolVersion maximumAllowed);
239262
}

0 commit comments

Comments
 (0)