Added Cassandra-Unit setup/teardown
This commit is contained in:
@@ -1,5 +1,13 @@
|
||||
package org.springframework.data.cassandra.config;
|
||||
|
||||
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.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -18,6 +26,12 @@ public class CassandraNamespaceTests {
|
||||
@Autowired
|
||||
private ApplicationContext ctx;
|
||||
|
||||
@BeforeClass
|
||||
public static void startCassandra()
|
||||
throws IOException, TTransportException, ConfigurationException, InterruptedException {
|
||||
EmbeddedCassandraServerHelper.startEmbeddedCassandra("cassandra.yaml");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSingleton() throws Exception {
|
||||
Object cluster = ctx.getBean("cassandra-cluster");
|
||||
@@ -32,4 +46,14 @@ public class CassandraNamespaceTests {
|
||||
System.out.println(org.apache.commons.beanutils.BeanUtils.describe(c.getConfiguration()));
|
||||
}
|
||||
|
||||
@After
|
||||
public void clearCassandra() {
|
||||
EmbeddedCassandraServerHelper.cleanEmbeddedCassandra();
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void stopCassandra() {
|
||||
EmbeddedCassandraServerHelper.stopEmbeddedCassandra();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
package org.springframework.data.cassandra.config;
|
||||
|
||||
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 com.datastax.driver.core.Cluster;
|
||||
@@ -7,6 +15,12 @@ import com.datastax.driver.core.Session;
|
||||
|
||||
public class DriverTests {
|
||||
|
||||
@BeforeClass
|
||||
public static void startCassandra()
|
||||
throws IOException, TTransportException, ConfigurationException, InterruptedException {
|
||||
EmbeddedCassandraServerHelper.startEmbeddedCassandra("cassandra.yaml");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test() throws Exception {
|
||||
|
||||
@@ -25,4 +39,13 @@ public class DriverTests {
|
||||
|
||||
}
|
||||
|
||||
@After
|
||||
public void clearCassandra() {
|
||||
EmbeddedCassandraServerHelper.cleanEmbeddedCassandra();
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void stopCassandra() {
|
||||
EmbeddedCassandraServerHelper.stopEmbeddedCassandra();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user