Added Embedded cassandra-unit to existing tests and all are passing.
This commit is contained in:
@@ -19,6 +19,14 @@ import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.cassandra.exceptions.ConfigurationException;
|
||||
import org.apache.thrift.transport.TTransportException;
|
||||
import org.cassandraunit.utils.EmbeddedCassandraServerHelper;
|
||||
import org.junit.After;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mock;
|
||||
@@ -38,6 +46,12 @@ public class BasicCassandraPersistentEntityUnitTests {
|
||||
|
||||
@Mock
|
||||
ApplicationContext context;
|
||||
|
||||
@BeforeClass
|
||||
public static void startCassandra()
|
||||
throws IOException, TTransportException, ConfigurationException, InterruptedException {
|
||||
EmbeddedCassandraServerHelper.startEmbeddedCassandra("cassandra.yaml");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void subclassInheritsAtDocumentAnnotation() {
|
||||
@@ -70,6 +84,16 @@ public class BasicCassandraPersistentEntityUnitTests {
|
||||
|
||||
assertThat(entity.getTable(), is("user_line"));
|
||||
}
|
||||
|
||||
@After
|
||||
public void clearCassandra() {
|
||||
EmbeddedCassandraServerHelper.cleanEmbeddedCassandra();
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void stopCassandra() {
|
||||
EmbeddedCassandraServerHelper.stopEmbeddedCassandra();
|
||||
}
|
||||
|
||||
@Table(name = "messages")
|
||||
class Message {
|
||||
|
||||
@@ -18,10 +18,17 @@ package org.springframework.data.cassandra.mapping;
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.Date;
|
||||
|
||||
import org.apache.cassandra.exceptions.ConfigurationException;
|
||||
import org.apache.thrift.transport.TTransportException;
|
||||
import org.cassandraunit.utils.EmbeddedCassandraServerHelper;
|
||||
import org.junit.After;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.mapping.model.SimpleTypeHolder;
|
||||
@@ -37,6 +44,12 @@ import org.springframework.util.ReflectionUtils;
|
||||
public class BasicCassandraPersistentPropertyUnitTests {
|
||||
|
||||
CassandraPersistentEntity<Timeline> entity;
|
||||
|
||||
@BeforeClass
|
||||
public static void startCassandra()
|
||||
throws IOException, TTransportException, ConfigurationException, InterruptedException {
|
||||
EmbeddedCassandraServerHelper.startEmbeddedCassandra("cassandra.yaml");
|
||||
}
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
@@ -69,6 +82,16 @@ public class BasicCassandraPersistentPropertyUnitTests {
|
||||
assertThat(property.isColumnId(), is(true));
|
||||
}
|
||||
|
||||
@After
|
||||
public void clearCassandra() {
|
||||
EmbeddedCassandraServerHelper.cleanEmbeddedCassandra();
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void stopCassandra() {
|
||||
EmbeddedCassandraServerHelper.stopEmbeddedCassandra();
|
||||
}
|
||||
|
||||
private CassandraPersistentProperty getPropertyFor(Field field) {
|
||||
return new BasicCassandraPersistentProperty(field, null, entity, new SimpleTypeHolder());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user