wip
This commit is contained in:
@@ -72,6 +72,11 @@
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cglib</groupId>
|
||||
<artifactId>cglib-nodep</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.el</groupId>
|
||||
<artifactId>el-api</artifactId>
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package org.springframework.cassandra.test.integration.config;
|
||||
|
||||
import org.springframework.cassandra.config.java.AbstractCassandraConfiguration;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import com.datastax.driver.core.Cluster;
|
||||
import com.datastax.driver.core.Cluster.Builder;
|
||||
|
||||
@Configuration
|
||||
public class Config extends AbstractCassandraConfiguration {
|
||||
|
||||
public static final String KEYSPACE = "testy";
|
||||
|
||||
public Cluster cluster;
|
||||
|
||||
@Override
|
||||
protected String getKeyspaceName() {
|
||||
return KEYSPACE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Cluster cluster() {
|
||||
Builder builder = Cluster.builder();
|
||||
|
||||
builder.addContactPoint("localhost").withPort(9042);
|
||||
|
||||
return cluster = builder.build();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package org.springframework.cassandra.test.integration.config;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.apache.cassandra.exceptions.ConfigurationException;
|
||||
import org.apache.thrift.transport.TTransportException;
|
||||
import org.cassandraunit.utils.EmbeddedCassandraServerHelper;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
import com.datastax.driver.core.Session;
|
||||
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration(classes = Config.class)
|
||||
public class ConfigTest {
|
||||
|
||||
@BeforeClass
|
||||
public static void startCassandra() throws ConfigurationException, TTransportException, IOException {
|
||||
EmbeddedCassandraServerHelper.startEmbeddedCassandra("cassandra.yaml");
|
||||
}
|
||||
|
||||
@Inject
|
||||
Session session;
|
||||
|
||||
@Test
|
||||
public void test() {
|
||||
assertNotNull(session);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user