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
The following commit(s) were added to refs/heads/main by this push: new 13cef38ca8 Add debug JVM only extension 13cef38ca8 is described below commit 13cef38ca8a44fe77172432afb4b769f79978510 Author: James Netherton <jamesnether...@gmail.com> AuthorDate: Mon May 23 09:23:32 2022 +0100 Add debug JVM only extension Fixes #3775 --- docs/modules/ROOT/examples/others/debug.yml | 13 +++ docs/modules/ROOT/nav.adoc | 1 + .../ROOT/pages/reference/extensions/debug.adoc | 35 +++++++ extensions-jvm/debug/deployment/pom.xml | 83 ++++++++++++++++ .../component/debug/deployment/DebugProcessor.java | 53 +++++++++++ .../component/debug/deployment/DebugResource.java | 40 ++++++++ .../component/debug/deployment/DebugTest.java | 51 ++++++++++ extensions-jvm/debug/pom.xml | 39 ++++++++ extensions-jvm/debug/runtime/pom.xml | 104 +++++++++++++++++++++ .../main/resources/META-INF/quarkus-extension.yaml | 32 +++++++ extensions-jvm/pom.xml | 1 + integration-tests-jvm/debug/pom.xml | 84 +++++++++++++++++ .../quarkus/component/debug/it/DebugResource.java | 43 +++++++++ .../quarkus/component/debug/it/DebugTest.java | 38 ++++++++ integration-tests-jvm/pom.xml | 1 + poms/bom/pom.xml | 15 +++ poms/bom/src/main/generated/flattened-full-pom.xml | 15 +++ .../src/main/generated/flattened-reduced-pom.xml | 15 +++ .../generated/flattened-reduced-verbose-pom.xml | 15 +++ 19 files changed, 678 insertions(+) diff --git a/docs/modules/ROOT/examples/others/debug.yml b/docs/modules/ROOT/examples/others/debug.yml new file mode 100644 index 0000000000..099e7d0218 --- /dev/null +++ b/docs/modules/ROOT/examples/others/debug.yml @@ -0,0 +1,13 @@ +# Do not edit directly! +# This file was generated by camel-quarkus-maven-plugin:update-extension-doc-page +cqArtifactId: camel-quarkus-debug +cqArtifactIdBase: debug +cqNativeSupported: false +cqStatus: Preview +cqDeprecated: false +cqJvmSince: 2.10.0 +cqNativeSince: n/a +cqCamelPartName: debug +cqCamelPartTitle: Debug +cqCamelPartDescription: Enables Camel Route Debugging +cqExtensionPageTitle: Debug diff --git a/docs/modules/ROOT/nav.adoc b/docs/modules/ROOT/nav.adoc index 31d326093f..247a6ff382 100644 --- a/docs/modules/ROOT/nav.adoc +++ b/docs/modules/ROOT/nav.adoc @@ -101,6 +101,7 @@ *** xref:reference/extensions/debezium-mysql.adoc[Debezium MySQL Connector] *** xref:reference/extensions/debezium-postgres.adoc[Debezium PostgresSQL Connector] *** xref:reference/extensions/debezium-sqlserver.adoc[Debezium SQL Server Connector] +*** xref:reference/extensions/debug.adoc[Debug] *** xref:reference/extensions/djl.adoc[Deep Java Library] *** xref:reference/extensions/digitalocean.adoc[DigitalOcean] *** xref:reference/extensions/direct.adoc[Direct] diff --git a/docs/modules/ROOT/pages/reference/extensions/debug.adoc b/docs/modules/ROOT/pages/reference/extensions/debug.adoc new file mode 100644 index 0000000000..23eb4bf2b3 --- /dev/null +++ b/docs/modules/ROOT/pages/reference/extensions/debug.adoc @@ -0,0 +1,35 @@ +// Do not edit directly! +// This file was generated by camel-quarkus-maven-plugin:update-extension-doc-page += Debug +:linkattrs: +:cq-artifact-id: camel-quarkus-debug +:cq-native-supported: false +:cq-status: Preview +:cq-status-deprecation: Preview +:cq-description: Enables Camel Route Debugging +:cq-deprecated: false +:cq-jvm-since: 2.10.0 +:cq-native-since: n/a + +[.badges] +[.badge-key]##JVM since##[.badge-supported]##2.10.0## [.badge-key]##Native##[.badge-unsupported]##unsupported## + +Enables Camel Route Debugging + +== What's inside + +* xref:{cq-camel-components}:others:debug.adoc[Debug] + +Please refer to the above link for usage and configuration details. + +== Maven coordinates + +[source,xml] +---- +<dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-debug</artifactId> +</dependency> +---- + +Check the xref:user-guide/index.adoc[User guide] for more information about writing Camel Quarkus applications. diff --git a/extensions-jvm/debug/deployment/pom.xml b/extensions-jvm/debug/deployment/pom.xml new file mode 100644 index 0000000000..f59295ebd7 --- /dev/null +++ b/extensions-jvm/debug/deployment/pom.xml @@ -0,0 +1,83 @@ +<?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-debug-parent</artifactId> + <version>2.10.0-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + + <artifactId>camel-quarkus-debug-deployment</artifactId> + <name>Camel Quarkus :: Debug :: Deployment</name> + + <dependencies> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-core-deployment</artifactId> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-management-deployment</artifactId> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-debug</artifactId> + </dependency> + + <dependency> + <groupId>io.quarkus</groupId> + <artifactId>quarkus-junit5-internal</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>io.quarkus</groupId> + <artifactId>quarkus-resteasy</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>io.rest-assured</groupId> + <artifactId>rest-assured</artifactId> + <scope>test</scope> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <annotationProcessorPaths> + <path> + <groupId>io.quarkus</groupId> + <artifactId>quarkus-extension-processor</artifactId> + <version>${quarkus.version}</version> + </path> + </annotationProcessorPaths> + </configuration> + </plugin> + </plugins> + </build> + +</project> diff --git a/extensions-jvm/debug/deployment/src/main/java/org/apache/camel/quarkus/component/debug/deployment/DebugProcessor.java b/extensions-jvm/debug/deployment/src/main/java/org/apache/camel/quarkus/component/debug/deployment/DebugProcessor.java new file mode 100644 index 0000000000..21ba451e4c --- /dev/null +++ b/extensions-jvm/debug/deployment/src/main/java/org/apache/camel/quarkus/component/debug/deployment/DebugProcessor.java @@ -0,0 +1,53 @@ +/* + * 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.debug.deployment; + +import io.quarkus.deployment.IsDevelopment; +import io.quarkus.deployment.annotations.BuildStep; +import io.quarkus.deployment.builditem.AllowJNDIBuildItem; +import io.quarkus.deployment.builditem.FeatureBuildItem; +import io.quarkus.deployment.pkg.steps.NativeBuild; +import org.apache.camel.quarkus.core.deployment.spi.CamelServiceDestination; +import org.apache.camel.quarkus.core.deployment.spi.CamelServicePatternBuildItem; + +class DebugProcessor { + private static final String FEATURE = "camel-debug"; + + @BuildStep(onlyIf = IsDevelopment.class) + FeatureBuildItem feature() { + return new FeatureBuildItem(FEATURE); + } + + @BuildStep(onlyIf = IsDevelopment.class) + AllowJNDIBuildItem allowJNDI() { + return new AllowJNDIBuildItem(); + } + + @BuildStep(onlyIfNot = IsDevelopment.class) + CamelServicePatternBuildItem camelDebuggerFactoryServicePattern() { + // Prevent debugging if not in dev mode. This is added as an exclusion since + // core defines an include path filter for META-INF/services/org/apache/camel/* + return new CamelServicePatternBuildItem(CamelServiceDestination.DISCOVERY, false, + "META-INF/services/org/apache/camel/debugger-factory"); + } + + @BuildStep(onlyIf = NativeBuild.class) + void nativeUnsupported() { + throw new RuntimeException("The " + FEATURE + " extension is not supported in native mode " + + "as JMX is not supported on GraalVM"); + } +} diff --git a/extensions-jvm/debug/deployment/src/test/java/org/apache/camel/quarkus/component/debug/deployment/DebugResource.java b/extensions-jvm/debug/deployment/src/test/java/org/apache/camel/quarkus/component/debug/deployment/DebugResource.java new file mode 100644 index 0000000000..4d4eedea16 --- /dev/null +++ b/extensions-jvm/debug/deployment/src/test/java/org/apache/camel/quarkus/component/debug/deployment/DebugResource.java @@ -0,0 +1,40 @@ +/* + * 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.debug.deployment; + +import javax.inject.Inject; +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.CamelContext; +import org.apache.camel.impl.debugger.BacklogDebugger; + +@Path("/debug") +public class DebugResource { + @Inject + CamelContext context; + + @Path("/enabled") + @GET + @Produces(MediaType.TEXT_PLAIN) + public boolean debuggingEnabled() { + BacklogDebugger debugger = BacklogDebugger.getBacklogDebugger(context); + return debugger != null && debugger.isEnabled(); + } +} diff --git a/extensions-jvm/debug/deployment/src/test/java/org/apache/camel/quarkus/component/debug/deployment/DebugTest.java b/extensions-jvm/debug/deployment/src/test/java/org/apache/camel/quarkus/component/debug/deployment/DebugTest.java new file mode 100644 index 0000000000..c848c3fa04 --- /dev/null +++ b/extensions-jvm/debug/deployment/src/test/java/org/apache/camel/quarkus/component/debug/deployment/DebugTest.java @@ -0,0 +1,51 @@ +/* + * 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.debug.deployment; + +import java.io.IOException; +import java.net.Socket; + +import io.quarkus.test.QuarkusDevModeTest; +import io.restassured.RestAssured; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.spec.JavaArchive; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.RegisterExtension; + +import static org.hamcrest.Matchers.is; + +public class DebugTest { + + @RegisterExtension + static final QuarkusDevModeTest TEST = new QuarkusDevModeTest() + .setArchiveProducer(() -> ShrinkWrap + .create(JavaArchive.class) + .addClass(DebugResource.class)); + + @Test + public void camelDebuggingEnabledInDevMode() throws IOException { + RestAssured.get("/debug/enabled") + .then() + .body(is("true")) + .statusCode(200); + + try (Socket socket = new Socket("localhost", 1099)) { + Assertions.assertTrue(socket.isConnected()); + } + } +} diff --git a/extensions-jvm/debug/pom.xml b/extensions-jvm/debug/pom.xml new file mode 100644 index 0000000000..5d1ad0815d --- /dev/null +++ b/extensions-jvm/debug/pom.xml @@ -0,0 +1,39 @@ +<?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-extensions-jvm</artifactId> + <version>2.10.0-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + + <artifactId>camel-quarkus-debug-parent</artifactId> + <name>Camel Quarkus :: Debug</name> + <packaging>pom</packaging> + + <modules> + <module>deployment</module> + <module>runtime</module> + </modules> +</project> diff --git a/extensions-jvm/debug/runtime/pom.xml b/extensions-jvm/debug/runtime/pom.xml new file mode 100644 index 0000000000..6a49af61f4 --- /dev/null +++ b/extensions-jvm/debug/runtime/pom.xml @@ -0,0 +1,104 @@ +<?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-debug-parent</artifactId> + <version>2.10.0-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + + <artifactId>camel-quarkus-debug</artifactId> + <name>Camel Quarkus :: Debug :: Runtime</name> + <description>Enables Camel Route Debugging</description> + + <properties> + <camel.quarkus.jvmSince>2.10.0</camel.quarkus.jvmSince> + </properties> + + <dependencies> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-core</artifactId> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-management</artifactId> + </dependency> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-debug</artifactId> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>io.quarkus</groupId> + <artifactId>quarkus-bootstrap-maven-plugin</artifactId> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <annotationProcessorPaths> + <path> + <groupId>io.quarkus</groupId> + <artifactId>quarkus-extension-processor</artifactId> + <version>${quarkus.version}</version> + </path> + </annotationProcessorPaths> + </configuration> + </plugin> + </plugins> + </build> + + + <profiles> + <profile> + <id>full</id> + <activation> + <property> + <name>!quickly</name> + </property> + </activation> + <build> + <plugins> + <plugin> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-maven-plugin</artifactId> + <executions> + <execution> + <id>update-extension-doc-page</id> + <goals> + <goal>update-extension-doc-page</goal> + </goals> + <phase>process-classes</phase> + </execution> + </executions> + </plugin> + </plugins> + </build> + </profile> + </profiles> +</project> diff --git a/extensions-jvm/debug/runtime/src/main/resources/META-INF/quarkus-extension.yaml b/extensions-jvm/debug/runtime/src/main/resources/META-INF/quarkus-extension.yaml new file mode 100644 index 0000000000..e931e70c49 --- /dev/null +++ b/extensions-jvm/debug/runtime/src/main/resources/META-INF/quarkus-extension.yaml @@ -0,0 +1,32 @@ +# +# 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. +# + +# This is a generated file. Do not edit directly! +# To re-generate, run the following command from the top level directory: +# +# mvn -N cq:update-quarkus-metadata +# +--- +name: "Camel Debug" +description: "Enables Camel Route Debugging" +metadata: + unlisted: true + guide: "https://camel.apache.org/camel-quarkus/latest/reference/extensions/debug.html" + categories: + - "integration" + status: + - "preview" diff --git a/extensions-jvm/pom.xml b/extensions-jvm/pom.xml index 74fc9473ee..17d8aadffd 100644 --- a/extensions-jvm/pom.xml +++ b/extensions-jvm/pom.xml @@ -53,6 +53,7 @@ <module>cometd</module> <module>corda</module> <module>couchbase</module> + <module>debug</module> <module>djl</module> <module>dns</module> <module>drill</module> diff --git a/integration-tests-jvm/debug/pom.xml b/integration-tests-jvm/debug/pom.xml new file mode 100644 index 0000000000..0711efc28a --- /dev/null +++ b/integration-tests-jvm/debug/pom.xml @@ -0,0 +1,84 @@ +<?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.10.0-SNAPSHOT</version> + <relativePath>../../poms/build-parent-it/pom.xml</relativePath> + </parent> + + <artifactId>camel-quarkus-integration-test-debug</artifactId> + <name>Camel Quarkus :: Integration Tests :: Debug</name> + <description>Integration tests for Camel Quarkus Debug extension</description> + + <dependencies> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-debug</artifactId> + </dependency> + <dependency> + <groupId>io.quarkus</groupId> + <artifactId>quarkus-resteasy</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> + </dependencies> + + <profiles> + <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-debug-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-jvm/debug/src/main/java/org/apache/camel/quarkus/component/debug/it/DebugResource.java b/integration-tests-jvm/debug/src/main/java/org/apache/camel/quarkus/component/debug/it/DebugResource.java new file mode 100644 index 0000000000..2c6daf86bf --- /dev/null +++ b/integration-tests-jvm/debug/src/main/java/org/apache/camel/quarkus/component/debug/it/DebugResource.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.debug.it; + +import javax.enterprise.context.ApplicationScoped; +import javax.inject.Inject; +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.CamelContext; +import org.apache.camel.impl.debugger.BacklogDebugger; + +@Path("/debug") +@ApplicationScoped +public class DebugResource { + + @Inject + CamelContext context; + + @Path("/enabled") + @GET + @Produces(MediaType.TEXT_PLAIN) + public boolean debuggingEnabled() { + BacklogDebugger debugger = BacklogDebugger.getBacklogDebugger(context); + return debugger != null && debugger.isEnabled(); + } +} diff --git a/integration-tests-jvm/debug/src/test/java/org/apache/camel/quarkus/component/debug/it/DebugTest.java b/integration-tests-jvm/debug/src/test/java/org/apache/camel/quarkus/component/debug/it/DebugTest.java new file mode 100644 index 0000000000..c560d73e6b --- /dev/null +++ b/integration-tests-jvm/debug/src/test/java/org/apache/camel/quarkus/component/debug/it/DebugTest.java @@ -0,0 +1,38 @@ +/* + * 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.debug.it; + +import io.quarkus.test.junit.QuarkusTest; +import io.restassured.RestAssured; +import org.junit.jupiter.api.Test; + +import static org.hamcrest.Matchers.is; + +/** + * Note: The dev mode test for enabling debugging is located in the debug extension deployment module. + */ +@QuarkusTest +public class DebugTest { + + @Test + public void camelDebuggingDisabledWhenNotInDevMode() { + RestAssured.get("/debug/enabled") + .then() + .body(is("false")) + .statusCode(200); + } +} diff --git a/integration-tests-jvm/pom.xml b/integration-tests-jvm/pom.xml index d6eae3bb9f..846a50bbd0 100644 --- a/integration-tests-jvm/pom.xml +++ b/integration-tests-jvm/pom.xml @@ -51,6 +51,7 @@ <module>cometd</module> <module>corda</module> <module>couchbase</module> + <module>debug</module> <module>djl</module> <module>dns</module> <module>drill</module> diff --git a/poms/bom/pom.xml b/poms/bom/pom.xml index e09b990409..5e06ac4d1b 100644 --- a/poms/bom/pom.xml +++ b/poms/bom/pom.xml @@ -1788,6 +1788,11 @@ </exclusion> </exclusions> </dependency> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-debug</artifactId> + <version>${camel.version}</version> + </dependency> <dependency> <groupId>org.apache.camel</groupId> <artifactId>camel-digitalocean</artifactId> @@ -6670,6 +6675,16 @@ <artifactId>camel-quarkus-debezium-sqlserver-deployment</artifactId> <version>${camel-quarkus.version}</version> </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-debug</artifactId> + <version>${camel-quarkus.version}</version> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-debug-deployment</artifactId> + <version>${camel-quarkus.version}</version> + </dependency> <dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-digitalocean</artifactId> diff --git a/poms/bom/src/main/generated/flattened-full-pom.xml b/poms/bom/src/main/generated/flattened-full-pom.xml index 93d603a1dc..8dd10f4e8c 100644 --- a/poms/bom/src/main/generated/flattened-full-pom.xml +++ b/poms/bom/src/main/generated/flattened-full-pom.xml @@ -1734,6 +1734,11 @@ </exclusion> </exclusions> </dependency> + <dependency> + <groupId>org.apache.camel</groupId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> + <artifactId>camel-debug</artifactId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> + <version>3.17.0</version><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> + </dependency> <dependency> <groupId>org.apache.camel</groupId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> <artifactId>camel-digitalocean</artifactId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> @@ -6614,6 +6619,16 @@ <artifactId>camel-quarkus-debezium-sqlserver-deployment</artifactId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> <version>2.10.0-SNAPSHOT</version><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> + <artifactId>camel-quarkus-debug</artifactId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> + <version>2.10.0-SNAPSHOT</version><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> + <artifactId>camel-quarkus-debug-deployment</artifactId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> + <version>2.10.0-SNAPSHOT</version><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> + </dependency> <dependency> <groupId>org.apache.camel.quarkus</groupId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> <artifactId>camel-quarkus-digitalocean</artifactId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> diff --git a/poms/bom/src/main/generated/flattened-reduced-pom.xml b/poms/bom/src/main/generated/flattened-reduced-pom.xml index 05b4ed064e..710c64de7a 100644 --- a/poms/bom/src/main/generated/flattened-reduced-pom.xml +++ b/poms/bom/src/main/generated/flattened-reduced-pom.xml @@ -1734,6 +1734,11 @@ </exclusion> </exclusions> </dependency> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-debug</artifactId> + <version>3.17.0</version> + </dependency> <dependency> <groupId>org.apache.camel</groupId> <artifactId>camel-digitalocean</artifactId> @@ -6614,6 +6619,16 @@ <artifactId>camel-quarkus-debezium-sqlserver-deployment</artifactId> <version>2.10.0-SNAPSHOT</version> </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-debug</artifactId> + <version>2.10.0-SNAPSHOT</version> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-debug-deployment</artifactId> + <version>2.10.0-SNAPSHOT</version> + </dependency> <dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-digitalocean</artifactId> diff --git a/poms/bom/src/main/generated/flattened-reduced-verbose-pom.xml b/poms/bom/src/main/generated/flattened-reduced-verbose-pom.xml index 84ca7e1151..06d7fa25b8 100644 --- a/poms/bom/src/main/generated/flattened-reduced-verbose-pom.xml +++ b/poms/bom/src/main/generated/flattened-reduced-verbose-pom.xml @@ -1734,6 +1734,11 @@ </exclusion> </exclusions> </dependency> + <dependency> + <groupId>org.apache.camel</groupId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> + <artifactId>camel-debug</artifactId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> + <version>3.17.0</version><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> + </dependency> <dependency> <groupId>org.apache.camel</groupId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> <artifactId>camel-digitalocean</artifactId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> @@ -6614,6 +6619,16 @@ <artifactId>camel-quarkus-debezium-sqlserver-deployment</artifactId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> <version>2.10.0-SNAPSHOT</version><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> + <artifactId>camel-quarkus-debug</artifactId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> + <version>2.10.0-SNAPSHOT</version><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> + <artifactId>camel-quarkus-debug-deployment</artifactId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> + <version>2.10.0-SNAPSHOT</version><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> + </dependency> <dependency> <groupId>org.apache.camel.quarkus</groupId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> <artifactId>camel-quarkus-digitalocean</artifactId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} -->