This is an automated email from the ASF dual-hosted git repository. jamesnetherton pushed a commit to branch 2.7.x in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
commit cc4b8e795240bff8264575e7189d165ae7f4c509 Author: James Netherton <[email protected]> AuthorDate: Tue Mar 8 08:21:31 2022 +0000 Merge platform-http-engine tests with platform-http --- integration-tests/platform-http-engine/pom.xml | 120 --------------------- .../platform/http/it/PlatformHttpResource.java | 57 ---------- .../platform/http/it/PlatformHttpRouteBuilder.java | 27 ----- .../src/main/resources/application.properties | 21 ---- .../http/server/it/PlatformHttpEngineIT.java | 24 ----- .../http/server/it/PlatformHttpEngineTest.java | 58 ---------- .../platform/http/it/PlatformHttpRouteBuilder.java | 27 +++++ .../component/http/server/it/PlatformHttpTest.java | 14 +++ integration-tests/pom.xml | 1 - tooling/scripts/test-categories.yaml | 1 - 10 files changed, 41 insertions(+), 309 deletions(-) diff --git a/integration-tests/platform-http-engine/pom.xml b/integration-tests/platform-http-engine/pom.xml deleted file mode 100644 index 32b16fd..0000000 --- a/integration-tests/platform-http-engine/pom.xml +++ /dev/null @@ -1,120 +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-build-parent-it</artifactId> - <version>2.7.1-SNAPSHOT</version> - <relativePath>../../poms/build-parent-it/pom.xml</relativePath> - </parent> - - <artifactId>camel-quarkus-integration-test-platform-http-engine</artifactId> - <name>Camel Quarkus :: Integration Tests :: Platform HTTP Engine</name> - <description>Integration tests for Camel Quarkus platform-http engine extension</description> - - <dependencies> - <dependency> - <groupId>org.apache.camel.quarkus</groupId> - <artifactId>camel-quarkus-platform-http</artifactId> - </dependency> - <dependency> - <groupId>io.quarkus</groupId> - <artifactId>quarkus-jsonb</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> - <dependency> - <groupId>org.assertj</groupId> - <artifactId>assertj-core</artifactId> - <scope>test</scope> - </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> - <profile> - <id>virtualDependencies</id> - <activation> - <property> - <name>!noVirtualDependencies</name> - </property> - </activation> - <dependencies> - <!-- 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-platform-http-deployment</artifactId> - <version>${project.version}</version> - <type>pom</type> - <scope>test</scope> - <exclusions> - <exclusion> - <groupId>*</groupId> - <artifactId>*</artifactId> - </exclusion> - </exclusions> - </dependency> - </dependencies> - </profile> - </profiles> - -</project> diff --git a/integration-tests/platform-http-engine/src/main/java/org/apache/camel/quarkus/component/platform/http/it/PlatformHttpResource.java b/integration-tests/platform-http-engine/src/main/java/org/apache/camel/quarkus/component/platform/http/it/PlatformHttpResource.java deleted file mode 100644 index 377c31c..0000000 --- a/integration-tests/platform-http-engine/src/main/java/org/apache/camel/quarkus/component/platform/http/it/PlatformHttpResource.java +++ /dev/null @@ -1,57 +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.platform.http.it; - -import javax.enterprise.context.ApplicationScoped; -import javax.inject.Inject; -import javax.json.Json; -import javax.json.JsonObject; -import javax.json.JsonObjectBuilder; -import javax.ws.rs.GET; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; - -import org.apache.camel.component.platform.http.PlatformHttpConstants; -import org.apache.camel.spi.Registry; - -@Path("/test") -@ApplicationScoped -public class PlatformHttpResource { - @Inject - Registry registry; - - @Path("/registry/inspect") - @GET - @Produces(MediaType.APPLICATION_JSON) - public JsonObject inspectRegistry() { - JsonObjectBuilder builder = Json.createObjectBuilder(); - - Object engine = registry.lookupByName(PlatformHttpConstants.PLATFORM_HTTP_ENGINE_NAME); - Object component = registry.lookupByName(PlatformHttpConstants.PLATFORM_HTTP_COMPONENT_NAME); - - if (engine != null) { - builder.add(PlatformHttpConstants.PLATFORM_HTTP_ENGINE_NAME, engine.getClass().getName()); - } - - if (component != null) { - builder.add(PlatformHttpConstants.PLATFORM_HTTP_COMPONENT_NAME, component.getClass().getName()); - } - - return builder.build(); - } -} diff --git a/integration-tests/platform-http-engine/src/main/java/org/apache/camel/quarkus/component/platform/http/it/PlatformHttpRouteBuilder.java b/integration-tests/platform-http-engine/src/main/java/org/apache/camel/quarkus/component/platform/http/it/PlatformHttpRouteBuilder.java deleted file mode 100644 index f4ca019..0000000 --- a/integration-tests/platform-http-engine/src/main/java/org/apache/camel/quarkus/component/platform/http/it/PlatformHttpRouteBuilder.java +++ /dev/null @@ -1,27 +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.platform.http.it; - -import org.apache.camel.builder.RouteBuilder; - -public class PlatformHttpRouteBuilder extends RouteBuilder { - @Override - public void configure() { - from("platform-http:/platform-http/hello?httpMethodRestrict=GET") - .setBody().constant("platform-http/hello"); - } -} diff --git a/integration-tests/platform-http-engine/src/main/resources/application.properties b/integration-tests/platform-http-engine/src/main/resources/application.properties deleted file mode 100644 index 768a767..0000000 --- a/integration-tests/platform-http-engine/src/main/resources/application.properties +++ /dev/null @@ -1,21 +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. -## --------------------------------------------------------------------------- -# -# Quarkus -# -quarkus.log.category."org.apache.camel.quarkus.core.deployment".level = INFO -quarkus.log.category."org.apache.camel.quarkus.component.platform.http".level = INFO diff --git a/integration-tests/platform-http-engine/src/test/java/org/apache/camel/quarkus/component/http/server/it/PlatformHttpEngineIT.java b/integration-tests/platform-http-engine/src/test/java/org/apache/camel/quarkus/component/http/server/it/PlatformHttpEngineIT.java deleted file mode 100644 index 0612638..0000000 --- a/integration-tests/platform-http-engine/src/test/java/org/apache/camel/quarkus/component/http/server/it/PlatformHttpEngineIT.java +++ /dev/null @@ -1,24 +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.server.it; - -import io.quarkus.test.junit.NativeImageTest; - -@NativeImageTest -class PlatformHttpEngineIT extends PlatformHttpEngineTest { - -} diff --git a/integration-tests/platform-http-engine/src/test/java/org/apache/camel/quarkus/component/http/server/it/PlatformHttpEngineTest.java b/integration-tests/platform-http-engine/src/test/java/org/apache/camel/quarkus/component/http/server/it/PlatformHttpEngineTest.java deleted file mode 100644 index 460c26b..0000000 --- a/integration-tests/platform-http-engine/src/test/java/org/apache/camel/quarkus/component/http/server/it/PlatformHttpEngineTest.java +++ /dev/null @@ -1,58 +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.server.it; - -import io.quarkus.test.junit.QuarkusTest; -import io.restassured.RestAssured; -import org.apache.camel.component.platform.http.PlatformHttpComponent; -import org.apache.camel.component.platform.http.PlatformHttpConstants; -import org.apache.camel.component.platform.http.vertx.VertxPlatformHttpEngine; -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.Test; - -import static org.hamcrest.CoreMatchers.equalTo; -import static org.hamcrest.CoreMatchers.is; - -@QuarkusTest -class PlatformHttpEngineTest { - @Test - public void registrySetUp() { - RestAssured.given() - .get("/test/registry/inspect") - .then() - .statusCode(200) - .body( - PlatformHttpConstants.PLATFORM_HTTP_ENGINE_NAME, is(VertxPlatformHttpEngine.class.getName()), - PlatformHttpConstants.PLATFORM_HTTP_COMPONENT_NAME, is(PlatformHttpComponent.class.getName())); - } - - @Test - public void basic() { - RestAssured.given() - .get("/platform-http/hello") - .then() - .statusCode(200) - .body(equalTo("platform-http/hello")); - } - - @Disabled("https://github.com/quarkusio/quarkus/issues/4408") - @Test - public void invalidMethod() { - RestAssured.post("/platform-http/hello") - .then().statusCode(405); - } -} diff --git a/integration-tests/platform-http/src/main/java/org/apache/camel/quarkus/component/platform/http/it/PlatformHttpRouteBuilder.java b/integration-tests/platform-http/src/main/java/org/apache/camel/quarkus/component/platform/http/it/PlatformHttpRouteBuilder.java index 46cdad9..0b315d1 100644 --- a/integration-tests/platform-http/src/main/java/org/apache/camel/quarkus/component/platform/http/it/PlatformHttpRouteBuilder.java +++ b/integration-tests/platform-http/src/main/java/org/apache/camel/quarkus/component/platform/http/it/PlatformHttpRouteBuilder.java @@ -30,9 +30,11 @@ import org.apache.camel.Exchange; import org.apache.camel.Message; import org.apache.camel.attachment.AttachmentMessage; import org.apache.camel.builder.RouteBuilder; +import org.apache.camel.component.platform.http.PlatformHttpConstants; import org.apache.camel.component.platform.http.vertx.VertxPlatformHttpConstants; import org.apache.camel.component.webhook.WebhookConfiguration; import org.apache.camel.model.rest.RestBindingMode; +import org.apache.camel.spi.Registry; public class PlatformHttpRouteBuilder extends RouteBuilder { @SuppressWarnings("unchecked") @@ -55,6 +57,31 @@ public class PlatformHttpRouteBuilder extends RouteBuilder { .setBody(constant("POST: /rest-post")) .endRest(); + from("platform-http:/registry/inspect") + .process(e -> { + Registry registry = e.getContext().getRegistry(); + + Object engine = registry.lookupByName(PlatformHttpConstants.PLATFORM_HTTP_ENGINE_NAME); + Object component = registry.lookupByName(PlatformHttpConstants.PLATFORM_HTTP_COMPONENT_NAME); + + String engineClassName = ""; + String componentClassName = ""; + + if (engine != null) { + engineClassName = engine.getClass().getName(); + } + + if (component != null) { + componentClassName = component.getClass().getName(); + } + + String json = String.format("{\"engine\": \"%s\", \"component\": \"%s\"}", engineClassName, + componentClassName); + Message message = e.getMessage(); + message.setHeader(Exchange.CONTENT_TYPE, "application/json"); + message.setBody(json); + }); + from("platform-http:/platform-http/hello?httpMethodRestrict=GET").setBody(simple("Hello ${header.name}")); from("platform-http:/platform-http/get-post?httpMethodRestrict=GET,POST").setBody(simple("Hello ${body}")); diff --git a/integration-tests/platform-http/src/test/java/org/apache/camel/quarkus/component/http/server/it/PlatformHttpTest.java b/integration-tests/platform-http/src/test/java/org/apache/camel/quarkus/component/http/server/it/PlatformHttpTest.java index 2060398..6a782c7 100644 --- a/integration-tests/platform-http/src/test/java/org/apache/camel/quarkus/component/http/server/it/PlatformHttpTest.java +++ b/integration-tests/platform-http/src/test/java/org/apache/camel/quarkus/component/http/server/it/PlatformHttpTest.java @@ -23,6 +23,8 @@ import io.quarkus.test.junit.QuarkusTest; import io.restassured.RestAssured; import io.restassured.http.ContentType; import io.restassured.http.Method; +import org.apache.camel.component.platform.http.PlatformHttpComponent; +import org.apache.camel.component.platform.http.vertx.VertxPlatformHttpEngine; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; @@ -30,6 +32,7 @@ import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; import static org.hamcrest.CoreMatchers.equalTo; +import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.Matchers.notNullValue; @QuarkusTest @@ -347,6 +350,17 @@ class PlatformHttpTest { .body(equalTo("camel:Admin")); } + @Test + public void registrySetUp() { + RestAssured.given() + .get("/registry/inspect") + .then() + .statusCode(200) + .body( + "engine", is(VertxPlatformHttpEngine.class.getName()), + "component", is(PlatformHttpComponent.class.getName())); + } + private static Method[] httpMethods() { return Method.values(); } diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml index 306a9e7..c00101d 100644 --- a/integration-tests/pom.xml +++ b/integration-tests/pom.xml @@ -168,7 +168,6 @@ <module>pg-replication-slot</module> <module>pgevent</module> <module>platform-http</module> - <module>platform-http-engine</module> <module>protobuf</module> <module>pubnub</module> <module>quartz</module> diff --git a/tooling/scripts/test-categories.yaml b/tooling/scripts/test-categories.yaml index 1dc2a95..c68a4f8 100644 --- a/tooling/scripts/test-categories.yaml +++ b/tooling/scripts/test-categories.yaml @@ -184,7 +184,6 @@ group-12: - opentracing - paho-mqtt5 - platform-http - - platform-http-engine - reactive-streams - rest - rest-openapi
