DATACASS-656 - Extend test matrix on TravisCI to use latest 2.2, 3.0 and 3.11 Cassandra versions.

Guard tests for unsupported Cassandra versions.
This commit is contained in:
Mark Paluch
2020-01-15 14:18:20 +01:00
parent 6f6d91c7d6
commit cce8d54898
4 changed files with 31 additions and 7 deletions

View File

@@ -1,11 +1,10 @@
language: java
env:
global:
- CASSANDRA_VERSION=3.11.2
matrix:
- CASSANDRA_VERSION=2.2.10
- CASSANDRA_VERSION=3.0.10
- CASSANDRA_VERSION=2.2.15
- CASSANDRA_VERSION=3.0.19
- CASSANDRA_VERSION=3.11.5
cache:
directories:

View File

@@ -148,7 +148,7 @@ public class AlterTableCqlGeneratorIntegrationTests extends AbstractKeyspaceCrea
assertThat(getTableMetadata("addamsfamily").getColumn("newname")).isPresent();
}
@Test // DATACASS-192
@Test // DATACASS-192, DATACASS-656
public void alterTableAddCaching() {
session.execute("CREATE TABLE users (user_name varchar PRIMARY KEY);");
@@ -161,8 +161,7 @@ public class AlterTableCqlGeneratorIntegrationTests extends AbstractKeyspaceCrea
execute(spec);
assertThat(getTableMetadata("users").getOptions().toString())
.contains("caching={keys=NONE, rows_per_partition=15}");
assertThat(getTableMetadata("users").getOptions().toString()).contains("caching").contains("keys").contains("NONE");
}
private void execute(AlterTableSpecification spec) {

View File

@@ -16,6 +16,7 @@
package org.springframework.data.cassandra.repository.support;
import static org.assertj.core.api.Assertions.*;
import static org.junit.Assume.*;
import java.util.ArrayList;
import java.util.Arrays;
@@ -46,15 +47,19 @@ import org.springframework.data.cassandra.core.query.CassandraPageRequest;
import org.springframework.data.cassandra.domain.User;
import org.springframework.data.cassandra.domain.UserToken;
import org.springframework.data.cassandra.repository.CassandraRepository;
import org.springframework.data.cassandra.support.CassandraVersion;
import org.springframework.data.cassandra.test.util.AbstractEmbeddedCassandraIntegrationTest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Slice;
import org.springframework.data.domain.Sort;
import org.springframework.data.repository.query.ExtensionAwareQueryMethodEvaluationContextProvider;
import org.springframework.data.util.Version;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.util.ClassUtils;
import com.datastax.oss.driver.api.core.CqlSession;
/**
* Integration tests for {@link SimpleCassandraRepository}.
*
@@ -65,6 +70,8 @@ import org.springframework.util.ClassUtils;
public class SimpleCassandraRepositoryIntegrationTests extends AbstractEmbeddedCassandraIntegrationTest
implements BeanClassLoaderAware, BeanFactoryAware {
static final Version CASSANDRA_3 = Version.parse("3.0");
@Configuration
public static class Config extends IntegrationTestConfig {
@@ -79,9 +86,11 @@ public class SimpleCassandraRepositoryIntegrationTests extends AbstractEmbeddedC
}
}
@Autowired private CqlSession session;
@Autowired private CassandraOperations operations;
@Autowired private CaptureEventListener eventListener;
private Version cassandraVersion;
private BeanFactory beanFactory;
private CassandraRepositoryFactory factory;
private ClassLoader classLoader;
@@ -110,6 +119,8 @@ public class SimpleCassandraRepositoryIntegrationTests extends AbstractEmbeddedC
repository = factory.getRepository(UserRepostitory.class);
cassandraVersion = CassandraVersion.get(session);
repository.deleteAll();
dave = new User("42", "Dave", "Matthews");
@@ -191,6 +202,8 @@ public class SimpleCassandraRepositoryIntegrationTests extends AbstractEmbeddedC
@Test // DATACASS-700
public void findAllWithPagingAndSorting() {
assumeTrue(cassandraVersion.isGreaterThan(CASSANDRA_3));
UserTokenRepostitory repository = factory.getRepository(UserTokenRepostitory.class);
repository.deleteAll();

View File

@@ -16,6 +16,7 @@
package org.springframework.data.cassandra.repository.support;
import static org.assertj.core.api.Assertions.*;
import static org.junit.Assume.*;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
@@ -44,14 +45,18 @@ import org.springframework.data.cassandra.core.query.CassandraPageRequest;
import org.springframework.data.cassandra.domain.User;
import org.springframework.data.cassandra.domain.UserToken;
import org.springframework.data.cassandra.repository.ReactiveCassandraRepository;
import org.springframework.data.cassandra.support.CassandraVersion;
import org.springframework.data.cassandra.test.util.AbstractEmbeddedCassandraIntegrationTest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Slice;
import org.springframework.data.domain.Sort;
import org.springframework.data.repository.query.ExtensionAwareQueryMethodEvaluationContextProvider;
import org.springframework.data.util.Version;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner;
import com.datastax.oss.driver.api.core.CqlSession;
/**
* Integration tests for {@link SimpleReactiveCassandraRepository}.
*
@@ -63,6 +68,8 @@ import org.springframework.test.context.junit4.SpringRunner;
public class SimpleReactiveCassandraRepositoryIntegrationTests extends AbstractEmbeddedCassandraIntegrationTest
implements BeanClassLoaderAware, BeanFactoryAware {
static final Version CASSANDRA_3 = Version.parse("3.0");
@Configuration
public static class Config extends IntegrationTestConfig {
@@ -72,8 +79,10 @@ public class SimpleReactiveCassandraRepositoryIntegrationTests extends AbstractE
}
}
@Autowired private CqlSession session;
@Autowired private ReactiveCassandraOperations operations;
private Version cassandraVersion;
private BeanFactory beanFactory;
private ClassLoader classLoader;
private ReactiveCassandraRepositoryFactory factory;
@@ -102,6 +111,8 @@ public class SimpleReactiveCassandraRepositoryIntegrationTests extends AbstractE
repository = factory.getRepository(UserRepostitory.class);
cassandraVersion = CassandraVersion.get(session);
deleteAll();
dave = new User("42", "Dave", "Matthews");
@@ -225,6 +236,8 @@ public class SimpleReactiveCassandraRepositoryIntegrationTests extends AbstractE
@Test // DATACASS-700
public void findAllWithPagingAndSorting() {
assumeTrue(cassandraVersion.isGreaterThan(CASSANDRA_3));
UserTokenRepostitory repository = factory.getRepository(UserTokenRepostitory.class);
repository.deleteAll();