You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by lb...@apache.org on 2020/07/15 00:09:14 UTC
[camel-k-runtime] branch master updated: Unable to run kotlin
routes with quarkus #394
This is an automated email from the ASF dual-hosted git repository.
lburgazzoli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-k-runtime.git
The following commit(s) were added to refs/heads/master by this push:
new 90a38e0 Unable to run kotlin routes with quarkus #394
90a38e0 is described below
commit 90a38e0e3fda798c25ab1f78a7580d418ab259ad
Author: lburgazzoli <lb...@gmail.com>
AuthorDate: Tue Jul 14 19:19:13 2020 +0200
Unable to run kotlin routes with quarkus #394
---
camel-k-loader-groovy/pom.xml | 4 -
camel-k-loader-java/pom.xml | 4 -
camel-k-loader-js/pom.xml | 4 -
.../camel-k-loader-kotlin-itests}/pom.xml | 43 +++--
.../camel/k/loader/kotlin/itests/LoaderTest.java | 48 ++++++
.../src/test/resources/log4j2-test.xml | 0
.../src/test/resources/routes.kts | 0
.../{ => camel-k-loader-kotlin}/pom.xml | 14 +-
.../kotlin/KotlinCompilationConfiguration.kt | 0
.../camel/k/loader/kotlin/KotlinSourceLoader.kt | 87 ++++++++++
.../k/loader/kotlin/dsl/BeansConfiguration.kt | 0
.../k/loader/kotlin/dsl/CamelConfiguration.kt | 0
.../k/loader/kotlin/dsl/ComponentsConfiguration.kt | 0
.../loader/kotlin/dsl/DataFormatsConfiguration.kt | 0
.../loader/kotlin/dsl/IntegrationConfiguration.kt | 0
.../k/loader/kotlin/dsl/LanguagesConfiguration.kt | 0
.../k/loader/kotlin/dsl/RegistryConfiguration.kt | 0
.../camel/k/loader/kotlin/dsl/RestConfiguration.kt | 0
.../k/loader/kotlin/dsl/RestVerbConfiguration.kt | 0
.../apache/camel/k/loader/kotlin/dsl/Support.kt | 0
.../kotlin/extension/LogComponentExtensions.kt | 0
...r.kotlin.dsl.IntegrationConfiguration.classname | 0
.../services/org/apache/camel/k/loader/kts | 0
.../org/apache/camel/k/loader/kotlin/LoaderTest.kt | 0
.../camel/k/loader/kotlin/dsl/IntegrationTest.kt | 0
.../k/loader/kotlin/extension/LogExtensionTest.kt | 0
.../src/test/resources/log4j2-test.xml | 0
.../src/test/resources/routes-new.kts | 0
.../src/test/resources/routes-with-beans.kts | 0
.../routes-with-components-configuration-error.kts | 0
.../routes-with-components-configuration.kts | 0
.../routes-with-dataformats-configuration.kts | 0
.../test/resources/routes-with-endpoint-dsl.kts | 0
.../test/resources/routes-with-error-handler.kts | 0
.../routes-with-languages-configuration.kts | 0
.../src/test/resources/routes-with-rest.kts | 0
.../src/test/resources/routes.kts | 0
camel-k-loader-kotlin/pom.xml | 191 +--------------------
.../camel/k/loader/kotlin/KotlinSourceLoader.kt | 104 -----------
camel-k-main/camel-k-runtime-main/pom.xml | 5 -
.../camel-k-quarkus-core/deployment/pom.xml | 4 +
.../camel-k-quarkus-core/runtime/pom.xml | 5 +
.../camel-k-quarkus-loader-groovy/runtime/pom.xml | 4 -
.../camel-k-quarkus-loader-java/runtime/pom.xml | 4 -
.../camel-k-quarkus-loader-js/runtime/pom.xml | 4 -
.../deployment/pom.xml | 9 +-
.../camel-k-quarkus-loader-kotlin/runtime/pom.xml | 9 +-
camel-k-runtime-core/pom.xml | 4 +
.../org/apache/camel/k/support/RouteBuilders.java | 39 ++---
.../data/application.properties | 34 ++++
.../data/routes.kts | 5 +-
.../pom.xml | 83 +++++----
.../src/main/resources/application.properties | 20 +++
examples/pom.xml | 1 +
54 files changed, 332 insertions(+), 397 deletions(-)
diff --git a/camel-k-loader-groovy/pom.xml b/camel-k-loader-groovy/pom.xml
index e1a9628..6693faf 100644
--- a/camel-k-loader-groovy/pom.xml
+++ b/camel-k-loader-groovy/pom.xml
@@ -42,10 +42,6 @@
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-endpointdsl</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
<artifactId>camel-groovy</artifactId>
<exclusions>
<exclusion>
diff --git a/camel-k-loader-java/pom.xml b/camel-k-loader-java/pom.xml
index 884e59d..1e4dd67 100644
--- a/camel-k-loader-java/pom.xml
+++ b/camel-k-loader-java/pom.xml
@@ -37,10 +37,6 @@
<artifactId>camel-core-engine</artifactId>
</dependency>
<dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-endpointdsl</artifactId>
- </dependency>
- <dependency>
<groupId>org.jooq</groupId>
<artifactId>joor</artifactId>
<version>${joor.version}</version>
diff --git a/camel-k-loader-js/pom.xml b/camel-k-loader-js/pom.xml
index a023746..b552896 100644
--- a/camel-k-loader-js/pom.xml
+++ b/camel-k-loader-js/pom.xml
@@ -36,10 +36,6 @@
<groupId>org.apache.camel</groupId>
<artifactId>camel-core-engine</artifactId>
</dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-endpointdsl</artifactId>
- </dependency>
<dependency>
<groupId>org.graalvm.js</groupId>
diff --git a/camel-k-quarkus/camel-k-quarkus-loader-kotlin/deployment/pom.xml b/camel-k-loader-kotlin/camel-k-loader-kotlin-itests/pom.xml
similarity index 58%
copy from camel-k-quarkus/camel-k-quarkus-loader-kotlin/deployment/pom.xml
copy to camel-k-loader-kotlin/camel-k-loader-kotlin-itests/pom.xml
index ca11a40..43075f2 100644
--- a/camel-k-quarkus/camel-k-quarkus-loader-kotlin/deployment/pom.xml
+++ b/camel-k-loader-kotlin/camel-k-loader-kotlin-itests/pom.xml
@@ -20,21 +20,45 @@
<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">
<parent>
<groupId>org.apache.camel.k</groupId>
- <artifactId>camel-k-quarkus-loader-kotlin-parent</artifactId>
+ <artifactId>camel-k-loader-kotlin-parent</artifactId>
<version>1.5.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
- <artifactId>camel-k-quarkus-loader-kotlin-deployment</artifactId>
+ <artifactId>camel-k-loader-kotlin-itests</artifactId>
<dependencies>
<dependency>
<groupId>org.apache.camel.k</groupId>
- <artifactId>camel-k-quarkus-loader-kotlin</artifactId>
+ <artifactId>camel-k-loader-kotlin</artifactId>
</dependency>
+
+ <!-- ****************************** -->
+ <!-- -->
+ <!-- TESTS -->
+ <!-- -->
+ <!-- ****************************** -->
+
<dependency>
<groupId>org.apache.camel.k</groupId>
- <artifactId>camel-k-quarkus-core-deployment</artifactId>
+ <artifactId>camel-k-test</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-timer</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-log</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-direct</artifactId>
+ <scope>test</scope>
</dependency>
</dependencies>
@@ -42,15 +66,10 @@
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
+ <artifactId>maven-surefire-plugin</artifactId>
<configuration>
- <annotationProcessorPaths>
- <path>
- <groupId>io.quarkus</groupId>
- <artifactId>quarkus-extension-processor</artifactId>
- <version>${quarkus.version}</version>
- </path>
- </annotationProcessorPaths>
+ <forkCount>1</forkCount>
+ <reuseForks>false</reuseForks>
</configuration>
</plugin>
</plugins>
diff --git a/camel-k-loader-kotlin/camel-k-loader-kotlin-itests/src/test/java/org/apache/camel/k/loader/kotlin/itests/LoaderTest.java b/camel-k-loader-kotlin/camel-k-loader-kotlin-itests/src/test/java/org/apache/camel/k/loader/kotlin/itests/LoaderTest.java
new file mode 100644
index 0000000..bc25de7
--- /dev/null
+++ b/camel-k-loader-kotlin/camel-k-loader-kotlin-itests/src/test/java/org/apache/camel/k/loader/kotlin/itests/LoaderTest.java
@@ -0,0 +1,48 @@
+/*
+ * 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.k.loader.kotlin.itests;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.impl.DefaultCamelContext;
+import org.apache.camel.k.Runtime;
+import org.apache.camel.k.Source;
+import org.apache.camel.k.Sources;
+import org.apache.camel.k.listener.RoutesConfigurer;
+import org.junit.jupiter.api.Test;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+public class LoaderTest {
+ @Test
+ public void testLoad() throws Exception {
+ final CamelContext context = new DefaultCamelContext();
+ final Runtime runtime = Runtime.on(context);
+ final Source source = Sources.fromURI("classpath:routes.kts");
+
+ RoutesConfigurer.load(runtime, source);
+
+ try {
+ context.start();
+
+ assertThat(context.getComponentNames()).isNotEmpty();
+ assertThat(context.getRoutes()).isNotEmpty();
+ assertThat(context.getEndpoints()).isNotEmpty();
+ } finally {
+ context.stop();
+ }
+ }
+}
diff --git a/camel-k-loader-kotlin/src/test/resources/log4j2-test.xml b/camel-k-loader-kotlin/camel-k-loader-kotlin-itests/src/test/resources/log4j2-test.xml
similarity index 100%
copy from camel-k-loader-kotlin/src/test/resources/log4j2-test.xml
copy to camel-k-loader-kotlin/camel-k-loader-kotlin-itests/src/test/resources/log4j2-test.xml
diff --git a/camel-k-loader-kotlin/src/test/resources/routes.kts b/camel-k-loader-kotlin/camel-k-loader-kotlin-itests/src/test/resources/routes.kts
similarity index 100%
copy from camel-k-loader-kotlin/src/test/resources/routes.kts
copy to camel-k-loader-kotlin/camel-k-loader-kotlin-itests/src/test/resources/routes.kts
diff --git a/camel-k-loader-kotlin/pom.xml b/camel-k-loader-kotlin/camel-k-loader-kotlin/pom.xml
similarity index 96%
copy from camel-k-loader-kotlin/pom.xml
copy to camel-k-loader-kotlin/camel-k-loader-kotlin/pom.xml
index ac889a3..ade15ab 100644
--- a/camel-k-loader-kotlin/pom.xml
+++ b/camel-k-loader-kotlin/camel-k-loader-kotlin/pom.xml
@@ -20,7 +20,7 @@
<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">
<parent>
<groupId>org.apache.camel.k</groupId>
- <artifactId>camel-k-runtime-parent</artifactId>
+ <artifactId>camel-k-loader-kotlin-parent</artifactId>
<version>1.5.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -38,10 +38,6 @@
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-endpointdsl</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
<artifactId>camel-log</artifactId>
<optional>true</optional>
</dependency>
@@ -180,12 +176,16 @@
<execution>
<id>java-compile</id>
<phase>compile</phase>
- <goals> <goal>compile</goal> </goals>
+ <goals>
+ <goal>compile</goal>
+ </goals>
</execution>
<execution>
<id>java-test-compile</id>
<phase>test-compile</phase>
- <goals> <goal>testCompile</goal> </goals>
+ <goals>
+ <goal>testCompile</goal>
+ </goals>
</execution>
</executions>
</plugin>
diff --git a/camel-k-loader-kotlin/src/main/kotlin/org/apache/camel/k/loader/kotlin/KotlinCompilationConfiguration.kt b/camel-k-loader-kotlin/camel-k-loader-kotlin/src/main/kotlin/org/apache/camel/k/loader/kotlin/KotlinCompilationConfiguration.kt
similarity index 100%
rename from camel-k-loader-kotlin/src/main/kotlin/org/apache/camel/k/loader/kotlin/KotlinCompilationConfiguration.kt
rename to camel-k-loader-kotlin/camel-k-loader-kotlin/src/main/kotlin/org/apache/camel/k/loader/kotlin/KotlinCompilationConfiguration.kt
diff --git a/camel-k-loader-kotlin/camel-k-loader-kotlin/src/main/kotlin/org/apache/camel/k/loader/kotlin/KotlinSourceLoader.kt b/camel-k-loader-kotlin/camel-k-loader-kotlin/src/main/kotlin/org/apache/camel/k/loader/kotlin/KotlinSourceLoader.kt
new file mode 100644
index 0000000..98f334c
--- /dev/null
+++ b/camel-k-loader-kotlin/camel-k-loader-kotlin/src/main/kotlin/org/apache/camel/k/loader/kotlin/KotlinSourceLoader.kt
@@ -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.k.loader.kotlin
+
+import org.apache.camel.Experimental
+import org.apache.camel.RuntimeCamelException
+import org.apache.camel.builder.endpoint.EndpointRouteBuilder
+import org.apache.camel.k.Runtime
+import org.apache.camel.k.Source
+import org.apache.camel.k.SourceLoader
+import org.apache.camel.k.loader.kotlin.dsl.IntegrationConfiguration
+import org.apache.camel.k.support.RouteBuilders
+import org.slf4j.LoggerFactory
+import java.io.InputStream
+import java.io.InputStreamReader
+import kotlin.script.experimental.api.ResultValue
+import kotlin.script.experimental.api.ScriptDiagnostic
+import kotlin.script.experimental.api.ScriptEvaluationConfiguration
+import kotlin.script.experimental.api.constructorArgs
+import kotlin.script.experimental.api.valueOrNull
+import kotlin.script.experimental.host.toScriptSource
+import kotlin.script.experimental.jvmhost.BasicJvmScriptingHost
+import kotlin.script.experimental.jvmhost.createJvmCompilationConfigurationFromTemplate
+
+@Experimental
+class KotlinSourceLoader : SourceLoader {
+ override fun getSupportedLanguages(): List<String> {
+ return listOf("kts")
+ }
+
+ @Throws(Exception::class)
+ override fun load(runtime: Runtime, source: Source): SourceLoader.Result {
+ val builder = RouteBuilders.endpoint(source) {
+ inputStream, builder -> doLoad(inputStream, builder)
+ }
+
+ return SourceLoader.Result.on(builder)
+ }
+
+ private fun doLoad(inputStream: InputStream, builder: EndpointRouteBuilder) {
+ val host = BasicJvmScriptingHost()
+ val config = createJvmCompilationConfigurationFromTemplate<IntegrationConfiguration>()
+
+ val result = host.eval(
+ InputStreamReader(inputStream).readText().toScriptSource(),
+ config,
+ ScriptEvaluationConfiguration {
+ //
+ // Arguments used to initialize the script base class (IntegrationConfiguration)
+ //
+ constructorArgs(builder)
+ }
+ )
+
+ // ensure evaluation errors propagation
+ when(val rv = result.valueOrNull()?.returnValue) {
+ is ResultValue.Error -> throw RuntimeCamelException(rv.error)
+ }
+
+ if (result.reports.isNotEmpty()) {
+ val logger = LoggerFactory.getLogger(KotlinSourceLoader::class.java)
+ for (report in result.reports) {
+ when (report.severity) {
+ ScriptDiagnostic.Severity.FATAL -> logger.error(report.message, report.exception)
+ ScriptDiagnostic.Severity.ERROR -> logger.error(report.message, report.exception)
+ ScriptDiagnostic.Severity.WARNING -> logger.warn(report.message, report.exception)
+ ScriptDiagnostic.Severity.INFO -> logger.info(report.message)
+ ScriptDiagnostic.Severity.DEBUG -> logger.debug(report.message)
+ }
+ }
+ }
+ }
+}
diff --git a/camel-k-loader-kotlin/src/main/kotlin/org/apache/camel/k/loader/kotlin/dsl/BeansConfiguration.kt b/camel-k-loader-kotlin/camel-k-loader-kotlin/src/main/kotlin/org/apache/camel/k/loader/kotlin/dsl/BeansConfiguration.kt
similarity index 100%
rename from camel-k-loader-kotlin/src/main/kotlin/org/apache/camel/k/loader/kotlin/dsl/BeansConfiguration.kt
rename to camel-k-loader-kotlin/camel-k-loader-kotlin/src/main/kotlin/org/apache/camel/k/loader/kotlin/dsl/BeansConfiguration.kt
diff --git a/camel-k-loader-kotlin/src/main/kotlin/org/apache/camel/k/loader/kotlin/dsl/CamelConfiguration.kt b/camel-k-loader-kotlin/camel-k-loader-kotlin/src/main/kotlin/org/apache/camel/k/loader/kotlin/dsl/CamelConfiguration.kt
similarity index 100%
rename from camel-k-loader-kotlin/src/main/kotlin/org/apache/camel/k/loader/kotlin/dsl/CamelConfiguration.kt
rename to camel-k-loader-kotlin/camel-k-loader-kotlin/src/main/kotlin/org/apache/camel/k/loader/kotlin/dsl/CamelConfiguration.kt
diff --git a/camel-k-loader-kotlin/src/main/kotlin/org/apache/camel/k/loader/kotlin/dsl/ComponentsConfiguration.kt b/camel-k-loader-kotlin/camel-k-loader-kotlin/src/main/kotlin/org/apache/camel/k/loader/kotlin/dsl/ComponentsConfiguration.kt
similarity index 100%
rename from camel-k-loader-kotlin/src/main/kotlin/org/apache/camel/k/loader/kotlin/dsl/ComponentsConfiguration.kt
rename to camel-k-loader-kotlin/camel-k-loader-kotlin/src/main/kotlin/org/apache/camel/k/loader/kotlin/dsl/ComponentsConfiguration.kt
diff --git a/camel-k-loader-kotlin/src/main/kotlin/org/apache/camel/k/loader/kotlin/dsl/DataFormatsConfiguration.kt b/camel-k-loader-kotlin/camel-k-loader-kotlin/src/main/kotlin/org/apache/camel/k/loader/kotlin/dsl/DataFormatsConfiguration.kt
similarity index 100%
rename from camel-k-loader-kotlin/src/main/kotlin/org/apache/camel/k/loader/kotlin/dsl/DataFormatsConfiguration.kt
rename to camel-k-loader-kotlin/camel-k-loader-kotlin/src/main/kotlin/org/apache/camel/k/loader/kotlin/dsl/DataFormatsConfiguration.kt
diff --git a/camel-k-loader-kotlin/src/main/kotlin/org/apache/camel/k/loader/kotlin/dsl/IntegrationConfiguration.kt b/camel-k-loader-kotlin/camel-k-loader-kotlin/src/main/kotlin/org/apache/camel/k/loader/kotlin/dsl/IntegrationConfiguration.kt
similarity index 100%
rename from camel-k-loader-kotlin/src/main/kotlin/org/apache/camel/k/loader/kotlin/dsl/IntegrationConfiguration.kt
rename to camel-k-loader-kotlin/camel-k-loader-kotlin/src/main/kotlin/org/apache/camel/k/loader/kotlin/dsl/IntegrationConfiguration.kt
diff --git a/camel-k-loader-kotlin/src/main/kotlin/org/apache/camel/k/loader/kotlin/dsl/LanguagesConfiguration.kt b/camel-k-loader-kotlin/camel-k-loader-kotlin/src/main/kotlin/org/apache/camel/k/loader/kotlin/dsl/LanguagesConfiguration.kt
similarity index 100%
rename from camel-k-loader-kotlin/src/main/kotlin/org/apache/camel/k/loader/kotlin/dsl/LanguagesConfiguration.kt
rename to camel-k-loader-kotlin/camel-k-loader-kotlin/src/main/kotlin/org/apache/camel/k/loader/kotlin/dsl/LanguagesConfiguration.kt
diff --git a/camel-k-loader-kotlin/src/main/kotlin/org/apache/camel/k/loader/kotlin/dsl/RegistryConfiguration.kt b/camel-k-loader-kotlin/camel-k-loader-kotlin/src/main/kotlin/org/apache/camel/k/loader/kotlin/dsl/RegistryConfiguration.kt
similarity index 100%
rename from camel-k-loader-kotlin/src/main/kotlin/org/apache/camel/k/loader/kotlin/dsl/RegistryConfiguration.kt
rename to camel-k-loader-kotlin/camel-k-loader-kotlin/src/main/kotlin/org/apache/camel/k/loader/kotlin/dsl/RegistryConfiguration.kt
diff --git a/camel-k-loader-kotlin/src/main/kotlin/org/apache/camel/k/loader/kotlin/dsl/RestConfiguration.kt b/camel-k-loader-kotlin/camel-k-loader-kotlin/src/main/kotlin/org/apache/camel/k/loader/kotlin/dsl/RestConfiguration.kt
similarity index 100%
rename from camel-k-loader-kotlin/src/main/kotlin/org/apache/camel/k/loader/kotlin/dsl/RestConfiguration.kt
rename to camel-k-loader-kotlin/camel-k-loader-kotlin/src/main/kotlin/org/apache/camel/k/loader/kotlin/dsl/RestConfiguration.kt
diff --git a/camel-k-loader-kotlin/src/main/kotlin/org/apache/camel/k/loader/kotlin/dsl/RestVerbConfiguration.kt b/camel-k-loader-kotlin/camel-k-loader-kotlin/src/main/kotlin/org/apache/camel/k/loader/kotlin/dsl/RestVerbConfiguration.kt
similarity index 100%
rename from camel-k-loader-kotlin/src/main/kotlin/org/apache/camel/k/loader/kotlin/dsl/RestVerbConfiguration.kt
rename to camel-k-loader-kotlin/camel-k-loader-kotlin/src/main/kotlin/org/apache/camel/k/loader/kotlin/dsl/RestVerbConfiguration.kt
diff --git a/camel-k-loader-kotlin/src/main/kotlin/org/apache/camel/k/loader/kotlin/dsl/Support.kt b/camel-k-loader-kotlin/camel-k-loader-kotlin/src/main/kotlin/org/apache/camel/k/loader/kotlin/dsl/Support.kt
similarity index 100%
rename from camel-k-loader-kotlin/src/main/kotlin/org/apache/camel/k/loader/kotlin/dsl/Support.kt
rename to camel-k-loader-kotlin/camel-k-loader-kotlin/src/main/kotlin/org/apache/camel/k/loader/kotlin/dsl/Support.kt
diff --git a/camel-k-loader-kotlin/src/main/kotlin/org/apache/camel/k/loader/kotlin/extension/LogComponentExtensions.kt b/camel-k-loader-kotlin/camel-k-loader-kotlin/src/main/kotlin/org/apache/camel/k/loader/kotlin/extension/LogComponentExtensions.kt
similarity index 100%
rename from camel-k-loader-kotlin/src/main/kotlin/org/apache/camel/k/loader/kotlin/extension/LogComponentExtensions.kt
rename to camel-k-loader-kotlin/camel-k-loader-kotlin/src/main/kotlin/org/apache/camel/k/loader/kotlin/extension/LogComponentExtensions.kt
diff --git a/camel-k-loader-kotlin/src/main/resources/META-INF/kotlin/script/templates/org.apache.camel.k.loader.kotlin.dsl.IntegrationConfiguration.classname b/camel-k-loader-kotlin/camel-k-loader-kotlin/src/main/resources/META-INF/kotlin/script/templates/org.apache.camel.k.loader.kotlin.dsl.IntegrationConfiguration.classname
similarity index 100%
rename from camel-k-loader-kotlin/src/main/resources/META-INF/kotlin/script/templates/org.apache.camel.k.loader.kotlin.dsl.IntegrationConfiguration.classname
rename to camel-k-loader-kotlin/camel-k-loader-kotlin/src/main/resources/META-INF/kotlin/script/templates/org.apache.camel.k.loader.kotlin.dsl.IntegrationConfiguration.classname
diff --git a/camel-k-loader-kotlin/src/main/resources/META-INF/services/org/apache/camel/k/loader/kts b/camel-k-loader-kotlin/camel-k-loader-kotlin/src/main/resources/META-INF/services/org/apache/camel/k/loader/kts
similarity index 100%
rename from camel-k-loader-kotlin/src/main/resources/META-INF/services/org/apache/camel/k/loader/kts
rename to camel-k-loader-kotlin/camel-k-loader-kotlin/src/main/resources/META-INF/services/org/apache/camel/k/loader/kts
diff --git a/camel-k-loader-kotlin/src/test/kotlin/org/apache/camel/k/loader/kotlin/LoaderTest.kt b/camel-k-loader-kotlin/camel-k-loader-kotlin/src/test/kotlin/org/apache/camel/k/loader/kotlin/LoaderTest.kt
similarity index 100%
rename from camel-k-loader-kotlin/src/test/kotlin/org/apache/camel/k/loader/kotlin/LoaderTest.kt
rename to camel-k-loader-kotlin/camel-k-loader-kotlin/src/test/kotlin/org/apache/camel/k/loader/kotlin/LoaderTest.kt
diff --git a/camel-k-loader-kotlin/src/test/kotlin/org/apache/camel/k/loader/kotlin/dsl/IntegrationTest.kt b/camel-k-loader-kotlin/camel-k-loader-kotlin/src/test/kotlin/org/apache/camel/k/loader/kotlin/dsl/IntegrationTest.kt
similarity index 100%
rename from camel-k-loader-kotlin/src/test/kotlin/org/apache/camel/k/loader/kotlin/dsl/IntegrationTest.kt
rename to camel-k-loader-kotlin/camel-k-loader-kotlin/src/test/kotlin/org/apache/camel/k/loader/kotlin/dsl/IntegrationTest.kt
diff --git a/camel-k-loader-kotlin/src/test/kotlin/org/apache/camel/k/loader/kotlin/extension/LogExtensionTest.kt b/camel-k-loader-kotlin/camel-k-loader-kotlin/src/test/kotlin/org/apache/camel/k/loader/kotlin/extension/LogExtensionTest.kt
similarity index 100%
rename from camel-k-loader-kotlin/src/test/kotlin/org/apache/camel/k/loader/kotlin/extension/LogExtensionTest.kt
rename to camel-k-loader-kotlin/camel-k-loader-kotlin/src/test/kotlin/org/apache/camel/k/loader/kotlin/extension/LogExtensionTest.kt
diff --git a/camel-k-loader-kotlin/src/test/resources/log4j2-test.xml b/camel-k-loader-kotlin/camel-k-loader-kotlin/src/test/resources/log4j2-test.xml
similarity index 100%
rename from camel-k-loader-kotlin/src/test/resources/log4j2-test.xml
rename to camel-k-loader-kotlin/camel-k-loader-kotlin/src/test/resources/log4j2-test.xml
diff --git a/camel-k-loader-kotlin/src/test/resources/routes-new.kts b/camel-k-loader-kotlin/camel-k-loader-kotlin/src/test/resources/routes-new.kts
similarity index 100%
copy from camel-k-loader-kotlin/src/test/resources/routes-new.kts
copy to camel-k-loader-kotlin/camel-k-loader-kotlin/src/test/resources/routes-new.kts
diff --git a/camel-k-loader-kotlin/src/test/resources/routes-with-beans.kts b/camel-k-loader-kotlin/camel-k-loader-kotlin/src/test/resources/routes-with-beans.kts
similarity index 100%
rename from camel-k-loader-kotlin/src/test/resources/routes-with-beans.kts
rename to camel-k-loader-kotlin/camel-k-loader-kotlin/src/test/resources/routes-with-beans.kts
diff --git a/camel-k-loader-kotlin/src/test/resources/routes-with-components-configuration-error.kts b/camel-k-loader-kotlin/camel-k-loader-kotlin/src/test/resources/routes-with-components-configuration-error.kts
similarity index 100%
rename from camel-k-loader-kotlin/src/test/resources/routes-with-components-configuration-error.kts
rename to camel-k-loader-kotlin/camel-k-loader-kotlin/src/test/resources/routes-with-components-configuration-error.kts
diff --git a/camel-k-loader-kotlin/src/test/resources/routes-with-components-configuration.kts b/camel-k-loader-kotlin/camel-k-loader-kotlin/src/test/resources/routes-with-components-configuration.kts
similarity index 100%
copy from camel-k-loader-kotlin/src/test/resources/routes-with-components-configuration.kts
copy to camel-k-loader-kotlin/camel-k-loader-kotlin/src/test/resources/routes-with-components-configuration.kts
diff --git a/camel-k-loader-kotlin/src/test/resources/routes-with-dataformats-configuration.kts b/camel-k-loader-kotlin/camel-k-loader-kotlin/src/test/resources/routes-with-dataformats-configuration.kts
similarity index 100%
rename from camel-k-loader-kotlin/src/test/resources/routes-with-dataformats-configuration.kts
rename to camel-k-loader-kotlin/camel-k-loader-kotlin/src/test/resources/routes-with-dataformats-configuration.kts
diff --git a/camel-k-loader-kotlin/src/test/resources/routes-with-endpoint-dsl.kts b/camel-k-loader-kotlin/camel-k-loader-kotlin/src/test/resources/routes-with-endpoint-dsl.kts
similarity index 100%
rename from camel-k-loader-kotlin/src/test/resources/routes-with-endpoint-dsl.kts
rename to camel-k-loader-kotlin/camel-k-loader-kotlin/src/test/resources/routes-with-endpoint-dsl.kts
diff --git a/camel-k-loader-kotlin/src/test/resources/routes-with-error-handler.kts b/camel-k-loader-kotlin/camel-k-loader-kotlin/src/test/resources/routes-with-error-handler.kts
similarity index 100%
rename from camel-k-loader-kotlin/src/test/resources/routes-with-error-handler.kts
rename to camel-k-loader-kotlin/camel-k-loader-kotlin/src/test/resources/routes-with-error-handler.kts
diff --git a/camel-k-loader-kotlin/src/test/resources/routes-with-languages-configuration.kts b/camel-k-loader-kotlin/camel-k-loader-kotlin/src/test/resources/routes-with-languages-configuration.kts
similarity index 100%
rename from camel-k-loader-kotlin/src/test/resources/routes-with-languages-configuration.kts
rename to camel-k-loader-kotlin/camel-k-loader-kotlin/src/test/resources/routes-with-languages-configuration.kts
diff --git a/camel-k-loader-kotlin/src/test/resources/routes-with-rest.kts b/camel-k-loader-kotlin/camel-k-loader-kotlin/src/test/resources/routes-with-rest.kts
similarity index 100%
rename from camel-k-loader-kotlin/src/test/resources/routes-with-rest.kts
rename to camel-k-loader-kotlin/camel-k-loader-kotlin/src/test/resources/routes-with-rest.kts
diff --git a/camel-k-loader-kotlin/src/test/resources/routes.kts b/camel-k-loader-kotlin/camel-k-loader-kotlin/src/test/resources/routes.kts
similarity index 100%
rename from camel-k-loader-kotlin/src/test/resources/routes.kts
rename to camel-k-loader-kotlin/camel-k-loader-kotlin/src/test/resources/routes.kts
diff --git a/camel-k-loader-kotlin/pom.xml b/camel-k-loader-kotlin/pom.xml
index ac889a3..5a6165e 100644
--- a/camel-k-loader-kotlin/pom.xml
+++ b/camel-k-loader-kotlin/pom.xml
@@ -25,191 +25,12 @@
</parent>
<modelVersion>4.0.0</modelVersion>
- <artifactId>camel-k-loader-kotlin</artifactId>
+ <packaging>pom</packaging>
+ <artifactId>camel-k-loader-kotlin-parent</artifactId>
- <dependencies>
- <dependency>
- <groupId>org.apache.camel.k</groupId>
- <artifactId>camel-k-runtime-core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-core-engine</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-endpointdsl</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-log</artifactId>
- <optional>true</optional>
- </dependency>
- <dependency>
- <groupId>org.jetbrains.kotlin</groupId>
- <artifactId>kotlin-stdlib-jdk8</artifactId>
- <version>${kotlin.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jetbrains.kotlin</groupId>
- <artifactId>kotlin-script-util</artifactId>
- <version>${kotlin.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jetbrains.kotlin</groupId>
- <artifactId>kotlin-scripting-jvm</artifactId>
- <version>${kotlin.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jetbrains.kotlin</groupId>
- <artifactId>kotlin-scripting-jvm-host</artifactId>
- <version>${kotlin.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jetbrains.kotlin</groupId>
- <artifactId>kotlin-scripting-compiler</artifactId>
- <version>${kotlin.version}</version>
- </dependency>
-
- <!-- ****************************** -->
- <!-- -->
- <!-- TESTS -->
- <!-- -->
- <!-- ****************************** -->
-
- <dependency>
- <groupId>org.apache.camel.k</groupId>
- <artifactId>camel-k-test</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-timer</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-seda</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-rest</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-direct</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-main</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-bean</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-jackson</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-dbcp2</artifactId>
- <version>${commons-dbcp2.version}</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.jetbrains.kotlin</groupId>
- <artifactId>kotlin-maven-plugin</artifactId>
- <version>${kotlin.version}</version>
- <configuration>
- <jvmTarget>${maven.compiler.target}</jvmTarget>
- </configuration>
- <executions>
- <execution>
- <id>compile</id>
- <goals>
- <goal>compile</goal>
- </goals>
- <configuration>
- <jvmTarget>${kotlin.compiler.target}</jvmTarget>
- <sourceDirs>
- <sourceDir>src/main/kotlin</sourceDir>
- </sourceDirs>
- </configuration>
- </execution>
- <execution>
- <id>test-compile</id>
- <goals>
- <goal>test-compile</goal>
- </goals>
- <configuration>
- <jvmTarget>${kotlin.compiler.target}</jvmTarget>
- <sourceDirs>
- <sourceDir>src/test/kotlin</sourceDir>
- </sourceDirs>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <executions>
- <!-- Replacing default-compile as it is treated specially by maven -->
- <execution>
- <id>default-compile</id>
- <phase>none</phase>
- </execution>
- <!-- Replacing default-testCompile as it is treated specially by maven -->
- <execution>
- <id>default-testCompile</id>
- <phase>none</phase>
- </execution>
- <execution>
- <id>java-compile</id>
- <phase>compile</phase>
- <goals> <goal>compile</goal> </goals>
- </execution>
- <execution>
- <id>java-test-compile</id>
- <phase>test-compile</phase>
- <goals> <goal>testCompile</goal> </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <forkCount>1</forkCount>
- <reuseForks>false</reuseForks>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.jboss.jandex</groupId>
- <artifactId>jandex-maven-plugin</artifactId>
- <executions>
- <execution>
- <id>make-index</id>
- <goals>
- <goal>jandex</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
+ <modules>
+ <module>camel-k-loader-kotlin</module>
+ <module>camel-k-loader-kotlin-itests</module>
+ </modules>
</project>
diff --git a/camel-k-loader-kotlin/src/main/kotlin/org/apache/camel/k/loader/kotlin/KotlinSourceLoader.kt b/camel-k-loader-kotlin/src/main/kotlin/org/apache/camel/k/loader/kotlin/KotlinSourceLoader.kt
deleted file mode 100644
index afe6d42..0000000
--- a/camel-k-loader-kotlin/src/main/kotlin/org/apache/camel/k/loader/kotlin/KotlinSourceLoader.kt
+++ /dev/null
@@ -1,104 +0,0 @@
-/**
- * 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.k.loader.kotlin
-
-import org.apache.camel.RuntimeCamelException
-import org.apache.camel.builder.endpoint.EndpointRouteBuilder
-import org.apache.camel.k.Runtime
-import org.apache.camel.k.Source
-import org.apache.camel.k.SourceLoader
-import org.apache.camel.k.loader.kotlin.dsl.IntegrationConfiguration
-import org.slf4j.Logger
-import org.slf4j.LoggerFactory
-import java.io.InputStream
-import java.io.InputStreamReader
-import kotlin.script.experimental.api.ResultValue
-import kotlin.script.experimental.api.ScriptDiagnostic
-import kotlin.script.experimental.api.ScriptEvaluationConfiguration
-import kotlin.script.experimental.api.constructorArgs
-import kotlin.script.experimental.api.valueOrNull
-import kotlin.script.experimental.host.toScriptSource
-import kotlin.script.experimental.jvm.BasicJvmScriptEvaluator
-import kotlin.script.experimental.jvmhost.BasicJvmScriptingHost
-import kotlin.script.experimental.jvmhost.JvmScriptCompiler
-import kotlin.script.experimental.jvmhost.createJvmCompilationConfigurationFromTemplate
-
-class KotlinSourceLoader : SourceLoader {
- companion object {
- private val LOGGER : Logger = LoggerFactory.getLogger(KotlinSourceLoader::class.java)
-
- @JvmStatic
- fun load(inputStream: InputStream): EndpointRouteBuilder {
- return object : EndpointRouteBuilder() {
- @Throws(Exception::class)
- override fun configure() {
- load(inputStream, this)
- }
- }
- }
-
- @JvmStatic
- fun load(inputStream: InputStream, builder: EndpointRouteBuilder) {
- val compiler = JvmScriptCompiler()
- val evaluator = BasicJvmScriptEvaluator()
- val host = BasicJvmScriptingHost(compiler = compiler, evaluator = evaluator)
- val config = createJvmCompilationConfigurationFromTemplate<IntegrationConfiguration>()
-
- val result = host.eval(
- InputStreamReader(inputStream).readText().toScriptSource(),
- config,
- ScriptEvaluationConfiguration {
- //
- // Arguments used to initialize the script base class
- //
- constructorArgs(builder)
- }
- )
-
- // ensure that evaluation errors propagation
- when(val rv = result.valueOrNull()?.returnValue) {
- is ResultValue.Error -> throw RuntimeCamelException(rv.error)
- }
-
- for (report in result.reports) {
- when (report.severity) {
- ScriptDiagnostic.Severity.FATAL -> LOGGER.error("{}", report.message, report.exception)
- ScriptDiagnostic.Severity.ERROR -> LOGGER.error("{}", report.message, report.exception)
- ScriptDiagnostic.Severity.WARNING -> LOGGER.warn("{}", report.message, report.exception)
- ScriptDiagnostic.Severity.INFO -> LOGGER.info("{}", report.message)
- ScriptDiagnostic.Severity.DEBUG -> LOGGER.debug("{}", report.message)
- }
- }
- }
- }
-
- override fun getSupportedLanguages(): List<String> {
- return listOf("kts")
- }
-
- @Throws(Exception::class)
- override fun load(runtime: Runtime, source: Source): SourceLoader.Result {
- return SourceLoader.Result.on(object : EndpointRouteBuilder() {
- @Throws(Exception::class)
- override fun configure() {
- source.resolveAsInputStream(runtime.camelContext).use {
- load(it, this)
- }
- }
- })
- }
-}
diff --git a/camel-k-main/camel-k-runtime-main/pom.xml b/camel-k-main/camel-k-runtime-main/pom.xml
index 7673ce5..0c69aeb 100644
--- a/camel-k-main/camel-k-runtime-main/pom.xml
+++ b/camel-k-main/camel-k-runtime-main/pom.xml
@@ -117,11 +117,6 @@
<artifactId>camel-direct</artifactId>
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-endpointdsl</artifactId>
- <scope>test</scope>
- </dependency>
<dependency>
<groupId>org.apache.camel.k</groupId>
diff --git a/camel-k-quarkus/camel-k-quarkus-core/deployment/pom.xml b/camel-k-quarkus/camel-k-quarkus-core/deployment/pom.xml
index 2a824a7..e7f221b 100644
--- a/camel-k-quarkus/camel-k-quarkus-core/deployment/pom.xml
+++ b/camel-k-quarkus/camel-k-quarkus-core/deployment/pom.xml
@@ -36,6 +36,10 @@
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-core-deployment</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-endpointdsl-deployment</artifactId>
+ </dependency>
</dependencies>
<build>
diff --git a/camel-k-quarkus/camel-k-quarkus-core/runtime/pom.xml b/camel-k-quarkus/camel-k-quarkus-core/runtime/pom.xml
index fcfef66..d645474 100644
--- a/camel-k-quarkus/camel-k-quarkus-core/runtime/pom.xml
+++ b/camel-k-quarkus/camel-k-quarkus-core/runtime/pom.xml
@@ -45,6 +45,11 @@
<artifactId>camel-quarkus-core</artifactId>
</dependency>
<dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-endpointdsl</artifactId>
+ </dependency>
+
+ <dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-development-mode-spi</artifactId>
<version>${quarkus.version}</version>
diff --git a/camel-k-quarkus/camel-k-quarkus-loader-groovy/runtime/pom.xml b/camel-k-quarkus/camel-k-quarkus-loader-groovy/runtime/pom.xml
index 8629f01..7a421e0 100644
--- a/camel-k-quarkus/camel-k-quarkus-loader-groovy/runtime/pom.xml
+++ b/camel-k-quarkus/camel-k-quarkus-loader-groovy/runtime/pom.xml
@@ -38,10 +38,6 @@
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-endpointdsl</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
<artifactId>camel-groovy</artifactId>
<exclusions>
<exclusion>
diff --git a/camel-k-quarkus/camel-k-quarkus-loader-java/runtime/pom.xml b/camel-k-quarkus/camel-k-quarkus-loader-java/runtime/pom.xml
index 4539249..20abf98 100644
--- a/camel-k-quarkus/camel-k-quarkus-loader-java/runtime/pom.xml
+++ b/camel-k-quarkus/camel-k-quarkus-loader-java/runtime/pom.xml
@@ -36,10 +36,6 @@
<groupId>org.apache.camel.k</groupId>
<artifactId>camel-k-loader-java</artifactId>
</dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-endpointdsl</artifactId>
- </dependency>
</dependencies>
<build>
diff --git a/camel-k-quarkus/camel-k-quarkus-loader-js/runtime/pom.xml b/camel-k-quarkus/camel-k-quarkus-loader-js/runtime/pom.xml
index fd231c2..6357ed1 100644
--- a/camel-k-quarkus/camel-k-quarkus-loader-js/runtime/pom.xml
+++ b/camel-k-quarkus/camel-k-quarkus-loader-js/runtime/pom.xml
@@ -31,10 +31,6 @@
<dependency>
<groupId>org.apache.camel.k</groupId>
<artifactId>camel-k-quarkus-core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-endpointdsl</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel.k</groupId>
diff --git a/camel-k-quarkus/camel-k-quarkus-loader-kotlin/deployment/pom.xml b/camel-k-quarkus/camel-k-quarkus-loader-kotlin/deployment/pom.xml
index ca11a40..a8d9233 100644
--- a/camel-k-quarkus/camel-k-quarkus-loader-kotlin/deployment/pom.xml
+++ b/camel-k-quarkus/camel-k-quarkus-loader-kotlin/deployment/pom.xml
@@ -30,11 +30,16 @@
<dependencies>
<dependency>
<groupId>org.apache.camel.k</groupId>
- <artifactId>camel-k-quarkus-loader-kotlin</artifactId>
+ <artifactId>camel-k-quarkus-core-deployment</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel.k</groupId>
- <artifactId>camel-k-quarkus-core-deployment</artifactId>
+ <artifactId>camel-k-quarkus-loader-kotlin</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-kotlin-deployment</artifactId>
</dependency>
</dependencies>
diff --git a/camel-k-quarkus/camel-k-quarkus-loader-kotlin/runtime/pom.xml b/camel-k-quarkus/camel-k-quarkus-loader-kotlin/runtime/pom.xml
index 3b276fd..3d14414 100644
--- a/camel-k-quarkus/camel-k-quarkus-loader-kotlin/runtime/pom.xml
+++ b/camel-k-quarkus/camel-k-quarkus-loader-kotlin/runtime/pom.xml
@@ -30,15 +30,16 @@
<dependencies>
<dependency>
<groupId>org.apache.camel.k</groupId>
- <artifactId>camel-k-quarkus-core</artifactId>
+ <artifactId>camel-k-loader-kotlin</artifactId>
</dependency>
+
<dependency>
<groupId>org.apache.camel.k</groupId>
- <artifactId>camel-k-loader-kotlin</artifactId>
+ <artifactId>camel-k-quarkus-core</artifactId>
</dependency>
<dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-endpointdsl</artifactId>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-kotlin</artifactId>
</dependency>
</dependencies>
diff --git a/camel-k-runtime-core/pom.xml b/camel-k-runtime-core/pom.xml
index 544846c..2fc614d 100644
--- a/camel-k-runtime-core/pom.xml
+++ b/camel-k-runtime-core/pom.xml
@@ -43,6 +43,10 @@
<groupId>org.apache.camel</groupId>
<artifactId>camel-core-languages</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-endpointdsl</artifactId>
+ </dependency>
<!-- ****************************** -->
<!-- -->
diff --git a/camel-k-loader-kotlin/src/test/resources/routes-with-components-configuration.kts b/camel-k-runtime-core/src/main/java/org/apache/camel/k/support/RouteBuilders.java
similarity index 55%
rename from camel-k-loader-kotlin/src/test/resources/routes-with-components-configuration.kts
rename to camel-k-runtime-core/src/main/java/org/apache/camel/k/support/RouteBuilders.java
index 3fdf39c..261eb99 100644
--- a/camel-k-loader-kotlin/src/test/resources/routes-with-components-configuration.kts
+++ b/camel-k-runtime-core/src/main/java/org/apache/camel/k/support/RouteBuilders.java
@@ -14,29 +14,26 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-import org.apache.camel.Exchange
-import org.apache.camel.component.log.LogComponent
-import org.apache.camel.component.seda.SedaComponent
+package org.apache.camel.k.support;
-camel {
- components {
- component<LogComponent>("log") {
- setExchangeFormatter {
- e: Exchange -> "" + e.getIn().body
- }
- }
+import java.io.InputStream;
+import java.util.function.BiConsumer;
- component<SedaComponent>("seda") {
- queueSize = 1234
- concurrentConsumers = 12
- }
+import org.apache.camel.builder.endpoint.EndpointRouteBuilder;
+import org.apache.camel.k.Source;
- component<SedaComponent>("mySeda") {
- queueSize = 4321
- concurrentConsumers = 21
- }
+public final class RouteBuilders {
+ private RouteBuilders() {
}
-}
-from("timer:tick")
- .to("log:info")
\ No newline at end of file
+ public static EndpointRouteBuilder endpoint(Source source, BiConsumer<InputStream, EndpointRouteBuilder> consumer) {
+ return new EndpointRouteBuilder() {
+ @Override
+ public void configure() throws Exception {
+ try (InputStream is = source.resolveAsInputStream(getContext())) {
+ consumer.accept(is, this);
+ }
+ }
+ };
+ };
+}
diff --git a/examples/camel-k-runtime-example-quarkus-kotlin/data/application.properties b/examples/camel-k-runtime-example-quarkus-kotlin/data/application.properties
new file mode 100644
index 0000000..b3c7007
--- /dev/null
+++ b/examples/camel-k-runtime-example-quarkus-kotlin/data/application.properties
@@ -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.
+## ---------------------------------------------------------------------------
+
+#
+# Quarkus
+#
+quarkus.banner.enabled = false
+
+#
+# camel - main
+#
+camel.main.name = camel-q
+camel.main.stream-caching-enabled = true
+camel.main.stream-caching-spool-directory = ${java.io.tmpdir}/camel-q
+
+#
+# Integration
+#
+message = test-xs
+
diff --git a/camel-k-loader-kotlin/src/test/resources/routes-new.kts b/examples/camel-k-runtime-example-quarkus-kotlin/data/routes.kts
similarity index 92%
rename from camel-k-loader-kotlin/src/test/resources/routes-new.kts
rename to examples/camel-k-runtime-example-quarkus-kotlin/data/routes.kts
index 7f8b923..489ddfc 100644
--- a/camel-k-loader-kotlin/src/test/resources/routes-new.kts
+++ b/examples/camel-k-runtime-example-quarkus-kotlin/data/routes.kts
@@ -14,4 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-println("test")
\ No newline at end of file
+
+from("timer:tick")
+ .routeId("kotlin")
+ .to("log:kotlin")
diff --git a/camel-k-quarkus/camel-k-quarkus-core/runtime/pom.xml b/examples/camel-k-runtime-example-quarkus-kotlin/pom.xml
similarity index 52%
copy from camel-k-quarkus/camel-k-quarkus-core/runtime/pom.xml
copy to examples/camel-k-runtime-example-quarkus-kotlin/pom.xml
index fcfef66..c10b8a8 100644
--- a/camel-k-quarkus/camel-k-quarkus-core/runtime/pom.xml
+++ b/examples/camel-k-runtime-example-quarkus-kotlin/pom.xml
@@ -18,36 +18,50 @@
-->
<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">
+
<parent>
<groupId>org.apache.camel.k</groupId>
- <artifactId>camel-k-quarkus-core-parent</artifactId>
+ <artifactId>camel-k-runtime-examples</artifactId>
<version>1.5.0-SNAPSHOT</version>
</parent>
+
<modelVersion>4.0.0</modelVersion>
+ <artifactId>camel-k-runtime-example-quarkus-kotlin</artifactId>
+
+ <properties>
+ <noDeps>true</noDeps>
+ <quarkus.camel.routes-discovery.enabled>false</quarkus.camel.routes-discovery.enabled>
+ </properties>
- <artifactId>camel-k-quarkus-core</artifactId>
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-bom</artifactId>
+ <version>${camel-quarkus.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
<dependencies>
<dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-support</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-core-engine</artifactId>
+ <groupId>org.apache.camel.k</groupId>
+ <artifactId>camel-k-runtime-quarkus</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel.k</groupId>
- <artifactId>camel-k-runtime-core</artifactId>
+ <artifactId>camel-k-quarkus-loader-kotlin</artifactId>
</dependency>
+
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
- <artifactId>camel-quarkus-core</artifactId>
+ <artifactId>camel-quarkus-log</artifactId>
</dependency>
<dependency>
- <groupId>io.quarkus</groupId>
- <artifactId>quarkus-development-mode-spi</artifactId>
- <version>${quarkus.version}</version>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-timer</artifactId>
</dependency>
</dependencies>
@@ -57,41 +71,46 @@
<groupId>io.quarkus</groupId>
<artifactId>quarkus-bootstrap-maven-plugin</artifactId>
<version>${quarkus.version}</version>
+ </plugin>
+ <plugin>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-maven-plugin</artifactId>
+ <version>${quarkus.version}</version>
<executions>
<execution>
+ <id>build</id>
<goals>
- <goal>extension-descriptor</goal>
+ <goal>build</goal>
</goals>
<configuration>
- <deployment>${project.groupId}:${project.artifactId}-deployment:${project.version}</deployment>
+ <finalName>${project.artifactId}</finalName>
</configuration>
</execution>
</executions>
</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>
- <plugin>
- <groupId>org.jboss.jandex</groupId>
- <artifactId>jandex-maven-plugin</artifactId>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>exec-maven-plugin</artifactId>
+ <version>${exec-maven-plugin.version}</version>
<executions>
<execution>
- <id>make-index</id>
<goals>
- <goal>jandex</goal>
+ <goal>exec</goal>
</goals>
</execution>
</executions>
+ <configuration>
+ <executable>java</executable>
+ <workingDirectory>${project.basedir}</workingDirectory>
+ <arguments>
+ <argument>-jar</argument>
+ <argument>${project.build.directory}/${project.artifactId}-runner.jar</argument>
+ </arguments>
+ <environmentVariables>
+ <CAMEL_K_CONF>${project.basedir}/data/application.properties</CAMEL_K_CONF>
+ <CAMEL_K_ROUTES>file:${project.basedir}/data/routes.kts</CAMEL_K_ROUTES>
+ </environmentVariables>
+ </configuration>
</plugin>
</plugins>
</build>
diff --git a/examples/camel-k-runtime-example-quarkus-kotlin/src/main/resources/application.properties b/examples/camel-k-runtime-example-quarkus-kotlin/src/main/resources/application.properties
new file mode 100644
index 0000000..1ba4656
--- /dev/null
+++ b/examples/camel-k-runtime-example-quarkus-kotlin/src/main/resources/application.properties
@@ -0,0 +1,20 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+
+#
+# empty file to avoid build warning
+#
\ No newline at end of file
diff --git a/examples/pom.xml b/examples/pom.xml
index c6f1848..6151d87 100644
--- a/examples/pom.xml
+++ b/examples/pom.xml
@@ -41,6 +41,7 @@
<module>camel-k-runtime-example-quarkus-js</module>
<module>camel-k-runtime-example-quarkus-yaml</module>
<module>camel-k-runtime-example-quarkus-knative</module>
+ <module>camel-k-runtime-example-quarkus-kotlin</module>
<module>camel-k-runtime-example-quarkus-groovy</module>
<module>camel-k-runtime-example-quarkus-java</module>
<module>camel-k-runtime-example-quarkus-xml</module>