You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by zb...@apache.org on 2022/10/17 06:58:20 UTC
[camel-quarkus] branch main updated: Add extension DSL modeline Fixes #3834
This is an automated email from the ASF dual-hosted git repository.
zbendhiba 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 c7b197f660 Add extension DSL modeline Fixes #3834
c7b197f660 is described below
commit c7b197f660d9b8eff2abe1ebcd85d729af354f0b
Author: Zineb Bendhiba <be...@gmail.com>
AuthorDate: Tue Jun 21 16:21:50 2022 +0200
Add extension DSL modeline
Fixes #3834
---
catalog/pom.xml | 13 ++
docs/modules/ROOT/examples/others/dsl-modeline.yml | 13 ++
docs/modules/ROOT/nav.adoc | 1 +
.../pages/reference/extensions/dsl-modeline.adoc | 41 +++++
extensions-jvm/dsl-modeline/deployment/pom.xml | 61 +++++++
.../modeline/deployment/DslModelineProcessor.java | 50 ++++++
extensions-jvm/dsl-modeline/pom.xml | 37 ++++
extensions-jvm/dsl-modeline/runtime/pom.xml | 97 ++++++++++
.../modeline/runtime/PropertyTraitRecorder.java | 34 ++++
.../main/resources/META-INF/quarkus-extension.yaml | 32 ++++
extensions-jvm/pom.xml | 1 +
integration-tests-jvm/dsl-modeline/pom.xml | 86 +++++++++
.../dsl/modeline/it/DslModelineResource.java | 87 +++++++++
.../src/main/resources/application.properties | 17 ++
.../src/main/resources/myapp.properties | 19 ++
.../component/dsl/modeline/it/DslModelineIT.java | 24 +++
.../component/dsl/modeline/it/DslModelineTest.java | 195 +++++++++++++++++++++
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 ++
22 files changed, 869 insertions(+)
diff --git a/catalog/pom.xml b/catalog/pom.xml
index ed5466c69c..d743848227 100644
--- a/catalog/pom.xml
+++ b/catalog/pom.xml
@@ -1228,6 +1228,19 @@
</exclusion>
</exclusions>
</dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-dsl-modeline</artifactId>
+ <version>${project.version}</version>
+ <type>pom</type>
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>*</groupId>
+ <artifactId>*</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-ehcache</artifactId>
diff --git a/docs/modules/ROOT/examples/others/dsl-modeline.yml b/docs/modules/ROOT/examples/others/dsl-modeline.yml
new file mode 100644
index 0000000000..477cf6f0d4
--- /dev/null
+++ b/docs/modules/ROOT/examples/others/dsl-modeline.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-dsl-modeline
+cqArtifactIdBase: dsl-modeline
+cqNativeSupported: false
+cqStatus: Preview
+cqDeprecated: false
+cqJvmSince: 2.14.0
+cqNativeSince: n/a
+cqCamelPartName: dsl-modeline
+cqCamelPartTitle: DSL Modeline
+cqCamelPartDescription: Camel DSL Camel K modeline
+cqExtensionPageTitle: DSL Modeline
diff --git a/docs/modules/ROOT/nav.adoc b/docs/modules/ROOT/nav.adoc
index 047ab3a667..6f65282373 100644
--- a/docs/modules/ROOT/nav.adoc
+++ b/docs/modules/ROOT/nav.adoc
@@ -98,6 +98,7 @@
*** xref:reference/extensions/cron.adoc[Cron]
*** xref:reference/extensions/crypto.adoc[Crypto (JCE)]
*** xref:reference/extensions/dns.adoc[DNS]
+*** xref:reference/extensions/dsl-modeline.adoc[DSL Modeline]
*** xref:reference/extensions/dataformat.adoc[Data Format]
*** xref:reference/extensions/datasonnet.adoc[DataSonnet]
*** xref:reference/extensions/dataset.adoc[Dataset]
diff --git a/docs/modules/ROOT/pages/reference/extensions/dsl-modeline.adoc b/docs/modules/ROOT/pages/reference/extensions/dsl-modeline.adoc
new file mode 100644
index 0000000000..63d27a6a61
--- /dev/null
+++ b/docs/modules/ROOT/pages/reference/extensions/dsl-modeline.adoc
@@ -0,0 +1,41 @@
+// Do not edit directly!
+// This file was generated by camel-quarkus-maven-plugin:update-extension-doc-page
+[id="extensions-dsl-modeline"]
+= DSL Modeline
+:linkattrs:
+:cq-artifact-id: camel-quarkus-dsl-modeline
+:cq-native-supported: false
+:cq-status: Preview
+:cq-status-deprecation: Preview
+:cq-description: Support for Camel K style modeline
+:cq-deprecated: false
+:cq-jvm-since: 2.14.0
+:cq-native-since: n/a
+
+ifeval::[{doc-show-badges} == true]
+[.badges]
+[.badge-key]##JVM since##[.badge-supported]##2.14.0## [.badge-key]##Native##[.badge-unsupported]##unsupported##
+endif::[]
+
+Support for Camel K style modeline
+
+[id="extensions-dsl-modeline-whats-inside"]
+== What's inside
+
+* xref:{cq-camel-components}:others:dsl-modeline.adoc[DSL Modeline]
+
+Please refer to the above link for usage and configuration details.
+
+[id="extensions-dsl-modeline-maven-coordinates"]
+== Maven coordinates
+
+[source,xml]
+----
+<dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-dsl-modeline</artifactId>
+</dependency>
+----
+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::[]
diff --git a/extensions-jvm/dsl-modeline/deployment/pom.xml b/extensions-jvm/dsl-modeline/deployment/pom.xml
new file mode 100644
index 0000000000..f6efacf0b7
--- /dev/null
+++ b/extensions-jvm/dsl-modeline/deployment/pom.xml
@@ -0,0 +1,61 @@
+<?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-dsl-modeline-parent</artifactId>
+ <version>2.14.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>camel-quarkus-dsl-modeline-deployment</artifactId>
+ <name>Camel Quarkus :: DSL Modeline :: 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-dsl-modeline</artifactId>
+ </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>
\ No newline at end of file
diff --git a/extensions-jvm/dsl-modeline/deployment/src/main/java/org/apache/camel/quarkus/component/dsl/modeline/deployment/DslModelineProcessor.java b/extensions-jvm/dsl-modeline/deployment/src/main/java/org/apache/camel/quarkus/component/dsl/modeline/deployment/DslModelineProcessor.java
new file mode 100644
index 0000000000..ae7c6a8dfc
--- /dev/null
+++ b/extensions-jvm/dsl-modeline/deployment/src/main/java/org/apache/camel/quarkus/component/dsl/modeline/deployment/DslModelineProcessor.java
@@ -0,0 +1,50 @@
+/*
+ * 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.dsl.modeline.deployment;
+
+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.deployment.pkg.steps.NativeBuild;
+import io.quarkus.runtime.RuntimeValue;
+import org.apache.camel.CamelContext;
+import org.apache.camel.quarkus.component.dsl.modeline.runtime.PropertyTraitRecorder;
+import org.apache.camel.quarkus.core.deployment.spi.CamelContextBuildItem;
+
+public class DslModelineProcessor {
+ private static final String FEATURE = "camel-dsl-modeline";
+
+ @BuildStep
+ FeatureBuildItem feature() {
+ return new FeatureBuildItem(FEATURE);
+ }
+
+ @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");
+ }
+
+ @Record(value = ExecutionTime.STATIC_INIT)
+ @BuildStep
+ void addPropertyTrait(CamelContextBuildItem camelContextBuildItem, PropertyTraitRecorder propertyTraitRecorder) {
+ RuntimeValue<CamelContext> context = camelContextBuildItem.getCamelContext();
+ propertyTraitRecorder.addPropertyTrait(context);
+ }
+
+}
diff --git a/extensions-jvm/dsl-modeline/pom.xml b/extensions-jvm/dsl-modeline/pom.xml
new file mode 100644
index 0000000000..bfde4c60df
--- /dev/null
+++ b/extensions-jvm/dsl-modeline/pom.xml
@@ -0,0 +1,37 @@
+<?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.14.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>camel-quarkus-dsl-modeline-parent</artifactId>
+ <name>Camel Quarkus :: DSL Modeline</name>
+ <packaging>pom</packaging>
+
+ <modules>
+ <module>deployment</module>
+ <module>runtime</module>
+ </modules>
+</project>
\ No newline at end of file
diff --git a/extensions-jvm/dsl-modeline/runtime/pom.xml b/extensions-jvm/dsl-modeline/runtime/pom.xml
new file mode 100644
index 0000000000..0bf9fa4c5e
--- /dev/null
+++ b/extensions-jvm/dsl-modeline/runtime/pom.xml
@@ -0,0 +1,97 @@
+<?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-dsl-modeline-parent</artifactId>
+ <version>2.14.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>camel-quarkus-dsl-modeline</artifactId>
+ <name>Camel Quarkus :: DSL Modeline :: Runtime</name>
+ <description>Support for Camel K style modeline</description>
+
+ <properties>
+ <camel.quarkus.jvmSince>2.14.0</camel.quarkus.jvmSince>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-dsl-modeline</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-extension-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>
\ No newline at end of file
diff --git a/extensions-jvm/dsl-modeline/runtime/src/main/java/org/apache/camel/quarkus/component/dsl/modeline/runtime/PropertyTraitRecorder.java b/extensions-jvm/dsl-modeline/runtime/src/main/java/org/apache/camel/quarkus/component/dsl/modeline/runtime/PropertyTraitRecorder.java
new file mode 100644
index 0000000000..6423851f17
--- /dev/null
+++ b/extensions-jvm/dsl-modeline/runtime/src/main/java/org/apache/camel/quarkus/component/dsl/modeline/runtime/PropertyTraitRecorder.java
@@ -0,0 +1,34 @@
+/*
+ * 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.dsl.modeline.runtime;
+
+import io.quarkus.runtime.RuntimeValue;
+import io.quarkus.runtime.annotations.Recorder;
+import org.apache.camel.CamelContext;
+import org.apache.camel.dsl.modeline.PropertyTrait;
+import org.apache.camel.spi.PropertiesComponent;
+
+@Recorder
+public class PropertyTraitRecorder {
+
+ public void addPropertyTrait(RuntimeValue<CamelContext> camelContextRuntimeValue) {
+ CamelContext camelContext = camelContextRuntimeValue.getValue();
+ PropertiesComponent pc = camelContext.getPropertiesComponent();
+ pc.addPropertiesSource(new PropertyTrait());
+ }
+
+}
diff --git a/extensions-jvm/dsl-modeline/runtime/src/main/resources/META-INF/quarkus-extension.yaml b/extensions-jvm/dsl-modeline/runtime/src/main/resources/META-INF/quarkus-extension.yaml
new file mode 100644
index 0000000000..35f664a4dc
--- /dev/null
+++ b/extensions-jvm/dsl-modeline/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 DSL Modeline"
+description: "Support for Camel K style modeline"
+metadata:
+ unlisted: true
+ guide: "https://camel.apache.org/camel-quarkus/latest/reference/extensions/dsl-modeline.html"
+ categories:
+ - "integration"
+ status:
+ - "preview"
diff --git a/extensions-jvm/pom.xml b/extensions-jvm/pom.xml
index e8d9ce8cd2..2d887c5f8e 100644
--- a/extensions-jvm/pom.xml
+++ b/extensions-jvm/pom.xml
@@ -58,6 +58,7 @@
<module>djl</module>
<module>dns</module>
<module>drill</module>
+ <module>dsl-modeline</module>
<module>ehcache</module>
<module>etcd3</module>
<module>facebook</module>
diff --git a/integration-tests-jvm/dsl-modeline/pom.xml b/integration-tests-jvm/dsl-modeline/pom.xml
new file mode 100644
index 0000000000..727bf01361
--- /dev/null
+++ b/integration-tests-jvm/dsl-modeline/pom.xml
@@ -0,0 +1,86 @@
+<?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.14.0-SNAPSHOT</version>
+ <relativePath>../../poms/build-parent-it/pom.xml</relativePath>
+ </parent>
+
+ <artifactId>camel-quarkus-integration-test-dsl-modeline</artifactId>
+ <name>Camel Quarkus :: Integration Tests :: Dsl Modeline</name>
+ <description>Integration tests for Camel Quarkus Dsl Modeline extension</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-dsl-modeline</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-resteasy-jackson</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-dsl-modeline-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>
\ No newline at end of file
diff --git a/integration-tests-jvm/dsl-modeline/src/main/java/org/apache/camel/quarkus/component/dsl/modeline/it/DslModelineResource.java b/integration-tests-jvm/dsl-modeline/src/main/java/org/apache/camel/quarkus/component/dsl/modeline/it/DslModelineResource.java
new file mode 100644
index 0000000000..1eb5cb4c77
--- /dev/null
+++ b/integration-tests-jvm/dsl-modeline/src/main/java/org/apache/camel/quarkus/component/dsl/modeline/it/DslModelineResource.java
@@ -0,0 +1,87 @@
+/*
+ * 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.dsl.modeline.it;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.enterprise.event.Observes;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.ExtendedCamelContext;
+import org.apache.camel.impl.event.CamelContextStartedEvent;
+import org.apache.camel.spi.DependencyStrategy;
+import org.apache.camel.spi.ModelineFactory;
+import org.apache.camel.support.ResourceHelper;
+
+@Path("/dsl-modeline")
+public class DslModelineResource {
+
+ private List<String> deps;
+
+ private ModelineFactory factory;
+
+ private CamelContext context;
+
+ public void onContextStart(@Observes CamelContextStartedEvent event) {
+ context = event.getContext();
+ deps = new ArrayList<>();
+ context.getRegistry().bind("myDep", (DependencyStrategy) dependency -> deps.add(dependency));
+ factory = context.adapt(ExtendedCamelContext.class).getModelineFactory();
+ }
+
+ @POST
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ public Response parseModeline(String line) throws Exception {
+ factory.parseModeline(ResourceHelper.fromString(null, line));
+ return Response.ok().build();
+ }
+
+ @Path("deps")
+ @GET
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ public List<String> getDependencies() {
+ return deps;
+ }
+
+ @Path("props/{property}")
+ @GET
+ @Consumes(MediaType.TEXT_PLAIN)
+ @Produces(MediaType.TEXT_PLAIN)
+ public String getDependencies(@PathParam("property") String property) {
+ String uri = String.format("{{%s}}", property);
+ return context.getPropertiesComponent().parseUri(uri);
+ }
+
+ @DELETE
+ public Response clear() {
+ deps.clear();
+ return Response.ok().build();
+ }
+
+}
diff --git a/integration-tests-jvm/dsl-modeline/src/main/resources/application.properties b/integration-tests-jvm/dsl-modeline/src/main/resources/application.properties
new file mode 100644
index 0000000000..2942848561
--- /dev/null
+++ b/integration-tests-jvm/dsl-modeline/src/main/resources/application.properties
@@ -0,0 +1,17 @@
+## ---------------------------------------------------------------------------
+## 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.resources.includes=myapp.properties
\ No newline at end of file
diff --git a/integration-tests-jvm/dsl-modeline/src/main/resources/myapp.properties b/integration-tests-jvm/dsl-modeline/src/main/resources/myapp.properties
new file mode 100644
index 0000000000..f37f1bd70d
--- /dev/null
+++ b/integration-tests-jvm/dsl-modeline/src/main/resources/myapp.properties
@@ -0,0 +1,19 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+
+foo=bar
+hi=Hej
\ No newline at end of file
diff --git a/integration-tests-jvm/dsl-modeline/src/test/java/org/apache/camel/quarkus/component/dsl/modeline/it/DslModelineIT.java b/integration-tests-jvm/dsl-modeline/src/test/java/org/apache/camel/quarkus/component/dsl/modeline/it/DslModelineIT.java
new file mode 100644
index 0000000000..6e0e229522
--- /dev/null
+++ b/integration-tests-jvm/dsl-modeline/src/test/java/org/apache/camel/quarkus/component/dsl/modeline/it/DslModelineIT.java
@@ -0,0 +1,24 @@
+/*
+ * 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.dsl.modeline.it;
+
+import io.quarkus.test.junit.QuarkusIntegrationTest;
+
+@QuarkusIntegrationTest
+class DslModelineIT extends DslModelineTest {
+
+}
diff --git a/integration-tests-jvm/dsl-modeline/src/test/java/org/apache/camel/quarkus/component/dsl/modeline/it/DslModelineTest.java b/integration-tests-jvm/dsl-modeline/src/test/java/org/apache/camel/quarkus/component/dsl/modeline/it/DslModelineTest.java
new file mode 100644
index 0000000000..daffeb6c1b
--- /dev/null
+++ b/integration-tests-jvm/dsl-modeline/src/test/java/org/apache/camel/quarkus/component/dsl/modeline/it/DslModelineTest.java
@@ -0,0 +1,195 @@
+/*
+ * 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.dsl.modeline.it;
+
+import java.util.List;
+
+import javax.ws.rs.core.Response;
+
+import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.RestAssured;
+import io.restassured.http.ContentType;
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.Matchers.equalTo;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+@QuarkusTest
+public class DslModelineTest {
+
+ @Test
+ void testModelineSingleDependency() {
+ String line = "// camel-k: dependency=mvn:org.my:application:1.0";
+ List<Response> response = parseAndGetDependencies(line);
+ assertNotNull(response);
+ assertEquals(1, response.size());
+ assertTrue(response.contains("mvn:org.my:application:1.0"));
+ }
+
+ @Test
+ void testModelineSingleDependencyCommentHash() {
+ String line = "### camel-k: dependency=mvn:org.my:application:1.0";
+ List<Response> response = parseAndGetDependencies(line);
+ assertNotNull(response);
+ assertEquals(1, response.size());
+ assertTrue(response.contains("mvn:org.my:application:1.0"));
+ }
+
+ @Test
+ void testModelineMultiDependency() {
+ String line = "// camel-k: dependency=mvn:org.my:application:1.0 dependency=mvn:com.foo:myapp:2.1";
+
+ List<Response> response = parseAndGetDependencies(line);
+ assertNotNull(response);
+ assertEquals(2, response.size());
+ assertTrue(response.contains("mvn:org.my:application:1.0"));
+ assertTrue(response.contains("mvn:com.foo:myapp:2.1"));
+
+ }
+
+ @Test
+ void testModelineSingleProperty() throws Exception {
+ String line = "// camel-k: property=hi=Hello";
+ clear();
+ parseModeline(line);
+
+ RestAssured
+ .get("/dsl-modeline/props/" + "hi")
+ .then()
+ .body(equalTo("Hello"));
+ }
+
+ @Test
+ void testModelineMultiProperty() throws Exception {
+ String line = "// camel-k: property=hi=Hello property=bye=Farvel";
+ parseModeline(line);
+
+ RestAssured
+ .get("/dsl-modeline/props/" + "hi")
+ .then()
+ .body(equalTo("Hello"));
+
+ RestAssured
+ .get("/dsl-modeline/props/" + "bye")
+ .then()
+ .body(equalTo("Farvel"));
+
+ }
+
+ @Test
+ void testModelineQuoteProperty() throws Exception {
+ String line = "// camel-k: property=hi='Hello World' property=bye='Farvel Verden'";
+ parseModeline(line);
+
+ RestAssured
+ .get("/dsl-modeline/props/" + "hi")
+ .then()
+ .body(equalTo("Hello World"));
+
+ RestAssured
+ .get("/dsl-modeline/props/" + "bye")
+ .then()
+ .body(equalTo("Farvel Verden"));
+ }
+
+ @Test
+ void testModelineMixed() throws Exception {
+ String line = "// camel-k: dependency=mvn:org.my:application:1.0 property=hi=Hello dependency=mvn:com.foo:myapp:2.1";
+ List<Response> response = parseAndGetDependencies(line);
+ assertNotNull(response);
+ assertEquals(2, response.size());
+ assertTrue(response.contains("mvn:org.my:application:1.0"));
+ assertTrue(response.contains("mvn:com.foo:myapp:2.1"));
+
+ RestAssured
+ .get("/dsl-modeline/props/" + "hi")
+ .then()
+ .body(equalTo("Hello"));
+ }
+
+ @Test
+ void testModelineMixedWithSpaces() throws Exception {
+ String line = "// camel-k: dependency=mvn:org.my:application:1.0 property=hi=Hello dependency=mvn:com.foo:myapp:2.1";
+ List<Response> response = parseAndGetDependencies(line);
+ assertNotNull(response);
+ assertEquals(2, response.size());
+ assertTrue(response.contains("mvn:org.my:application:1.0"));
+ assertTrue(response.contains("mvn:com.foo:myapp:2.1"));
+
+ RestAssured
+ .get("/dsl-modeline/props/" + "hi")
+ .then()
+ .body(equalTo("Hello"));
+
+ }
+
+ @Test
+ void testModelinePropertiesFile() throws Exception {
+ String line = "// camel-k: property=classpath:myapp.properties";
+ parseModeline(line);
+
+ RestAssured
+ .get("/dsl-modeline/props/" + "hi")
+ .then()
+ .body(equalTo("Hej"));
+
+ RestAssured
+ .get("/dsl-modeline/props/" + "foo")
+ .then()
+ .body(equalTo("bar"));
+
+ }
+
+ private List parseAndGetDependencies(String line) {
+ // clear list
+ clear();
+
+ //compute new results
+ parseModeline(line);
+
+ //get dependencies
+ return RestAssured
+ .given()
+ .contentType(ContentType.JSON)
+ .when()
+ .body(line)
+ .get("/dsl-modeline/deps")
+ .then()
+ .extract().body().as(List.class);
+
+ }
+
+ private void clear() {
+ // clear list
+ RestAssured.delete("/dsl-modeline")
+ .then()
+ .statusCode(200);
+ }
+
+ private void parseModeline(String line) {
+ RestAssured
+ .given()
+ .contentType(ContentType.JSON)
+ .when()
+ .body(line)
+ .post("/dsl-modeline")
+ .then()
+ .statusCode(200);
+ }
+}
diff --git a/integration-tests-jvm/pom.xml b/integration-tests-jvm/pom.xml
index 32692dbce5..4cfed236e1 100644
--- a/integration-tests-jvm/pom.xml
+++ b/integration-tests-jvm/pom.xml
@@ -56,6 +56,7 @@
<module>djl</module>
<module>dns</module>
<module>drill</module>
+ <module>dsl-modeline</module>
<module>ehcache</module>
<module>etcd3</module>
<module>facebook</module>
diff --git a/poms/bom/pom.xml b/poms/bom/pom.xml
index 2a849250b0..0a677cc41a 100644
--- a/poms/bom/pom.xml
+++ b/poms/bom/pom.xml
@@ -2078,6 +2078,11 @@
</exclusion>
</exclusions>
</dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-dsl-modeline</artifactId>
+ <version>${camel.version}</version>
+ </dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-dsl-support</artifactId>
@@ -7016,6 +7021,16 @@
<artifactId>camel-quarkus-dropbox-deployment</artifactId>
<version>${camel-quarkus.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-dsl-modeline</artifactId>
+ <version>${camel-quarkus.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-dsl-modeline-deployment</artifactId>
+ <version>${camel-quarkus.version}</version>
+ </dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-ehcache</artifactId>
diff --git a/poms/bom/src/main/generated/flattened-full-pom.xml b/poms/bom/src/main/generated/flattened-full-pom.xml
index 184e2e9609..ccd19f9c83 100644
--- a/poms/bom/src/main/generated/flattened-full-pom.xml
+++ b/poms/bom/src/main/generated/flattened-full-pom.xml
@@ -2017,6 +2017,11 @@
</exclusion>
</exclusions>
</dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} -->
+ <artifactId>camel-dsl-modeline</artifactId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} -->
+ <version>3.19.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-dsl-support</artifactId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} -->
@@ -6953,6 +6958,16 @@
<artifactId>camel-quarkus-dropbox-deployment</artifactId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} -->
<version>2.14.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-dsl-modeline</artifactId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} -->
+ <version>2.14.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-dsl-modeline-deployment</artifactId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} -->
+ <version>2.14.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-ehcache</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 85a4468760..458dd1346a 100644
--- a/poms/bom/src/main/generated/flattened-reduced-pom.xml
+++ b/poms/bom/src/main/generated/flattened-reduced-pom.xml
@@ -2017,6 +2017,11 @@
</exclusion>
</exclusions>
</dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-dsl-modeline</artifactId>
+ <version>3.19.0</version>
+ </dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-dsl-support</artifactId>
@@ -6953,6 +6958,16 @@
<artifactId>camel-quarkus-dropbox-deployment</artifactId>
<version>2.14.0-SNAPSHOT</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-dsl-modeline</artifactId>
+ <version>2.14.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-dsl-modeline-deployment</artifactId>
+ <version>2.14.0-SNAPSHOT</version>
+ </dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-ehcache</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 2bebda4602..02d26f51fa 100644
--- a/poms/bom/src/main/generated/flattened-reduced-verbose-pom.xml
+++ b/poms/bom/src/main/generated/flattened-reduced-verbose-pom.xml
@@ -2017,6 +2017,11 @@
</exclusion>
</exclusions>
</dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} -->
+ <artifactId>camel-dsl-modeline</artifactId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} -->
+ <version>3.19.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-dsl-support</artifactId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} -->
@@ -6953,6 +6958,16 @@
<artifactId>camel-quarkus-dropbox-deployment</artifactId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} -->
<version>2.14.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-dsl-modeline</artifactId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} -->
+ <version>2.14.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-dsl-modeline-deployment</artifactId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} -->
+ <version>2.14.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-ehcache</artifactId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} -->