diff --git a/spring-integration-cassandra/build.gradle b/spring-integration-cassandra/build.gradle index 1f34122..757d504 100644 --- a/spring-integration-cassandra/build.gradle +++ b/spring-integration-cassandra/build.gradle @@ -1,10 +1,3 @@ -buildscript { - repositories { - maven { url 'https://repo.spring.io/plugins-release' } - } -} - - plugins { id 'java' id 'eclipse' @@ -32,10 +25,11 @@ repositories { ext { assertjVersion = '3.13.2' cassandraUnitVersion = '3.11.2.0' - slf4jVersion = '1.7.28' + junitVersion = '5.5.2' reactorVersion = 'Dysprosium-RELEASE' + slf4jVersion = '1.7.28' springDataVersion = 'Moore-RELEASE' - springIntegrationVersion = '5.2.0.RELEASE' + springIntegrationVersion = '5.2.1.BUILD-SNAPSHOT' idPrefix = 'cassandra' @@ -61,6 +55,7 @@ dependencyManagement { mavenBom "org.springframework.integration:spring-integration-bom:$springIntegrationVersion" mavenBom "org.springframework.data:spring-data-releasetrain:$springDataVersion" mavenBom "io.projectreactor:reactor-bom:$reactorVersion" + mavenBom "org.junit:junit-bom:$junitVersion" } } @@ -94,13 +89,20 @@ dependencies { compile 'org.springframework.integration:spring-integration-core' compile 'org.springframework.data:spring-data-cassandra' - testCompile 'org.springframework.integration:spring-integration-test' + testCompile ('org.springframework.integration:spring-integration-test') { + exclude group: 'junit' + } testCompile "org.assertj:assertj-core:$assertjVersion" - testCompile "org.cassandraunit:cassandra-unit-spring:$cassandraUnitVersion" + testCompile ("org.cassandraunit:cassandra-unit-spring:$cassandraUnitVersion") { + exclude group: 'junit' + } testCompile 'io.projectreactor:reactor-test' + testCompile 'org.junit.jupiter:junit-jupiter-api' testRuntime "org.slf4j:jcl-over-slf4j:$slf4jVersion" + testRuntime 'org.junit.jupiter:junit-jupiter-engine' + testRuntime 'org.junit.platform:junit-platform-launcher' } // enable all compiler warnings; individual projects may customize further @@ -113,6 +115,7 @@ test { append = false destinationFile = file("$buildDir/jacoco.exec") } + useJUnitPlatform() } jacocoTestReport { @@ -128,12 +131,12 @@ build.dependsOn jacocoTestReport task sourcesJar(type: Jar) { - classifier = 'sources' + archiveClassifier = 'sources' from sourceSets.main.allJava } task javadocJar(type: Jar) { - classifier = 'javadoc' + archiveClassifier = 'javadoc' from javadoc } @@ -165,8 +168,8 @@ task api(type: Javadoc) { task schemaZip(type: Zip) { group = 'Distribution' - classifier = 'schema' - description = "Builds -${classifier} archive containing all " + + archiveClassifier = 'schema' + description = "Builds -${archiveClassifier} archive containing all " + "XSDs for deployment at static.springframework.org/schema." def Properties schemas = new Properties(); @@ -190,8 +193,8 @@ task schemaZip(type: Zip) { task docsZip(type: Zip) { group = 'Distribution' - classifier = 'docs' - description = "Builds -${classifier} archive containing api " + + archiveClassifier = 'docs' + description = "Builds -${archiveClassifier} archive containing api " + "for deployment at static.spring.io/spring-integration/docs." from('src/dist') { @@ -205,8 +208,8 @@ task docsZip(type: Zip) { task distZip(type: Zip, dependsOn: [docsZip, schemaZip]) { group = 'Distribution' - classifier = 'dist' - description = "Builds -${classifier} archive, containing all jars and docs, " + + archiveClassifier = 'dist' + description = "Builds -${archiveClassifier} archive, containing all jars and docs, " + "suitable for community download page." ext.baseDir = "${project.name}-${project.version}"; @@ -217,11 +220,11 @@ task distZip(type: Zip, dependsOn: [docsZip, schemaZip]) { into "${baseDir}" } - from(zipTree(docsZip.archivePath)) { + from(zipTree(docsZip.archiveFile)) { into "${baseDir}/docs" } - from(zipTree(schemaZip.archivePath)) { + from(zipTree(schemaZip.archiveFile)) { into "${baseDir}/schema" } @@ -236,11 +239,11 @@ task distZip(type: Zip, dependsOn: [docsZip, schemaZip]) { // Not published by default; only for use when building from source. task depsZip(type: Zip, dependsOn: distZip) { zipTask -> group = 'Distribution' - classifier = 'dist-with-deps' - description = "Builds -${classifier} archive, containing everything " + - "in the -${distZip.classifier} archive plus all dependencies." + archiveClassifier = 'dist-with-deps' + description = "Builds -${archiveClassifier} archive, containing everything " + + "in the -${distZip.archiveClassifier} archive plus all dependencies." - from zipTree(distZip.archivePath) + from zipTree(distZip.archiveFile) gradle.taskGraph.whenReady { taskGraph -> if (taskGraph.hasTask(":${zipTask.name}")) { diff --git a/spring-integration-cassandra/src/test/java/org/springframework/integration/cassandra/config/CassandraOutboundAdapterIntegrationTests.java b/spring-integration-cassandra/src/test/java/org/springframework/integration/cassandra/config/CassandraOutboundAdapterIntegrationTests.java index a9dce33..9a93a64 100644 --- a/spring-integration-cassandra/src/test/java/org/springframework/integration/cassandra/config/CassandraOutboundAdapterIntegrationTests.java +++ b/spring-integration-cassandra/src/test/java/org/springframework/integration/cassandra/config/CassandraOutboundAdapterIntegrationTests.java @@ -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 message = MessageBuilder.withPayload(b1).build(); this.cassandraMessageHandler1.send(message); @@ -102,7 +101,7 @@ public class CassandraOutboundAdapterIntegrationTests { } @Test - public void testCassandraBatchInsertAndSelectStatement() { + void testCassandraBatchInsertAndSelectStatement() { List 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 books = BookSampler.getBookList(5); List> ingestBooks = new ArrayList<>(); for (Book b : books) { @@ -148,7 +147,7 @@ public class CassandraOutboundAdapterIntegrationTests { } @Test - public void testExpressionTruncate() { + void testExpressionTruncate() { Message message = MessageBuilder.withPayload(BookSampler.getBook()).build(); this.cassandraMessageHandler1.send(message); Select select = QueryBuilder.select().all().from("book"); diff --git a/spring-integration-cassandra/src/test/java/org/springframework/integration/cassandra/config/CassandraOutboundAdapterParserTests.java b/spring-integration-cassandra/src/test/java/org/springframework/integration/cassandra/config/CassandraOutboundAdapterParserTests.java index 8ca68c0..c1794a8 100644 --- a/spring-integration-cassandra/src/test/java/org/springframework/integration/cassandra/config/CassandraOutboundAdapterParserTests.java +++ b/spring-integration-cassandra/src/test/java/org/springframework/integration/cassandra/config/CassandraOutboundAdapterParserTests.java @@ -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); diff --git a/spring-integration-cassandra/src/test/java/org/springframework/integration/cassandra/config/CassandraParserUtilsTests.java b/spring-integration-cassandra/src/test/java/org/springframework/integration/cassandra/config/CassandraParserUtilsTests.java index 5e8599c..3d97c68 100644 --- a/spring-integration-cassandra/src/test/java/org/springframework/integration/cassandra/config/CassandraParserUtilsTests.java +++ b/spring-integration-cassandra/src/test/java/org/springframework/integration/cassandra/config/CassandraParserUtilsTests.java @@ -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 = diff --git a/spring-integration-cassandra/src/test/java/org/springframework/integration/cassandra/outbound/CassandraMessageHandlerTests.java b/spring-integration-cassandra/src/test/java/org/springframework/integration/cassandra/outbound/CassandraMessageHandlerTests.java index 5588c79..884e0bf 100644 --- a/spring-integration-cassandra/src/test/java/org/springframework/integration/cassandra/outbound/CassandraMessageHandlerTests.java +++ b/spring-integration-cassandra/src/test/java/org/springframework/integration/cassandra/outbound/CassandraMessageHandlerTests.java @@ -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 books = BookSampler.getBookList(5); this.cassandraMessageHandler2.handleMessage(new GenericMessage<>(books)); @@ -145,7 +144,7 @@ public class CassandraMessageHandlerTests { } @Test - public void testCassandraBatchIngest() { + void testCassandraBatchIngest() { List books = BookSampler.getBookList(5); List> ingestBooks = new ArrayList<>(); for (Book b : books) {