This is an automated email from the ASF dual-hosted git repository.
lburgazzoli 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 1abe10c Dynamic endpoint cannot be resolved properly (toD) #1116
1abe10c is described below
commit 1abe10cc9c7b2f23f662b46b679093be47fb4c69
Author: lburgazzoli <[email protected]>
AuthorDate: Tue Apr 21 18:47:39 2020 +0200
Dynamic endpoint cannot be resolved properly (toD) #1116
---
.github/workflows/pr-build.yaml | 1 +
.../quarkus/core/deployment/BuildProcessor.java | 3 +-
integration-tests/pom.xml | 1 +
integration-tests/send-dynamic-http/pom.xml | 142 +++++++++++++++++++++
.../component/http/it/SendDynamicResource.java | 79 ++++++++++++
.../src/main/resources/application.properties | 25 ++++
.../quarkus/component/http/it/SendDynamicIT.java | 23 ++++
.../quarkus/component/http/it/SendDynamicTest.java | 43 +++++++
8 files changed, 316 insertions(+), 1 deletion(-)
diff --git a/.github/workflows/pr-build.yaml b/.github/workflows/pr-build.yaml
index 2472e4f..c1ceb75 100644
--- a/.github/workflows/pr-build.yaml
+++ b/.github/workflows/pr-build.yaml
@@ -147,6 +147,7 @@ jobs:
quartz
scheduler
seda
+ send-dynamic-http
ref
- category: Memoryhog Dataformat JSON
test-modules: >
diff --git
a/extensions-core/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/BuildProcessor.java
b/extensions-core/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/BuildProcessor.java
index 9833510..fe2e2fe 100644
---
a/extensions-core/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/BuildProcessor.java
+++
b/extensions-core/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/BuildProcessor.java
@@ -164,7 +164,8 @@ class BuildProcessor {
"META-INF/services/org/apache/camel/configurer/*",
"META-INF/services/org/apache/camel/language/*",
"META-INF/services/org/apache/camel/dataformat/*",
- "META-INF/services/org/apache/camel/cron/*"));
+ "META-INF/services/org/apache/camel/cron/*",
+ "META-INF/services/org/apache/camel/send-dynamic/*"));
// TODO: this can be removed and the
RestBindingJaxbDataFormatFactory can be discovered
// and instantiated when camel is on the classpath with a
camel context customizer
diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml
index a9f3412..aa94ba1 100644
--- a/integration-tests/pom.xml
+++ b/integration-tests/pom.xml
@@ -111,6 +111,7 @@
<module>sap-netweaver</module>
<module>scheduler</module>
<module>seda</module>
+ <module>send-dynamic-http</module>
<module>servicenow</module>
<module>servlet</module>
<module>slack</module>
diff --git a/integration-tests/send-dynamic-http/pom.xml
b/integration-tests/send-dynamic-http/pom.xml
new file mode 100644
index 0000000..db912fc
--- /dev/null
+++ b/integration-tests/send-dynamic-http/pom.xml
@@ -0,0 +1,142 @@
+<?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.1.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>
+
+ <properties>
+ <!-- mvnd, a.k.a. Maven Daemon: https://github.com/gnodet/mvnd -->
+ <!-- The following rule tells mvnd to build the listed deployment
modules before this module. -->
+ <!-- This is important because mvnd builds modules in parallel by
default. The deployment modules are not -->
+ <!-- explicit dependencies of this module in the Maven sense, although
they are required by the Quarkus Maven plugin. -->
+ <!-- Please update rule whenever you change the dependencies of this
module by running -->
+ <!-- mvn process-resources -Pformat from the root directory -->
+
<mvnd.builder.rule>camel-quarkus-ahc-deployment,camel-quarkus-ahc-ws-deployment,camel-quarkus-direct-deployment,camel-quarkus-http-deployment,camel-quarkus-netty-http-deployment,camel-quarkus-support-policy-deployment</mvnd.builder.rule>
+ </properties>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-bom-test</artifactId>
+ <version>${project.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+ <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>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>build</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <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
new file mode 100644
index 0000000..c9c88e6
--- /dev/null
+++
b/integration-tests/send-dynamic-http/src/main/java/org/apache/camel/quarkus/component/http/it/SendDynamicResource.java
@@ -0,0 +1,79 @@
+/*
+ * 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/main/resources/application.properties
b/integration-tests/send-dynamic-http/src/main/resources/application.properties
new file mode 100644
index 0000000..494bcea
--- /dev/null
+++
b/integration-tests/send-dynamic-http/src/main/resources/application.properties
@@ -0,0 +1,25 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+#
+# Quarkus
+#
+quarkus.log.file.enable = false
+
+#
+# Camel
+#
+camel.context.name = quarkus-camel-example
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
new file mode 100644
index 0000000..418954e
--- /dev/null
+++
b/integration-tests/send-dynamic-http/src/test/java/org/apache/camel/quarkus/component/http/it/SendDynamicIT.java
@@ -0,0 +1,23 @@
+/*
+ * 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
new file mode 100644
index 0000000..085db6e
--- /dev/null
+++
b/integration-tests/send-dynamic-http/src/test/java/org/apache/camel/quarkus/component/http/it/SendDynamicTest.java
@@ -0,0 +1,43 @@
+/*
+ * 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())));
+ }
+}