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 2021/03/02 19:25:42 UTC

[camel-quarkus] branch master updated: Move HTTP send-dynamic test to HTTP itest module

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 99932f9  Move HTTP send-dynamic test to HTTP itest module
99932f9 is described below

commit 99932f93512a149301961b28a68ea41f2c47fff9
Author: James Netherton <ja...@gmail.com>
AuthorDate: Tue Mar 2 13:07:51 2021 +0000

    Move HTTP send-dynamic test to HTTP itest module
---
 integration-tests/http/pom.xml                     |  21 +++
 .../quarkus/component/http/it/HttpResource.java    |  50 +++++++
 .../camel/quarkus/component/http/it/HttpTest.java  |  17 +++
 integration-tests/pom.xml                          |   1 -
 integration-tests/send-dynamic-http/pom.xml        | 146 ---------------------
 .../component/http/it/SendDynamicResource.java     |  79 -----------
 .../quarkus/component/http/it/SendDynamicIT.java   |  23 ----
 .../quarkus/component/http/it/SendDynamicTest.java |  43 ------
 tooling/scripts/test-categories.yaml               |   1 -
 9 files changed, 88 insertions(+), 293 deletions(-)

diff --git a/integration-tests/http/pom.xml b/integration-tests/http/pom.xml
index e3f1635..b1ed446 100644
--- a/integration-tests/http/pom.xml
+++ b/integration-tests/http/pom.xml
@@ -48,6 +48,10 @@
         </dependency>
         <dependency>
             <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-endpointdsl</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
             <artifactId>camel-quarkus-netty-http</artifactId>
         </dependency>
         <dependency>
@@ -62,6 +66,10 @@
             <groupId>io.quarkus</groupId>
             <artifactId>quarkus-resteasy</artifactId>
         </dependency>
+        <dependency>
+            <groupId>io.quarkus</groupId>
+            <artifactId>quarkus-resteasy-jsonb</artifactId>
+        </dependency>
 
         <!-- test dependencies -->
         <dependency>
@@ -124,6 +132,19 @@
         </dependency>
         <dependency>
             <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-endpointdsl-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-http-deployment</artifactId>
             <version>${project.version}</version>
             <type>pom</type>
diff --git a/integration-tests/http/src/main/java/org/apache/camel/quarkus/component/http/it/HttpResource.java b/integration-tests/http/src/main/java/org/apache/camel/quarkus/component/http/it/HttpResource.java
index e081b4c..e428ac5 100644
--- a/integration-tests/http/src/main/java/org/apache/camel/quarkus/component/http/it/HttpResource.java
+++ b/integration-tests/http/src/main/java/org/apache/camel/quarkus/component/http/it/HttpResource.java
@@ -21,6 +21,8 @@ import java.util.concurrent.TimeUnit;
 
 import javax.enterprise.context.ApplicationScoped;
 import javax.inject.Inject;
+import javax.json.Json;
+import javax.json.JsonObject;
 import javax.ws.rs.Consumes;
 import javax.ws.rs.GET;
 import javax.ws.rs.POST;
@@ -32,6 +34,10 @@ import javax.ws.rs.core.MediaType;
 import org.apache.camel.ConsumerTemplate;
 import org.apache.camel.Exchange;
 import org.apache.camel.FluentProducerTemplate;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.builder.EndpointConsumerBuilder;
+import org.apache.camel.builder.EndpointProducerBuilder;
+import org.apache.camel.builder.endpoint.EndpointRouteBuilder;
 
 @Path("/test/client")
 @ApplicationScoped
@@ -227,4 +233,48 @@ public class HttpResource {
                 .withHeader(Exchange.HTTP_METHOD, "POST")
                 .request(String.class);
     }
+
+    // *****************************
+    //
+    // Send dynamic tests
+    //
+    // *****************************
+
+    @Path("/send-dynamic")
+    @GET
+    @Produces(MediaType.APPLICATION_JSON)
+    public String getSendDynamic(@QueryParam("test-port") int port) {
+        return producerTemplate
+                .withHeader("SendDynamicHttpEndpointPort", port)
+                .to("direct:send-dynamic")
+                .request(String.class);
+    }
+
+    @Path("/send-dynamic/service")
+    @GET
+    @Produces(MediaType.APPLICATION_JSON)
+    public JsonObject get(@QueryParam("q") String q, @QueryParam("fq") String fq) {
+        return Json.createObjectBuilder()
+                .add("q", q)
+                .add("fq", fq)
+                .build();
+    }
+
+    @ApplicationScoped
+    RoutesBuilder sendDynamicRoutes() {
+        return new EndpointRouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                final EndpointConsumerBuilder trigger = direct(
+                        "send-dynamic");
+                final EndpointProducerBuilder service = http(
+                        "localhost:${header.SendDynamicHttpEndpointPort}/test/send-dynamic/service?q=*&fq=publication_date:%5B${date:now-72h:yyyy-MM-dd}T00:00:00Z%20TO%20${date:now-24h:yyyy-MM-dd}T23:59:59Z%5D&wt=xml&indent=false&start=0&rows=100");
+
+                from(trigger)
+                        .setHeader(Exchange.HTTP_METHOD).constant("GET")
+                        .toD(service)
+                        .convertBodyTo(String.class);
+            }
+        };
+    }
 }
diff --git a/integration-tests/http/src/test/java/org/apache/camel/quarkus/component/http/it/HttpTest.java b/integration-tests/http/src/test/java/org/apache/camel/quarkus/component/http/it/HttpTest.java
index 82b9d67..70089f6 100644
--- a/integration-tests/http/src/test/java/org/apache/camel/quarkus/component/http/it/HttpTest.java
+++ b/integration-tests/http/src/test/java/org/apache/camel/quarkus/component/http/it/HttpTest.java
@@ -19,12 +19,15 @@ package org.apache.camel.quarkus.component.http.it;
 import io.quarkus.test.common.QuarkusTestResource;
 import io.quarkus.test.junit.QuarkusTest;
 import io.restassured.RestAssured;
+import io.restassured.http.ContentType;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.params.ParameterizedTest;
 import org.junit.jupiter.params.provider.ValueSource;
 
 import static org.hamcrest.Matchers.containsString;
+import static org.hamcrest.Matchers.empty;
 import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.not;
 
 @QuarkusTest
 @QuarkusTestResource(HttpTestResource.class)
@@ -88,4 +91,18 @@ class HttpTest {
                 .then()
                 .body(is("Hello " + body));
     }
+
+    @Test
+    public void sendDynamic() {
+        RestAssured
+                .given()
+                .queryParam("test-port", RestAssured.port)
+                .accept(ContentType.JSON)
+                .when()
+                .get("/test/send-dynamic")
+                .then()
+                .body(
+                        "q", is(not(empty())),
+                        "fq", is(not(empty())));
+    }
 }
diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml
index 64c99ca..b15582b 100644
--- a/integration-tests/pom.xml
+++ b/integration-tests/pom.xml
@@ -176,7 +176,6 @@
         <module>saga</module>
         <module>salesforce</module>
         <module>sap-netweaver</module>
-        <module>send-dynamic-http</module>
         <module>servicenow</module>
         <module>servlet</module>
         <module>shiro</module>
diff --git a/integration-tests/send-dynamic-http/pom.xml b/integration-tests/send-dynamic-http/pom.xml
deleted file mode 100644
index 9e24a54..0000000
--- a/integration-tests/send-dynamic-http/pom.xml
+++ /dev/null
@@ -1,146 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
-    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.
-
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-    <parent>
-        <groupId>org.apache.camel.quarkus</groupId>
-        <artifactId>camel-quarkus-integration-tests</artifactId>
-        <version>1.8.0-SNAPSHOT</version>
-    </parent>
-
-    <artifactId>camel-quarkus-integration-test-send-dynamic-http</artifactId>
-    <name>Camel Quarkus :: Integration Tests :: SendDynamic (HTTP)</name>
-    <description>Integration tests for SendDynamic EIP for http components</description>
-
-    <dependencies>
-        <dependency>
-            <groupId>org.apache.camel.quarkus</groupId>
-            <artifactId>camel-quarkus-endpointdsl</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.camel.quarkus</groupId>
-            <artifactId>camel-quarkus-http</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.camel.quarkus</groupId>
-            <artifactId>camel-quarkus-direct</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>
-            <groupId>io.quarkus</groupId>
-            <artifactId>quarkus-junit5</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>io.rest-assured</groupId>
-            <artifactId>rest-assured</artifactId>
-            <scope>test</scope>
-        </dependency>
-
-        <!-- test dependencies - camel-quarkus -->
-        <dependency>
-            <groupId>org.apache.camel.quarkus</groupId>
-            <artifactId>camel-quarkus-integration-test-support</artifactId>
-            <scope>test</scope>
-        </dependency>
-
-        <!-- 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-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-endpointdsl-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-http-deployment</artifactId>
-            <version>${project.version}</version>
-            <type>pom</type>
-            <scope>test</scope>
-            <exclusions>
-                <exclusion>
-                    <groupId>*</groupId>
-                    <artifactId>*</artifactId>
-                </exclusion>
-            </exclusions>
-        </dependency>
-    </dependencies>
-
-
-    <profiles>
-        <profile>
-            <id>native</id>
-            <activation>
-                <property>
-                    <name>native</name>
-                </property>
-            </activation>
-            <properties>
-                <quarkus.package.type>native</quarkus.package.type>
-            </properties>
-            <build>
-                <plugins>
-                    <plugin>
-                        <groupId>org.apache.maven.plugins</groupId>
-                        <artifactId>maven-failsafe-plugin</artifactId>
-                        <executions>
-                            <execution>
-                                <goals>
-                                    <goal>integration-test</goal>
-                                    <goal>verify</goal>
-                                </goals>
-                            </execution>
-                        </executions>
-                    </plugin>
-                </plugins>
-            </build>
-        </profile>
-    </profiles>
-
-</project>
diff --git a/integration-tests/send-dynamic-http/src/main/java/org/apache/camel/quarkus/component/http/it/SendDynamicResource.java b/integration-tests/send-dynamic-http/src/main/java/org/apache/camel/quarkus/component/http/it/SendDynamicResource.java
deleted file mode 100644
index c9c88e6..0000000
--- a/integration-tests/send-dynamic-http/src/main/java/org/apache/camel/quarkus/component/http/it/SendDynamicResource.java
+++ /dev/null
@@ -1,79 +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.http.it;
-
-import javax.enterprise.context.ApplicationScoped;
-import javax.inject.Inject;
-import javax.json.Json;
-import javax.json.JsonObject;
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
-import javax.ws.rs.core.MediaType;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.FluentProducerTemplate;
-import org.apache.camel.RoutesBuilder;
-import org.apache.camel.builder.EndpointConsumerBuilder;
-import org.apache.camel.builder.EndpointProducerBuilder;
-import org.apache.camel.builder.endpoint.EndpointRouteBuilder;
-
-@Path("/test")
-@ApplicationScoped
-public class SendDynamicResource {
-    @Inject
-    FluentProducerTemplate producerTemplate;
-
-    @Path("/send-dynamic")
-    @GET
-    @Produces(MediaType.APPLICATION_JSON)
-    public String get(@QueryParam("test-port") int port) {
-        return producerTemplate
-                .withHeader("SendDynamicHttpEndpointPort", port)
-                .to("direct:send-dynamic")
-                .request(String.class);
-    }
-
-    @Path("/service")
-    @GET
-    @Produces(MediaType.APPLICATION_JSON)
-    public JsonObject get(@QueryParam("q") String q, @QueryParam("fq") String fq) {
-        return Json.createObjectBuilder()
-                .add("q", q)
-                .add("fq", fq)
-                .build();
-    }
-
-    @javax.enterprise.inject.Produces
-    RoutesBuilder myRoute() {
-        return new EndpointRouteBuilder() {
-            @Override
-            public void configure() throws Exception {
-                final EndpointConsumerBuilder trigger = direct(
-                        "send-dynamic");
-                final EndpointProducerBuilder service = http(
-                        "localhost:${header.SendDynamicHttpEndpointPort}/test/service?q=*&fq=publication_date:%5B${date:now-72h:yyyy-MM-dd}T00:00:00Z%20TO%20${date:now-24h:yyyy-MM-dd}T23:59:59Z%5D&wt=xml&indent=false&start=0&rows=100");
-
-                from(trigger)
-                        .setHeader(Exchange.HTTP_METHOD).constant("GET")
-                        .toD(service)
-                        .convertBodyTo(String.class);
-            }
-        };
-    }
-}
diff --git a/integration-tests/send-dynamic-http/src/test/java/org/apache/camel/quarkus/component/http/it/SendDynamicIT.java b/integration-tests/send-dynamic-http/src/test/java/org/apache/camel/quarkus/component/http/it/SendDynamicIT.java
deleted file mode 100644
index 418954e..0000000
--- a/integration-tests/send-dynamic-http/src/test/java/org/apache/camel/quarkus/component/http/it/SendDynamicIT.java
+++ /dev/null
@@ -1,23 +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.http.it;
-
-import io.quarkus.test.junit.NativeImageTest;
-
-@NativeImageTest
-class SendDynamicIT extends SendDynamicTest {
-}
diff --git a/integration-tests/send-dynamic-http/src/test/java/org/apache/camel/quarkus/component/http/it/SendDynamicTest.java b/integration-tests/send-dynamic-http/src/test/java/org/apache/camel/quarkus/component/http/it/SendDynamicTest.java
deleted file mode 100644
index 085db6e..0000000
--- a/integration-tests/send-dynamic-http/src/test/java/org/apache/camel/quarkus/component/http/it/SendDynamicTest.java
+++ /dev/null
@@ -1,43 +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.http.it;
-
-import io.quarkus.test.junit.QuarkusTest;
-import io.restassured.RestAssured;
-import io.restassured.http.ContentType;
-import org.junit.jupiter.api.Test;
-
-import static org.hamcrest.Matchers.empty;
-import static org.hamcrest.Matchers.is;
-import static org.hamcrest.Matchers.not;
-
-@QuarkusTest
-class SendDynamicTest {
-    @Test
-    public void sendDynamic() {
-        RestAssured
-                .given()
-                .queryParam("test-port", RestAssured.port)
-                .accept(ContentType.JSON)
-                .when()
-                .get("/test/send-dynamic")
-                .then()
-                .body(
-                        "q", is(not(empty())),
-                        "fq", is(not(empty())));
-    }
-}
diff --git a/tooling/scripts/test-categories.yaml b/tooling/scripts/test-categories.yaml
index 869da62..23b86eb 100644
--- a/tooling/scripts/test-categories.yaml
+++ b/tooling/scripts/test-categories.yaml
@@ -154,7 +154,6 @@ networking2-dataformats:
   - mail
   - netty
   - nsq
-  - send-dynamic-http
   - servlet
   - univocity-parsers
   - websocket-jsr356