You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ja...@apache.org on 2023/07/03 14:55:20 UTC
[camel-quarkus] branch main updated: Add native support for camel-quarkus-debug
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 5c9e3108fb Add native support for camel-quarkus-debug
5c9e3108fb is described below
commit 5c9e3108fb8a7754b3809acbe60203ef63876e5c
Author: James Netherton <ja...@gmail.com>
AuthorDate: Mon Jul 3 11:07:35 2023 +0100
Add native support for camel-quarkus-debug
Fixes #5042
---
docs/modules/ROOT/examples/others/debug.yml | 6 +-
.../ROOT/pages/reference/extensions/debug.adoc | 58 ++++++++++++++--
extensions-jvm/pom.xml | 1 -
.../debug/deployment/pom.xml | 0
.../component/debug/deployment/DebugProcessor.java | 26 ++++---
.../debug/deployment/DebugDevModeTest.java | 2 +-
.../debug/deployment/DebugDisabledTest.java | 22 +++---
.../DebugEnabledFromCamelMainPropertyTest.java | 34 ++++++++--
.../debug/deployment/DebugEnabledTest.java | 34 ++++++++--
.../component/debug/deployment/DebugResource.java | 0
{extensions-jvm => extensions}/debug/pom.xml | 2 +-
.../debug/runtime/pom.xml | 1 +
.../debug/runtime/src/main/doc/configuration.adoc | 7 ++
extensions/debug/runtime/src/main/doc/usage.adoc | 11 +++
.../camel/quarkus/component/debug/DebugConfig.java | 28 +++-----
.../main/resources/META-INF/quarkus-extension.yaml | 0
.../management/deployment/ManagementProcessor.java | 6 +-
extensions/pom.xml | 1 +
integration-tests-jvm/pom.xml | 1 -
.../debug/pom.xml | 27 ++++++++
.../quarkus/component/debug/it/DebugResource.java | 0
.../src/main/resources/application.properties | 18 +++++
.../camel/quarkus/component/debug/it/DebugIT.java | 20 +-----
.../quarkus/component/debug/it/DebugTest.java | 79 ++++++++++++++++++++++
integration-tests/pom.xml | 1 +
tooling/scripts/test-categories.yaml | 1 +
26 files changed, 306 insertions(+), 80 deletions(-)
diff --git a/docs/modules/ROOT/examples/others/debug.yml b/docs/modules/ROOT/examples/others/debug.yml
index 099e7d0218..b11c2ecf40 100644
--- a/docs/modules/ROOT/examples/others/debug.yml
+++ b/docs/modules/ROOT/examples/others/debug.yml
@@ -2,11 +2,11 @@
# This file was generated by camel-quarkus-maven-plugin:update-extension-doc-page
cqArtifactId: camel-quarkus-debug
cqArtifactIdBase: debug
-cqNativeSupported: false
-cqStatus: Preview
+cqNativeSupported: true
+cqStatus: Stable
cqDeprecated: false
cqJvmSince: 2.10.0
-cqNativeSince: n/a
+cqNativeSince: 3.0.0
cqCamelPartName: debug
cqCamelPartTitle: Debug
cqCamelPartDescription: Enables Camel Route Debugging
diff --git a/docs/modules/ROOT/pages/reference/extensions/debug.adoc b/docs/modules/ROOT/pages/reference/extensions/debug.adoc
index 13cc30be96..a04a415908 100644
--- a/docs/modules/ROOT/pages/reference/extensions/debug.adoc
+++ b/docs/modules/ROOT/pages/reference/extensions/debug.adoc
@@ -4,17 +4,17 @@
= Debug
:linkattrs:
:cq-artifact-id: camel-quarkus-debug
-:cq-native-supported: false
-:cq-status: Preview
-:cq-status-deprecation: Preview
+:cq-native-supported: true
+:cq-status: Stable
+:cq-status-deprecation: Stable
:cq-description: Enables Camel Route Debugging
:cq-deprecated: false
:cq-jvm-since: 2.10.0
-:cq-native-since: n/a
+:cq-native-since: 3.0.0
ifeval::[{doc-show-badges} == true]
[.badges]
-[.badge-key]##JVM since##[.badge-supported]##2.10.0## [.badge-key]##Native##[.badge-unsupported]##unsupported##
+[.badge-key]##JVM since##[.badge-supported]##2.10.0## [.badge-key]##Native since##[.badge-supported]##3.0.0##
endif::[]
Enables Camel Route Debugging
@@ -29,6 +29,10 @@ Please refer to the above link for usage and configuration details.
[id="extensions-debug-maven-coordinates"]
== Maven coordinates
+https://{link-quarkus-code-generator}/?extension-search=camel-quarkus-debug[Create a new project with this extension on {link-quarkus-code-generator}, window="_blank"]
+
+Or add the coordinates to your existing project:
+
[source,xml]
----
<dependency>
@@ -39,3 +43,47 @@ Please refer to the above link for usage and configuration details.
ifeval::[{doc-show-user-guide-link} == true]
Check the xref:user-guide/index.adoc[User guide] for more information about writing Camel Quarkus applications.
endif::[]
+
+[id="extensions-debug-usage"]
+== Usage
+[id="extensions-debug-usage-native-mode"]
+=== Native mode
+
+**Experimental** JMX support was added for native executables in GraalVM for JDK 17/20 / Mandrel 23.0. You can enable this feature by
+adding the following configuration property to `application.properties`.
+
+[source,properties]
+----
+quarkus.native.monitoring=jmxserver,jmxclient
+----
+
+For more information, refer to the https://quarkus.io/guides/building-native-image#using-monitoring-options[Quarkus native guide].
+
+
+[id="extensions-debug-additional-camel-quarkus-configuration"]
+== Additional Camel Quarkus configuration
+
+By default, the `debug` extension is automatically enabled in development mode. If you want to leverage debugging
+capabilities outside of development mode, you must set a configuration property as follows.
+
+[source,properties]
+----
+quarkus.camel.debug.enabled=true
+----
+
+
+[width="100%",cols="80,5,15",options="header"]
+|===
+| Configuration property | Type | Default
+
+
+|icon:lock[title=Fixed at build time] [[quarkus.camel.debug.enabled]]`link:#quarkus.camel.debug.enabled[quarkus.camel.debug.enabled]`
+
+
+| `boolean`
+| `false`
+|===
+
+[.configuration-legend]
+{doc-link-icon-lock}[title=Fixed at build time] Configuration property fixed at build time. All other configuration properties are overridable at runtime.
+
diff --git a/extensions-jvm/pom.xml b/extensions-jvm/pom.xml
index b7002e51cd..e16ab783eb 100644
--- a/extensions-jvm/pom.xml
+++ b/extensions-jvm/pom.xml
@@ -54,7 +54,6 @@
<module>console</module>
<module>corda</module>
<module>couchbase</module>
- <module>debug</module>
<module>djl</module>
<module>dns</module>
<module>drill</module>
diff --git a/extensions-jvm/debug/deployment/pom.xml b/extensions/debug/deployment/pom.xml
similarity index 100%
rename from extensions-jvm/debug/deployment/pom.xml
rename to extensions/debug/deployment/pom.xml
diff --git a/extensions-jvm/debug/deployment/src/main/java/org/apache/camel/quarkus/component/debug/deployment/DebugProcessor.java b/extensions/debug/deployment/src/main/java/org/apache/camel/quarkus/component/debug/deployment/DebugProcessor.java
similarity index 72%
rename from extensions-jvm/debug/deployment/src/main/java/org/apache/camel/quarkus/component/debug/deployment/DebugProcessor.java
rename to extensions/debug/deployment/src/main/java/org/apache/camel/quarkus/component/debug/deployment/DebugProcessor.java
index 21ba451e4c..24c84cd13e 100644
--- a/extensions-jvm/debug/deployment/src/main/java/org/apache/camel/quarkus/component/debug/deployment/DebugProcessor.java
+++ b/extensions/debug/deployment/src/main/java/org/apache/camel/quarkus/component/debug/deployment/DebugProcessor.java
@@ -16,28 +16,31 @@
*/
package org.apache.camel.quarkus.component.debug.deployment;
-import io.quarkus.deployment.IsDevelopment;
+import java.util.function.BooleanSupplier;
+
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 io.quarkus.runtime.LaunchMode;
+import org.apache.camel.quarkus.component.debug.DebugConfig;
import org.apache.camel.quarkus.core.deployment.spi.CamelServiceDestination;
import org.apache.camel.quarkus.core.deployment.spi.CamelServicePatternBuildItem;
+import org.eclipse.microprofile.config.ConfigProvider;
class DebugProcessor {
private static final String FEATURE = "camel-debug";
- @BuildStep(onlyIf = IsDevelopment.class)
+ @BuildStep(onlyIf = DebugEnabled.class)
FeatureBuildItem feature() {
return new FeatureBuildItem(FEATURE);
}
- @BuildStep(onlyIf = IsDevelopment.class)
+ @BuildStep(onlyIf = DebugEnabled.class)
AllowJNDIBuildItem allowJNDI() {
return new AllowJNDIBuildItem();
}
- @BuildStep(onlyIfNot = IsDevelopment.class)
+ @BuildStep(onlyIfNot = DebugEnabled.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/*
@@ -45,9 +48,14 @@ class DebugProcessor {
"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");
+ static class DebugEnabled implements BooleanSupplier {
+ DebugConfig config;
+ LaunchMode launchMode;
+
+ @Override
+ public boolean getAsBoolean() {
+ return (launchMode.equals(LaunchMode.DEVELOPMENT)) || (config.enabled
+ || ConfigProvider.getConfig().getOptionalValue("camel.main.debugging", boolean.class).orElse(false));
+ }
}
}
diff --git a/extensions-jvm/debug/deployment/src/test/java/org/apache/camel/quarkus/component/debug/deployment/DebugTest.java b/extensions/debug/deployment/src/test/java/org/apache/camel/quarkus/component/debug/deployment/DebugDevModeTest.java
similarity index 98%
copy from extensions-jvm/debug/deployment/src/test/java/org/apache/camel/quarkus/component/debug/deployment/DebugTest.java
copy to extensions/debug/deployment/src/test/java/org/apache/camel/quarkus/component/debug/deployment/DebugDevModeTest.java
index c848c3fa04..552e108ae9 100644
--- a/extensions-jvm/debug/deployment/src/test/java/org/apache/camel/quarkus/component/debug/deployment/DebugTest.java
+++ b/extensions/debug/deployment/src/test/java/org/apache/camel/quarkus/component/debug/deployment/DebugDevModeTest.java
@@ -29,7 +29,7 @@ import org.junit.jupiter.api.extension.RegisterExtension;
import static org.hamcrest.Matchers.is;
-public class DebugTest {
+public class DebugDevModeTest {
@RegisterExtension
static final QuarkusDevModeTest TEST = new QuarkusDevModeTest()
diff --git a/integration-tests-jvm/debug/src/test/java/org/apache/camel/quarkus/component/debug/it/DebugTest.java b/extensions/debug/deployment/src/test/java/org/apache/camel/quarkus/component/debug/deployment/DebugDisabledTest.java
similarity index 63%
copy from integration-tests-jvm/debug/src/test/java/org/apache/camel/quarkus/component/debug/it/DebugTest.java
copy to extensions/debug/deployment/src/test/java/org/apache/camel/quarkus/component/debug/deployment/DebugDisabledTest.java
index c560d73e6b..2801a3ba89 100644
--- a/integration-tests-jvm/debug/src/test/java/org/apache/camel/quarkus/component/debug/it/DebugTest.java
+++ b/extensions/debug/deployment/src/test/java/org/apache/camel/quarkus/component/debug/deployment/DebugDisabledTest.java
@@ -14,22 +14,28 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.camel.quarkus.component.debug.it;
+package org.apache.camel.quarkus.component.debug.deployment;
-import io.quarkus.test.junit.QuarkusTest;
+import java.io.IOException;
+
+import io.quarkus.test.QuarkusUnitTest;
import io.restassured.RestAssured;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
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 {
+public class DebugDisabledTest {
+
+ @RegisterExtension
+ static final QuarkusUnitTest CONFIG = new QuarkusUnitTest()
+ .setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class)
+ .addClass(DebugResource.class));
@Test
- public void camelDebuggingDisabledWhenNotInDevMode() {
+ public void camelDebuggingDisabledByDefault() throws IOException {
RestAssured.get("/debug/enabled")
.then()
.body(is("false"))
diff --git a/extensions-jvm/debug/deployment/src/test/java/org/apache/camel/quarkus/component/debug/deployment/DebugTest.java b/extensions/debug/deployment/src/test/java/org/apache/camel/quarkus/component/debug/deployment/DebugEnabledFromCamelMainPropertyTest.java
similarity index 59%
copy from extensions-jvm/debug/deployment/src/test/java/org/apache/camel/quarkus/component/debug/deployment/DebugTest.java
copy to extensions/debug/deployment/src/test/java/org/apache/camel/quarkus/component/debug/deployment/DebugEnabledFromCamelMainPropertyTest.java
index c848c3fa04..7a9afce27d 100644
--- a/extensions-jvm/debug/deployment/src/test/java/org/apache/camel/quarkus/component/debug/deployment/DebugTest.java
+++ b/extensions/debug/deployment/src/test/java/org/apache/camel/quarkus/component/debug/deployment/DebugEnabledFromCamelMainPropertyTest.java
@@ -17,11 +17,16 @@
package org.apache.camel.quarkus.component.debug.deployment;
import java.io.IOException;
+import java.io.StringWriter;
+import java.io.Writer;
import java.net.Socket;
+import java.util.Properties;
-import io.quarkus.test.QuarkusDevModeTest;
+import io.quarkus.test.QuarkusUnitTest;
import io.restassured.RestAssured;
import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.Asset;
+import org.jboss.shrinkwrap.api.asset.StringAsset;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
@@ -29,16 +34,16 @@ import org.junit.jupiter.api.extension.RegisterExtension;
import static org.hamcrest.Matchers.is;
-public class DebugTest {
+public class DebugEnabledFromCamelMainPropertyTest {
@RegisterExtension
- static final QuarkusDevModeTest TEST = new QuarkusDevModeTest()
- .setArchiveProducer(() -> ShrinkWrap
- .create(JavaArchive.class)
- .addClass(DebugResource.class));
+ static final QuarkusUnitTest CONFIG = new QuarkusUnitTest()
+ .setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class)
+ .addClass(DebugResource.class)
+ .addAsResource(applicationProperties(), "application.properties"));
@Test
- public void camelDebuggingEnabledInDevMode() throws IOException {
+ public void camelDebuggingEnabledFromCamelMainProperty() throws IOException {
RestAssured.get("/debug/enabled")
.then()
.body(is("true"))
@@ -48,4 +53,19 @@ public class DebugTest {
Assertions.assertTrue(socket.isConnected());
}
}
+
+ public static final Asset applicationProperties() {
+ Writer writer = new StringWriter();
+
+ Properties props = new Properties();
+ props.setProperty("camel.main.debugging", "true");
+
+ try {
+ props.store(writer, "");
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+
+ return new StringAsset(writer.toString());
+ }
}
diff --git a/extensions-jvm/debug/deployment/src/test/java/org/apache/camel/quarkus/component/debug/deployment/DebugTest.java b/extensions/debug/deployment/src/test/java/org/apache/camel/quarkus/component/debug/deployment/DebugEnabledTest.java
similarity index 60%
rename from extensions-jvm/debug/deployment/src/test/java/org/apache/camel/quarkus/component/debug/deployment/DebugTest.java
rename to extensions/debug/deployment/src/test/java/org/apache/camel/quarkus/component/debug/deployment/DebugEnabledTest.java
index c848c3fa04..fddde87127 100644
--- a/extensions-jvm/debug/deployment/src/test/java/org/apache/camel/quarkus/component/debug/deployment/DebugTest.java
+++ b/extensions/debug/deployment/src/test/java/org/apache/camel/quarkus/component/debug/deployment/DebugEnabledTest.java
@@ -17,11 +17,16 @@
package org.apache.camel.quarkus.component.debug.deployment;
import java.io.IOException;
+import java.io.StringWriter;
+import java.io.Writer;
import java.net.Socket;
+import java.util.Properties;
-import io.quarkus.test.QuarkusDevModeTest;
+import io.quarkus.test.QuarkusUnitTest;
import io.restassured.RestAssured;
import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.Asset;
+import org.jboss.shrinkwrap.api.asset.StringAsset;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
@@ -29,16 +34,16 @@ import org.junit.jupiter.api.extension.RegisterExtension;
import static org.hamcrest.Matchers.is;
-public class DebugTest {
+public class DebugEnabledTest {
@RegisterExtension
- static final QuarkusDevModeTest TEST = new QuarkusDevModeTest()
- .setArchiveProducer(() -> ShrinkWrap
- .create(JavaArchive.class)
- .addClass(DebugResource.class));
+ static final QuarkusUnitTest CONFIG = new QuarkusUnitTest()
+ .setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class)
+ .addClass(DebugResource.class)
+ .addAsResource(applicationProperties(), "application.properties"));
@Test
- public void camelDebuggingEnabledInDevMode() throws IOException {
+ public void camelDebuggingEnabled() throws IOException {
RestAssured.get("/debug/enabled")
.then()
.body(is("true"))
@@ -48,4 +53,19 @@ public class DebugTest {
Assertions.assertTrue(socket.isConnected());
}
}
+
+ public static final Asset applicationProperties() {
+ Writer writer = new StringWriter();
+
+ Properties props = new Properties();
+ props.setProperty("quarkus.camel.debug.enabled", "true");
+
+ try {
+ props.store(writer, "");
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+
+ return new StringAsset(writer.toString());
+ }
}
diff --git a/extensions-jvm/debug/deployment/src/test/java/org/apache/camel/quarkus/component/debug/deployment/DebugResource.java b/extensions/debug/deployment/src/test/java/org/apache/camel/quarkus/component/debug/deployment/DebugResource.java
similarity index 100%
rename from extensions-jvm/debug/deployment/src/test/java/org/apache/camel/quarkus/component/debug/deployment/DebugResource.java
rename to extensions/debug/deployment/src/test/java/org/apache/camel/quarkus/component/debug/deployment/DebugResource.java
diff --git a/extensions-jvm/debug/pom.xml b/extensions/debug/pom.xml
similarity index 96%
rename from extensions-jvm/debug/pom.xml
rename to extensions/debug/pom.xml
index 150ac0ea56..6234bd3061 100644
--- a/extensions-jvm/debug/pom.xml
+++ b/extensions/debug/pom.xml
@@ -21,7 +21,7 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.camel.quarkus</groupId>
- <artifactId>camel-quarkus-extensions-jvm</artifactId>
+ <artifactId>camel-quarkus-extensions</artifactId>
<version>3.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
diff --git a/extensions-jvm/debug/runtime/pom.xml b/extensions/debug/runtime/pom.xml
similarity index 98%
rename from extensions-jvm/debug/runtime/pom.xml
rename to extensions/debug/runtime/pom.xml
index 5b9d7b4c9f..2ec929e863 100644
--- a/extensions-jvm/debug/runtime/pom.xml
+++ b/extensions/debug/runtime/pom.xml
@@ -32,6 +32,7 @@
<properties>
<camel.quarkus.jvmSince>2.10.0</camel.quarkus.jvmSince>
+ <camel.quarkus.nativeSince>3.0.0</camel.quarkus.nativeSince>
</properties>
<dependencies>
diff --git a/extensions/debug/runtime/src/main/doc/configuration.adoc b/extensions/debug/runtime/src/main/doc/configuration.adoc
new file mode 100644
index 0000000000..02afba7fc9
--- /dev/null
+++ b/extensions/debug/runtime/src/main/doc/configuration.adoc
@@ -0,0 +1,7 @@
+By default, the `debug` extension is automatically enabled in development mode. If you want to leverage debugging
+capabilities outside of development mode, you must set a configuration property as follows.
+
+[source,properties]
+----
+quarkus.camel.debug.enabled=true
+----
diff --git a/extensions/debug/runtime/src/main/doc/usage.adoc b/extensions/debug/runtime/src/main/doc/usage.adoc
new file mode 100644
index 0000000000..db8216f521
--- /dev/null
+++ b/extensions/debug/runtime/src/main/doc/usage.adoc
@@ -0,0 +1,11 @@
+=== Native mode
+
+**Experimental** JMX support was added for native executables in GraalVM for JDK 17/20 / Mandrel 23.0. You can enable this feature by
+adding the following configuration property to `application.properties`.
+
+[source,properties]
+----
+quarkus.native.monitoring=jmxserver,jmxclient
+----
+
+For more information, refer to the https://quarkus.io/guides/building-native-image#using-monitoring-options[Quarkus native guide].
diff --git a/integration-tests-jvm/debug/src/test/java/org/apache/camel/quarkus/component/debug/it/DebugTest.java b/extensions/debug/runtime/src/main/java/org/apache/camel/quarkus/component/debug/DebugConfig.java
similarity index 58%
copy from integration-tests-jvm/debug/src/test/java/org/apache/camel/quarkus/component/debug/it/DebugTest.java
copy to extensions/debug/runtime/src/main/java/org/apache/camel/quarkus/component/debug/DebugConfig.java
index c560d73e6b..f8b1d2716f 100644
--- a/integration-tests-jvm/debug/src/test/java/org/apache/camel/quarkus/component/debug/it/DebugTest.java
+++ b/extensions/debug/runtime/src/main/java/org/apache/camel/quarkus/component/debug/DebugConfig.java
@@ -14,25 +14,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.camel.quarkus.component.debug.it;
+package org.apache.camel.quarkus.component.debug;
-import io.quarkus.test.junit.QuarkusTest;
-import io.restassured.RestAssured;
-import org.junit.jupiter.api.Test;
+import io.quarkus.runtime.annotations.ConfigPhase;
+import io.quarkus.runtime.annotations.ConfigRoot;
-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);
- }
+@ConfigRoot(name = "camel.debug", phase = ConfigPhase.BUILD_AND_RUN_TIME_FIXED)
+public class DebugConfig {
+ /**
+ * Set whether to enable Camel debugging support.
+ */
+ public boolean enabled;
}
diff --git a/extensions-jvm/debug/runtime/src/main/resources/META-INF/quarkus-extension.yaml b/extensions/debug/runtime/src/main/resources/META-INF/quarkus-extension.yaml
similarity index 100%
rename from extensions-jvm/debug/runtime/src/main/resources/META-INF/quarkus-extension.yaml
rename to extensions/debug/runtime/src/main/resources/META-INF/quarkus-extension.yaml
diff --git a/extensions/management/deployment/src/main/java/org/apache/camel/quarkus/component/management/deployment/ManagementProcessor.java b/extensions/management/deployment/src/main/java/org/apache/camel/quarkus/component/management/deployment/ManagementProcessor.java
index 7a07f21de2..041ba407d4 100644
--- a/extensions/management/deployment/src/main/java/org/apache/camel/quarkus/component/management/deployment/ManagementProcessor.java
+++ b/extensions/management/deployment/src/main/java/org/apache/camel/quarkus/component/management/deployment/ManagementProcessor.java
@@ -17,6 +17,7 @@
package org.apache.camel.quarkus.component.management.deployment;
import java.lang.reflect.Modifier;
+import java.rmi.NotBoundException;
import java.util.Objects;
import java.util.Set;
import java.util.function.Predicate;
@@ -25,6 +26,7 @@ import java.util.stream.Stream;
import javax.management.MBeanException;
import javax.management.MBeanServerNotification;
+import javax.management.ObjectInstance;
import javax.management.modelmbean.DescriptorSupport;
import javax.management.modelmbean.ModelMBeanAttributeInfo;
import javax.management.modelmbean.ModelMBeanInfoSupport;
@@ -69,7 +71,9 @@ class ManagementProcessor {
ModelMBeanOperationInfo.class.getName(),
MBeanException.class.getName(),
MBeanServerNotification.class.getName(),
- Object.class.getName()
+ NotBoundException.class.getName(),
+ Object.class.getName(),
+ ObjectInstance.class.getName(),
};
@BuildStep
diff --git a/extensions/pom.xml b/extensions/pom.xml
index 9a6f56baee..4fb55e069d 100644
--- a/extensions/pom.xml
+++ b/extensions/pom.xml
@@ -90,6 +90,7 @@
<module>debezium-mysql</module>
<module>debezium-postgres</module>
<module>debezium-sqlserver</module>
+ <module>debug</module>
<module>digitalocean</module>
<module>direct</module>
<module>disruptor</module>
diff --git a/integration-tests-jvm/pom.xml b/integration-tests-jvm/pom.xml
index be5b009ec7..1ba33ea06d 100644
--- a/integration-tests-jvm/pom.xml
+++ b/integration-tests-jvm/pom.xml
@@ -53,7 +53,6 @@
<module>controlbus-statistics</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/debug/pom.xml
similarity index 77%
rename from integration-tests-jvm/debug/pom.xml
rename to integration-tests/debug/pom.xml
index 97db1a27a8..4dbdfce0e3 100644
--- a/integration-tests-jvm/debug/pom.xml
+++ b/integration-tests/debug/pom.xml
@@ -78,5 +78,32 @@
</dependency>
</dependencies>
</profile>
+ <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-jvm/debug/src/main/java/org/apache/camel/quarkus/component/debug/it/DebugResource.java b/integration-tests/debug/src/main/java/org/apache/camel/quarkus/component/debug/it/DebugResource.java
similarity index 100%
rename from integration-tests-jvm/debug/src/main/java/org/apache/camel/quarkus/component/debug/it/DebugResource.java
rename to integration-tests/debug/src/main/java/org/apache/camel/quarkus/component/debug/it/DebugResource.java
diff --git a/integration-tests/debug/src/main/resources/application.properties b/integration-tests/debug/src/main/resources/application.properties
new file mode 100644
index 0000000000..e231224d05
--- /dev/null
+++ b/integration-tests/debug/src/main/resources/application.properties
@@ -0,0 +1,18 @@
+## ---------------------------------------------------------------------------
+## 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.native.monitoring=jmxserver,jmxclient
+quarkus.camel.debug.enabled=true
diff --git a/integration-tests-jvm/debug/src/test/java/org/apache/camel/quarkus/component/debug/it/DebugTest.java b/integration-tests/debug/src/test/java/org/apache/camel/quarkus/component/debug/it/DebugIT.java
similarity index 62%
rename from integration-tests-jvm/debug/src/test/java/org/apache/camel/quarkus/component/debug/it/DebugTest.java
rename to integration-tests/debug/src/test/java/org/apache/camel/quarkus/component/debug/it/DebugIT.java
index c560d73e6b..05c2de736b 100644
--- a/integration-tests-jvm/debug/src/test/java/org/apache/camel/quarkus/component/debug/it/DebugTest.java
+++ b/integration-tests/debug/src/test/java/org/apache/camel/quarkus/component/debug/it/DebugIT.java
@@ -16,23 +16,9 @@
*/
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 io.quarkus.test.junit.QuarkusIntegrationTest;
-import static org.hamcrest.Matchers.is;
+@QuarkusIntegrationTest
+class DebugIT extends DebugTest {
-/**
- * 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/debug/src/test/java/org/apache/camel/quarkus/component/debug/it/DebugTest.java b/integration-tests/debug/src/test/java/org/apache/camel/quarkus/component/debug/it/DebugTest.java
new file mode 100644
index 0000000000..f613f742b3
--- /dev/null
+++ b/integration-tests/debug/src/test/java/org/apache/camel/quarkus/component/debug/it/DebugTest.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.debug.it;
+
+import java.util.Iterator;
+import java.util.Set;
+
+import javax.management.MBeanServerConnection;
+import javax.management.ObjectInstance;
+import javax.management.ObjectName;
+import javax.management.remote.JMXConnector;
+import javax.management.remote.JMXConnectorFactory;
+import javax.management.remote.JMXServiceURL;
+
+import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.RestAssured;
+import org.apache.camel.ServiceStatus;
+import org.junit.jupiter.api.Test;
+
+import static org.apache.camel.component.debug.JmxConnectorService.DEFAULT_HOST;
+import static org.apache.camel.component.debug.JmxConnectorService.DEFAULT_REGISTRY_PORT;
+import static org.apache.camel.component.debug.JmxConnectorService.DEFAULT_SERVICE_URL_PATH;
+import static org.hamcrest.Matchers.is;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.fail;
+
+@QuarkusTest
+public class DebugTest {
+
+ @Test
+ public void camelDebuggingEnabled() {
+ RestAssured.get("/debug/enabled")
+ .then()
+ .body(is("true"))
+ .statusCode(200);
+ }
+
+ @Test
+ void camelDebugJmxConnection() throws Exception {
+ String url = String.format("service:jmx:rmi:///jndi/rmi://%s:%d%s", DEFAULT_HOST, DEFAULT_REGISTRY_PORT,
+ DEFAULT_SERVICE_URL_PATH);
+ JMXServiceURL jmxUrl = new JMXServiceURL(url);
+
+ try (JMXConnector connector = JMXConnectorFactory.connect(jmxUrl)) {
+ MBeanServerConnection mbeanServer = connector.getMBeanServerConnection();
+
+ ObjectName objectName = new ObjectName("org.apache.camel:type=context,*");
+ Set<ObjectInstance> mbeans = mbeanServer.queryMBeans(objectName, null);
+ assertNotNull(mbeans);
+
+ Iterator<ObjectInstance> iterator = mbeans.iterator();
+ if (iterator.hasNext()) {
+ ObjectInstance camelContext = iterator.next();
+ assertNotNull(camelContext);
+
+ String status = (String) mbeanServer.invoke(camelContext.getObjectName(), "getState", new Object[] {},
+ new String[] {});
+ assertEquals(ServiceStatus.Started, ServiceStatus.valueOf(status));
+ } else {
+ fail("Expected to find 1 CamelContext MBean");
+ }
+ }
+ }
+}
diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml
index 9dc57f5c65..3ac8d352fe 100644
--- a/integration-tests/pom.xml
+++ b/integration-tests/pom.xml
@@ -83,6 +83,7 @@
<module>dataformats-json-grouped</module>
<module>datasonnet</module>
<module>debezium</module>
+ <module>debug</module>
<module>digitalocean</module>
<module>disruptor</module>
<module>dropbox</module>
diff --git a/tooling/scripts/test-categories.yaml b/tooling/scripts/test-categories.yaml
index 7cad8f0e8e..43531438d5 100644
--- a/tooling/scripts/test-categories.yaml
+++ b/tooling/scripts/test-categories.yaml
@@ -137,6 +137,7 @@ group-08:
- zendesk
group-09:
- amqp
+ - debug
- ftp
- graphql
- kafka-sasl-ssl