You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ja...@apache.org on 2023/09/25 18:20:28 UTC

[camel-quarkus] branch main updated (b17705396f -> 9e62edc298)

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

jamesnetherton pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git


    from b17705396f Upgrade to Quarkus CXF 2.4.1
     new fe592f16d3 Create basic Azure Servicebus tests
     new 9e62edc298 Implement comments from review

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 integration-tests-jvm/azure-servicebus/pom.xml     | 60 +++++++++++++++++++++-
 .../servicebus/it/AzureServiceBusResource.java     | 37 +++++++------
 .../servicebus/it/AzureServiceBusRoutes.java}      | 34 ++++++------
 .../servicebus/it/AzureServicebusResource.java     | 50 ------------------
 .../src/main/resources/application.properties      |  4 +-
 .../azure/servicebus/it/AzureServiceBusTest.java   | 41 +++++++--------
 .../azure/servicebus/it/AzureServicebusTest.java   | 34 ------------
 7 files changed, 116 insertions(+), 144 deletions(-)
 copy integration-test-groups/foundation/bean/src/main/java/org/apache/camel/quarkus/component/bean/eip/EipResource.java => integration-tests-jvm/azure-servicebus/src/main/java/org/apache/camel/quarkus/component/azure/servicebus/it/AzureServiceBusResource.java (59%)
 copy integration-tests-jvm/{redis/src/main/java/org/apache/camel/quarkus/component/redis/it/RedisRoute.java => azure-servicebus/src/main/java/org/apache/camel/quarkus/component/azure/servicebus/it/AzureServiceBusRoutes.java} (55%)
 delete mode 100644 integration-tests-jvm/azure-servicebus/src/main/java/org/apache/camel/quarkus/component/azure/servicebus/it/AzureServicebusResource.java
 copy {integration-test-groups/aws2-quarkus-client/aws2-sqs => integration-tests-jvm/azure-servicebus}/src/main/resources/application.properties (92%)
 copy integration-tests/hazelcast/src/test/java/org/apache/camel/quarkus/component/hazelcast/it/HazelcastTopicTest.java => integration-tests-jvm/azure-servicebus/src/test/java/org/apache/camel/quarkus/component/azure/servicebus/it/AzureServiceBusTest.java (51%)
 delete mode 100644 integration-tests-jvm/azure-servicebus/src/test/java/org/apache/camel/quarkus/component/azure/servicebus/it/AzureServicebusTest.java


[camel-quarkus] 01/02: Create basic Azure Servicebus tests

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit fe592f16d364ba8595c63af73b0eee677be1d7e1
Author: Lucia Drozdova <ld...@redhat.com>
AuthorDate: Fri Sep 22 09:25:57 2023 +0200

    Create basic Azure Servicebus tests
---
 integration-tests-jvm/azure-servicebus/pom.xml     | 21 ++++++++
 ...sResource.java => AzureServiceBusResource.java} | 40 +++++++++-------
 .../azure/servicebus/it/AzureServiceBusRoutes.java | 45 +++++++++++++++++
 .../src/main/resources/application.properties      | 17 +++++++
 .../azure/servicebus/it/AzureServiceBusTest.java   | 56 ++++++++++++++++++++++
 .../azure/servicebus/it/AzureServicebusTest.java   | 34 -------------
 6 files changed, 163 insertions(+), 50 deletions(-)

diff --git a/integration-tests-jvm/azure-servicebus/pom.xml b/integration-tests-jvm/azure-servicebus/pom.xml
index 7bec5c3a5f..25bb7a6fd6 100644
--- a/integration-tests-jvm/azure-servicebus/pom.xml
+++ b/integration-tests-jvm/azure-servicebus/pom.xml
@@ -58,6 +58,22 @@
             <groupId>io.quarkus</groupId>
             <artifactId>quarkus-resteasy</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-direct</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-mock</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>io.quarkus</groupId>
+            <artifactId>quarkus-resteasy</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>io.quarkus</groupId>
+            <artifactId>quarkus-resteasy-jsonb</artifactId>
+        </dependency>
 
         <!-- test dependencies -->
         <dependency>
@@ -70,6 +86,11 @@
             <artifactId>rest-assured</artifactId>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>org.awaitility</groupId>
+            <artifactId>awaitility</artifactId>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
 
     <profiles>
diff --git a/integration-tests-jvm/azure-servicebus/src/main/java/org/apache/camel/quarkus/component/azure/servicebus/it/AzureServicebusResource.java b/integration-tests-jvm/azure-servicebus/src/main/java/org/apache/camel/quarkus/component/azure/servicebus/it/AzureServiceBusResource.java
similarity index 56%
rename from integration-tests-jvm/azure-servicebus/src/main/java/org/apache/camel/quarkus/component/azure/servicebus/it/AzureServicebusResource.java
rename to integration-tests-jvm/azure-servicebus/src/main/java/org/apache/camel/quarkus/component/azure/servicebus/it/AzureServiceBusResource.java
index d1a03193bd..d095a81e5b 100644
--- a/integration-tests-jvm/azure-servicebus/src/main/java/org/apache/camel/quarkus/component/azure/servicebus/it/AzureServicebusResource.java
+++ b/integration-tests-jvm/azure-servicebus/src/main/java/org/apache/camel/quarkus/component/azure/servicebus/it/AzureServiceBusResource.java
@@ -16,35 +16,43 @@
  */
 package org.apache.camel.quarkus.component.azure.servicebus.it;
 
+import java.util.List;
+import java.util.stream.Collectors;
+
 import jakarta.enterprise.context.ApplicationScoped;
 import jakarta.inject.Inject;
 import jakarta.ws.rs.GET;
 import jakarta.ws.rs.Path;
 import jakarta.ws.rs.Produces;
 import jakarta.ws.rs.core.MediaType;
-import jakarta.ws.rs.core.Response;
 import org.apache.camel.CamelContext;
-import org.jboss.logging.Logger;
+import org.apache.camel.Exchange;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.component.mock.MockEndpoint;
 
 @Path("/azure-servicebus")
 @ApplicationScoped
-public class AzureServicebusResource {
-
-    private static final Logger LOG = Logger.getLogger(AzureServicebusResource.class);
-
-    private static final String COMPONENT_AZURE_SERVICEBUS = "azure-servicebus";
+public class AzureServiceBusResource {
+    @Inject
+    ProducerTemplate producerTemplate;
     @Inject
     CamelContext context;
 
-    @Path("/load/component/azure-servicebus")
+    @Path("/producer")
+    @GET
+    @Produces(MediaType.APPLICATION_JSON)
+    public List<String> getBasicProducer() throws Exception {
+        return producerTemplate.requestBody("direct:producer-test", null, List.class);
+    }
+
+    @Path("/consumer")
     @GET
-    @Produces(MediaType.TEXT_PLAIN)
-    public Response loadComponentAzureServicebus() throws Exception {
-        /* This is an autogenerated test */
-        if (context.getComponent(COMPONENT_AZURE_SERVICEBUS) != null) {
-            return Response.ok().build();
-        }
-        LOG.warnf("Could not load [%s] from the Camel context", COMPONENT_AZURE_SERVICEBUS);
-        return Response.status(500, COMPONENT_AZURE_SERVICEBUS + " could not be loaded from the Camel context").build();
+    @Produces(MediaType.APPLICATION_JSON)
+    public List<String> getBasicConsumer() throws Exception {
+        final MockEndpoint mockEndpoint = context.getEndpoint("mock:azure-servicebus-consumed", MockEndpoint.class);
+        return mockEndpoint.getReceivedExchanges().stream()
+                .map(Exchange::getMessage)
+                .map(m -> m.getBody(String.class))
+                .collect(Collectors.toList());
     }
 }
diff --git a/integration-tests-jvm/azure-servicebus/src/main/java/org/apache/camel/quarkus/component/azure/servicebus/it/AzureServiceBusRoutes.java b/integration-tests-jvm/azure-servicebus/src/main/java/org/apache/camel/quarkus/component/azure/servicebus/it/AzureServiceBusRoutes.java
new file mode 100644
index 0000000000..9ed3c4fc01
--- /dev/null
+++ b/integration-tests-jvm/azure-servicebus/src/main/java/org/apache/camel/quarkus/component/azure/servicebus/it/AzureServiceBusRoutes.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.quarkus.component.azure.servicebus.it;
+
+import java.util.Arrays;
+import java.util.List;
+
+import jakarta.enterprise.context.ApplicationScoped;
+import org.apache.camel.builder.RouteBuilder;
+import org.eclipse.microprofile.config.inject.ConfigProperty;
+
+@ApplicationScoped
+public class AzureServiceBusRoutes extends RouteBuilder {
+
+    @ConfigProperty(name = "azure.servicebus.connection-string")
+    String azureServiceBusConnectionString;
+
+    @Override
+    public void configure() {
+        from("direct:producer-test")
+                .process(exchange -> {
+                    final List<String> inputBatch = Arrays.asList("Bulbasaur", "Pikachu", "Charizard", "Squirtle");
+                    exchange.getIn().setBody(inputBatch);
+                })
+                .to("azure-servicebus:test?connectionString=RAW(" + azureServiceBusConnectionString + ")");
+
+        from("azure-servicebus:test?connectionString=RAW(" + azureServiceBusConnectionString + ")")
+                .log("${body}")
+                .to("mock:azure-servicebus-consumed");
+    }
+}
diff --git a/integration-tests-jvm/azure-servicebus/src/main/resources/application.properties b/integration-tests-jvm/azure-servicebus/src/main/resources/application.properties
new file mode 100644
index 0000000000..8b6c11687c
--- /dev/null
+++ b/integration-tests-jvm/azure-servicebus/src/main/resources/application.properties
@@ -0,0 +1,17 @@
+## ---------------------------------------------------------------------------
+## Licensed to the Apache Software Foundation (ASF) under one or more
+## contributor license agreements.  See the NOTICE file distributed with
+## this work for additional information regarding copyright ownership.
+## The ASF licenses this file to You under the Apache License, Version 2.0
+## (the "License"); you may not use this file except in compliance with
+## the License.  You may obtain a copy of the License at
+##
+##      http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+## ---------------------------------------------------------------------------
+azure.servicebus.connection-string=${AZURE_SERVICEBUS_CONNECTION_STRING}
diff --git a/integration-tests-jvm/azure-servicebus/src/test/java/org/apache/camel/quarkus/component/azure/servicebus/it/AzureServiceBusTest.java b/integration-tests-jvm/azure-servicebus/src/test/java/org/apache/camel/quarkus/component/azure/servicebus/it/AzureServiceBusTest.java
new file mode 100644
index 0000000000..889738f9b9
--- /dev/null
+++ b/integration-tests-jvm/azure-servicebus/src/test/java/org/apache/camel/quarkus/component/azure/servicebus/it/AzureServiceBusTest.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.quarkus.component.azure.servicebus.it;
+
+import java.util.Arrays;
+import java.util.List;
+
+import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.RestAssured;
+import io.restassured.http.ContentType;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable;
+
+@EnabledIfEnvironmentVariable(named = "AZURE_SERVICEBUS_CONNECTION_STRING", matches = ".+")
+@QuarkusTest
+class AzureServiceBusTest {
+
+    final List<String> inputBatch = Arrays.asList("Bulbasaur", "Pikachu", "Charizard", "Squirtle");
+
+    @Test
+    public void basicProducerConsumerTest() {
+        final List sentMessages = RestAssured.given()
+                .get("/azure-servicebus/producer")
+                .then().statusCode(200).extract().body().as(List.class);
+
+        Assertions.assertEquals(inputBatch, sentMessages);
+    }
+
+    @Test
+    public void basicConsumerTest() {
+        final List consumedMessages = RestAssured.given()
+                .contentType(ContentType.JSON)
+                .get("/azure-servicebus/consumer")
+                .then()
+                .extract().body().as(List.class);
+
+        Assertions.assertFalse(consumedMessages.isEmpty());
+        Assertions.assertTrue(consumedMessages.stream().anyMatch(inputBatch::contains));
+    }
+
+}
diff --git a/integration-tests-jvm/azure-servicebus/src/test/java/org/apache/camel/quarkus/component/azure/servicebus/it/AzureServicebusTest.java b/integration-tests-jvm/azure-servicebus/src/test/java/org/apache/camel/quarkus/component/azure/servicebus/it/AzureServicebusTest.java
deleted file mode 100644
index 166b446805..0000000000
--- a/integration-tests-jvm/azure-servicebus/src/test/java/org/apache/camel/quarkus/component/azure/servicebus/it/AzureServicebusTest.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.quarkus.component.azure.servicebus.it;
-
-import io.quarkus.test.junit.QuarkusTest;
-import io.restassured.RestAssured;
-import org.junit.jupiter.api.Test;
-
-@QuarkusTest
-class AzureServicebusTest {
-
-    @Test
-    public void loadComponentAzureServicebus() {
-        /* A simple autogenerated test */
-        RestAssured.get("/azure-servicebus/load/component/azure-servicebus")
-                .then()
-                .statusCode(200);
-    }
-
-}


[camel-quarkus] 02/02: Implement comments from review

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 9e62edc298921bb24cffad4c54297ab23506388d
Author: Lucia Drozdova <ld...@redhat.com>
AuthorDate: Fri Sep 22 14:55:50 2023 +0200

    Implement comments from review
---
 integration-tests-jvm/azure-servicebus/pom.xml     | 39 +++++++++++++++++++++-
 .../azure/servicebus/it/AzureServiceBusTest.java   |  4 ---
 2 files changed, 38 insertions(+), 5 deletions(-)

diff --git a/integration-tests-jvm/azure-servicebus/pom.xml b/integration-tests-jvm/azure-servicebus/pom.xml
index 25bb7a6fd6..2a189f9528 100644
--- a/integration-tests-jvm/azure-servicebus/pom.xml
+++ b/integration-tests-jvm/azure-servicebus/pom.xml
@@ -105,7 +105,33 @@
                 <!-- The following dependencies guarantee that this module is built after them. You can update them by running `mvn process-resources -Pformat -N` from the source tree root directory -->
                 <dependency>
                     <groupId>org.apache.camel.quarkus</groupId>
-                    <artifactId>camel-quarkus-azure-servicebus-deployment</artifactId>
+                    <artifactId>camel-quarkus-azure-eventhubs-deployment</artifactId>
+                    <version>${project.version}</version>
+                    <type>pom</type>
+                    <scope>test</scope>
+                    <exclusions>
+                        <exclusion>
+                            <groupId>*</groupId>
+                            <artifactId>*</artifactId>
+                        </exclusion>
+                    </exclusions>
+                </dependency>
+                <dependency>
+                    <groupId>org.apache.camel.quarkus</groupId>
+                    <artifactId>camel-quarkus-direct-deployment</artifactId>
+                    <version>${project.version}</version>
+                    <type>pom</type>
+                    <scope>test</scope>
+                    <exclusions>
+                        <exclusion>
+                            <groupId>*</groupId>
+                            <artifactId>*</artifactId>
+                        </exclusion>
+                    </exclusions>
+                </dependency>
+                <dependency>
+                    <groupId>org.apache.camel.quarkus</groupId>
+                    <artifactId>camel-quarkus-mock-deployment</artifactId>
                     <version>${project.version}</version>
                     <type>pom</type>
                     <scope>test</scope>
@@ -118,5 +144,16 @@
                 </dependency>
             </dependencies>
         </profile>
+        <profile>
+            <id>skip-testcontainers-tests</id>
+            <activation>
+                <property>
+                    <name>skip-testcontainers-tests</name>
+                </property>
+            </activation>
+            <properties>
+                <skipTests>true</skipTests>
+            </properties>
+        </profile>
     </profiles>
 </project>
diff --git a/integration-tests-jvm/azure-servicebus/src/test/java/org/apache/camel/quarkus/component/azure/servicebus/it/AzureServiceBusTest.java b/integration-tests-jvm/azure-servicebus/src/test/java/org/apache/camel/quarkus/component/azure/servicebus/it/AzureServiceBusTest.java
index 889738f9b9..17db6c9cea 100644
--- a/integration-tests-jvm/azure-servicebus/src/test/java/org/apache/camel/quarkus/component/azure/servicebus/it/AzureServiceBusTest.java
+++ b/integration-tests-jvm/azure-servicebus/src/test/java/org/apache/camel/quarkus/component/azure/servicebus/it/AzureServiceBusTest.java
@@ -39,10 +39,7 @@ class AzureServiceBusTest {
                 .then().statusCode(200).extract().body().as(List.class);
 
         Assertions.assertEquals(inputBatch, sentMessages);
-    }
 
-    @Test
-    public void basicConsumerTest() {
         final List consumedMessages = RestAssured.given()
                 .contentType(ContentType.JSON)
                 .get("/azure-servicebus/consumer")
@@ -52,5 +49,4 @@ class AzureServiceBusTest {
         Assertions.assertFalse(consumedMessages.isEmpty());
         Assertions.assertTrue(consumedMessages.stream().anyMatch(inputBatch::contains));
     }
-
 }