DATACASS-431 - Disable tests for ALTER TYPE support on Apache Cassandra 3.10.
Apache Cassandra does not allow altering column/field types since version 3.10. We don't run these tests anymore for version 3.10 and later.
This commit is contained in:
@@ -16,6 +16,7 @@
|
|||||||
package org.springframework.cassandra.core.cql.generator;
|
package org.springframework.cassandra.core.cql.generator;
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.*;
|
import static org.assertj.core.api.Assertions.*;
|
||||||
|
import static org.junit.Assume.*;
|
||||||
|
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -27,6 +28,8 @@ import org.springframework.cassandra.core.keyspace.TableOption;
|
|||||||
import org.springframework.cassandra.core.keyspace.TableOption.CachingOption;
|
import org.springframework.cassandra.core.keyspace.TableOption.CachingOption;
|
||||||
import org.springframework.cassandra.core.keyspace.TableOption.KeyCachingOption;
|
import org.springframework.cassandra.core.keyspace.TableOption.KeyCachingOption;
|
||||||
import org.springframework.cassandra.test.integration.AbstractKeyspaceCreatingIntegrationTest;
|
import org.springframework.cassandra.test.integration.AbstractKeyspaceCreatingIntegrationTest;
|
||||||
|
import org.springframework.cassandra.test.integration.support.CassandraVersion;
|
||||||
|
import org.springframework.data.util.Version;
|
||||||
|
|
||||||
import com.datastax.driver.core.ColumnMetadata;
|
import com.datastax.driver.core.ColumnMetadata;
|
||||||
import com.datastax.driver.core.DataType;
|
import com.datastax.driver.core.DataType;
|
||||||
@@ -40,16 +43,24 @@ import com.datastax.driver.core.TableMetadata;
|
|||||||
*/
|
*/
|
||||||
public class AlterTableCqlGeneratorIntegrationTests extends AbstractKeyspaceCreatingIntegrationTest {
|
public class AlterTableCqlGeneratorIntegrationTests extends AbstractKeyspaceCreatingIntegrationTest {
|
||||||
|
|
||||||
|
static final Version CASSANDRA_3_10 = Version.parse("3.10");
|
||||||
|
|
||||||
|
Version cassandraVersion;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
|
|
||||||
|
cassandraVersion = CassandraVersion.get(session);
|
||||||
|
|
||||||
session.execute("DROP TABLE IF EXISTS addamsFamily;");
|
session.execute("DROP TABLE IF EXISTS addamsFamily;");
|
||||||
session.execute("DROP TABLE IF EXISTS users;");
|
session.execute("DROP TABLE IF EXISTS users;");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test // DATACASS-192
|
@Test // DATACASS-192, DATACASS-429
|
||||||
public void alterTableAlterColumnType() {
|
public void alterTableAlterColumnType() {
|
||||||
|
|
||||||
|
assumeTrue(cassandraVersion.isLessThan(CASSANDRA_3_10));
|
||||||
|
|
||||||
session.execute(
|
session.execute(
|
||||||
"CREATE TABLE addamsFamily (name varchar PRIMARY KEY, gender varchar,\n" + " lastknownlocation bigint);");
|
"CREATE TABLE addamsFamily (name varchar PRIMARY KEY, gender varchar,\n" + " lastknownlocation bigint);");
|
||||||
|
|
||||||
@@ -63,9 +74,11 @@ public class AlterTableCqlGeneratorIntegrationTests extends AbstractKeyspaceCrea
|
|||||||
assertThat(column.getType()).isEqualTo(DataType.varint());
|
assertThat(column.getType()).isEqualTo(DataType.varint());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test // DATACASS-192
|
@Test // DATACASS-192, DATACASS-429
|
||||||
public void alterTableAlterListColumnType() {
|
public void alterTableAlterListColumnType() {
|
||||||
|
|
||||||
|
assumeTrue(cassandraVersion.isLessThan(CASSANDRA_3_10));
|
||||||
|
|
||||||
session.execute(
|
session.execute(
|
||||||
"CREATE TABLE addamsFamily (name varchar PRIMARY KEY, gender varchar,\n" + " lastknownlocation list<ascii>);");
|
"CREATE TABLE addamsFamily (name varchar PRIMARY KEY, gender varchar,\n" + " lastknownlocation list<ascii>);");
|
||||||
|
|
||||||
|
|||||||
@@ -15,25 +15,34 @@
|
|||||||
*/
|
*/
|
||||||
package org.springframework.cassandra.core.cql.generator;
|
package org.springframework.cassandra.core.cql.generator;
|
||||||
|
|
||||||
|
import static org.junit.Assume.*;
|
||||||
import static org.springframework.cassandra.core.cql.generator.AlterUserTypeCqlGenerator.*;
|
import static org.springframework.cassandra.core.cql.generator.AlterUserTypeCqlGenerator.*;
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.springframework.cassandra.core.keyspace.AlterUserTypeSpecification;
|
import org.springframework.cassandra.core.keyspace.AlterUserTypeSpecification;
|
||||||
import org.springframework.cassandra.test.integration.AbstractKeyspaceCreatingIntegrationTest;
|
import org.springframework.cassandra.test.integration.AbstractKeyspaceCreatingIntegrationTest;
|
||||||
|
import org.springframework.cassandra.test.integration.support.CassandraVersion;
|
||||||
|
import org.springframework.data.util.Version;
|
||||||
|
|
||||||
import com.datastax.driver.core.DataType;
|
import com.datastax.driver.core.DataType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Integration tests for {@link AlterUserTypeCqlGenerator}.
|
* Integration tests for {@link AlterUserTypeCqlGenerator}.
|
||||||
*
|
*
|
||||||
* @author Mark Paluch
|
* @author Mark Paluch
|
||||||
*/
|
*/
|
||||||
public class AlterUserTypeCqlGeneratorIntegrationTests extends AbstractKeyspaceCreatingIntegrationTest {
|
public class AlterUserTypeCqlGeneratorIntegrationTests extends AbstractKeyspaceCreatingIntegrationTest {
|
||||||
|
|
||||||
|
static final Version CASSANDRA_3_10 = Version.parse("3.10");
|
||||||
|
|
||||||
|
Version cassandraVersion;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
|
|
||||||
|
cassandraVersion = CassandraVersion.get(session);
|
||||||
|
|
||||||
session.execute("DROP TYPE IF EXISTS address;");
|
session.execute("DROP TYPE IF EXISTS address;");
|
||||||
session.execute("CREATE TYPE address (zip text, state text);");
|
session.execute("CREATE TYPE address (zip text, state text);");
|
||||||
}
|
}
|
||||||
@@ -47,9 +56,11 @@ public class AlterUserTypeCqlGeneratorIntegrationTests extends AbstractKeyspaceC
|
|||||||
session.execute(toCql(spec));
|
session.execute(toCql(spec));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test // DATACASS-172
|
@Test // DATACASS-172, DATACASS-429
|
||||||
public void alterTypeShouldAlterField() {
|
public void alterTypeShouldAlterField() {
|
||||||
|
|
||||||
|
assumeTrue(cassandraVersion.isLessThan(CASSANDRA_3_10));
|
||||||
|
|
||||||
AlterUserTypeSpecification spec = AlterUserTypeSpecification.alterType("address")//
|
AlterUserTypeSpecification spec = AlterUserTypeSpecification.alterType("address")//
|
||||||
.alter("zip", DataType.varchar());
|
.alter("zip", DataType.varchar());
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2016-2017 the original author or authors.
|
* Copyright 2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.springframework.data.cassandra.test.integration.support;
|
package org.springframework.cassandra.test.integration.support;
|
||||||
|
|
||||||
import lombok.experimental.UtilityClass;
|
import lombok.experimental.UtilityClass;
|
||||||
|
|
||||||
@@ -37,11 +37,11 @@ import org.junit.Before;
|
|||||||
import org.junit.Ignore;
|
import org.junit.Ignore;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.springframework.cassandra.test.integration.AbstractKeyspaceCreatingIntegrationTest;
|
import org.springframework.cassandra.test.integration.AbstractKeyspaceCreatingIntegrationTest;
|
||||||
|
import org.springframework.cassandra.test.integration.support.CassandraVersion;
|
||||||
import org.springframework.data.annotation.Id;
|
import org.springframework.data.annotation.Id;
|
||||||
import org.springframework.data.cassandra.core.CassandraOperations;
|
import org.springframework.data.cassandra.core.CassandraOperations;
|
||||||
import org.springframework.data.cassandra.core.CassandraTemplate;
|
import org.springframework.data.cassandra.core.CassandraTemplate;
|
||||||
import org.springframework.data.cassandra.domain.AllPossibleTypes;
|
import org.springframework.data.cassandra.domain.AllPossibleTypes;
|
||||||
import org.springframework.data.cassandra.test.integration.support.CassandraVersion;
|
|
||||||
import org.springframework.data.cassandra.test.integration.support.SchemaTestUtils;
|
import org.springframework.data.cassandra.test.integration.support.SchemaTestUtils;
|
||||||
import org.springframework.data.util.Version;
|
import org.springframework.data.util.Version;
|
||||||
|
|
||||||
@@ -58,7 +58,7 @@ import com.datastax.driver.core.SimpleStatement;
|
|||||||
@SuppressWarnings("Since15")
|
@SuppressWarnings("Since15")
|
||||||
public class CassandraTypeMappingIntegrationTest extends AbstractKeyspaceCreatingIntegrationTest {
|
public class CassandraTypeMappingIntegrationTest extends AbstractKeyspaceCreatingIntegrationTest {
|
||||||
|
|
||||||
static final Version VERSION_3_1 = Version.parse("3.10");
|
static final Version VERSION_3_10 = Version.parse("3.10");
|
||||||
|
|
||||||
CassandraOperations operations;
|
CassandraOperations operations;
|
||||||
Version cassandraVersion;
|
Version cassandraVersion;
|
||||||
@@ -75,7 +75,7 @@ public class CassandraTypeMappingIntegrationTest extends AbstractKeyspaceCreatin
|
|||||||
SchemaTestUtils.truncate(AllPossibleTypes.class, operations);
|
SchemaTestUtils.truncate(AllPossibleTypes.class, operations);
|
||||||
SchemaTestUtils.truncate(TimeEntity.class, operations);
|
SchemaTestUtils.truncate(TimeEntity.class, operations);
|
||||||
|
|
||||||
if (cassandraVersion.isGreaterThanOrEqualTo(VERSION_3_1)) {
|
if (cassandraVersion.isGreaterThanOrEqualTo(VERSION_3_10)) {
|
||||||
|
|
||||||
SchemaTestUtils.potentiallyCreateTableFor(WithDuration.class, operations);
|
SchemaTestUtils.potentiallyCreateTableFor(WithDuration.class, operations);
|
||||||
SchemaTestUtils.truncate(WithDuration.class, operations);
|
SchemaTestUtils.truncate(WithDuration.class, operations);
|
||||||
@@ -633,7 +633,7 @@ public class CassandraTypeMappingIntegrationTest extends AbstractKeyspaceCreatin
|
|||||||
@Test // DATACASS-429
|
@Test // DATACASS-429
|
||||||
public void shouldReadAndWriteDuration() {
|
public void shouldReadAndWriteDuration() {
|
||||||
|
|
||||||
assumeTrue(cassandraVersion.isGreaterThanOrEqualTo(VERSION_3_1));
|
assumeTrue(cassandraVersion.isGreaterThanOrEqualTo(VERSION_3_10));
|
||||||
|
|
||||||
WithDuration withDuration = new WithDuration("foo", Duration.from("2h"));
|
WithDuration withDuration = new WithDuration("foo", Duration.from("2h"));
|
||||||
|
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import org.junit.Before;
|
|||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.cassandra.test.integration.support.CassandraVersion;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.data.cassandra.config.SchemaAction;
|
import org.springframework.data.cassandra.config.SchemaAction;
|
||||||
import org.springframework.data.cassandra.core.CassandraOperations;
|
import org.springframework.data.cassandra.core.CassandraOperations;
|
||||||
@@ -37,7 +38,6 @@ import org.springframework.data.cassandra.test.integration.repository.querymetho
|
|||||||
import org.springframework.data.cassandra.test.integration.repository.querymethods.derived.PersonRepository.PersonDto;
|
import org.springframework.data.cassandra.test.integration.repository.querymethods.derived.PersonRepository.PersonDto;
|
||||||
import org.springframework.data.cassandra.test.integration.repository.querymethods.derived.PersonRepository.PersonProjection;
|
import org.springframework.data.cassandra.test.integration.repository.querymethods.derived.PersonRepository.PersonProjection;
|
||||||
import org.springframework.data.cassandra.test.integration.support.AbstractSpringDataEmbeddedCassandraIntegrationTest;
|
import org.springframework.data.cassandra.test.integration.support.AbstractSpringDataEmbeddedCassandraIntegrationTest;
|
||||||
import org.springframework.data.cassandra.test.integration.support.CassandraVersion;
|
|
||||||
import org.springframework.data.cassandra.test.integration.support.IntegrationTestConfig;
|
import org.springframework.data.cassandra.test.integration.support.IntegrationTestConfig;
|
||||||
import org.springframework.data.domain.Sort;
|
import org.springframework.data.domain.Sort;
|
||||||
import org.springframework.data.util.Version;
|
import org.springframework.data.util.Version;
|
||||||
|
|||||||
Reference in New Issue
Block a user