kc/BaseIntegrationTest.java

27 lines
920 B
Java
Raw Normal View History

2018-03-25 23:41:59 +00:00
package com.example.crud;
import example.domain.Event;
import org.junit.Before;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cassandra.core.cql.CqlIdentifier;
import org.springframework.data.cassandra.core.CassandraAdminOperations;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.HashMap;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = CassandraConfiguration.class)
public abstract class BaseIntegrationTest {
@Autowired
private CassandraAdminOperations adminTemplate;
@Before
public void resetKeySpace() {
adminTemplate.dropTable(CqlIdentifier.cqlId("event"));
adminTemplate.createTable(true, CqlIdentifier.cqlId("event"), Event.class, new HashMap<String, Object>());
}
}