This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/main by this push:
     new f2199b2  CAMEL-16602: Use test-infra for testing
f2199b2 is described below

commit f2199b237b2e405957e89bda9e357439520eb78c
Author: Claus Ibsen <[email protected]>
AuthorDate: Tue May 11 13:34:07 2021 +0200

    CAMEL-16602: Use test-infra for testing
---
 components/camel-kamelet-reify/pom.xml             | 41 ++++--------------
 ...eletReifyBasicTest.java => KameletReifyIT.java} | 48 +++++++++++-----------
 2 files changed, 31 insertions(+), 58 deletions(-)

diff --git a/components/camel-kamelet-reify/pom.xml 
b/components/camel-kamelet-reify/pom.xml
index 26e59f8..2b596a3 100644
--- a/components/camel-kamelet-reify/pom.xml
+++ b/components/camel-kamelet-reify/pom.xml
@@ -43,37 +43,22 @@
             <artifactId>camel-core-model</artifactId>
         </dependency>
 
-        <!-- TESTS  -->
+        <!-- test infra -->
         <dependency>
             <groupId>org.apache.camel</groupId>
-            <artifactId>camel-groovy</artifactId>
+            <artifactId>camel-test-infra-common</artifactId>
+            <version>${project.version}</version>
+            <type>test-jar</type>
             <scope>test</scope>
         </dependency>
         <dependency>
             <groupId>org.apache.camel</groupId>
-            <artifactId>camel-joor</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.camel</groupId>
-            <artifactId>camel-timer</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.camel</groupId>
-            <artifactId>camel-log</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.camel</groupId>
-            <artifactId>camel-mock</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.camel</groupId>
-            <artifactId>camel-direct</artifactId>
+            <artifactId>camel-test-infra-activemq</artifactId>
+            <version>${project.version}</version>
             <scope>test</scope>
+            <type>test-jar</type>
         </dependency>
+
         <dependency>
             <groupId>org.apache.camel</groupId>
             <artifactId>camel-test-junit5</artifactId>
@@ -81,16 +66,6 @@
         </dependency>
         <dependency>
             <groupId>org.apache.camel</groupId>
-            <artifactId>camel-testcontainers-junit5</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.camel</groupId>
-            <artifactId>camel-http</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.camel</groupId>
             <artifactId>camel-activemq</artifactId>
             <scope>test</scope>
         </dependency>
diff --git 
a/components/camel-kamelet-reify/src/test/java/org/apache/camel/component/kameletreify/KameletReifyBasicTest.java
 
b/components/camel-kamelet-reify/src/test/java/org/apache/camel/component/kameletreify/KameletReifyIT.java
similarity index 72%
rename from 
components/camel-kamelet-reify/src/test/java/org/apache/camel/component/kameletreify/KameletReifyBasicTest.java
rename to 
components/camel-kamelet-reify/src/test/java/org/apache/camel/component/kameletreify/KameletReifyIT.java
index 2852604..8d8c34a 100644
--- 
a/components/camel-kamelet-reify/src/test/java/org/apache/camel/component/kameletreify/KameletReifyBasicTest.java
+++ 
b/components/camel-kamelet-reify/src/test/java/org/apache/camel/component/kameletreify/KameletReifyIT.java
@@ -25,24 +25,33 @@ import org.apache.camel.BindToRegistry;
 import org.apache.camel.PropertyInject;
 import org.apache.camel.RoutesBuilder;
 import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.test.testcontainers.junit5.ContainerAwareTestSupport;
-import org.apache.http.annotation.Obsolete;
+import org.apache.camel.test.AvailablePortFinder;
+import org.apache.camel.test.infra.activemq.services.ActiveMQEmbeddedService;
+import 
org.apache.camel.test.infra.activemq.services.ActiveMQEmbeddedServiceBuilder;
+import org.apache.camel.test.junit5.CamelTestSupport;
 import org.junit.jupiter.api.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.testcontainers.containers.GenericContainer;
-import org.testcontainers.containers.output.Slf4jLogConsumer;
-import org.testcontainers.containers.wait.strategy.Wait;
+import org.junit.jupiter.api.extension.RegisterExtension;
 
 import static org.assertj.core.api.Assertions.assertThat;
 
-public class KameletReifyBasicTest extends ContainerAwareTestSupport {
-    private static final Logger LOGGER = 
LoggerFactory.getLogger(KameletReifyBasicTest.class);
-    private static final String CONTAINER_NAME = "activemq";
-    private static final String CONTAINER_IMAGE = 
"rmohr/activemq:5.15.9-alpine";
-    private static final int TCP_PORT = 61616;
+public class KameletReifyIT extends CamelTestSupport {
+
+    static int tcpPort = AvailablePortFinder.getNextAvailable();
+
+    @RegisterExtension
+    public static ActiveMQEmbeddedService service = 
ActiveMQEmbeddedServiceBuilder
+            .bare()
+            .withPersistent(false)
+            .withTcpTransport(tcpPort)
+            .build();
+
     private static final String QUEUE_NAME = "my-queue";
 
+    @Override
+    protected boolean useJmx() {
+        return false;
+    }
+
     @Test
     public void componentsAreWrapped() throws Exception {
         assertThat(context().getComponentNames())
@@ -74,7 +83,7 @@ public class KameletReifyBasicTest extends 
ContainerAwareTestSupport {
     //
     // **********************************************
 
-    @Obsolete
+    @Override
     protected RoutesBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {
             @Override
@@ -88,19 +97,8 @@ public class KameletReifyBasicTest extends 
ContainerAwareTestSupport {
     }
 
     @Override
-    protected GenericContainer<?> createContainer() {
-        return new GenericContainer<>(CONTAINER_IMAGE)
-                .withNetworkAliases(CONTAINER_NAME)
-                .withExposedPorts(TCP_PORT)
-                .withLogConsumer(new Slf4jLogConsumer(LOGGER))
-                .waitingFor(Wait.forListeningPort());
-    }
-
-    @Override
     protected Properties useOverridePropertiesWithPropertiesComponent() {
-        final String host = getContainerHost(CONTAINER_NAME);
-        final int port = getContainerPort(CONTAINER_NAME, TCP_PORT);
-        final String brokerUrl = String.format("tcp://%s:%d", host, port);
+        final String brokerUrl = String.format("tcp://localhost:%d", tcpPort);
 
         Properties properties = new Properties();
         properties.setProperty("amqBrokerUrl", brokerUrl);

Reply via email to