You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by pp...@apache.org on 2021/01/07 16:59:56 UTC
[camel-quarkus] branch master updated: CSimple NPE even if CSimple
language is not used #2103
This is an automated email from the ASF dual-hosted git repository.
ppalaga pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
The following commit(s) were added to refs/heads/master by this push:
new 4b47002 CSimple NPE even if CSimple language is not used #2103
4b47002 is described below
commit 4b47002a08db117ef02223e87d8d8af73b98dfbc
Author: Peter Palaga <pp...@redhat.com>
AuthorDate: Wed Jan 6 21:05:20 2021 +0100
CSimple NPE even if CSimple language is not used #2103
---
catalog/pom.xml | 13 ++
.../ROOT/pages/reference/extensions/core.adoc | 1 -
.../ROOT/pages/reference/extensions/csimple.adoc | 56 +++++++
.../ROOT/partials/reference/languages/csimple.adoc | 10 +-
.../core/runtime/src/main/adoc/limitations.adoc | 17 ---
extensions/csimple/deployment/pom.xml | 63 ++++++++
.../CSimpleExpressionSourceBuildItem.java | 2 +-
.../csimple/deployment/CSimpleProcessor.java | 18 ++-
.../csimple}/deployment/CSimpleXmlProcessor.java | 75 +++++-----
extensions/csimple/pom.xml | 39 +++++
extensions/csimple/runtime/pom.xml | 110 ++++++++++++++
.../csimple/runtime/src/main/doc/limitations.adoc | 19 +++
.../csimple}/CSimpleLanguageRecorder.java | 2 +-
.../resources/META-INF}/quarkus-extension.yaml | 23 +--
extensions/pom.xml | 1 +
.../apache/camel/quarkus/core/CoreResource.java | 9 --
.../org/apache/camel/quarkus/core/CoreRoutes.java | 3 -
.../org/apache/camel/quarkus/core/CoreTest.java | 11 --
integration-tests/csimple/pom.xml | 166 +++++++++++++++++++++
.../component/csimple/it/CSimpleResource.java | 51 +++++++
.../component/csimple/it/CSimpleRoute.java} | 12 +-
.../src/main/resources/application.properties | 18 +++
.../src/main/resources/routes/my-routes.xml | 17 ---
.../quarkus/component/csimple/it/CSimpleIT.java} | 19 +--
.../quarkus/component/csimple/it/CSimpleTest.java} | 36 +++--
.../camel/quarkus/main/CoreMainXmlIoResource.java | 7 -
.../src/main/resources/routes/my-routes.xml | 7 -
.../camel/quarkus/main/CoreMainXmlIoTest.java | 10 --
.../apache/camel/quarkus/main/CoreMainTest.java | 3 +-
integration-tests/pom.xml | 1 +
pom.xml | 2 +-
poms/bom/pom.xml | 10 ++
.../quarkus-extension.yaml | 2 +-
.../org/apache/camel/quarkus/maven/CqCatalog.java | 22 ++-
tooling/scripts/test-categories.yaml | 1 +
35 files changed, 659 insertions(+), 197 deletions(-)
diff --git a/catalog/pom.xml b/catalog/pom.xml
index beddd47..feaa238 100644
--- a/catalog/pom.xml
+++ b/catalog/pom.xml
@@ -1141,6 +1141,19 @@
</dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-csimple</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-csv</artifactId>
<version>${project.version}</version>
<type>pom</type>
diff --git a/docs/modules/ROOT/pages/reference/extensions/core.adoc b/docs/modules/ROOT/pages/reference/extensions/core.adoc
index 5ce8699..ae0138b 100644
--- a/docs/modules/ROOT/pages/reference/extensions/core.adoc
+++ b/docs/modules/ROOT/pages/reference/extensions/core.adoc
@@ -18,7 +18,6 @@ Camel core functionality and basic Camel languages: Constant, ExchangeProperty,
== What's inside
* xref:{cq-camel-components}:languages:constant-language.adoc[Constant language]
-* xref:{cq-camel-components}:languages:csimple-language.adoc[CSimple language]
* xref:{cq-camel-components}:languages:exchangeProperty-language.adoc[ExchangeProperty language]
* xref:{cq-camel-components}:languages:file-language.adoc[File language]
* xref:{cq-camel-components}:languages:header-language.adoc[Header language]
diff --git a/docs/modules/ROOT/pages/reference/extensions/csimple.adoc b/docs/modules/ROOT/pages/reference/extensions/csimple.adoc
new file mode 100644
index 0000000..26cbff3
--- /dev/null
+++ b/docs/modules/ROOT/pages/reference/extensions/csimple.adoc
@@ -0,0 +1,56 @@
+// Do not edit directly!
+// This file was generated by camel-quarkus-maven-plugin:update-extension-doc-page
+= CSimple
+:cq-artifact-id: camel-quarkus-csimple
+:cq-native-supported: true
+:cq-status: Stable
+:cq-description: Compiled Simple language
+:cq-deprecated: false
+:cq-jvm-since: 1.5.0
+:cq-native-since: 1.5.0
+
+[.badges]
+[.badge-key]##JVM since##[.badge-supported]##1.5.0## [.badge-key]##Native since##[.badge-supported]##1.5.0##
+
+Compiled Simple language
+
+== What's inside
+
+* xref:{cq-camel-components}:languages:csimple-language.adoc[CSimple language]
+
+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-csimple</artifactId>
+</dependency>
+----
+
+Check the xref:user-guide/index.adoc[User guide] for more information about writing Camel Quarkus applications.
+
+== Camel Quarkus limitations
+
+CSimple language is supported only in
+
+* XML DSL
+* Java DSL when implemented in a class extending `org.apache.camel.builder.RouteBuilder`
+
+The compilation of CSimple scripts happens at build time. To be able to discover the scripts in the route definitions,
+those definitions need to get assembled at build time. When extending
+`org.apache.camel.builder.RouteBuilder`, this basically means instantiating your `RouteBuilder`, setting
+a fake `CamelContext` instance on it and calling its `configure()` method. It may fail if your `configure()`
+method attempts to access some resource that is only available at runtime.
+
+You can use the `quarkus.camel.csimple.on-build-time-analysis-failure` configuration parameter to decide
+what should happen in such cases. Possible values are `warn` (default), `fail` or `ignore`.
+
+[WARNING]
+====
+CSimple language will not work on Camel Quarkus if used in a `org.apache.camel.builder.LambdaRouteBuilder`
+====
+
+
diff --git a/docs/modules/ROOT/partials/reference/languages/csimple.adoc b/docs/modules/ROOT/partials/reference/languages/csimple.adoc
index cfc8a73..877eeba 100644
--- a/docs/modules/ROOT/partials/reference/languages/csimple.adoc
+++ b/docs/modules/ROOT/partials/reference/languages/csimple.adoc
@@ -1,13 +1,13 @@
// Do not edit directly!
// This file was generated by camel-quarkus-maven-plugin:update-extension-doc-page
-:cq-artifact-id: camel-quarkus-core
-:cq-artifact-id-base: core
+:cq-artifact-id: camel-quarkus-csimple
+:cq-artifact-id-base: csimple
:cq-native-supported: true
:cq-status: Stable
:cq-deprecated: false
-:cq-jvm-since: 0.0.1
-:cq-native-since: 0.0.1
+:cq-jvm-since: 1.5.0
+:cq-native-since: 1.5.0
:cq-camel-part-name: csimple
:cq-camel-part-title: CSimple
:cq-camel-part-description: Evaluate a compile simple expression language.
-:cq-extension-page-title: Core
+:cq-extension-page-title: CSimple
diff --git a/extensions-core/core/runtime/src/main/adoc/limitations.adoc b/extensions-core/core/runtime/src/main/adoc/limitations.adoc
deleted file mode 100644
index 9697d1c..0000000
--- a/extensions-core/core/runtime/src/main/adoc/limitations.adoc
+++ /dev/null
@@ -1,17 +0,0 @@
-=== CSimple language
-
-CSimple language is supported only in
-
-* XML DSL
-* Java DSL when implemented in a class extending `org.apache.camel.builder.RouteBuilder`
-
-The compilation of CSimple scripts happens at build time. To extract the scripts from the route definitions, these need
-to be assembled at build time. This may fail if the given route requires some data that is only available at runtime.
-You can use the `quarkus.camel.csimple.on-build-time-analysis-failure` configuration parameter to decide
-what should happen in such cases. The possible values are `warn` (default), `fail` or `ignore`.
-
-[WARNING]
-====
-CSimple language will not work on Camel Quarkus if used in a `org.apache.camel.builder.LambdaRouteBuilder`
-====
-
diff --git a/extensions/csimple/deployment/pom.xml b/extensions/csimple/deployment/pom.xml
new file mode 100644
index 0000000..4f5aa65
--- /dev/null
+++ b/extensions/csimple/deployment/pom.xml
@@ -0,0 +1,63 @@
+<?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-csimple-parent</artifactId>
+ <version>1.6.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>camel-quarkus-csimple-deployment</artifactId>
+ <name>Camel Quarkus :: CSimple :: 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-csimple</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>
diff --git a/extensions-core/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/spi/CSimpleExpressionSourceBuildItem.java b/extensions/csimple/deployment/src/main/java/org/apache/camel/quarkus/component/csimple/deployment/CSimpleExpressionSourceBuildItem.java
similarity index 96%
rename from extensions-core/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/spi/CSimpleExpressionSourceBuildItem.java
rename to extensions/csimple/deployment/src/main/java/org/apache/camel/quarkus/component/csimple/deployment/CSimpleExpressionSourceBuildItem.java
index 1547e6f..b1a6723 100644
--- a/extensions-core/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/spi/CSimpleExpressionSourceBuildItem.java
+++ b/extensions/csimple/deployment/src/main/java/org/apache/camel/quarkus/component/csimple/deployment/CSimpleExpressionSourceBuildItem.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.camel.quarkus.core.deployment.spi;
+package org.apache.camel.quarkus.component.csimple.deployment;
import io.quarkus.builder.item.MultiBuildItem;
diff --git a/extensions-core/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/CSimpleRouteDefinitionProcessor.java b/extensions/csimple/deployment/src/main/java/org/apache/camel/quarkus/component/csimple/deployment/CSimpleProcessor.java
similarity index 96%
rename from extensions-core/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/CSimpleRouteDefinitionProcessor.java
rename to extensions/csimple/deployment/src/main/java/org/apache/camel/quarkus/component/csimple/deployment/CSimpleProcessor.java
index c9878ab..72229a3 100644
--- a/extensions-core/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/CSimpleRouteDefinitionProcessor.java
+++ b/extensions/csimple/deployment/src/main/java/org/apache/camel/quarkus/component/csimple/deployment/CSimpleProcessor.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.camel.quarkus.core.deployment;
+package org.apache.camel.quarkus.component.csimple.deployment;
import java.io.BufferedReader;
import java.io.File;
@@ -51,6 +51,7 @@ import io.quarkus.deployment.annotations.BuildProducer;
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.builditem.GeneratedClassBuildItem;
import io.quarkus.deployment.dev.CompilationProvider;
import io.quarkus.deployment.dev.CompilationProvider.Context;
@@ -69,10 +70,10 @@ import org.apache.camel.language.csimple.CSimpleLanguage;
import org.apache.camel.language.csimple.CSimpleLanguage.Builder;
import org.apache.camel.model.Constants;
import org.apache.camel.model.ExpressionNode;
-import org.apache.camel.quarkus.core.CSimpleLanguageRecorder;
+import org.apache.camel.quarkus.component.csimple.CSimpleLanguageRecorder;
import org.apache.camel.quarkus.core.CamelConfig;
import org.apache.camel.quarkus.core.CamelConfig.FailureRemedy;
-import org.apache.camel.quarkus.core.deployment.spi.CSimpleExpressionSourceBuildItem;
+import org.apache.camel.quarkus.core.deployment.LanguageExpressionContentHandler;
import org.apache.camel.quarkus.core.deployment.spi.CamelBeanBuildItem;
import org.apache.camel.quarkus.core.deployment.spi.CamelContextBuildItem;
import org.apache.camel.quarkus.core.deployment.spi.CamelRoutesBuilderClassBuildItem;
@@ -80,9 +81,16 @@ import org.apache.camel.quarkus.core.deployment.spi.CompiledCSimpleExpressionBui
import org.apache.camel.util.PropertiesHelper;
import org.jboss.logging.Logger;
-class CSimpleRouteDefinitionProcessor {
- private static final Logger LOG = Logger.getLogger(CSimpleRouteDefinitionProcessor.class);
+class CSimpleProcessor {
+
+ private static final Logger LOG = Logger.getLogger(CSimpleProcessor.class);
static final String CLASS_EXT = ".class";
+ private static final String FEATURE = "camel-csimple";
+
+ @BuildStep
+ FeatureBuildItem feature() {
+ return new FeatureBuildItem(FEATURE);
+ }
@BuildStep
void collectCSimpleExpresions(
diff --git a/extensions-core/main/deployment/src/main/java/org/apache/camel/quarkus/main/deployment/CSimpleXmlProcessor.java b/extensions/csimple/deployment/src/main/java/org/apache/camel/quarkus/component/csimple/deployment/CSimpleXmlProcessor.java
similarity index 58%
rename from extensions-core/main/deployment/src/main/java/org/apache/camel/quarkus/main/deployment/CSimpleXmlProcessor.java
rename to extensions/csimple/deployment/src/main/java/org/apache/camel/quarkus/component/csimple/deployment/CSimpleXmlProcessor.java
index c227733..2718247 100644
--- a/extensions-core/main/deployment/src/main/java/org/apache/camel/quarkus/main/deployment/CSimpleXmlProcessor.java
+++ b/extensions/csimple/deployment/src/main/java/org/apache/camel/quarkus/component/csimple/deployment/CSimpleXmlProcessor.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.camel.quarkus.main.deployment;
+package org.apache.camel.quarkus.component.csimple.deployment;
import java.io.Closeable;
import java.io.FileNotFoundException;
@@ -33,15 +33,16 @@ import javax.xml.parsers.SAXParserFactory;
import org.xml.sax.SAXException;
+import io.quarkus.deployment.Capabilities;
import io.quarkus.deployment.annotations.BuildProducer;
import io.quarkus.deployment.annotations.BuildStep;
import org.apache.camel.impl.DefaultCamelContext;
import org.apache.camel.impl.engine.DefaultPackageScanResourceResolver;
import org.apache.camel.quarkus.core.CamelConfig;
import org.apache.camel.quarkus.core.deployment.LanguageExpressionContentHandler;
-import org.apache.camel.quarkus.core.deployment.spi.CSimpleExpressionSourceBuildItem;
import org.apache.camel.quarkus.core.deployment.spi.CamelRoutesBuilderClassBuildItem;
import org.apache.camel.quarkus.core.deployment.util.CamelSupport;
+import org.apache.camel.quarkus.support.common.CamelCapabilities;
import org.jboss.logging.Logger;
public class CSimpleXmlProcessor {
@@ -52,49 +53,53 @@ public class CSimpleXmlProcessor {
void collectCSimpleExpresions(
CamelConfig config,
List<CamelRoutesBuilderClassBuildItem> routesBuilderClasses,
- BuildProducer<CSimpleExpressionSourceBuildItem> csimpleExpressions)
+ BuildProducer<CSimpleExpressionSourceBuildItem> csimpleExpressions,
+ Capabilities capabilities)
throws ParserConfigurationException, SAXException, IOException {
- final List<String> locations = Stream.of("camel.main.xml-routes", "camel.main.xml-rests")
- .map(prop -> CamelSupport.getOptionalConfigValue(prop, String[].class, new String[0]))
- .flatMap(Stream::of)
- .collect(Collectors.toList());
+ if (capabilities.isCapabilityPresent(CamelCapabilities.MAIN)) {
+ final List<String> locations = Stream.of("camel.main.xml-routes", "camel.main.xml-rests")
+ .map(prop -> CamelSupport.getOptionalConfigValue(prop, String[].class, new String[0]))
+ .flatMap(Stream::of)
+ .collect(Collectors.toList());
- try (DefaultPackageScanResourceResolver resolver = new DefaultPackageScanResourceResolver()) {
- resolver.setCamelContext(new DefaultCamelContext());
- final SAXParserFactory saxParserFactory = SAXParserFactory.newInstance();
- saxParserFactory.setNamespaceAware(true);
- SAXParser saxParser = saxParserFactory.newSAXParser();
- for (String part : locations) {
- try {
- try (CloseableCollection<InputStream> set = new CloseableCollection<InputStream>(
- resolver.findResources(part))) {
- for (InputStream is : set) {
- LOG.debugf("Found XML routes from location: %s", part);
- try {
- saxParser.parse(
- is,
- new LanguageExpressionContentHandler(
- "csimple",
- (script, isPredicate) -> csimpleExpressions.produce(
- new CSimpleExpressionSourceBuildItem(
- script,
- isPredicate,
- "org.apache.camel.language.csimple.XmlRouteBuilder"))));
- } finally {
- if (is != null) {
- is.close();
+ try (DefaultPackageScanResourceResolver resolver = new DefaultPackageScanResourceResolver()) {
+ resolver.setCamelContext(new DefaultCamelContext());
+ final SAXParserFactory saxParserFactory = SAXParserFactory.newInstance();
+ saxParserFactory.setNamespaceAware(true);
+ SAXParser saxParser = saxParserFactory.newSAXParser();
+ for (String part : locations) {
+ try {
+ try (CloseableCollection<InputStream> set = new CloseableCollection<InputStream>(
+ resolver.findResources(part))) {
+ for (InputStream is : set) {
+ LOG.debugf("Found XML routes from location: %s", part);
+ try {
+ saxParser.parse(
+ is,
+ new LanguageExpressionContentHandler(
+ "csimple",
+ (script, isPredicate) -> csimpleExpressions.produce(
+ new CSimpleExpressionSourceBuildItem(
+ script,
+ isPredicate,
+ "org.apache.camel.language.csimple.XmlRouteBuilder"))));
+ } finally {
+ if (is != null) {
+ is.close();
+ }
}
}
}
+ } catch (FileNotFoundException e) {
+ LOG.debugf("No XML routes found in %s. Skipping XML routes detection.", part);
+ } catch (Exception e) {
+ throw new RuntimeException("Could not analyze CSimple expressions in " + part, e);
}
- } catch (FileNotFoundException e) {
- LOG.debugf("No XML routes found in %s. Skipping XML routes detection.", part);
- } catch (Exception e) {
- throw new RuntimeException("Could not analyze CSimple expressions in " + part, e);
}
}
}
+
}
static class CloseableCollection<E extends Closeable> implements Closeable, Iterable<E> {
diff --git a/extensions/csimple/pom.xml b/extensions/csimple/pom.xml
new file mode 100644
index 0000000..df4327f
--- /dev/null
+++ b/extensions/csimple/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-build-parent</artifactId>
+ <version>1.6.0-SNAPSHOT</version>
+ <relativePath>../../poms/build-parent/pom.xml</relativePath>
+ </parent>
+
+ <artifactId>camel-quarkus-csimple-parent</artifactId>
+ <name>Camel Quarkus :: CSimple</name>
+ <packaging>pom</packaging>
+
+ <modules>
+ <module>deployment</module>
+ <module>runtime</module>
+ </modules>
+</project>
diff --git a/extensions/csimple/runtime/pom.xml b/extensions/csimple/runtime/pom.xml
new file mode 100644
index 0000000..5d03036
--- /dev/null
+++ b/extensions/csimple/runtime/pom.xml
@@ -0,0 +1,110 @@
+<?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-csimple-parent</artifactId>
+ <version>1.6.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>camel-quarkus-csimple</artifactId>
+ <name>Camel Quarkus :: CSimple :: Runtime</name>
+ <description>Compiled Simple language</description>
+
+ <properties>
+ <camel.quarkus.jvmSince>1.5.0</camel.quarkus.jvmSince>
+ <camel.quarkus.nativeSince>1.5.0</camel.quarkus.nativeSince>
+ <quarkus.metadata.status>preview</quarkus.metadata.status>
+ </properties>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-bom</artifactId>
+ <version>${project.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-core</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/csimple/runtime/src/main/doc/limitations.adoc b/extensions/csimple/runtime/src/main/doc/limitations.adoc
new file mode 100644
index 0000000..115ae91
--- /dev/null
+++ b/extensions/csimple/runtime/src/main/doc/limitations.adoc
@@ -0,0 +1,19 @@
+CSimple language is supported only in
+
+* XML DSL
+* Java DSL when implemented in a class extending `org.apache.camel.builder.RouteBuilder`
+
+The compilation of CSimple scripts happens at build time. To be able to discover the scripts in the route definitions,
+those definitions need to get assembled at build time. When extending
+`org.apache.camel.builder.RouteBuilder`, this basically means instantiating your `RouteBuilder`, setting
+a fake `CamelContext` instance on it and calling its `configure()` method. It may fail if your `configure()`
+method attempts to access some resource that is only available at runtime.
+
+You can use the `quarkus.camel.csimple.on-build-time-analysis-failure` configuration parameter to decide
+what should happen in such cases. Possible values are `warn` (default), `fail` or `ignore`.
+
+[WARNING]
+====
+CSimple language will not work on Camel Quarkus if used in a `org.apache.camel.builder.LambdaRouteBuilder`
+====
+
diff --git a/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/CSimpleLanguageRecorder.java b/extensions/csimple/runtime/src/main/java/org/apache/camel/quarkus/component/csimple/CSimpleLanguageRecorder.java
similarity index 96%
rename from extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/CSimpleLanguageRecorder.java
rename to extensions/csimple/runtime/src/main/java/org/apache/camel/quarkus/component/csimple/CSimpleLanguageRecorder.java
index d0237d7..b58b942 100644
--- a/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/CSimpleLanguageRecorder.java
+++ b/extensions/csimple/runtime/src/main/java/org/apache/camel/quarkus/component/csimple/CSimpleLanguageRecorder.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.camel.quarkus.core;
+package org.apache.camel.quarkus.component.csimple;
import io.quarkus.runtime.RuntimeValue;
import io.quarkus.runtime.annotations.Recorder;
diff --git a/tooling/create-extension-templates/quarkus-extension.yaml b/extensions/csimple/runtime/src/main/resources/META-INF/quarkus-extension.yaml
similarity index 70%
copy from tooling/create-extension-templates/quarkus-extension.yaml
copy to extensions/csimple/runtime/src/main/resources/META-INF/quarkus-extension.yaml
index 961aa23..2d280e6 100644
--- a/tooling/create-extension-templates/quarkus-extension.yaml
+++ b/extensions/csimple/runtime/src/main/resources/META-INF/quarkus-extension.yaml
@@ -21,22 +21,11 @@
# mvn -N cq:update-quarkus-metadata
#
---
-name: "Camel [=nameBase]"
-description: "[=description]"
+name: "Camel CSimple"
+description: "Compiled Simple language"
metadata:
-[#if !nativeSupported ] unlisted: true
-[/#if]
-[#if keywords?size > 0 ] keywords:
-[#list keywords as keyword]
- - "[=keyword]"
-[/#list]
-[/#if]
- guide: "[=guideUrl]"
-[#if categories?size > 0 ] categories:
-[#list categories as category]
- - "[=category]"
-[/#list]
-[/#if]
+ guide: "https://camel.apache.org/camel-quarkus/latest/reference/extensions/csimple.html"
+ categories:
+ - "integration"
status:
- - "[=nativeSupported?then('stable', 'preview')]"
-[#if deprecated ] - "deprecated"[/#if]
\ No newline at end of file
+ - "preview"
diff --git a/extensions/pom.xml b/extensions/pom.xml
index 3f6e8ff..445b245 100644
--- a/extensions/pom.xml
+++ b/extensions/pom.xml
@@ -88,6 +88,7 @@
<module>couchdb</module>
<module>cron</module>
<module>crypto</module>
+ <module>csimple</module>
<module>csv</module>
<module>dataformat</module>
<module>debezium-mysql</module>
diff --git a/integration-tests/core/src/main/java/org/apache/camel/quarkus/core/CoreResource.java b/integration-tests/core/src/main/java/org/apache/camel/quarkus/core/CoreResource.java
index 60e4c2f..af3879a 100644
--- a/integration-tests/core/src/main/java/org/apache/camel/quarkus/core/CoreResource.java
+++ b/integration-tests/core/src/main/java/org/apache/camel/quarkus/core/CoreResource.java
@@ -28,9 +28,7 @@ import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;
import javax.json.Json;
import javax.json.JsonObject;
-import javax.ws.rs.Consumes;
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;
@@ -268,11 +266,4 @@ public class CoreResource {
return context.adapt(ExtendedCamelContext.class).getHeadersMapFactory() instanceof DefaultHeadersMapFactory;
}
- @Path("/csimple-hello")
- @POST
- @Consumes(MediaType.TEXT_PLAIN)
- @Produces(MediaType.TEXT_PLAIN)
- public String csimpleHello(String body) {
- return producerTemplate.requestBody("direct:csimple-hello", body, String.class);
- }
}
diff --git a/integration-tests/core/src/main/java/org/apache/camel/quarkus/core/CoreRoutes.java b/integration-tests/core/src/main/java/org/apache/camel/quarkus/core/CoreRoutes.java
index 5956f38..4aa1678 100644
--- a/integration-tests/core/src/main/java/org/apache/camel/quarkus/core/CoreRoutes.java
+++ b/integration-tests/core/src/main/java/org/apache/camel/quarkus/core/CoreRoutes.java
@@ -27,9 +27,6 @@ public class CoreRoutes extends RouteBuilder {
.setBody().constant("I'm alive !")
.to("log:keep-alive");
- from("direct:csimple-hello")
- .setBody().csimple("Hello ${body}");
-
}
}
diff --git a/integration-tests/core/src/test/java/org/apache/camel/quarkus/core/CoreTest.java b/integration-tests/core/src/test/java/org/apache/camel/quarkus/core/CoreTest.java
index a96f2fe..7086113 100644
--- a/integration-tests/core/src/test/java/org/apache/camel/quarkus/core/CoreTest.java
+++ b/integration-tests/core/src/test/java/org/apache/camel/quarkus/core/CoreTest.java
@@ -21,7 +21,6 @@ import java.net.HttpURLConnection;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.RestAssured;
-import io.restassured.http.ContentType;
import io.restassured.response.Response;
import org.apache.camel.support.DefaultLRUCacheFactory;
import org.junit.jupiter.api.Test;
@@ -125,14 +124,4 @@ public class CoreTest {
RestAssured.when().get("/test/headersmap-factory").then().body(is("true"));
}
- @Test
- public void csimpleHello() {
- RestAssured.given()
- .body("Joe")
- .contentType(ContentType.TEXT)
- .post("/test/csimple-hello")
- .then()
- .body(is("Hello Joe"));
- }
-
}
diff --git a/integration-tests/csimple/pom.xml b/integration-tests/csimple/pom.xml
new file mode 100644
index 0000000..12af525
--- /dev/null
+++ b/integration-tests/csimple/pom.xml
@@ -0,0 +1,166 @@
+<?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-integration-tests</artifactId>
+ <version>1.6.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>camel-quarkus-integration-test-csimple</artifactId>
+ <name>Camel Quarkus :: Integration Tests :: CSimple</name>
+ <description>Integration tests for Camel Quarkus CSimple extension</description>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-bom-test</artifactId>
+ <version>${project.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-csimple</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-direct</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-resteasy</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-main</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-xml-io</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>
+
+ <!-- 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-csimple-deployment</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-direct-deployment</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-main-deployment</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-xml-io-deployment</artifactId>
+ <version>${project.version}</version>
+ <type>pom</type>
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>*</groupId>
+ <artifactId>*</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ </dependencies>
+
+ <profiles>
+ <profile>
+ <id>native</id>
+ <activation>
+ <property>
+ <name>native</name>
+ </property>
+ </activation>
+ <properties>
+ <quarkus.package.type>native</quarkus.package.type>
+ </properties>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-failsafe-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>integration-test</goal>
+ <goal>verify</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+</project>
diff --git a/integration-tests/csimple/src/main/java/org/apache/camel/quarkus/component/csimple/it/CSimpleResource.java b/integration-tests/csimple/src/main/java/org/apache/camel/quarkus/component/csimple/it/CSimpleResource.java
new file mode 100644
index 0000000..7cae634
--- /dev/null
+++ b/integration-tests/csimple/src/main/java/org/apache/camel/quarkus/component/csimple/it/CSimpleResource.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.csimple.it;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Inject;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+
+import org.apache.camel.ProducerTemplate;
+
+@Path("/csimple")
+@ApplicationScoped
+public class CSimpleResource {
+
+ @Inject
+ ProducerTemplate producerTemplate;
+
+ @Path("/csimple-hello")
+ @POST
+ @Consumes(MediaType.TEXT_PLAIN)
+ @Produces(MediaType.TEXT_PLAIN)
+ public String csimpleHello(String body) {
+ return producerTemplate.requestBody("direct:csimple-hello", body, String.class);
+ }
+
+ @Path("/csimple-xml-dsl")
+ @POST
+ @Consumes(MediaType.TEXT_PLAIN)
+ @Produces(MediaType.TEXT_PLAIN)
+ public String csimpleXmlDsl(String body) {
+ return producerTemplate.requestBody("direct:csimple-xml-dsl", body, String.class);
+ }
+}
diff --git a/integration-tests/core/src/main/java/org/apache/camel/quarkus/core/CoreRoutes.java b/integration-tests/csimple/src/main/java/org/apache/camel/quarkus/component/csimple/it/CSimpleRoute.java
similarity index 77%
copy from integration-tests/core/src/main/java/org/apache/camel/quarkus/core/CoreRoutes.java
copy to integration-tests/csimple/src/main/java/org/apache/camel/quarkus/component/csimple/it/CSimpleRoute.java
index 5956f38..10b76c4 100644
--- a/integration-tests/core/src/main/java/org/apache/camel/quarkus/core/CoreRoutes.java
+++ b/integration-tests/csimple/src/main/java/org/apache/camel/quarkus/component/csimple/it/CSimpleRoute.java
@@ -14,22 +14,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.camel.quarkus.core;
+package org.apache.camel.quarkus.component.csimple.it;
import org.apache.camel.builder.RouteBuilder;
-public class CoreRoutes extends RouteBuilder {
+public class CSimpleRoute extends RouteBuilder {
@Override
- public void configure() {
- from("timer:keep-alive")
- .routeId("timer")
- .setBody().constant("I'm alive !")
- .to("log:keep-alive");
-
+ public void configure() throws Exception {
from("direct:csimple-hello")
.setBody().csimple("Hello ${body}");
-
}
}
diff --git a/integration-tests/csimple/src/main/resources/application.properties b/integration-tests/csimple/src/main/resources/application.properties
new file mode 100644
index 0000000..0ee16d9
--- /dev/null
+++ b/integration-tests/csimple/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.
+## ---------------------------------------------------------------------------
+
+camel.main.xml-routes = classpath:routes/my-routes.xml
diff --git a/integration-tests/main-xml-io/src/main/resources/routes/my-routes.xml b/integration-tests/csimple/src/main/resources/routes/my-routes.xml
similarity index 74%
copy from integration-tests/main-xml-io/src/main/resources/routes/my-routes.xml
copy to integration-tests/csimple/src/main/resources/routes/my-routes.xml
index ae9376a..e6b4470 100644
--- a/integration-tests/main-xml-io/src/main/resources/routes/my-routes.xml
+++ b/integration-tests/csimple/src/main/resources/routes/my-routes.xml
@@ -24,23 +24,6 @@
http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd">
- <route id="my-xml-route">
- <from uri="timer:from-xml?period=3000"/>
- <setBody>
- <constant>Hello World!!!</constant>
- </setBody>
- <to uri="log:from-xml"/>
- </route>
-
- <route id="namespace-aware-route">
- <from uri="direct:namespace-aware"/>
- <setBody>
- <xpath resultType="java.lang.String">
- /foo:foo-text/text()
- </xpath>
- </setBody>
- </route>
-
<route id="csimple-xml-dsl">
<from uri="direct:csimple-xml-dsl"/>
<setBody>
diff --git a/integration-tests/core/src/main/java/org/apache/camel/quarkus/core/CoreRoutes.java b/integration-tests/csimple/src/test/java/org/apache/camel/quarkus/component/csimple/it/CSimpleIT.java
similarity index 65%
copy from integration-tests/core/src/main/java/org/apache/camel/quarkus/core/CoreRoutes.java
copy to integration-tests/csimple/src/test/java/org/apache/camel/quarkus/component/csimple/it/CSimpleIT.java
index 5956f38..500a67e 100644
--- a/integration-tests/core/src/main/java/org/apache/camel/quarkus/core/CoreRoutes.java
+++ b/integration-tests/csimple/src/test/java/org/apache/camel/quarkus/component/csimple/it/CSimpleIT.java
@@ -14,22 +14,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.camel.quarkus.core;
+package org.apache.camel.quarkus.component.csimple.it;
-import org.apache.camel.builder.RouteBuilder;
+import io.quarkus.test.junit.NativeImageTest;
-public class CoreRoutes extends RouteBuilder {
-
- @Override
- public void configure() {
- from("timer:keep-alive")
- .routeId("timer")
- .setBody().constant("I'm alive !")
- .to("log:keep-alive");
-
- from("direct:csimple-hello")
- .setBody().csimple("Hello ${body}");
-
- }
+@NativeImageTest
+class CSimpleIT extends CSimpleTest {
}
diff --git a/integration-tests/core/src/main/java/org/apache/camel/quarkus/core/CoreRoutes.java b/integration-tests/csimple/src/test/java/org/apache/camel/quarkus/component/csimple/it/CSimpleTest.java
similarity index 50%
copy from integration-tests/core/src/main/java/org/apache/camel/quarkus/core/CoreRoutes.java
copy to integration-tests/csimple/src/test/java/org/apache/camel/quarkus/component/csimple/it/CSimpleTest.java
index 5956f38..4e3d3bb 100644
--- a/integration-tests/core/src/main/java/org/apache/camel/quarkus/core/CoreRoutes.java
+++ b/integration-tests/csimple/src/test/java/org/apache/camel/quarkus/component/csimple/it/CSimpleTest.java
@@ -14,22 +14,36 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.camel.quarkus.core;
+package org.apache.camel.quarkus.component.csimple.it;
-import org.apache.camel.builder.RouteBuilder;
+import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.RestAssured;
+import io.restassured.http.ContentType;
+import org.junit.jupiter.api.Test;
-public class CoreRoutes extends RouteBuilder {
+import static org.hamcrest.Matchers.is;
- @Override
- public void configure() {
- from("timer:keep-alive")
- .routeId("timer")
- .setBody().constant("I'm alive !")
- .to("log:keep-alive");
+@QuarkusTest
+class CSimpleTest {
- from("direct:csimple-hello")
- .setBody().csimple("Hello ${body}");
+ @Test
+ public void csimpleHello() {
+ RestAssured.given()
+ .body("Joe")
+ .contentType(ContentType.TEXT)
+ .post("/csimple/csimple-hello")
+ .then()
+ .body(is("Hello Joe"));
+ }
+ @Test
+ public void csimpleXml() {
+ RestAssured.given()
+ .body("Joe")
+ .contentType(ContentType.TEXT)
+ .post("/csimple/csimple-xml-dsl")
+ .then()
+ .body(is("Hi Joe"));
}
}
diff --git a/integration-tests/main-xml-io/src/main/java/org/apache/camel/quarkus/main/CoreMainXmlIoResource.java b/integration-tests/main-xml-io/src/main/java/org/apache/camel/quarkus/main/CoreMainXmlIoResource.java
index fb3ce7d..75a3014 100644
--- a/integration-tests/main-xml-io/src/main/java/org/apache/camel/quarkus/main/CoreMainXmlIoResource.java
+++ b/integration-tests/main-xml-io/src/main/java/org/apache/camel/quarkus/main/CoreMainXmlIoResource.java
@@ -91,11 +91,4 @@ public class CoreMainXmlIoResource {
return template.requestBody("direct:namespace-aware", body, String.class);
}
- @Path("/csimple-xml-dsl")
- @POST
- @Consumes(MediaType.TEXT_PLAIN)
- @Produces(MediaType.TEXT_PLAIN)
- public String csimpleXmlDsl(String body) {
- return template.requestBody("direct:csimple-xml-dsl", body, String.class);
- }
}
diff --git a/integration-tests/main-xml-io/src/main/resources/routes/my-routes.xml b/integration-tests/main-xml-io/src/main/resources/routes/my-routes.xml
index ae9376a..48feb17 100644
--- a/integration-tests/main-xml-io/src/main/resources/routes/my-routes.xml
+++ b/integration-tests/main-xml-io/src/main/resources/routes/my-routes.xml
@@ -41,11 +41,4 @@
</setBody>
</route>
- <route id="csimple-xml-dsl">
- <from uri="direct:csimple-xml-dsl"/>
- <setBody>
- <csimple>Hi ${body}</csimple>
- </setBody>
- </route>
-
</routes>
\ No newline at end of file
diff --git a/integration-tests/main-xml-io/src/test/java/org/apache/camel/quarkus/main/CoreMainXmlIoTest.java b/integration-tests/main-xml-io/src/test/java/org/apache/camel/quarkus/main/CoreMainXmlIoTest.java
index c8c07c7..9a6fd6f 100644
--- a/integration-tests/main-xml-io/src/test/java/org/apache/camel/quarkus/main/CoreMainXmlIoTest.java
+++ b/integration-tests/main-xml-io/src/test/java/org/apache/camel/quarkus/main/CoreMainXmlIoTest.java
@@ -76,14 +76,4 @@ public class CoreMainXmlIoTest {
}
- @Test
- public void csimpleXml() {
- RestAssured.given()
- .body("Joe")
- .contentType(ContentType.TEXT)
- .post("/test/csimple-xml-dsl")
- .then()
- .body(is("Hi Joe"));
- }
-
}
diff --git a/integration-tests/main/src/test/java/org/apache/camel/quarkus/main/CoreMainTest.java b/integration-tests/main/src/test/java/org/apache/camel/quarkus/main/CoreMainTest.java
index 5f6b344..5ab20b9 100644
--- a/integration-tests/main/src/test/java/org/apache/camel/quarkus/main/CoreMainTest.java
+++ b/integration-tests/main/src/test/java/org/apache/camel/quarkus/main/CoreMainTest.java
@@ -104,8 +104,7 @@ public class CoreMainTest {
"file", "org.apache.camel.language.simple.FileLanguage",
"header", "org.apache.camel.language.header.HeaderLanguage",
"simple", "org.apache.camel.language.simple.SimpleLanguage",
- "ref", "org.apache.camel.language.ref.RefLanguage",
- "csimple", "org.apache.camel.language.csimple.CSimpleLanguage"));
+ "ref", "org.apache.camel.language.ref.RefLanguage"));
Map<String, String> factoryFinderMap = p.getMap("factory-finder.class-map", String.class, String.class);
diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml
index 4f8f525..1b8897d 100644
--- a/integration-tests/pom.xml
+++ b/integration-tests/pom.xml
@@ -80,6 +80,7 @@
<module>consul</module>
<module>couchdb</module>
<module>crypto</module>
+ <module>csimple</module>
<module>csv</module>
<module>dataformat</module>
<module>dataformats-json</module>
diff --git a/pom.xml b/pom.xml
index a50124f..efb2618 100644
--- a/pom.xml
+++ b/pom.xml
@@ -130,7 +130,7 @@
<zt-exec.version>1.11</zt-exec.version>
<!-- Maven plugin versions (keep sorted alphabetically) -->
- <cq-plugin.version>0.24.0</cq-plugin.version>
+ <cq-plugin.version>0.26.0</cq-plugin.version>
<build-helper-maven-plugin.version>3.1.0</build-helper-maven-plugin.version>
<exec-maven-plugin.version>3.0.0</exec-maven-plugin.version>
<formatter-maven-plugin.version>2.11.0</formatter-maven-plugin.version>
diff --git a/poms/bom/pom.xml b/poms/bom/pom.xml
index 89f7e96..b1c40b8 100644
--- a/poms/bom/pom.xml
+++ b/poms/bom/pom.xml
@@ -2950,6 +2950,16 @@
</dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-csimple</artifactId>
+ <version>${camel-quarkus.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-csimple-deployment</artifactId>
+ <version>${camel-quarkus.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-csv</artifactId>
<version>${camel-quarkus.version}</version>
</dependency>
diff --git a/tooling/create-extension-templates/quarkus-extension.yaml b/tooling/create-extension-templates/quarkus-extension.yaml
index 961aa23..8ed1e51 100644
--- a/tooling/create-extension-templates/quarkus-extension.yaml
+++ b/tooling/create-extension-templates/quarkus-extension.yaml
@@ -38,5 +38,5 @@ metadata:
[/#list]
[/#if]
status:
- - "[=nativeSupported?then('stable', 'preview')]"
+ - "[=status]"
[#if deprecated ] - "deprecated"[/#if]
\ No newline at end of file
diff --git a/tooling/maven-plugin/src/main/java/org/apache/camel/quarkus/maven/CqCatalog.java b/tooling/maven-plugin/src/main/java/org/apache/camel/quarkus/maven/CqCatalog.java
index ecc1ebb..1a20ac6 100644
--- a/tooling/maven-plugin/src/main/java/org/apache/camel/quarkus/maven/CqCatalog.java
+++ b/tooling/maven-plugin/src/main/java/org/apache/camel/quarkus/maven/CqCatalog.java
@@ -23,9 +23,8 @@ import java.nio.file.FileSystems;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
import java.util.List;
+import java.util.function.Predicate;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@@ -106,20 +105,19 @@ public class CqCatalog {
}
}
- public static List<String> toCamelArtifactIdBase(String cqArtifactIdBase) {
+ public Stream<ArtifactModel<?>> filterModels(String cqArtifactIdBase) {
+ final Predicate<ArtifactModel<?>> filter;
if ("core".equals(cqArtifactIdBase)) {
- return Arrays.asList("camel-base", "camel-core-languages");
+ filter = model -> ("camel-base".equals(model.getArtifactId())
+ || "camel-core-languages".equals(model.getArtifactId())) && !"csimple".equals(model.getName());
+ } else if ("csimple".equals(cqArtifactIdBase)) {
+ filter = model -> "camel-core-languages".equals(model.getArtifactId()) && "csimple".equals(model.getName());
} else if ("reactive-executor".equals(cqArtifactIdBase)) {
- return Collections.singletonList("camel-reactive-executor-vertx");
+ filter = model -> "camel-reactive-executor-vertx".equals(model.getArtifactId());
} else {
- return Collections.singletonList("camel-" + cqArtifactIdBase);
+ filter = model -> ("camel-" + cqArtifactIdBase).equals(model.getArtifactId());
}
- }
-
- public Stream<ArtifactModel<?>> filterModels(String artifactIdBase) {
- List<String> camelArtifactIds = toCamelArtifactIdBase(artifactIdBase);
- return models()
- .filter(model -> camelArtifactIds.contains(model.getArtifactId()));
+ return models().filter(filter);
}
public Stream<ArtifactModel<?>> models() {
diff --git a/tooling/scripts/test-categories.yaml b/tooling/scripts/test-categories.yaml
index ec7fe39..0d7c05c 100644
--- a/tooling/scripts/test-categories.yaml
+++ b/tooling/scripts/test-categories.yaml
@@ -106,6 +106,7 @@ dozer-social:
- master
- syndication
- zendesk
+ - csimple
messaging-networking1:
- activemq
- amqp