@Override public VersionNumber getCassandraVersion() { ResultSet result = executeWithSession(session -> session.execute("select release_version from system.local")); Row versionRow = result.one(); if (versionRow == null) { throw new PrestoException(CASSANDRA_VERSION_ERROR, "The cluster version is not available. " + "Please make sure that the Cassandra cluster is up and running, " + "and that the contact points are specified correctly."); } return VersionNumber.parse(versionRow.getString("release_version")); }
if (predicateString.contains(" IN (") && cassandraVersion.compareTo(VersionNumber.parse("2.2.0")) < 0 && currentClusteringColumn != (clusteringColumns.size() - 1)) { break;
@BeforeTest void setUp() { col1 = new CassandraColumnHandle("cassandra", "partitionKey1", 1, CassandraType.BIGINT, null, true, false, false, false); col2 = new CassandraColumnHandle("cassandra", "clusteringKey1", 2, CassandraType.BIGINT, null, false, true, false, false); col3 = new CassandraColumnHandle("cassandra", "clusteringKey2", 3, CassandraType.BIGINT, null, false, true, false, false); col4 = new CassandraColumnHandle("cassandra", "clusteringKe3", 4, CassandraType.BIGINT, null, false, true, false, false); cassandraTable = new CassandraTable( new CassandraTableHandle("cassandra", "test", "records"), ImmutableList.of(col1, col2, col3, col4)); cassandraVersion = VersionNumber.parse("2.1.5"); }
private ProtocolVersion(String minCassandraVersion, int asInt, ProtocolVersion lowerSupported) { this.minCassandraVersion = VersionNumber.parse(minCassandraVersion); this.asInt = asInt; this.lowerSupported = lowerSupported; }
void setVersion(String cassandraVersion) { VersionNumber versionNumber = null; try { if (cassandraVersion != null) { versionNumber = VersionNumber.parse(cassandraVersion); } } catch (IllegalArgumentException e) { logger.warn( "Error parsing Cassandra version {}. This shouldn't have happened", cassandraVersion); } this.cassandraVersion = versionNumber; }
void setDseVersion(String dseVersion) { VersionNumber versionNumber = null; try { if (dseVersion != null) { versionNumber = VersionNumber.parse(dseVersion); } } catch (IllegalArgumentException e) { logger.warn("Error parsing DSE version {}. This shouldn't have happened", dseVersion); } this.dseVersion = versionNumber; }
@Override public ProtocolVersion getProtocolVersion() { VersionNumber version = getCassandraVersion(); if (version.compareTo(VersionNumber.parse("2.0")) < 0) { return ProtocolVersion.V1; } else if (version.compareTo(VersionNumber.parse("2.1")) < 0) { return ProtocolVersion.V2; } else if (version.compareTo(VersionNumber.parse("2.2")) < 0) { return ProtocolVersion.V3; } else { return ProtocolVersion.V4; } }
@Test(groups = "unit") public void should_treat_same_prerelease_equal() { VersionNumber version1 = VersionNumber.parse("3.0.15-SNAPSHOT"); VersionNumber version2 = VersionNumber.parse("3.0.15-SNAPSHOT"); assertThat(version1).isEqualTo(version2); assertThat(version1.hashCode()).isEqualTo(version2.hashCode()); }
/** @jira_ticket JAVA-1367 */ @Test(groups = "short") public void should_fail_when_version_provided_and_too_high() throws Exception { if (ccm().getCassandraVersion().compareTo(VersionNumber.parse("2.2")) >= 0) { throw new SkipException("Server supports protocol V4"); } UnsupportedProtocolVersionException e = connectWithUnsupportedVersion(V4); assertThat(e.getUnsupportedVersion()).isEqualTo(V4); // pre-CASSANDRA-11464: server replies with its own version assertThat(e.getServerVersion()).isEqualTo(protocolVersion); }
/** @jira_ticket JAVA-1367 */ @Test(groups = "short") public void should_fail_when_beta_allowed_and_too_high() throws Exception { if (ccm().getCassandraVersion().compareTo(VersionNumber.parse("3.10")) >= 0) { throw new SkipException("Server supports protocol protocol V5 beta"); } UnsupportedProtocolVersionException e = connectWithUnsupportedBetaVersion(); assertThat(e.getUnsupportedVersion()).isEqualTo(V5); }
public VersionNumberAssert hasNextStable(String version) { assertThat(actual.nextStable()).isEqualTo(VersionNumber.parse(version)); return this; }
@Test(groups = "unit") public void should_parse_dse_patch() { assertThat(VersionNumber.parse("1.2.19.2-SNAPSHOT")) .hasMajorMinorPatch(1, 2, 19) .hasDsePatch(2) .hasToString("1.2.19.2-SNAPSHOT") .hasNextStable("1.2.19.2"); }
@Override public void beforeTestClass(Object testInstance) throws Exception { if (CCMBridge.getGlobalCassandraVersion().compareTo(VersionNumber.parse("3.0")) >= 0) { throw new SkipException("C* 3.0+ does not support Protocol V1"); } super.beforeTestClass(testInstance); }
private static void cassandraVersionCheck(CassandraVersion version) { versionCheck( CCMBridge.getGlobalCassandraVersion(), VersionNumber.parse(version.value()), version.description()); }
@Override public void onTestContextInitialized() { is21 = ccm().getCassandraVersion().compareTo(VersionNumber.parse("2.1.3")) > 0; // only add tuples / nested collections at > 2.1.3. execute( "CREATE TABLE codec_mapping (k int PRIMARY KEY, " + "v int, l list<int>, m map<int,int>" + (is21 ? ", t tuple<int,int>, s set<frozen<list<int>>>)" : ")")); }
@Test(groups = "unit") public void should_parse_release_version() { assertThat(VersionNumber.parse("1.2.19")) .hasMajorMinorPatch(1, 2, 19) .hasDsePatch(-1) .hasNoPreReleaseLabels() .hasBuildLabel(null) .hasNextStable("1.2.19") .hasToString("1.2.19"); }
@Test(groups = "unit") public void should_allow_tilde_as_first_pre_release_delimiter() { assertThat(VersionNumber.parse("1.2.0~beta1-SNAPSHOT")) .hasMajorMinorPatch(1, 2, 0) .hasDsePatch(-1) .hasPreReleaseLabels("beta1", "SNAPSHOT") .hasBuildLabel(null) .hasToString("1.2.0-beta1-SNAPSHOT") .hasNextStable("1.2.0"); }
@Test(groups = "unit") public void should_parse_pre_release_version() { assertThat(VersionNumber.parse("1.2.0-beta1-SNAPSHOT")) .hasMajorMinorPatch(1, 2, 0) .hasDsePatch(-1) .hasPreReleaseLabels("beta1", "SNAPSHOT") .hasBuildLabel(null) .hasToString("1.2.0-beta1-SNAPSHOT") .hasNextStable("1.2.0"); }
private static void dseVersionCheck(DseVersion version) { VersionNumber dseVersion = CCMBridge.getGlobalDSEVersion(); if (dseVersion != null) { versionCheck( CCMBridge.getGlobalDSEVersion(), VersionNumber.parse(version.value()), version.description()); } else { throw new SkipException( "Skipping test because not configured for DataStax Enterprise cluster."); } }