#224 - Use external or embedded (if external Apache Cassandra is not available) for Cassandra examples.
We now check whether an external Apache Cassandra instance is available at localhost:9042 and use it to run the examples. Otherwise, if no external Apache Cassandra instance is available, we start an embedded Cassandra instance.
This commit is contained in:
committed by
Oliver Gierke
parent
1d3af17572
commit
d9f77903ef
@@ -19,11 +19,13 @@ import static org.hamcrest.CoreMatchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.junit.Assume.*;
|
||||
|
||||
import example.springdata.cassandra.util.CassandraKeyspace;
|
||||
import example.springdata.cassandra.util.CassandraVersion;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.ClassRule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.data.util.Version;
|
||||
@@ -31,9 +33,6 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import com.datastax.driver.core.Session;
|
||||
|
||||
import example.springdata.cassandra.util.CassandraVersion;
|
||||
import example.springdata.cassandra.util.RequiresCassandraKeyspace;
|
||||
|
||||
/**
|
||||
* Integration test showing the basic usage of {@link BasicUserRepository}.
|
||||
*
|
||||
@@ -48,7 +47,7 @@ public class BasicUserRepositoryTests {
|
||||
|
||||
public final static Version CASSANDRA_3_4 = Version.parse("3.4");
|
||||
|
||||
@ClassRule public final static RequiresCassandraKeyspace CASSANDRA_KEYSPACE = RequiresCassandraKeyspace.onLocalhost();
|
||||
@ClassRule public final static CassandraKeyspace CASSANDRA_KEYSPACE = CassandraKeyspace.onLocalhost();
|
||||
|
||||
@Autowired BasicUserRepository repository;
|
||||
@Autowired Session session;
|
||||
|
||||
@@ -18,6 +18,8 @@ package example.springdata.cassandra.basic;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import example.springdata.cassandra.util.CassandraKeyspace;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -28,7 +30,6 @@ import org.junit.Before;
|
||||
import org.junit.ClassRule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.data.cassandra.core.CassandraOperations;
|
||||
@@ -40,18 +41,16 @@ import com.datastax.driver.core.Row;
|
||||
import com.datastax.driver.core.querybuilder.Insert;
|
||||
import com.datastax.driver.core.querybuilder.QueryBuilder;
|
||||
|
||||
import example.springdata.cassandra.util.RequiresCassandraKeyspace;
|
||||
|
||||
/**
|
||||
* Integration test showing the basic usage of {@link CassandraTemplate}.
|
||||
*
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(classes = BasicConfiguration.CassandraConfig.class)
|
||||
@SpringBootTest(classes = BasicConfiguration.class)
|
||||
public class CassandraOperationsIntegrationTests {
|
||||
|
||||
@ClassRule public final static RequiresCassandraKeyspace CASSANDRA_KEYSPACE = RequiresCassandraKeyspace.onLocalhost();
|
||||
@ClassRule public final static CassandraKeyspace CASSANDRA_KEYSPACE = CassandraKeyspace.onLocalhost();
|
||||
|
||||
@Autowired CassandraOperations template;
|
||||
|
||||
|
||||
@@ -18,13 +18,14 @@ package example.springdata.cassandra.convert;
|
||||
import static org.hamcrest.MatcherAssert.*;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
|
||||
import example.springdata.cassandra.util.CassandraKeyspace;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.ClassRule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.data.cassandra.core.CassandraOperations;
|
||||
@@ -33,8 +34,6 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
import com.datastax.driver.core.Row;
|
||||
import com.datastax.driver.core.querybuilder.QueryBuilder;
|
||||
|
||||
import example.springdata.cassandra.util.RequiresCassandraKeyspace;
|
||||
|
||||
/**
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
@@ -42,7 +41,7 @@ import example.springdata.cassandra.util.RequiresCassandraKeyspace;
|
||||
@SpringBootTest(classes = ConverterConfiguration.class)
|
||||
public class ConversionIntegrationTests {
|
||||
|
||||
@ClassRule public final static RequiresCassandraKeyspace CASSANDRA_KEYSPACE = RequiresCassandraKeyspace.onLocalhost();
|
||||
@ClassRule public final static CassandraKeyspace CASSANDRA_KEYSPACE = CassandraKeyspace.onLocalhost();
|
||||
|
||||
@Autowired CassandraOperations operations;
|
||||
|
||||
|
||||
@@ -18,20 +18,19 @@ package example.springdata.cassandra.projection;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import example.springdata.cassandra.util.CassandraKeyspace;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.ClassRule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.data.projection.TargetAware;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
import example.springdata.cassandra.util.RequiresCassandraKeyspace;
|
||||
|
||||
/**
|
||||
* Integration tests for {@link CustomerRepository} to show projection capabilities.
|
||||
*
|
||||
@@ -41,7 +40,7 @@ import example.springdata.cassandra.util.RequiresCassandraKeyspace;
|
||||
@SpringBootTest(classes = ProjectionConfiguration.class)
|
||||
public class CustomerRepositoryIntegrationTest {
|
||||
|
||||
@ClassRule public final static RequiresCassandraKeyspace CASSANDRA_KEYSPACE = RequiresCassandraKeyspace.onLocalhost();
|
||||
@ClassRule public final static CassandraKeyspace CASSANDRA_KEYSPACE = CassandraKeyspace.onLocalhost();
|
||||
|
||||
@Autowired CustomerRepository customers;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user