Upgrade SI-Cassandra dependencies
Use JUnit 5 for tests
This commit is contained in:
@@ -25,10 +25,9 @@ import java.util.List;
|
||||
import org.apache.cassandra.exceptions.ConfigurationException;
|
||||
import org.apache.thrift.transport.TTransportException;
|
||||
import org.cassandraunit.utils.EmbeddedCassandraServerHelper;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.jupiter.api.AfterAll;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.cassandra.core.CassandraTemplate;
|
||||
@@ -41,7 +40,7 @@ import org.springframework.integration.support.MessageBuilder;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.support.GenericMessage;
|
||||
import org.springframework.test.annotation.DirtiesContext;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
|
||||
|
||||
import com.datastax.driver.core.querybuilder.QueryBuilder;
|
||||
import com.datastax.driver.core.querybuilder.Select;
|
||||
@@ -52,11 +51,11 @@ import reactor.test.StepVerifier;
|
||||
* @author Filippo Balicchia
|
||||
* @author Artem Bilan
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringJUnitConfig
|
||||
@DirtiesContext
|
||||
public class CassandraOutboundAdapterIntegrationTests {
|
||||
class CassandraOutboundAdapterIntegrationTests {
|
||||
|
||||
protected static final String CASSANDRA_CONFIG = "spring-cassandra.yaml";
|
||||
private static final String CASSANDRA_CONFIG = "spring-cassandra.yaml";
|
||||
|
||||
@Autowired
|
||||
private CassandraTemplate cassandraTemplate;
|
||||
@@ -79,19 +78,19 @@ public class CassandraOutboundAdapterIntegrationTests {
|
||||
@Autowired
|
||||
private FluxMessageChannel resultChannel;
|
||||
|
||||
@BeforeClass
|
||||
public static void init() throws TTransportException, IOException, ConfigurationException {
|
||||
@BeforeAll
|
||||
static void init() throws TTransportException, IOException, ConfigurationException {
|
||||
EmbeddedCassandraServerHelper.startEmbeddedCassandra(CASSANDRA_CONFIG, "build/embeddedCassandra");
|
||||
EmbeddedCassandraServerHelper.getSession();
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void cleanup() {
|
||||
@AfterAll
|
||||
static void cleanup() {
|
||||
EmbeddedCassandraServerHelper.cleanEmbeddedCassandra();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBasicCassandraInsert() {
|
||||
void testBasicCassandraInsert() {
|
||||
Book b1 = BookSampler.getBook();
|
||||
Message<Book> message = MessageBuilder.withPayload(b1).build();
|
||||
this.cassandraMessageHandler1.send(message);
|
||||
@@ -102,7 +101,7 @@ public class CassandraOutboundAdapterIntegrationTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCassandraBatchInsertAndSelectStatement() {
|
||||
void testCassandraBatchInsertAndSelectStatement() {
|
||||
List<Book> books = BookSampler.getBookList(5);
|
||||
this.cassandraMessageHandler2.send(new GenericMessage<>(books));
|
||||
Message<?> message = MessageBuilder.withPayload("Cassandra Puppy Guru").setHeader("limit", 2).build();
|
||||
@@ -124,7 +123,7 @@ public class CassandraOutboundAdapterIntegrationTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCassandraBatchIngest() {
|
||||
void testCassandraBatchIngest() {
|
||||
List<Book> books = BookSampler.getBookList(5);
|
||||
List<List<?>> ingestBooks = new ArrayList<>();
|
||||
for (Book b : books) {
|
||||
@@ -148,7 +147,7 @@ public class CassandraOutboundAdapterIntegrationTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testExpressionTruncate() {
|
||||
void testExpressionTruncate() {
|
||||
Message<Book> message = MessageBuilder.withPayload(BookSampler.getBook()).build();
|
||||
this.cassandraMessageHandler1.send(message);
|
||||
Select select = QueryBuilder.select().all().from("book");
|
||||
|
||||
@@ -18,28 +18,27 @@ package org.springframework.integration.cassandra.config;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.integration.cassandra.outbound.CassandraMessageHandler;
|
||||
import org.springframework.integration.test.util.TestUtils;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
|
||||
|
||||
/**
|
||||
* @author Filippo Balicchia
|
||||
* @author Artem Bilan
|
||||
*/
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
public class CassandraOutboundAdapterParserTests {
|
||||
@SpringJUnitConfig
|
||||
class CassandraOutboundAdapterParserTests {
|
||||
|
||||
@Autowired
|
||||
private ApplicationContext context;
|
||||
|
||||
@Test
|
||||
public void minimalConfig() {
|
||||
void minimalConfig() {
|
||||
CassandraMessageHandler handler =
|
||||
TestUtils.getPropertyValue(this.context.getBean("outbound1.adapter"), "handler",
|
||||
CassandraMessageHandler.class);
|
||||
@@ -53,19 +52,20 @@ public class CassandraOutboundAdapterParserTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void ingestConfig() {
|
||||
void ingestConfig() {
|
||||
CassandraMessageHandler handler =
|
||||
TestUtils.getPropertyValue(this.context.getBean("outbound2"), "handler",
|
||||
CassandraMessageHandler.class);
|
||||
|
||||
assertThat(TestUtils.getPropertyValue(handler, "ingestQuery"))
|
||||
.isEqualTo("insert into book (isbn, title, author, pages, saleDate, isInStock) values (?, ?, ?, ?, ?, " +
|
||||
.isEqualTo("insert into book (isbn, title, author, pages, saleDate, isInStock) values (?, ?, ?, ?, ?," +
|
||||
" " +
|
||||
"?)");
|
||||
assertThat(TestUtils.getPropertyValue(handler, "producesReply", Boolean.class)).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void fullConfig() {
|
||||
void fullConfig() {
|
||||
CassandraMessageHandler handler =
|
||||
TestUtils.getPropertyValue(this.context.getBean("outgateway"), "handler",
|
||||
CassandraMessageHandler.class);
|
||||
@@ -76,7 +76,7 @@ public class CassandraOutboundAdapterParserTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void statementConfig() {
|
||||
void statementConfig() {
|
||||
CassandraMessageHandler handler =
|
||||
TestUtils.getPropertyValue(this.context.getBean("outbound4.adapter"), "handler",
|
||||
CassandraMessageHandler.class);
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.springframework.integration.cassandra.config;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.beans.factory.support.RootBeanDefinition;
|
||||
@@ -28,10 +28,10 @@ import org.springframework.integration.cassandra.config.xml.CassandraParserUtils
|
||||
* @author Filippo Balicchia
|
||||
* @author Artem Bilan
|
||||
*/
|
||||
public class CassandraParserUtilsTests {
|
||||
class CassandraParserUtilsTests {
|
||||
|
||||
@Test
|
||||
public void mutuallyExclusiveCase1() {
|
||||
void mutuallyExclusiveCase1() {
|
||||
String query = "";
|
||||
BeanDefinition statementExpressionDef = null;
|
||||
String ingestQuery = "";
|
||||
@@ -39,7 +39,7 @@ public class CassandraParserUtilsTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mutuallyExclusiveCase2() {
|
||||
void mutuallyExclusiveCase2() {
|
||||
String query = "";
|
||||
BeanDefinition statementExpressionDef = null;
|
||||
String ingestQuery =
|
||||
@@ -48,7 +48,7 @@ public class CassandraParserUtilsTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mutuallyExclusiveCase3() {
|
||||
void mutuallyExclusiveCase3() {
|
||||
String query = "";
|
||||
BeanDefinition statementExpressionDef = new RootBeanDefinition();
|
||||
String ingestQuery = "";
|
||||
@@ -56,7 +56,7 @@ public class CassandraParserUtilsTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mutuallyExclusiveCase4() {
|
||||
void mutuallyExclusiveCase4() {
|
||||
String query = "";
|
||||
BeanDefinition statementExpressionDef = new RootBeanDefinition();
|
||||
String ingestQuery =
|
||||
@@ -65,7 +65,7 @@ public class CassandraParserUtilsTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mutuallyExclusiveCase5() {
|
||||
void mutuallyExclusiveCase5() {
|
||||
String query = "SELECT * FROM book limit :size";
|
||||
BeanDefinition statementExpressionDef = new RootBeanDefinition();
|
||||
String ingestQuery = "";
|
||||
@@ -73,7 +73,7 @@ public class CassandraParserUtilsTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mutuallyExclusiveCase6() {
|
||||
void mutuallyExclusiveCase6() {
|
||||
String query = "SELECT * FROM book limit :size";
|
||||
BeanDefinition statementExpressionDef = new RootBeanDefinition();
|
||||
String ingestQuery =
|
||||
@@ -82,7 +82,7 @@ public class CassandraParserUtilsTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mutuallyExclusiveCase7() {
|
||||
void mutuallyExclusiveCase7() {
|
||||
String query = "SELECT * FROM book limit :size";
|
||||
BeanDefinition statementExpressionDef = new RootBeanDefinition();
|
||||
String ingestQuery = "";
|
||||
@@ -90,7 +90,7 @@ public class CassandraParserUtilsTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mutuallyExclusiveCase8() {
|
||||
void mutuallyExclusiveCase8() {
|
||||
String query = "SELECT * FROM book limit :size";
|
||||
BeanDefinition statementExpressionDef = new RootBeanDefinition();
|
||||
String ingestQuery =
|
||||
|
||||
@@ -25,10 +25,9 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.cassandraunit.utils.EmbeddedCassandraServerHelper;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.jupiter.api.AfterAll;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
@@ -52,7 +51,7 @@ import org.springframework.messaging.MessageHandler;
|
||||
import org.springframework.messaging.PollableChannel;
|
||||
import org.springframework.messaging.support.GenericMessage;
|
||||
import org.springframework.test.annotation.DirtiesContext;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
|
||||
|
||||
import com.datastax.driver.core.ConsistencyLevel;
|
||||
import com.datastax.driver.core.querybuilder.QueryBuilder;
|
||||
@@ -64,7 +63,7 @@ import reactor.test.StepVerifier;
|
||||
* @author Soby Chacko
|
||||
* @author Artem Bilan
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringJUnitConfig
|
||||
@DirtiesContext
|
||||
public class CassandraMessageHandlerTests {
|
||||
|
||||
@@ -90,19 +89,19 @@ public class CassandraMessageHandlerTests {
|
||||
@Autowired
|
||||
public FluxMessageChannel resultChannel;
|
||||
|
||||
@BeforeClass
|
||||
public static void startCassandra() throws Exception {
|
||||
@BeforeAll
|
||||
static void startCassandra() throws Exception {
|
||||
EmbeddedCassandraServerHelper.startEmbeddedCassandra(CASSANDRA_CONFIG, "build/embeddedCassandra");
|
||||
EmbeddedCassandraServerHelper.getSession();
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void cleanup() {
|
||||
@AfterAll
|
||||
static void cleanup() {
|
||||
EmbeddedCassandraServerHelper.cleanEmbeddedCassandra();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBasicCassandraInsert() {
|
||||
void testBasicCassandraInsert() {
|
||||
Book b1 = new Book();
|
||||
b1.setIsbn("123456-1");
|
||||
b1.setTitle("Spring Integration Cassandra");
|
||||
@@ -122,7 +121,7 @@ public class CassandraMessageHandlerTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCassandraBatchInsertAndSelectStatement() {
|
||||
void testCassandraBatchInsertAndSelectStatement() {
|
||||
List<Book> books = BookSampler.getBookList(5);
|
||||
|
||||
this.cassandraMessageHandler2.handleMessage(new GenericMessage<>(books));
|
||||
@@ -145,7 +144,7 @@ public class CassandraMessageHandlerTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCassandraBatchIngest() {
|
||||
void testCassandraBatchIngest() {
|
||||
List<Book> books = BookSampler.getBookList(5);
|
||||
List<List<?>> ingestBooks = new ArrayList<>();
|
||||
for (Book b : books) {
|
||||
|
||||
Reference in New Issue
Block a user