You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by lb...@apache.org on 2019/10/17 12:10:22 UTC
[camel-quarkus] branch master updated: Update to quarkus 0.25.0
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 cc87614 Update to quarkus 0.25.0
cc87614 is described below
commit cc876147987aa5eb918d927b2380b970ac2d1a60
Author: lburgazzoli <lb...@gmail.com>
AuthorDate: Sun Oct 13 23:51:07 2019 +0200
Update to quarkus 0.25.0
---
.../quarkus/core/deployment/BuildProcessor.java | 21 ++++-----
.../deployment/CamelReactiveExecutorBuildItem.java | 8 +---
.../http/deployment/PlatformHttpProcessor.java | 34 ++++++++++++--
...rmHttpEngine.java => PlatformHttpHandlers.java} | 26 +++++------
.../http/runtime/PlatformHttpRecorder.java | 8 +++-
.../http/runtime/QuarkusPlatformHttpConsumer.java | 45 ++++++-------------
.../http/runtime/QuarkusPlatformHttpEngine.java | 15 ++++++-
.../executor/deployment/BuildProcessor.java | 2 +-
.../pom.xml | 10 ++---
.../platform/http/it/PlatformHttpResource.java | 7 ++-
.../platform/http/it/PlatformHttpRouteBuilder.java | 23 +++-------
.../src/main/resources/application.properties | 26 +++++++++++
.../http/server/it/PlatformHttpEngineIT.java | 22 ++-------
.../http/server/it/PlatformHttpEngineTest.java | 52 ++++++++++++++++++++++
integration-tests/platform-http/pom.xml | 8 ----
.../component/http/server/it/PlatformHttpTest.java | 21 ---------
integration-tests/pom.xml | 1 +
pom.xml | 2 +-
18 files changed, 188 insertions(+), 143 deletions(-)
diff --git a/extensions/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/BuildProcessor.java b/extensions/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/BuildProcessor.java
index 6a0801d..9e4b6bb 100644
--- a/extensions/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/BuildProcessor.java
+++ b/extensions/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/BuildProcessor.java
@@ -181,6 +181,13 @@ class BuildProcessor {
beanProducer.produce(AdditionalBeanBuildItem.unremovableOf(CamelMainProducers.class));
}
+ @Overridable
+ @Record(value = ExecutionTime.RUNTIME_INIT, optional = true)
+ @BuildStep(onlyIfNot = Flags.MainDisabled.class)
+ CamelReactiveExecutorBuildItem reactiveExecutor(CamelMainRecorder recorder) {
+ return new CamelReactiveExecutorBuildItem(recorder.createReactiveExecutor());
+ }
+
/**
* This method is responsible to configure camel-main during static init phase which means
* discovering routes, listeners and services that need to be bound to the camel-main.
@@ -223,10 +230,9 @@ class BuildProcessor {
* @param registry a reference to a {@link Registry}; note that this parameter is here as placeholder to
* ensure the {@link Registry} is fully configured before starting camel-main.
* @param config runtime configuration.
- * @param executors the {@link org.apache.camel.spi.ReactiveExecutor} to be configured on camel-main, this
+ * @param executor the {@link org.apache.camel.spi.ReactiveExecutor} to be configured on camel-main, this
* happens during {@link ExecutionTime#RUNTIME_INIT} because the executor may need to start
- * threads and so on. Note that we now expect a list of executors but that's because there is
- * no way as of quarkus 0.23.x to have optional items.
+ * threads and so on.
* @param shutdown a reference to a {@link io.quarkus.runtime.ShutdownContext} used to register shutdown logic.
* @param startList a placeholder to ensure camel-main start after the ArC container is fully initialized. This
* is required as under the hoods the camel registry may look-up beans form the
@@ -239,7 +245,7 @@ class BuildProcessor {
CamelMainBuildItem main,
CamelRuntimeRegistryBuildItem registry,
CamelConfig.Runtime config,
- List<CamelReactiveExecutorBuildItem> executors, // TODO: replace with @Overridable
+ CamelReactiveExecutorBuildItem executor,
ShutdownContextBuildItem shutdown,
List<ServiceStartBuildItem> startList) {
@@ -252,12 +258,7 @@ class BuildProcessor {
recorder.addRoutesFromLocation(main.getInstance(), location);
});
- if (executors.size() > 1) {
- throw new IllegalArgumentException("Detected multiple reactive executors");
- } else if (executors.size() == 1) {
- recorder.setReactiveExecutor(main.getInstance(), executors.get(0).getInstance());
- }
-
+ recorder.setReactiveExecutor(main.getInstance(), executor.getInstance());
recorder.start(shutdown, main.getInstance());
}
}
diff --git a/extensions/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/CamelReactiveExecutorBuildItem.java b/extensions/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/CamelReactiveExecutorBuildItem.java
index c6193ce..4ec60a6 100644
--- a/extensions/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/CamelReactiveExecutorBuildItem.java
+++ b/extensions/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/CamelReactiveExecutorBuildItem.java
@@ -17,18 +17,14 @@
package org.apache.camel.quarkus.core.deployment;
-import io.quarkus.builder.item.MultiBuildItem;
+import io.quarkus.builder.item.SimpleBuildItem;
import io.quarkus.runtime.RuntimeValue;
import org.apache.camel.spi.ReactiveExecutor;
/**
* Holds the {@link ReactiveExecutor} {@link RuntimeValue}.
- *
- * TODO: should extend SimpleBuildItem when moving to quarkus snapshots or 0.24
- * as we can then use the @Overridable annotation which allow to provide
- * alternative implementation of a build item.
*/
-public final class CamelReactiveExecutorBuildItem extends MultiBuildItem {
+public final class CamelReactiveExecutorBuildItem extends SimpleBuildItem {
private final RuntimeValue<ReactiveExecutor> instance;
public CamelReactiveExecutorBuildItem(RuntimeValue<ReactiveExecutor> instance) {
diff --git a/extensions/platform-http/deployment/src/main/java/org/apache/camel/quarkus/component/platform/http/deployment/PlatformHttpProcessor.java b/extensions/platform-http/deployment/src/main/java/org/apache/camel/quarkus/component/platform/http/deployment/PlatformHttpProcessor.java
index 986be50..32ebe11 100644
--- a/extensions/platform-http/deployment/src/main/java/org/apache/camel/quarkus/component/platform/http/deployment/PlatformHttpProcessor.java
+++ b/extensions/platform-http/deployment/src/main/java/org/apache/camel/quarkus/component/platform/http/deployment/PlatformHttpProcessor.java
@@ -16,13 +16,20 @@
*/
package org.apache.camel.quarkus.component.platform.http.deployment;
+import java.util.ArrayList;
+import java.util.List;
+
import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.deployment.annotations.ExecutionTime;
import io.quarkus.deployment.annotations.Record;
import io.quarkus.deployment.builditem.FeatureBuildItem;
import io.quarkus.vertx.http.deployment.VertxWebRouterBuildItem;
+import io.quarkus.vertx.web.deployment.BodyHandlerBuildItem;
+import io.vertx.core.Handler;
+import io.vertx.ext.web.RoutingContext;
import org.apache.camel.component.platform.http.PlatformHttpComponent;
import org.apache.camel.component.platform.http.PlatformHttpConstants;
+import org.apache.camel.quarkus.component.platform.http.runtime.PlatformHttpHandlers;
import org.apache.camel.quarkus.component.platform.http.runtime.PlatformHttpRecorder;
import org.apache.camel.quarkus.component.platform.http.runtime.QuarkusPlatformHttpEngine;
import org.apache.camel.quarkus.core.deployment.CamelRuntimeBeanBuildItem;
@@ -38,15 +45,36 @@ class PlatformHttpProcessor {
@Record(ExecutionTime.RUNTIME_INIT)
@BuildStep
- PlatformHttpEngineBuildItem platformHttpEngine(PlatformHttpRecorder recorder, VertxWebRouterBuildItem router) {
+ PlatformHttpEngineBuildItem platformHttpEngine(
+ PlatformHttpRecorder recorder,
+ VertxWebRouterBuildItem router,
+ BodyHandlerBuildItem bodyHandler,
+ List<FeatureBuildItem> features) {
+
+ List<Handler<RoutingContext>> handlers = new ArrayList<>();
+
+ //
+ // When RESTEasy is added to the classpath, then the routes are paused
+ // so we need to resume them.
+ //
+ // https://github.com/quarkusio/quarkus/issues/4564
+ //
+ // TODO: remove this once the issue get fixed
+ //
+ if (features.stream().map(FeatureBuildItem::getInfo).anyMatch("resteasy"::equals)) {
+ handlers.add(new PlatformHttpHandlers.Resumer());
+ }
+
+ handlers.add(bodyHandler.getHandler());
+
return new PlatformHttpEngineBuildItem(
- recorder.createEngine(router.getRouter())
+ recorder.createEngine(router.getRouter(), handlers)
);
}
@Record(ExecutionTime.RUNTIME_INIT)
@BuildStep
- CamelRuntimeBeanBuildItem platformHttpEngineBean(PlatformHttpRecorder recorder, PlatformHttpEngineBuildItem engine) {
+ CamelRuntimeBeanBuildItem platformHttpEngineBean(PlatformHttpRecorder recorder, PlatformHttpEngineBuildItem engine) {
return new CamelRuntimeBeanBuildItem(
PlatformHttpConstants.PLATFORM_HTTP_ENGINE_NAME,
QuarkusPlatformHttpEngine.class,
diff --git a/extensions/platform-http/runtime/src/main/java/org/apache/camel/quarkus/component/platform/http/runtime/QuarkusPlatformHttpEngine.java b/extensions/platform-http/runtime/src/main/java/org/apache/camel/quarkus/component/platform/http/runtime/PlatformHttpHandlers.java
similarity index 59%
copy from extensions/platform-http/runtime/src/main/java/org/apache/camel/quarkus/component/platform/http/runtime/QuarkusPlatformHttpEngine.java
copy to extensions/platform-http/runtime/src/main/java/org/apache/camel/quarkus/component/platform/http/runtime/PlatformHttpHandlers.java
index 969c3d1..8c1cf6a 100644
--- a/extensions/platform-http/runtime/src/main/java/org/apache/camel/quarkus/component/platform/http/runtime/QuarkusPlatformHttpEngine.java
+++ b/extensions/platform-http/runtime/src/main/java/org/apache/camel/quarkus/component/platform/http/runtime/PlatformHttpHandlers.java
@@ -16,23 +16,21 @@
*/
package org.apache.camel.quarkus.component.platform.http.runtime;
-import io.vertx.ext.web.Router;
-import org.apache.camel.Consumer;
-import org.apache.camel.Processor;
-import org.apache.camel.component.platform.http.PlatformHttpEndpoint;
-import org.apache.camel.component.platform.http.spi.PlatformHttpEngine;
+import io.vertx.core.Handler;
+import io.vertx.ext.web.RoutingContext;
-public class QuarkusPlatformHttpEngine implements PlatformHttpEngine {
- private final Router router;
-
- public QuarkusPlatformHttpEngine(Router router) {
- this.router = router;
+public final class PlatformHttpHandlers {
+ private PlatformHttpHandlers() {
}
- @Override
- public Consumer createConsumer(PlatformHttpEndpoint endpoint, Processor processor) {
- return new QuarkusPlatformHttpConsumer(endpoint, processor, router);
+ public static class Resumer implements Handler<RoutingContext> {
+ @Override
+ public void handle(RoutingContext context) {
+ // Workaround for route paused when resteasy is added to the game
+ // on quarkus >= 0.24.0
+ context.request().resume();
+ context.next();
+ }
}
-
}
diff --git a/extensions/platform-http/runtime/src/main/java/org/apache/camel/quarkus/component/platform/http/runtime/PlatformHttpRecorder.java b/extensions/platform-http/runtime/src/main/java/org/apache/camel/quarkus/component/platform/http/runtime/PlatformHttpRecorder.java
index 109a711..a3bf6b7 100644
--- a/extensions/platform-http/runtime/src/main/java/org/apache/camel/quarkus/component/platform/http/runtime/PlatformHttpRecorder.java
+++ b/extensions/platform-http/runtime/src/main/java/org/apache/camel/quarkus/component/platform/http/runtime/PlatformHttpRecorder.java
@@ -16,16 +16,20 @@
*/
package org.apache.camel.quarkus.component.platform.http.runtime;
+import java.util.List;
+
import io.quarkus.runtime.RuntimeValue;
import io.quarkus.runtime.annotations.Recorder;
+import io.vertx.core.Handler;
import io.vertx.ext.web.Router;
+import io.vertx.ext.web.RoutingContext;
import org.apache.camel.component.platform.http.PlatformHttpComponent;
import org.apache.camel.component.platform.http.spi.PlatformHttpEngine;
@Recorder
public class PlatformHttpRecorder {
- public RuntimeValue<PlatformHttpEngine> createEngine(RuntimeValue<Router> router) {
- return new RuntimeValue<>(new QuarkusPlatformHttpEngine(router.getValue()));
+ public RuntimeValue<PlatformHttpEngine> createEngine(RuntimeValue<Router> router, List<Handler<RoutingContext>> handlers) {
+ return new RuntimeValue<>(new QuarkusPlatformHttpEngine(router.getValue(), handlers));
}
public RuntimeValue<PlatformHttpComponent> createComponent(RuntimeValue<PlatformHttpEngine> engine) {
diff --git a/extensions/platform-http/runtime/src/main/java/org/apache/camel/quarkus/component/platform/http/runtime/QuarkusPlatformHttpConsumer.java b/extensions/platform-http/runtime/src/main/java/org/apache/camel/quarkus/component/platform/http/runtime/QuarkusPlatformHttpConsumer.java
index 3c04bdb..8ab321d 100644
--- a/extensions/platform-http/runtime/src/main/java/org/apache/camel/quarkus/component/platform/http/runtime/QuarkusPlatformHttpConsumer.java
+++ b/extensions/platform-http/runtime/src/main/java/org/apache/camel/quarkus/component/platform/http/runtime/QuarkusPlatformHttpConsumer.java
@@ -29,6 +29,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
+import io.vertx.core.Handler;
import io.vertx.core.MultiMap;
import io.vertx.core.buffer.Buffer;
import io.vertx.core.http.HttpMethod;
@@ -37,8 +38,6 @@ import io.vertx.core.http.HttpServerResponse;
import io.vertx.ext.web.Route;
import io.vertx.ext.web.Router;
import io.vertx.ext.web.RoutingContext;
-import io.vertx.ext.web.handler.BodyHandler;
-
import org.apache.camel.Consumer;
import org.apache.camel.Endpoint;
import org.apache.camel.Exchange;
@@ -56,8 +55,6 @@ import org.apache.camel.support.DefaultMessage;
import org.apache.camel.support.ExchangeHelper;
import org.apache.camel.support.MessageHelper;
import org.apache.camel.support.ObjectHelper;
-import org.eclipse.microprofile.config.Config;
-import org.eclipse.microprofile.config.ConfigProvider;
import org.jboss.logging.Logger;
/**
@@ -67,11 +64,13 @@ public class QuarkusPlatformHttpConsumer extends DefaultConsumer {
private static final Logger LOG = Logger.getLogger(QuarkusPlatformHttpConsumer.class);
private final Router router;
+ private final List<Handler<RoutingContext>> handlers;
private Route route;
- public QuarkusPlatformHttpConsumer(Endpoint endpoint, Processor processor, Router router) {
+ public QuarkusPlatformHttpConsumer(Endpoint endpoint, Processor processor, Router router, List<Handler<RoutingContext>> handlers) {
super(endpoint, processor);
this.router = router;
+ this.handlers = handlers;
}
@Override
@@ -91,40 +90,22 @@ public class QuarkusPlatformHttpConsumer extends DefaultConsumer {
methods.stream().forEach(m -> newRoute.method(HttpMethod.valueOf(m.name())));
}
- Config cfg = ConfigProvider.getConfig();
- final BodyHandler bodyHandler = BodyHandler.create();
- /*
- * Keep in sync with how the BodyHandler is configured in io.quarkus.vertx.web.runtime.VertxWebRecorder
- * Eventually, VertxWebRecorder should have a method to do this for us.
- *
- * TODO: remove this code when moving to quarkus 0.24.x, see https://github.com/quarkusio/quarkus/pull/4314
- */
- cfg.getOptionalValue("quarkus.http.body.handle-file-uploads", boolean.class).ifPresent(bodyHandler::setHandleFileUploads);
- cfg.getOptionalValue("quarkus.http.body.uploads-directory", String.class).ifPresent(bodyHandler::setUploadsDirectory);
- cfg.getOptionalValue("quarkus.http.body.delete-uploaded-files-on-end", boolean.class).ifPresent(bodyHandler::setDeleteUploadedFilesOnEnd);
- cfg.getOptionalValue("quarkus.http.body.merge-form-attributes", boolean.class).ifPresent(bodyHandler::setMergeFormAttributes);
- cfg.getOptionalValue("quarkus.http.body.preallocate-body-buffer", boolean.class).ifPresent(bodyHandler::setPreallocateBodyBuffer);
-
- newRoute
- .handler(ctx -> {
- // Workaround for route blocking and not handling any request
- // on quarkus 0.24.0
- ctx.request().resume();
- ctx.next();
- })
- .handler(bodyHandler)
- .handler(ctx -> {
+ handlers.forEach(newRoute::handler);
+
+ newRoute.handler(
+ ctx -> {
try {
final PlatformHttpEndpoint endpoint = getEndpoint();
final HeaderFilterStrategy headerFilterStrategy = endpoint.getHeaderFilterStrategy();
final Exchange e = toExchange(ctx, endpoint.createExchange(), headerFilterStrategy);
getProcessor().process(e);
writeResponse(ctx, e, headerFilterStrategy);
- } catch (Exception e1) {
- LOG.debugf(e1, "Could not handle '%s'", path);
- ctx.fail(e1);
+ } catch (Exception e) {
+ LOG.debugf(e, "Could not handle '%s'", path);
+ ctx.fail(e);
}
- });
+ }
+ );
this.route = newRoute;
}
diff --git a/extensions/platform-http/runtime/src/main/java/org/apache/camel/quarkus/component/platform/http/runtime/QuarkusPlatformHttpEngine.java b/extensions/platform-http/runtime/src/main/java/org/apache/camel/quarkus/component/platform/http/runtime/QuarkusPlatformHttpEngine.java
index 969c3d1..3e44401 100644
--- a/extensions/platform-http/runtime/src/main/java/org/apache/camel/quarkus/component/platform/http/runtime/QuarkusPlatformHttpEngine.java
+++ b/extensions/platform-http/runtime/src/main/java/org/apache/camel/quarkus/component/platform/http/runtime/QuarkusPlatformHttpEngine.java
@@ -16,7 +16,13 @@
*/
package org.apache.camel.quarkus.component.platform.http.runtime;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import io.vertx.core.Handler;
import io.vertx.ext.web.Router;
+import io.vertx.ext.web.RoutingContext;
import org.apache.camel.Consumer;
import org.apache.camel.Processor;
import org.apache.camel.component.platform.http.PlatformHttpEndpoint;
@@ -25,14 +31,19 @@ import org.apache.camel.component.platform.http.spi.PlatformHttpEngine;
public class QuarkusPlatformHttpEngine implements PlatformHttpEngine {
private final Router router;
+ private final List<Handler<RoutingContext>> handlers;
- public QuarkusPlatformHttpEngine(Router router) {
+ public QuarkusPlatformHttpEngine(Router router, List<Handler<RoutingContext>> handlers) {
this.router = router;
+ this.handlers = new ArrayList<>(handlers);
}
@Override
public Consumer createConsumer(PlatformHttpEndpoint endpoint, Processor processor) {
- return new QuarkusPlatformHttpConsumer(endpoint, processor, router);
+ return new QuarkusPlatformHttpConsumer(endpoint, processor, router, handlers);
}
+ public List<Handler<RoutingContext>> getHandlers() {
+ return Collections.unmodifiableList(this.handlers);
+ }
}
diff --git a/extensions/reactive-executor/deployment/src/main/java/org/apache/camel/quarkus/reactive/executor/deployment/BuildProcessor.java b/extensions/reactive-executor/deployment/src/main/java/org/apache/camel/quarkus/reactive/executor/deployment/BuildProcessor.java
index 649beb6..7ee67f8 100644
--- a/extensions/reactive-executor/deployment/src/main/java/org/apache/camel/quarkus/reactive/executor/deployment/BuildProcessor.java
+++ b/extensions/reactive-executor/deployment/src/main/java/org/apache/camel/quarkus/reactive/executor/deployment/BuildProcessor.java
@@ -25,7 +25,7 @@ import org.apache.camel.quarkus.core.deployment.CamelReactiveExecutorBuildItem;
import org.apache.camel.quarkus.reactive.executor.ReactiveExecutorRecorder;
public class BuildProcessor {
- @Record(ExecutionTime.RUNTIME_INIT)
+ @Record(value = ExecutionTime.RUNTIME_INIT, optional = true)
@BuildStep(onlyIfNot = Flags.MainDisabled.class)
CamelReactiveExecutorBuildItem reactiveExecutor(ReactiveExecutorRecorder recorder, VertxBuildItem vertx) {
return new CamelReactiveExecutorBuildItem(recorder.createReactiveExecutor(vertx.getVertx()));
diff --git a/integration-tests/platform-http/pom.xml b/integration-tests/platform-http-engine/pom.xml
similarity index 94%
copy from integration-tests/platform-http/pom.xml
copy to integration-tests/platform-http-engine/pom.xml
index 2b4b318..4956a5f 100644
--- a/integration-tests/platform-http/pom.xml
+++ b/integration-tests/platform-http-engine/pom.xml
@@ -27,9 +27,9 @@
<version>0.2.1-SNAPSHOT</version>
</parent>
- <artifactId>camel-quarkus-integration-test-platform-http</artifactId>
- <name>Camel Quarkus :: Integration Tests :: Platform HTTP</name>
- <description>Integration tests for Camel Quarkus platform-http extension</description>
+ <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>
@@ -37,10 +37,6 @@
<artifactId>camel-quarkus-platform-http</artifactId>
</dependency>
<dependency>
- <groupId>org.apache.camel.quarkus</groupId>
- <artifactId>camel-quarkus-rest</artifactId>
- </dependency>
- <dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-jsonb</artifactId>
</dependency>
diff --git a/integration-tests/platform-http/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
similarity index 86%
rename from integration-tests/platform-http/src/main/java/org/apache/camel/quarkus/component/platform/http/it/PlatformHttpResource.java
rename to integration-tests/platform-http-engine/src/main/java/org/apache/camel/quarkus/component/platform/http/it/PlatformHttpResource.java
index 288e1c6..57f75b1 100644
--- a/integration-tests/platform-http/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
@@ -27,6 +27,7 @@ import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import org.apache.camel.component.platform.http.PlatformHttpConstants;
+import org.apache.camel.quarkus.component.platform.http.runtime.QuarkusPlatformHttpEngine;
import org.apache.camel.spi.Registry;
@Path("/test")
@@ -37,7 +38,7 @@ public class PlatformHttpResource {
@Path("/registry/inspect")
@GET
- @Produces(MediaType.TEXT_PLAIN)
+ @Produces(MediaType.APPLICATION_JSON)
public JsonObject inspectRegistry() {
JsonObjectBuilder builder = Json.createObjectBuilder();
@@ -47,7 +48,11 @@ public class PlatformHttpResource {
if (engine != null) {
builder.add(PlatformHttpConstants.PLATFORM_HTTP_ENGINE_NAME, engine.getClass().getName());
+ if (engine instanceof QuarkusPlatformHttpEngine) {
+ builder.add("handlers-size", ((QuarkusPlatformHttpEngine)engine).getHandlers().size());
+ }
}
+
if (component != null) {
builder.add(PlatformHttpConstants.PLATFORM_HTTP_COMPONENT_NAME, component.getClass().getName());
}
diff --git a/extensions/platform-http/runtime/src/main/java/org/apache/camel/quarkus/component/platform/http/runtime/QuarkusPlatformHttpEngine.java b/integration-tests/platform-http-engine/src/main/java/org/apache/camel/quarkus/component/platform/http/it/PlatformHttpRouteBuilder.java
similarity index 55%
copy from extensions/platform-http/runtime/src/main/java/org/apache/camel/quarkus/component/platform/http/runtime/QuarkusPlatformHttpEngine.java
copy to integration-tests/platform-http-engine/src/main/java/org/apache/camel/quarkus/component/platform/http/it/PlatformHttpRouteBuilder.java
index 969c3d1..3d3b573 100644
--- a/extensions/platform-http/runtime/src/main/java/org/apache/camel/quarkus/component/platform/http/runtime/QuarkusPlatformHttpEngine.java
+++ b/integration-tests/platform-http-engine/src/main/java/org/apache/camel/quarkus/component/platform/http/it/PlatformHttpRouteBuilder.java
@@ -14,25 +14,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.camel.quarkus.component.platform.http.runtime;
+package org.apache.camel.quarkus.component.platform.http.it;
-import io.vertx.ext.web.Router;
-import org.apache.camel.Consumer;
-import org.apache.camel.Processor;
-import org.apache.camel.component.platform.http.PlatformHttpEndpoint;
-import org.apache.camel.component.platform.http.spi.PlatformHttpEngine;
-
-
-public class QuarkusPlatformHttpEngine implements PlatformHttpEngine {
- private final Router router;
-
- public QuarkusPlatformHttpEngine(Router router) {
- this.router = router;
- }
+import org.apache.camel.builder.RouteBuilder;
+public class PlatformHttpRouteBuilder extends RouteBuilder {
@Override
- public Consumer createConsumer(PlatformHttpEndpoint endpoint, Processor processor) {
- return new QuarkusPlatformHttpConsumer(endpoint, processor, router);
+ 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
new file mode 100644
index 0000000..7396627
--- /dev/null
+++ b/integration-tests/platform-http-engine/src/main/resources/application.properties
@@ -0,0 +1,26 @@
+## ---------------------------------------------------------------------------
+## 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.ssl.native=true
+quarkus.log.file.enable = false
+quarkus.log.category."org.apache.camel.quarkus.core.deployment".level = DEBUG
+quarkus.log.category."org.apache.camel.quarkus.component.platform.http".level = DEBUG
+#
+# Quarkus :: Camel
+#
diff --git a/extensions/platform-http/runtime/src/main/java/org/apache/camel/quarkus/component/platform/http/runtime/QuarkusPlatformHttpEngine.java b/integration-tests/platform-http-engine/src/test/java/org/apache/camel/quarkus/component/http/server/it/PlatformHttpEngineIT.java
similarity index 53%
copy from extensions/platform-http/runtime/src/main/java/org/apache/camel/quarkus/component/platform/http/runtime/QuarkusPlatformHttpEngine.java
copy to integration-tests/platform-http-engine/src/test/java/org/apache/camel/quarkus/component/http/server/it/PlatformHttpEngineIT.java
index 969c3d1..42f8cdb 100644
--- a/extensions/platform-http/runtime/src/main/java/org/apache/camel/quarkus/component/platform/http/runtime/QuarkusPlatformHttpEngine.java
+++ b/integration-tests/platform-http-engine/src/test/java/org/apache/camel/quarkus/component/http/server/it/PlatformHttpEngineIT.java
@@ -14,25 +14,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.camel.quarkus.component.platform.http.runtime;
+package org.apache.camel.quarkus.component.http.server.it;
-import io.vertx.ext.web.Router;
-import org.apache.camel.Consumer;
-import org.apache.camel.Processor;
-import org.apache.camel.component.platform.http.PlatformHttpEndpoint;
-import org.apache.camel.component.platform.http.spi.PlatformHttpEngine;
+import io.quarkus.test.junit.SubstrateTest;
-
-public class QuarkusPlatformHttpEngine implements PlatformHttpEngine {
- private final Router router;
-
- public QuarkusPlatformHttpEngine(Router router) {
- this.router = router;
- }
-
- @Override
- public Consumer createConsumer(PlatformHttpEndpoint endpoint, Processor processor) {
- return new QuarkusPlatformHttpConsumer(endpoint, processor, router);
- }
+@SubstrateTest
+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
new file mode 100644
index 0000000..9a47b41
--- /dev/null
+++ b/integration-tests/platform-http-engine/src/test/java/org/apache/camel/quarkus/component/http/server/it/PlatformHttpEngineTest.java
@@ -0,0 +1,52 @@
+/*
+ * 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.quarkus.component.platform.http.runtime.QuarkusPlatformHttpEngine;
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.hamcrest.core.Is.is;
+
+@QuarkusTest
+class PlatformHttpEngineTest {
+ @Test
+ public void registrySetUp() {
+ RestAssured.given()
+ .get("/test/registry/inspect")
+ .then()
+ .statusCode(200)
+ .body(
+ PlatformHttpConstants.PLATFORM_HTTP_ENGINE_NAME, is(QuarkusPlatformHttpEngine.class.getName()),
+ PlatformHttpConstants.PLATFORM_HTTP_COMPONENT_NAME, is(PlatformHttpComponent.class.getName()),
+ "handlers-size", is(2)
+ );
+ }
+
+ @Test
+ public void basic() {
+ RestAssured.given()
+ .get("/platform-http/hello")
+ .then()
+ .statusCode(200)
+ .body(equalTo("platform-http/hello"));
+ }
+}
diff --git a/integration-tests/platform-http/pom.xml b/integration-tests/platform-http/pom.xml
index 2b4b318..b7483c4 100644
--- a/integration-tests/platform-http/pom.xml
+++ b/integration-tests/platform-http/pom.xml
@@ -40,14 +40,6 @@
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-rest</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>
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 2b76bf6..7d9af7c 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
@@ -18,33 +18,13 @@ package org.apache.camel.quarkus.component.http.server.it;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.RestAssured;
-import io.restassured.path.json.JsonPath;
-import org.apache.camel.component.platform.http.PlatformHttpComponent;
-import org.apache.camel.component.platform.http.PlatformHttpConstants;
-import org.apache.camel.quarkus.component.platform.http.runtime.QuarkusPlatformHttpEngine;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
-import static org.assertj.core.api.Assertions.assertThat;
import static org.hamcrest.CoreMatchers.equalTo;
@QuarkusTest
class PlatformHttpTest {
-
- @Test
- public void registrySetUp() {
- JsonPath p = RestAssured.given()
- .get("/test/registry/inspect")
- .then()
- .statusCode(200)
- .extract()
- .body()
- .jsonPath();
-
- assertThat(p.getString(PlatformHttpConstants.PLATFORM_HTTP_ENGINE_NAME)).isEqualTo(QuarkusPlatformHttpEngine.class.getName());
- assertThat(p.getString(PlatformHttpConstants.PLATFORM_HTTP_COMPONENT_NAME)).isEqualTo(PlatformHttpComponent.class.getName());
- }
-
@Test
public void basic() {
RestAssured.given()
@@ -86,5 +66,4 @@ class PlatformHttpTest {
RestAssured.get("/platform-http/rest-post")
.then().statusCode(405);
}
-
}
diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml
index 5f10efb..7cd2cb7 100644
--- a/integration-tests/pom.xml
+++ b/integration-tests/pom.xml
@@ -99,6 +99,7 @@
<module>netty-http</module>
<module>opentracing</module>
<module>paho</module>
+ <module>platform-http-engine</module>
<module>platform-http</module>
<module>salesforce</module>
<module>servlet</module>
diff --git a/pom.xml b/pom.xml
index f1eb153..71099a9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -41,7 +41,7 @@
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<camel.version>3.0.0-SNAPSHOT</camel.version>
- <quarkus.version>0.24.0</quarkus.version>
+ <quarkus.version>0.25.0</quarkus.version>
<jetty.version>9.4.18.v20190429</jetty.version>
<xstream.version>1.4.11</xstream.version>