This is an automated email from the ASF dual-hosted git repository. aldettinger pushed a commit to branch CAMEL-13965 in repository https://gitbox.apache.org/repos/asf/camel.git
commit fbeb9ca5051cdd6fe8b0c9c2983e44f6f8654d65 Author: aldettinger <aldettin...@gmail.com> AuthorDate: Fri Oct 25 14:00:19 2019 +0200 CAMEL-14084: Migrated camel-consul tests to camel-testcontainers-spring-junit5 --- components/camel-consul/pom.xml | 2 +- .../SpringConsulDefaultServiceCallRouteTest.java | 12 +++++------ ...SpringConsulExpressionServiceCallRouteTest.java | 12 +++++------ .../SpringConsulRibbonServiceCallRouteTest.java | 12 +++++------ .../cloud/SpringConsulServiceCallRouteTest.java | 8 +++---- .../main/docs/testcontainers-spring-junit5.adoc | 25 +++++++++++++++++++--- docs/components/modules/ROOT/pages/index.adoc | 4 +++- .../ROOT/pages/testcontainers-spring-junit5.adoc | 25 +++++++++++++++++++--- 8 files changed, 70 insertions(+), 30 deletions(-) diff --git a/components/camel-consul/pom.xml b/components/camel-consul/pom.xml index 65eef4f..282cfed 100644 --- a/components/camel-consul/pom.xml +++ b/components/camel-consul/pom.xml @@ -50,7 +50,7 @@ <!-- testing --> <dependency> <groupId>org.apache.camel</groupId> - <artifactId>camel-testcontainers-spring</artifactId> + <artifactId>camel-testcontainers-spring-junit5</artifactId> <scope>test</scope> </dependency> <dependency> diff --git a/components/camel-consul/src/test/java/org/apache/camel/component/consul/cloud/SpringConsulDefaultServiceCallRouteTest.java b/components/camel-consul/src/test/java/org/apache/camel/component/consul/cloud/SpringConsulDefaultServiceCallRouteTest.java index a5bfb2d..3fb9c09 100644 --- a/components/camel-consul/src/test/java/org/apache/camel/component/consul/cloud/SpringConsulDefaultServiceCallRouteTest.java +++ b/components/camel-consul/src/test/java/org/apache/camel/component/consul/cloud/SpringConsulDefaultServiceCallRouteTest.java @@ -20,8 +20,8 @@ import java.util.List; import org.apache.camel.component.ribbon.cloud.RibbonServiceLoadBalancer; import org.apache.camel.impl.cloud.DefaultServiceCallProcessor; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import org.springframework.context.support.AbstractApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; @@ -35,9 +35,9 @@ public class SpringConsulDefaultServiceCallRouteTest extends SpringConsulService public void testServiceCallConfiguration() { List<DefaultServiceCallProcessor> processors = findServiceCallProcessors(); - Assert.assertFalse(processors.isEmpty()); - Assert.assertEquals(2, processors.size()); - Assert.assertFalse(processors.get(0).getLoadBalancer() instanceof RibbonServiceLoadBalancer); - Assert.assertFalse(processors.get(1).getLoadBalancer() instanceof RibbonServiceLoadBalancer); + Assertions.assertFalse(processors.isEmpty()); + Assertions.assertEquals(2, processors.size()); + Assertions.assertFalse(processors.get(0).getLoadBalancer() instanceof RibbonServiceLoadBalancer); + Assertions.assertFalse(processors.get(1).getLoadBalancer() instanceof RibbonServiceLoadBalancer); } } diff --git a/components/camel-consul/src/test/java/org/apache/camel/component/consul/cloud/SpringConsulExpressionServiceCallRouteTest.java b/components/camel-consul/src/test/java/org/apache/camel/component/consul/cloud/SpringConsulExpressionServiceCallRouteTest.java index 79f5e98..d913c76 100644 --- a/components/camel-consul/src/test/java/org/apache/camel/component/consul/cloud/SpringConsulExpressionServiceCallRouteTest.java +++ b/components/camel-consul/src/test/java/org/apache/camel/component/consul/cloud/SpringConsulExpressionServiceCallRouteTest.java @@ -20,8 +20,8 @@ import java.util.List; import org.apache.camel.component.ribbon.cloud.RibbonServiceLoadBalancer; import org.apache.camel.impl.cloud.DefaultServiceCallProcessor; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import org.springframework.context.support.AbstractApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; @@ -35,9 +35,9 @@ public class SpringConsulExpressionServiceCallRouteTest extends SpringConsulServ public void testServiceCallConfiguration() { List<DefaultServiceCallProcessor> processors = findServiceCallProcessors(); - Assert.assertFalse(processors.isEmpty()); - Assert.assertEquals(2, processors.size()); - Assert.assertFalse(processors.get(0).getLoadBalancer() instanceof RibbonServiceLoadBalancer); - Assert.assertFalse(processors.get(1).getLoadBalancer() instanceof RibbonServiceLoadBalancer); + Assertions.assertFalse(processors.isEmpty()); + Assertions.assertEquals(2, processors.size()); + Assertions.assertFalse(processors.get(0).getLoadBalancer() instanceof RibbonServiceLoadBalancer); + Assertions.assertFalse(processors.get(1).getLoadBalancer() instanceof RibbonServiceLoadBalancer); } } diff --git a/components/camel-consul/src/test/java/org/apache/camel/component/consul/cloud/SpringConsulRibbonServiceCallRouteTest.java b/components/camel-consul/src/test/java/org/apache/camel/component/consul/cloud/SpringConsulRibbonServiceCallRouteTest.java index e3fbb6f..0941097 100644 --- a/components/camel-consul/src/test/java/org/apache/camel/component/consul/cloud/SpringConsulRibbonServiceCallRouteTest.java +++ b/components/camel-consul/src/test/java/org/apache/camel/component/consul/cloud/SpringConsulRibbonServiceCallRouteTest.java @@ -20,8 +20,8 @@ import java.util.List; import org.apache.camel.component.ribbon.cloud.RibbonServiceLoadBalancer; import org.apache.camel.impl.cloud.DefaultServiceCallProcessor; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import org.springframework.context.support.AbstractApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; @@ -35,9 +35,9 @@ public class SpringConsulRibbonServiceCallRouteTest extends SpringConsulServiceC public void testServiceCallConfiguration() { List<DefaultServiceCallProcessor> processors = findServiceCallProcessors(); - Assert.assertFalse(processors.isEmpty()); - Assert.assertEquals(2, processors.size()); - Assert.assertTrue(processors.get(0).getLoadBalancer() instanceof RibbonServiceLoadBalancer); - Assert.assertTrue(processors.get(1).getLoadBalancer() instanceof RibbonServiceLoadBalancer); + Assertions.assertFalse(processors.isEmpty()); + Assertions.assertEquals(2, processors.size()); + Assertions.assertTrue(processors.get(0).getLoadBalancer() instanceof RibbonServiceLoadBalancer); + Assertions.assertTrue(processors.get(1).getLoadBalancer() instanceof RibbonServiceLoadBalancer); } } diff --git a/components/camel-consul/src/test/java/org/apache/camel/component/consul/cloud/SpringConsulServiceCallRouteTest.java b/components/camel-consul/src/test/java/org/apache/camel/component/consul/cloud/SpringConsulServiceCallRouteTest.java index 68de60c..6732c02 100644 --- a/components/camel-consul/src/test/java/org/apache/camel/component/consul/cloud/SpringConsulServiceCallRouteTest.java +++ b/components/camel-consul/src/test/java/org/apache/camel/component/consul/cloud/SpringConsulServiceCallRouteTest.java @@ -31,9 +31,9 @@ import org.apache.camel.component.consul.ConsulTestSupport; import org.apache.camel.impl.cloud.DefaultServiceCallProcessor; import org.apache.camel.processor.ChoiceProcessor; import org.apache.camel.processor.FilterProcessor; -import org.apache.camel.test.testcontainers.spring.ContainerAwareSpringTestSupport; -import org.junit.Assert; -import org.junit.Test; +import org.apache.camel.test.testcontainers.spring.junit5.ContainerAwareSpringTestSupport; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import org.testcontainers.containers.GenericContainer; public abstract class SpringConsulServiceCallRouteTest extends ContainerAwareSpringTestSupport { @@ -130,7 +130,7 @@ public abstract class SpringConsulServiceCallRouteTest extends ContainerAwareSpr protected List<DefaultServiceCallProcessor> findServiceCallProcessors() { Route route = context().getRoute("scall"); - Assert.assertNotNull("ServiceCall Route should be present", route); + Assertions.assertNotNull(route, "ServiceCall Route should be present"); return findServiceCallProcessors(new ArrayList<>(), route.navigate()); } diff --git a/components/camel-testcontainers-spring-junit5/src/main/docs/testcontainers-spring-junit5.adoc b/components/camel-testcontainers-spring-junit5/src/main/docs/testcontainers-spring-junit5.adoc index 96b3347..7338f04 100644 --- a/components/camel-testcontainers-spring-junit5/src/main/docs/testcontainers-spring-junit5.adoc +++ b/components/camel-testcontainers-spring-junit5/src/main/docs/testcontainers-spring-junit5.adoc @@ -1,9 +1,28 @@ = Testcontainers Spring -*Available since 2.22.0* +*Available since 3.0.0* -Testing camel components is sometime complex because the 3th party system a component interacts with does not provide testing facilities and/or is only available as a native application. To reduce this complexity, *Camel Testcontainers Spring* extends camel spring test support providing a way to create and interact with containerized applications. +Testing camel components is sometime complex because the 3th party system a component interacts with does not provide testing facilities and/or is only available as a native application. To reduce this complexity, *Camel Testcontainers Spring JUnit 5* extends camel spring test support providing a way to create and interact with containerized applications. -This module is an extension to the camel-testcontainers component to add support for Spring. +This module is an extension to the camel-testcontainers-junit5 component to add support for Spring. Therefore see the documentation for testcontainers for more details. +== Migrating Camel Testcontainers Spring Tests from JUnit 4 to JUnit 5 +Find below some hints to help in migrating camel testcontainers spring tests from JUnit 4 to JUnit 5. + +=== Referencing the Camel Testcontainers Spring JUnit5 library in your project +Projects using `camel-testcontainers-spring` would need to use `camel-testcontainers-spring-junit5`. For instance, maven users would update their pom.xml file as below: +---- +<dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-testcontainers-spring-junit5</artifactId> + <scope>test</scope> +</dependency> +---- + +Tips: It's possible to run JUnit4 & JUnit5 based camel tests side by side including the following dependencies `camel-testcontainers-spring`, +`camel-testcontainers-spring-junit5` and `junit-vintage-engine`. This configuration allows to migrate a camel test at once. + +=== Typical migration steps linked to JUnit 5 support in Camel Testcontainers Spring +* Migration steps linked to xref:components::testcontainers-junit5.adoc[JUnit 5 support in Camel Testcontainers itself] should have been applied first +* Imports of `org.apache.camel.test.testcontainers.spring.\*` should be replaced with `org.apache.camel.test.testcontainers.spring.junit5.*` \ No newline at end of file diff --git a/docs/components/modules/ROOT/pages/index.adoc b/docs/components/modules/ROOT/pages/index.adoc index 0614488..3134560 100644 --- a/docs/components/modules/ROOT/pages/index.adoc +++ b/docs/components/modules/ROOT/pages/index.adoc @@ -762,7 +762,7 @@ Number of Languages: 17 in 11 JAR artifacts (0 deprecated) == Miscellaneous Components // others: START -Number of Miscellaneous Components: 38 in 38 JAR artifacts (0 deprecated) +Number of Miscellaneous Components: 39 in 39 JAR artifacts (0 deprecated) [width="100%",cols="4,1,5",options="header"] |=== @@ -776,6 +776,8 @@ Number of Miscellaneous Components: 38 in 38 JAR artifacts (0 deprecated) | xref:cdi.adoc[CDI] (camel-cdi) | 2.10 | Using Camel with CDI +| xref:consul.adoc[Consul] (camel-consul) | | Camel Consul support + | xref:cxf-transport.adoc[CXF Transport] (camel-cxf-transport) | 2.8 | Camel Transport for Apache CXF | xref:hystrix.adoc[Hystrix] (camel-hystrix) | 2.18 | Circuit Breaker EIP using Netflix Hystrix diff --git a/docs/components/modules/ROOT/pages/testcontainers-spring-junit5.adoc b/docs/components/modules/ROOT/pages/testcontainers-spring-junit5.adoc index 86b1f77..0519db3 100644 --- a/docs/components/modules/ROOT/pages/testcontainers-spring-junit5.adoc +++ b/docs/components/modules/ROOT/pages/testcontainers-spring-junit5.adoc @@ -1,10 +1,29 @@ = Testcontainers Spring :page-source: components/camel-testcontainers-spring-junit5/src/main/docs/testcontainers-spring-junit5.adoc -*Available since 2.22.0* +*Available since 3.0.0* -Testing camel components is sometime complex because the 3th party system a component interacts with does not provide testing facilities and/or is only available as a native application. To reduce this complexity, *Camel Testcontainers Spring* extends camel spring test support providing a way to create and interact with containerized applications. +Testing camel components is sometime complex because the 3th party system a component interacts with does not provide testing facilities and/or is only available as a native application. To reduce this complexity, *Camel Testcontainers Spring JUnit 5* extends camel spring test support providing a way to create and interact with containerized applications. -This module is an extension to the camel-testcontainers component to add support for Spring. +This module is an extension to the camel-testcontainers-junit5 component to add support for Spring. Therefore see the documentation for testcontainers for more details. +== Migrating Camel Testcontainers Spring Tests from JUnit 4 to JUnit 5 +Find below some hints to help in migrating camel testcontainers spring tests from JUnit 4 to JUnit 5. + +=== Referencing the Camel Testcontainers Spring JUnit5 library in your project +Projects using `camel-testcontainers-spring` would need to use `camel-testcontainers-spring-junit5`. For instance, maven users would update their pom.xml file as below: +---- +<dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-testcontainers-spring-junit5</artifactId> + <scope>test</scope> +</dependency> +---- + +Tips: It's possible to run JUnit4 & JUnit5 based camel tests side by side including the following dependencies `camel-testcontainers-spring`, +`camel-testcontainers-spring-junit5` and `junit-vintage-engine`. This configuration allows to migrate a camel test at once. + +=== Typical migration steps linked to JUnit 5 support in Camel Testcontainers Spring +* Migration steps linked to xref:components::testcontainers-junit5.adoc[JUnit 5 support in Camel Testcontainers itself] should have been applied first +* Imports of `org.apache.camel.test.testcontainers.spring.\*` should be replaced with `org.apache.camel.test.testcontainers.spring.junit5.*` \ No newline at end of file