You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2022/04/05 06:43:50 UTC
[camel-spring-boot] branch main updated: [CAMEL-17878] - add tests in camel-kamelet-starter. (#500)
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-spring-boot.git
The following commit(s) were added to refs/heads/main by this push:
new 5856845efc1 [CAMEL-17878] - add tests in camel-kamelet-starter. (#500)
5856845efc1 is described below
commit 5856845efc18ae065c58412dfa324b7a9484cb9a
Author: Vaishnavi R <66...@users.noreply.github.com>
AuthorDate: Tue Apr 5 12:13:45 2022 +0530
[CAMEL-17878] - add tests in camel-kamelet-starter. (#500)
Updated the pom.xml file.
---
components-starter/camel-kamelet-starter/pom.xml | 82 ++++++++
.../kamelet/springboot/KameletBasicTest.java | 117 ++++++++++++
.../kamelet/springboot/KameletComponentTest.java | 73 +++++++
.../kamelet/springboot/KameletConsumeOnlyTest.java | 73 +++++++
.../springboot/KameletConsumerUoWIssueTest.java | 100 ++++++++++
.../kamelet/springboot/KameletDiscoveryTest.java | 121 ++++++++++++
.../springboot/KameletEipAggregateGroovyTest.java | 98 ++++++++++
.../springboot/KameletEipAggregateJoorTest.java | 101 ++++++++++
.../springboot/KameletEipAggregateTest.java | 92 +++++++++
.../kamelet/springboot/KameletEipFilterTest.java | 85 +++++++++
.../springboot/KameletEipMulticastTest.java | 148 ++++++++++++++
.../springboot/KameletEipNoChildrenTest.java | 78 ++++++++
.../kamelet/springboot/KameletEipTest.java | 92 +++++++++
.../springboot/KameletGlobalPropertiesTest.java | 212 +++++++++++++++++++++
.../springboot/KameletLocalBeanClassFourTest.java | 104 ++++++++++
.../springboot/KameletLocalBeanClassTest.java | 92 +++++++++
.../springboot/KameletLocalBeanClassThreeTest.java | 104 ++++++++++
.../springboot/KameletLocalBeanClassTwoTest.java | 92 +++++++++
.../springboot/KameletLocalBeanConfigureTest.java | 116 +++++++++++
.../KameletLocalBeanGroovyExternalTest.java | 100 ++++++++++
.../springboot/KameletLocalBeanGroovyTest.java | 86 +++++++++
.../springboot/KameletLocalBeanIoCTest.java | 101 ++++++++++
.../KameletLocalBeanJoorExternalTest.java | 103 ++++++++++
.../springboot/KameletLocalBeanLanguageTest.java | 121 ++++++++++++
.../springboot/KameletLocalBeanSupplierTest.java | 108 +++++++++++
.../kamelet/springboot/KameletLocalBeanTest.java | 112 +++++++++++
.../springboot/KameletLocalBeanTypeTest.java | 102 ++++++++++
.../kamelet/springboot/KameletLocationTest.java | 145 ++++++++++++++
.../springboot/KameletRecipientListTest.java | 91 +++++++++
.../kamelet/springboot/KameletRouteDumpTest.java | 88 +++++++++
.../kamelet/springboot/KameletRouteTest.java | 112 +++++++++++
.../kamelet/springboot/KameletToDTest.java | 91 +++++++++
.../kamelet/springboot/KameletUoWIssueTest.java | 98 ++++++++++
.../kamelet/springboot/KameletValidationTest.java | 69 +++++++
.../kamelet/springboot/KameletWireTapTest.java | 91 +++++++++
.../component/kamelet/springboot/MyInjectBar.java | 37 ++++
.../src/test/resources/kamelet.test.properties | 26 +++
.../src/test/resources/log4j2.properties | 34 ++++
.../src/test/resources/mybar.groovy | 22 +++
.../src/test/resources/mybar.joor | 4 +
.../src/test/resources/upper-kamelet.xml | 23 +++
41 files changed, 3744 insertions(+)
diff --git a/components-starter/camel-kamelet-starter/pom.xml b/components-starter/camel-kamelet-starter/pom.xml
index e81817e18df..07533e9788b 100644
--- a/components-starter/camel-kamelet-starter/pom.xml
+++ b/components-starter/camel-kamelet-starter/pom.xml
@@ -38,6 +38,88 @@
<artifactId>camel-kamelet</artifactId>
<version>${camel-version}</version>
</dependency>
+ <!-- Testing dependencies -->
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-xml-jaxb</artifactId>
+ <version>${camel-version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-groovy</artifactId>
+ <version>${camel-version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-joor</artifactId>
+ <version>${camel-version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-timer</artifactId>
+ <version>${camel-version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-log</artifactId>
+ <version>${camel-version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-mock</artifactId>
+ <version>${camel-version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-direct</artifactId>
+ <version>${camel-version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-test-spring-junit5</artifactId>
+ <version>${camel-version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-http</artifactId>
+ <version>${camel-version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-main</artifactId>
+ <version>${camel-version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.assertj</groupId>
+ <artifactId>assertj-core</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-slf4j-impl</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.awaitility</groupId>
+ <artifactId>awaitility</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-test</artifactId>
+ <version>${spring-boot-version}</version>
+ <scope>test</scope>
+ </dependency>
<!--START OF GENERATED CODE-->
<dependency>
<groupId>org.apache.camel.springboot</groupId>
diff --git a/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletBasicTest.java b/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletBasicTest.java
new file mode 100644
index 00000000000..2ea386c5de6
--- /dev/null
+++ b/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletBasicTest.java
@@ -0,0 +1,117 @@
+/*
+ * 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.component.kamelet.springboot;
+
+import java.util.UUID;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.Exchange;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.jupiter.api.Test;
+import org.apache.camel.spring.boot.CamelAutoConfiguration;
+import org.apache.camel.FluentProducerTemplate;
+import org.apache.camel.ConsumerTemplate;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.annotation.Bean;
+import org.springframework.test.annotation.DirtiesContext;
+import org.apache.camel.test.spring.junit5.CamelSpringBootTest;
+
+
+@DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD)
+@CamelSpringBootTest
+@SpringBootTest(
+ classes = {
+ CamelAutoConfiguration.class,
+ KameletBasicTest.class,
+ }
+)
+
+public class KameletBasicTest {
+
+ @Autowired
+ private CamelContext context;
+
+ @Autowired
+ FluentProducerTemplate fluentTemplate;
+
+ @Autowired
+ ConsumerTemplate consumer;
+
+ @Test
+ public void canProduceToKamelet() {
+ String body = UUID.randomUUID().toString();
+
+ assertThat(
+ fluentTemplate.toF("kamelet:setBody/test?bodyValue=%s", body).request(String.class)).isEqualTo(body);
+ }
+
+ @Test
+ public void canConsumeFromKamelet() {
+ assertThat(
+ consumer.receiveBody("kamelet:tick", Integer.class)).isEqualTo(1);
+ }
+
+ @Test
+ public void kameletCanBeCreatedWhileContextIsStarting() {
+ assertThat(
+ fluentTemplate.to("direct:templateEmbedded").request(String.class)).isEqualTo("embedded");
+ }
+
+ @Test
+ public void kameletCanBeCreatedAfterContextIsStarted() throws Exception {
+ String body = UUID.randomUUID().toString();
+
+ RouteBuilder.addRoutes(context, b -> {
+ b.from("direct:templateAfter")
+ .toF("kamelet:setBody/test?bodyValue=%s", body);
+ });
+
+ assertThat(
+ fluentTemplate.to("direct:templateAfter").request(String.class)).isEqualTo(body);
+ }
+
+ // **********************************************
+ //
+ // test set-up
+ //
+ // **********************************************
+ @Bean
+ protected RoutesBuilder createRouteBuilder() {
+ return new RouteBuilder() {
+ @Override
+ public void configure() {
+ routeTemplate("setBody")
+ .templateParameter("bodyValue")
+ .from("kamelet:source")
+ .setBody().constant("{{bodyValue}}");
+
+ routeTemplate("tick")
+ .from("timer:{{routeId}}?repeatCount=1&delay=-1")
+ .setBody().exchangeProperty(Exchange.TIMER_COUNTER)
+ .to("kamelet:sink");
+
+ from("direct:templateEmbedded")
+ .toF("kamelet:setBody/embedded?bodyValue=embedded");
+ }
+ };
+ }
+}
\ No newline at end of file
diff --git a/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletComponentTest.java b/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletComponentTest.java
new file mode 100644
index 00000000000..15340748563
--- /dev/null
+++ b/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletComponentTest.java
@@ -0,0 +1,73 @@
+/*
+ * 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.component.kamelet.springboot;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.component.kamelet.Kamelet;
+import org.apache.camel.component.kamelet.KameletComponent;
+import org.apache.camel.support.PropertyBindingSupport;
+import org.junit.jupiter.api.Test;
+import org.apache.camel.spring.boot.CamelAutoConfiguration;
+
+import static org.apache.camel.util.CollectionHelper.mapOf;
+import static org.assertj.core.api.Assertions.assertThat;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.annotation.DirtiesContext;
+import org.apache.camel.test.spring.junit5.CamelSpringBootTest;
+
+
+@DirtiesContext
+@CamelSpringBootTest
+@SpringBootTest(
+ classes = {
+ CamelAutoConfiguration.class,
+ KameletComponentTest.class,
+ }
+)
+
+
+public class KameletComponentTest {
+
+ @Autowired
+ private CamelContext context;
+
+ @Test
+ public void testComponent() {
+ KameletComponent component = context.getComponent(Kamelet.SCHEME, KameletComponent.class);
+
+ PropertyBindingSupport.build()
+ .withIgnoreCase(true)
+ .withReflection(false)
+ .withRemoveParameters(false)
+ .withCamelContext(context)
+ .withTarget(component)
+ .withConfigurer(component.getComponentPropertyConfigurer())
+ .withProperties(mapOf(
+ "template-properties[myTemplate].foo", "bar",
+ "route-properties[myRoute].foo", "baz"))
+ .bind();
+
+ assertThat(component.getTemplateProperties()).isNotEmpty();
+ assertThat(component.getTemplateProperties()).containsKey("myTemplate");
+ assertThat(component.getTemplateProperties().get("myTemplate")).containsEntry("foo", "bar");
+ assertThat(component.getRouteProperties()).isNotEmpty();
+ assertThat(component.getRouteProperties()).containsKey("myRoute");
+ assertThat(component.getRouteProperties().get("myRoute")).containsEntry("foo", "baz");
+ }
+}
\ No newline at end of file
diff --git a/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletConsumeOnlyTest.java b/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletConsumeOnlyTest.java
new file mode 100644
index 00000000000..4d9cee3d07d
--- /dev/null
+++ b/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletConsumeOnlyTest.java
@@ -0,0 +1,73 @@
+/*
+ * 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.component.kamelet.springboot;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.jupiter.api.Test;
+import org.apache.camel.ConsumerTemplate;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Bean;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.annotation.DirtiesContext;
+import org.apache.camel.test.spring.junit5.CamelSpringBootTest;
+import org.apache.camel.spring.boot.CamelAutoConfiguration;
+
+
+@DirtiesContext
+@CamelSpringBootTest
+@SpringBootTest(
+ classes = {
+ CamelAutoConfiguration.class,
+ KameletConsumeOnlyTest.class,
+ }
+)
+
+public class KameletConsumeOnlyTest {
+
+ @Autowired
+ ConsumerTemplate consumer;
+
+ @Test
+ public void canConsumeFromKamelet() {
+ assertThat(
+ consumer.receiveBody("kamelet:tick", Integer.class)).isEqualTo(1);
+ }
+
+ // **********************************************
+ //
+ // test set-up
+ //
+ // **********************************************
+
+ @Bean
+ protected RoutesBuilder createRouteBuilder() {
+ return new RouteBuilder() {
+ @Override
+ public void configure() {
+ routeTemplate("tick")
+ .from("timer:{{routeId}}?repeatCount=1&delay=-1")
+ .setBody().exchangeProperty(Exchange.TIMER_COUNTER)
+ .to("kamelet:sink");
+ }
+ };
+ }
+}
\ No newline at end of file
diff --git a/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletConsumerUoWIssueTest.java b/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletConsumerUoWIssueTest.java
new file mode 100644
index 00000000000..5ee5202fa96
--- /dev/null
+++ b/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletConsumerUoWIssueTest.java
@@ -0,0 +1,100 @@
+/*
+ * 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.component.kamelet.springboot;
+
+import org.apache.camel.EndpointInject;
+import org.apache.camel.Exchange;
+import org.apache.camel.ExtendedExchange;
+import org.apache.camel.Processor;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.support.SynchronizationAdapter;
+import org.junit.jupiter.api.Test;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.CamelContext;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Bean;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.annotation.DirtiesContext;
+import org.apache.camel.test.spring.junit5.CamelSpringBootTest;
+import org.apache.camel.spring.boot.CamelAutoConfiguration;
+
+
+@DirtiesContext
+@CamelSpringBootTest
+@SpringBootTest(
+ classes = {
+ CamelAutoConfiguration.class,
+ KameletConsumerUoWIssueTest.class,
+ }
+)
+
+public class KameletConsumerUoWIssueTest {
+
+ @Autowired
+ ProducerTemplate template;
+
+ @EndpointInject("mock:foo")
+ MockEndpoint mock;
+
+ @Autowired
+ private CamelContext context;
+
+ @Test
+ public void testUoW() throws Exception {
+ mock.expectedBodiesReceived("1", "Done");
+
+ context.getRouteController().startAllRoutes();
+
+ mock.assertIsSatisfied();
+ }
+
+ // **********************************************
+ //
+ // test set-up
+ //
+ // **********************************************
+
+ @Bean
+ protected RoutesBuilder createRouteBuilder() {
+ return new RouteBuilder() {
+ @Override
+ public void configure() {
+ routeTemplate("tick")
+ .from("timer:tick?repeatCount=1&delay=-1")
+ .setBody().exchangeProperty(Exchange.TIMER_COUNTER)
+ .process(new Processor() {
+ @Override
+ public void process(Exchange exchange) {
+ exchange.adapt(ExtendedExchange.class).addOnCompletion(new SynchronizationAdapter() {
+ @Override
+ public void onDone(Exchange exchange) {
+ super.onDone(exchange);
+ template.sendBody("mock:foo", "Done");
+ }
+ });
+ }
+ }).to("kamelet:sink");
+
+ from("kamelet:tick").noAutoStartup().routeId("tick")
+ .to("mock:foo");
+ }
+ };
+ }
+}
\ No newline at end of file
diff --git a/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletDiscoveryTest.java b/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletDiscoveryTest.java
new file mode 100644
index 00000000000..abc934387d8
--- /dev/null
+++ b/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletDiscoveryTest.java
@@ -0,0 +1,121 @@
+/*
+ * 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.component.kamelet.springboot;
+
+import org.apache.camel.FailedToCreateRouteException;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.impl.engine.DefaultRoutesLoader;
+import org.apache.camel.spi.Resource;
+import org.apache.camel.support.RoutesBuilderLoaderSupport;
+import org.junit.jupiter.api.Test;
+import org.apache.camel.CamelContext;
+import org.apache.camel.FluentProducerTemplate;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Bean;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.annotation.DirtiesContext;
+import org.apache.camel.test.spring.junit5.CamelSpringBootTest;
+import org.apache.camel.spring.boot.CamelAutoConfiguration;
+
+
+@DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD)
+@CamelSpringBootTest
+@SpringBootTest(
+ classes = {
+ CamelAutoConfiguration.class,
+ KameletDiscoveryTest.class,
+ }
+)
+
+public class KameletDiscoveryTest {
+
+ @Autowired
+ private CamelContext context;
+
+ @Autowired
+ FluentProducerTemplate fluentTemplate;
+
+ @Test
+ public void kameletCanBeDiscovered() throws Exception {
+ context.getRegistry().bind(
+ DefaultRoutesLoader.ROUTES_LOADER_KEY_PREFIX + "kamelet.yaml",
+ new RoutesBuilderLoaderSupport() {
+ @Override
+ public String getSupportedExtension() {
+ return "kamelet.yaml";
+ }
+
+ @Override
+ public RoutesBuilder loadRoutesBuilder(Resource resource) {
+ return new RouteBuilder() {
+ @Override
+ public void configure() {
+ routeTemplate("mySetBody")
+ .from("kamelet:source")
+ .setBody().constant("discovered");
+
+ }
+ };
+ }
+ });
+ context.addRoutes(new RouteBuilder() {
+ @Override
+ public void configure() {
+ from("direct:discovery")
+ .toF("kamelet:mySetBody");
+ }
+ });
+
+ assertThat(fluentTemplate.to("direct:discovery").request(String.class)).isEqualTo("discovered");
+ }
+
+ @Test
+ public void kameletNotFound() {
+ context.getRegistry().bind(
+ DefaultRoutesLoader.ROUTES_LOADER_KEY_PREFIX + "kamelet.yaml",
+ new RoutesBuilderLoaderSupport() {
+ @Override
+ public String getSupportedExtension() {
+ return "kamelet.yaml";
+ }
+ @Bean
+ public RoutesBuilder loadRoutesBuilder(Resource resource) {
+ return new RouteBuilder() {
+ @Override
+ public void configure() {
+ }
+ };
+ }
+ });
+ RouteBuilder builder = new RouteBuilder() {
+ @Override
+ public void configure() {
+ from("direct:discovery")
+ .toF("kamelet:mySetBody");
+ }
+ };
+
+ assertThatThrownBy(() -> context.addRoutes(builder))
+ .isInstanceOf(FailedToCreateRouteException.class)
+ .hasRootCauseMessage("Cannot find RouteTemplate with id mySetBody");
+ }
+}
\ No newline at end of file
diff --git a/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletEipAggregateGroovyTest.java b/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletEipAggregateGroovyTest.java
new file mode 100644
index 00000000000..d867cde6161
--- /dev/null
+++ b/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletEipAggregateGroovyTest.java
@@ -0,0 +1,98 @@
+/*
+ * 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.component.kamelet.springboot;
+
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.jupiter.api.Test;
+import org.apache.camel.spring.boot.CamelAutoConfiguration;
+import org.apache.camel.EndpointInject;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.component.mock.MockEndpoint;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.annotation.Bean;
+import org.springframework.test.annotation.DirtiesContext;
+import org.apache.camel.test.spring.junit5.CamelSpringBootTest;
+
+
+@DirtiesContext
+@CamelSpringBootTest
+@SpringBootTest(
+ classes = {
+ CamelAutoConfiguration.class,
+ KameletEipAggregateGroovyTest.class,
+ }
+)
+
+public class KameletEipAggregateGroovyTest {
+
+ @Autowired
+ ProducerTemplate template;
+
+ @EndpointInject("mock:result")
+ MockEndpoint mock;
+
+ @Test
+ public void testAggregate() throws Exception {
+ mock.expectedBodiesReceived("A,B,C,D,E");
+
+ template.sendBody("direct:start", "A");
+ template.sendBody("direct:start", "B");
+ template.sendBody("direct:start", "C");
+ template.sendBody("direct:start", "D");
+ template.sendBody("direct:start", "E");
+
+ mock.assertIsSatisfied();
+ }
+
+ // **********************************************
+ //
+ // test set-up
+ //
+ // **********************************************
+
+ @Bean
+ protected RoutesBuilder createRouteBuilder() {
+ return new RouteBuilder() {
+ @Override
+ public void configure() {
+ routeTemplate("my-aggregate")
+ .templateBean("myAgg", "groovy",
+ // for aggregation we need a class that has the method with how to aggregate the messages
+ // the logic can of course be much more than just to append with comma
+ "class MyAgg { String agg(b1, b2) { b1 + ',' + b2 } }; new MyAgg()")
+ // the groovy is evaluated as a script so must return an instance of the class
+ .templateParameter("count")
+ .from("kamelet:source")
+ .aggregate(constant(true))
+ .completionSize("{{count}}")
+ // use the groovy script bean for aggregation
+ .aggregationStrategy("{{myAgg}}")
+ .to("log:aggregate")
+ .to("kamelet:sink")
+ .end();
+
+ from("direct:start")
+ .kamelet("my-aggregate?count=5")
+ .to("log:info")
+ .to("mock:result");
+ }
+ };
+ }
+}
\ No newline at end of file
diff --git a/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletEipAggregateJoorTest.java b/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletEipAggregateJoorTest.java
new file mode 100644
index 00000000000..d6e83a00432
--- /dev/null
+++ b/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletEipAggregateJoorTest.java
@@ -0,0 +1,101 @@
+/*
+ * 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.component.kamelet.springboot;
+
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.jupiter.api.Test;
+import org.apache.camel.spring.boot.CamelAutoConfiguration;
+import org.apache.camel.EndpointInject;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.component.mock.MockEndpoint;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.annotation.Bean;
+import org.springframework.test.annotation.DirtiesContext;
+import org.apache.camel.test.spring.junit5.CamelSpringBootTest;
+
+
+@DirtiesContext
+@CamelSpringBootTest
+@SpringBootTest(
+ classes = {
+ CamelAutoConfiguration.class,
+ KameletEipAggregateJoorTest.class,
+ }
+)
+
+
+public class KameletEipAggregateJoorTest {
+
+ @Autowired
+ ProducerTemplate template;
+
+ @EndpointInject("mock:result")
+ MockEndpoint mock;
+
+ @Test
+ public void testAggregate() throws Exception {
+ mock.expectedBodiesReceived("A,B,C,D,E");
+
+ template.sendBody("direct:start", "A");
+ template.sendBody("direct:start", "B");
+ template.sendBody("direct:start", "C");
+ template.sendBody("direct:start", "D");
+ template.sendBody("direct:start", "E");
+
+ mock.assertIsSatisfied();
+ }
+
+ // **********************************************
+ //
+ // test set-up
+ //
+ // **********************************************
+
+ @Bean
+ protected RoutesBuilder createRouteBuilder() {
+ return new RouteBuilder() {
+ @Override
+ public void configure() {
+ routeTemplate("my-aggregate")
+ .templateBean("myAgg", "joor",
+ // for aggregation we can use a BiFunction that takes Exchange as input and return the aggregated response
+ // camel-joor has special support for this if we use (e1, e2) -> { ... } as a lambda expression
+ "(e1, e2) -> {" +
+ " String b1 = e1.getMessage().getBody(String.class);" +
+ " String b2 = e2.getMessage().getBody(String.class);" +
+ " return b1 + ',' + b2; }")
+ .templateParameter("count")
+ .from("kamelet:source")
+ .aggregate(constant(true))
+ .completionSize("{{count}}")
+ // use the groovy script bean for aggregation
+ .aggregationStrategy("{{myAgg}}")
+ .to("log:aggregate")
+ .to("kamelet:sink")
+ .end();
+
+ from("direct:start")
+ .kamelet("my-aggregate?count=5")
+ .to("log:info")
+ .to("mock:result");
+ }
+ };
+ }
+}
\ No newline at end of file
diff --git a/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletEipAggregateTest.java b/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletEipAggregateTest.java
new file mode 100644
index 00000000000..acfecce0256
--- /dev/null
+++ b/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletEipAggregateTest.java
@@ -0,0 +1,92 @@
+/*
+ * 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.component.kamelet.springboot;
+
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.builder.AggregationStrategies;
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.jupiter.api.Test;
+import org.apache.camel.spring.boot.CamelAutoConfiguration;
+import org.apache.camel.EndpointInject;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.component.mock.MockEndpoint;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.annotation.Bean;
+import org.springframework.test.annotation.DirtiesContext;
+import org.apache.camel.test.spring.junit5.CamelSpringBootTest;
+
+
+@DirtiesContext
+@CamelSpringBootTest
+@SpringBootTest(
+ classes = {
+ CamelAutoConfiguration.class,
+ KameletEipAggregateTest.class,
+ }
+)
+
+public class KameletEipAggregateTest {
+
+ @Autowired
+ ProducerTemplate template;
+
+ @EndpointInject("mock:result")
+ MockEndpoint mock;
+
+ @Test
+ public void testAggregate() throws Exception {
+ mock.expectedBodiesReceived("A,B,C,D,E");
+
+ template.sendBody("direct:start", "A");
+ template.sendBody("direct:start", "B");
+ template.sendBody("direct:start", "C");
+ template.sendBody("direct:start", "D");
+ template.sendBody("direct:start", "E");
+
+ mock.assertIsSatisfied();
+ }
+
+ // **********************************************
+ //
+ // test set-up
+ //
+ // **********************************************
+ @Bean
+ protected RoutesBuilder createRouteBuilder() {
+ return new RouteBuilder() {
+ @Override
+ public void configure() {
+ routeTemplate("my-aggregate")
+ .templateParameter("count")
+ .from("kamelet:source")
+ .aggregate(constant(true))
+ .completionSize("{{count}}")
+ .aggregationStrategy(AggregationStrategies.string(","))
+ .to("log:aggregate")
+ .to("kamelet:sink")
+ .end();
+
+ from("direct:start")
+ .kamelet("my-aggregate?count=5")
+ .to("log:info")
+ .to("mock:result");
+ }
+ };
+ }
+}
\ No newline at end of file
diff --git a/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletEipFilterTest.java b/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletEipFilterTest.java
new file mode 100644
index 00000000000..707ccb12504
--- /dev/null
+++ b/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletEipFilterTest.java
@@ -0,0 +1,85 @@
+/*
+ * 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.component.kamelet.springboot;
+
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.jupiter.api.Test;
+import org.apache.camel.spring.boot.CamelAutoConfiguration;
+import org.apache.camel.EndpointInject;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.component.mock.MockEndpoint;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.annotation.Bean;
+import org.springframework.test.annotation.DirtiesContext;
+import org.apache.camel.test.spring.junit5.CamelSpringBootTest;
+
+
+@DirtiesContext
+@CamelSpringBootTest
+@SpringBootTest(
+ classes = {
+ CamelAutoConfiguration.class,
+ KameletEipFilterTest.class,
+ }
+)
+
+public class KameletEipFilterTest {
+
+ @Autowired
+ ProducerTemplate template;
+
+ @EndpointInject("mock:result")
+ MockEndpoint mock;
+
+ @Test
+ public void testFilter() throws Exception {
+ mock.expectedBodiesReceived(5, 6, 7, 8, 9, 10);
+
+ for (int i = 0; i < 20; i++) {
+ template.sendBody("direct:start", i);
+ }
+
+ mock.assertIsSatisfied();
+ }
+
+ // **********************************************
+ //
+ // test set-up
+ //
+ // **********************************************
+
+ @Bean
+ protected RoutesBuilder createRouteBuilder() {
+ return new RouteBuilder() {
+ @Override
+ public void configure() {
+ routeTemplate("filter")
+ .from("kamelet:source")
+ .filter().simple("${body} range '5..10'")
+ .to("log:filter")
+ .to("kamelet:sink");
+
+ from("direct:start")
+ .kamelet("filter")
+ .to("mock:result");
+ }
+ };
+ }
+}
\ No newline at end of file
diff --git a/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletEipMulticastTest.java b/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletEipMulticastTest.java
new file mode 100644
index 00000000000..fdc29777413
--- /dev/null
+++ b/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletEipMulticastTest.java
@@ -0,0 +1,148 @@
+/*
+ * 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.component.kamelet.springboot;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.model.MulticastDefinition;
+import org.apache.camel.model.ProcessorDefinitionHelper;
+import org.apache.camel.model.RouteDefinition;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+import org.apache.camel.CamelContext;
+import org.apache.camel.spring.boot.CamelAutoConfiguration;
+import org.apache.camel.EndpointInject;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.model.ModelCamelContext;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.annotation.Bean;
+import org.springframework.test.annotation.DirtiesContext;
+import org.apache.camel.test.spring.junit5.CamelSpringBootTest;
+
+@DirtiesContext
+@CamelSpringBootTest
+@SpringBootTest(
+ classes = {
+ CamelAutoConfiguration.class,
+ KameletEipMulticastTest.class,
+ }
+)
+
+public class KameletEipMulticastTest {
+
+ @Autowired
+ ProducerTemplate template;
+
+ @EndpointInject("mock:result")
+ MockEndpoint mock;
+
+ @EndpointInject("mock:resultTwo")
+ MockEndpoint mockTwo;
+
+ @Autowired
+ CamelContext context;
+
+ @Bean
+ public boolean isUseRouteBuilder() {
+ return false;
+ }
+
+ @Test
+ public void testOne() throws Exception {
+ context.addRoutes(new RouteBuilder() {
+ @Override
+ public void configure() throws Exception {
+ routeTemplate("echo")
+ .from("kamelet:source")
+ .setBody(body().append(body()));
+
+ routeTemplate("reverse")
+ .from("kamelet:source")
+ .setBody(this::reverse);
+
+ from("direct:start").routeId("start")
+ .multicast()
+ .kamelet("echo")
+ .kamelet("reverse") // this becomes output on previous kamelet
+ .end()
+ .to("mock:result");
+ }
+
+ private Object reverse(Exchange exchange) {
+ StringBuilder sb = new StringBuilder(exchange.getMessage().getBody(String.class));
+ sb.reverse();
+ return sb.toString();
+ }
+ });
+ context.start();
+
+ mock.expectedBodiesReceived("CBACBA");
+
+ template.sendBody("direct:start", "ABC");
+
+ mock.assertIsSatisfied();
+
+ RouteDefinition rd = ((ModelCamelContext) context).getRouteDefinition("start");
+ MulticastDefinition md = ProcessorDefinitionHelper.findFirstTypeInOutputs(rd.getOutputs(), MulticastDefinition.class);
+ Assertions.assertEquals(1, md.getOutputs().size());
+ }
+
+ @Test
+ public void testTwo() throws Exception {
+ context.addRoutes(new RouteBuilder() {
+ @Override
+ public void configure() throws Exception {
+ routeTemplate("echo")
+ .from("kamelet:source")
+ .setBody(body().append(body()));
+
+ routeTemplate("reverse")
+ .from("kamelet:source")
+ .setBody(this::reverse);
+
+ from("direct:start").routeId("start")
+ .multicast()
+ .kamelet("echo").end()
+ .kamelet("reverse").end()
+ .end()
+ .to("mock:resultTwo");
+ }
+
+ private Object reverse(Exchange exchange) {
+ StringBuilder sb = new StringBuilder(exchange.getMessage().getBody(String.class));
+ sb.reverse();
+ return sb.toString();
+ }
+ });
+ context.start();
+
+ mockTwo.expectedBodiesReceived("CBA", "FED");
+
+ template.sendBody("direct:start", "ABC");
+ template.sendBody("direct:start", "DEF");
+
+ mockTwo.assertIsSatisfied();
+
+ RouteDefinition rd = ((ModelCamelContext) context).getRouteDefinition("start");
+ MulticastDefinition md = ProcessorDefinitionHelper.findFirstTypeInOutputs(rd.getOutputs(), MulticastDefinition.class);
+ Assertions.assertEquals(2, md.getOutputs().size());
+ }
+
+}
\ No newline at end of file
diff --git a/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletEipNoChildrenTest.java b/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletEipNoChildrenTest.java
new file mode 100644
index 00000000000..2485f10f825
--- /dev/null
+++ b/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletEipNoChildrenTest.java
@@ -0,0 +1,78 @@
+/*
+ * 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.component.kamelet.springboot;
+
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+import org.apache.camel.spring.boot.CamelAutoConfiguration;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.annotation.Bean;
+import org.springframework.test.annotation.DirtiesContext;
+import org.apache.camel.test.spring.junit5.CamelSpringBootTest;
+import org.apache.camel.ProducerTemplate;
+
+
+@DirtiesContext
+@CamelSpringBootTest
+@SpringBootTest(
+ classes = {
+ CamelAutoConfiguration.class,
+ KameletEipNoChildrenTest.class,
+ }
+)
+
+public class KameletEipNoChildrenTest {
+
+ @Autowired
+ ProducerTemplate template;
+
+
+ @Test
+ public void testOne() {
+ String out = template.requestBody("direct:start", "A", String.class);
+ assertEquals("AA", out);
+
+ out = template.requestBody("direct:start", "B", String.class);
+ assertEquals("BB", out);
+ }
+
+ // **********************************************
+ //
+ // test set-up
+ //
+ // **********************************************
+
+ @Bean
+ protected RoutesBuilder createRouteBuilder() {
+ return new RouteBuilder() {
+ @Override
+ public void configure() {
+ routeTemplate("echo")
+ .from("kamelet:source")
+ .setBody(body().append(body()));
+
+ from("direct:start")
+ .kamelet("echo");
+ }
+ };
+ }
+}
\ No newline at end of file
diff --git a/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletEipTest.java b/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletEipTest.java
new file mode 100644
index 00000000000..fbbe8d10f28
--- /dev/null
+++ b/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletEipTest.java
@@ -0,0 +1,92 @@
+/*
+ * 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.component.kamelet.springboot;
+
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.jupiter.api.Test;
+import org.apache.camel.spring.boot.CamelAutoConfiguration;
+import org.apache.camel.EndpointInject;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.component.mock.MockEndpoint;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.annotation.Bean;
+import org.springframework.test.annotation.DirtiesContext;
+import org.apache.camel.test.spring.junit5.CamelSpringBootTest;
+
+@DirtiesContext
+@CamelSpringBootTest
+@SpringBootTest(
+ classes = {
+ CamelAutoConfiguration.class,
+ KameletEipTest.class,
+ }
+)
+
+
+public class KameletEipTest {
+
+ @Autowired
+ ProducerTemplate template;
+
+ @EndpointInject("mock:result")
+ MockEndpoint mock;
+
+ @Test
+ public void testOne() throws Exception {
+ mock.expectedBodiesReceived("AA");
+
+ template.sendBody("direct:start", "A");
+
+ mock.assertIsSatisfied();
+ }
+
+ @Test
+ public void testTwo() throws Exception {
+ mock.reset();
+ mock.expectedBodiesReceived("AA", "BB");
+
+ template.sendBody("direct:start", "A");
+ template.sendBody("direct:start", "B");
+
+ mock.assertIsSatisfied();
+ }
+
+ // **********************************************
+ //
+ // test set-up
+ //
+ // **********************************************
+
+ @Bean
+ protected RoutesBuilder createRouteBuilder() {
+ return new RouteBuilder() {
+ @Override
+ public void configure() {
+ routeTemplate("echo")
+ .from("kamelet:source")
+ .setBody(body().append(body()));
+
+ from("direct:start")
+ .kamelet("echo")
+ .to("mock:result");
+ }
+ };
+ }
+}
\ No newline at end of file
diff --git a/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletGlobalPropertiesTest.java b/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletGlobalPropertiesTest.java
new file mode 100644
index 00000000000..a272fe2c53f
--- /dev/null
+++ b/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletGlobalPropertiesTest.java
@@ -0,0 +1,212 @@
+/*
+ * 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.component.kamelet.springboot;
+
+import static org.apache.camel.util.PropertiesHelper.asProperties;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.FluentProducerTemplate;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.http.HttpEndpoint;
+import org.apache.camel.component.kamelet.Kamelet;
+import org.apache.camel.component.kamelet.KameletEndpoint;
+import org.apache.camel.spring.boot.CamelAutoConfiguration;
+import org.apache.camel.test.spring.junit5.CamelSpringBootTest;
+import org.apache.camel.test.spring.junit5.UseOverridePropertiesWithPropertiesComponent;
+
+import org.junit.jupiter.api.Test;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.annotation.Bean;
+import org.springframework.test.annotation.DirtiesContext;
+
+import java.util.Properties;
+
+@DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD)
+@CamelSpringBootTest
+@SpringBootTest(
+ classes = {
+ CamelAutoConfiguration.class,
+ KameletGlobalPropertiesTest.class
+ }
+)
+
+public class KameletGlobalPropertiesTest {
+
+ @Autowired
+ FluentProducerTemplate fluentTemplate;
+ @Autowired
+ private CamelContext context;
+
+ // **********************************************
+ //
+ // test set-up
+ //
+ // **********************************************
+ @UseOverridePropertiesWithPropertiesComponent
+ public static Properties useOverridePropertiesWithPropertiesComponent() {
+ return asProperties(
+ "proxy.usr", "u+sr",
+ "proxy.pwd", "p+wd",
+ "raw.proxy.usr", "RAW(u+sr)",
+ "raw.proxy.pwd", "RAW(p+wd)",
+ "bodyValue", "from-uri",
+ Kamelet.PROPERTIES_PREFIX + "setBody.bodyValue", "from-template",
+ Kamelet.PROPERTIES_PREFIX + "setBody.test.bodyValue", "from-route",
+ Kamelet.PROPERTIES_PREFIX + "setBody.someId.bodyValue", "from-route-someId");
+ }
+
+ @Test
+ public void propertiesAreTakenFromRouteId() {
+ assertThat(
+ fluentTemplate
+ .to("direct:someId")
+ .request(String.class)).isEqualTo("from-route-someId");
+
+ assertThat(
+ fluentTemplate
+ .to("kamelet:setBody/test")
+ .request(String.class)).isEqualTo("from-route");
+ }
+
+ @Test
+ public void propertiesAreTakenFromTemplateId() {
+ assertThat(
+ fluentTemplate
+ .to("kamelet:setBody")
+ .request(String.class)).isEqualTo("from-template");
+ }
+
+ @Test
+ public void propertiesAreTakenFromURI() {
+ assertThat(
+ fluentTemplate
+ .to("kamelet:setBody?bodyValue={{bodyValue}}")
+ .request(String.class)).isEqualTo("from-uri");
+ }
+
+ @Test
+ public void rawIsPropagated() {
+ context.getEndpoint(
+ "kamelet:http-send?proxyUsr=RAW(u+sr)&proxyPwd=RAW(p+wd)");
+
+ assertThat(context.getEndpoints().stream().filter(HttpEndpoint.class::isInstance).findFirst()
+ .map(HttpEndpoint.class::cast))
+ .get()
+ .hasFieldOrPropertyWithValue("endpointUri",
+ "http://localhost:8080?proxyAuthUsername=u%2Bsr&proxyAuthPassword=p%2Bwd")
+ .hasFieldOrPropertyWithValue("proxyAuthUsername", "u+sr")
+ .hasFieldOrPropertyWithValue("proxyAuthPassword", "p+wd");
+ }
+
+ @Test
+ public void rawWithPlaceholdersIsPropagated() {
+ context.getEndpoint(
+ "kamelet:http-send?proxyUsr=RAW({{proxy.usr}})&proxyPwd=RAW({{proxy.pwd}})");
+
+ assertThat(context.getEndpoints().stream().filter(HttpEndpoint.class::isInstance).findFirst()
+ .map(HttpEndpoint.class::cast))
+ .get()
+ .hasFieldOrPropertyWithValue("endpointUri",
+ "http://localhost:8080?proxyAuthUsername=u%2Bsr&proxyAuthPassword=p%2Bwd")
+ .hasFieldOrPropertyWithValue("proxyAuthUsername", "u+sr")
+ .hasFieldOrPropertyWithValue("proxyAuthPassword", "p+wd");
+ }
+
+ @Test
+ public void rawPropertiesIsPropagated() {
+ context.getEndpoint(
+ "kamelet:http-send?proxyUsr={{raw.proxy.usr}}&proxyPwd={{raw.proxy.pwd}}");
+
+ assertThat(context.getEndpoints().stream().filter(HttpEndpoint.class::isInstance).findFirst()
+ .map(HttpEndpoint.class::cast))
+ .get()
+ .hasFieldOrPropertyWithValue("endpointUri",
+ "http://localhost:8080?proxyAuthUsername=u%2Bsr&proxyAuthPassword=p%2Bwd")
+ .hasFieldOrPropertyWithValue("proxyAuthUsername", "u+sr")
+ .hasFieldOrPropertyWithValue("proxyAuthPassword", "p+wd");
+ }
+
+ @Test
+ public void rawPropertyRefIsPropagated() {
+ context.getEndpoint(
+ "kamelet:http-send?proxyUsr=#property:proxy.usr&proxyPwd=#property:proxy.pwd");
+
+ assertThat(context.getEndpoints().stream().filter(HttpEndpoint.class::isInstance).findFirst()
+ .map(HttpEndpoint.class::cast))
+ .get()
+ .hasFieldOrPropertyWithValue("endpointUri",
+ "http://localhost:8080?proxyAuthUsername=%23property%3Aproxy.usr&proxyAuthPassword=%23property%3Aproxy.pwd")
+ .hasFieldOrPropertyWithValue("proxyAuthUsername", "u+sr")
+ .hasFieldOrPropertyWithValue("proxyAuthPassword", "p+wd");
+ }
+
+ @Test
+ public void urlEncodingIsRespected() {
+ assertThat(context.getEndpoint("kamelet:timer-source?message=Hello+Kamelets&period=1000", KameletEndpoint.class)
+ .getKameletProperties())
+ .containsEntry("message", "Hello Kamelets");
+ assertThat(context.getEndpoint("kamelet:timer-source?message=Hi%20Kamelets&period=1000", KameletEndpoint.class)
+ .getKameletProperties())
+ .containsEntry("message", "Hi Kamelets");
+ assertThat(context
+ .getEndpoint("kamelet:timer-source?message=messaging.knative.dev%2Fv1beta1&period=1000", KameletEndpoint.class)
+ .getKameletProperties())
+ .containsEntry("message", "messaging.knative.dev/v1beta1");
+ }
+
+ @Bean
+ protected RoutesBuilder createRouteBuilder() {
+ context.getPropertiesComponent().setLocation("classpath:kamelet.test.properties");
+
+ return new RouteBuilder() {
+ @Override
+ public void configure() {
+ // template
+ routeTemplate("setBody")
+ .templateParameter("bodyValue")
+ .from("kamelet:source")
+ .setBody().constant("{{bodyValue}}");
+
+ // template
+ routeTemplate("http-send")
+ .templateParameter("proxyUsr")
+ .templateParameter("proxyPwd")
+ .from("kamelet:source")
+ .log("info")
+ .to("http://localhost:8080?proxyAuthUsername={{proxyUsr}}&proxyAuthPassword={{proxyPwd}}");
+
+ // template
+ routeTemplate("timer-source")
+ .templateParameter("period")
+ .templateParameter("message")
+ .from("timer:tick")
+ .setBody().constant("{{message}}")
+ .to("kamelet:sink");
+
+ // routes
+ from("direct:someId").to("kamelet:setBody/someId");
+
+ from("direct:test").to("kamelet:setBody");
+ }
+ };
+ }
+}
\ No newline at end of file
diff --git a/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletLocalBeanClassFourTest.java b/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletLocalBeanClassFourTest.java
new file mode 100644
index 00000000000..0fa8d11a237
--- /dev/null
+++ b/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletLocalBeanClassFourTest.java
@@ -0,0 +1,104 @@
+/*
+ * 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.component.kamelet.springboot;
+
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.jupiter.api.Test;
+import org.apache.camel.spring.boot.CamelAutoConfiguration;
+import org.apache.camel.EndpointInject;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.component.mock.MockEndpoint;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.annotation.Bean;
+import org.springframework.test.annotation.DirtiesContext;
+import org.apache.camel.test.spring.junit5.CamelSpringBootTest;
+
+@DirtiesContext
+@CamelSpringBootTest
+@SpringBootTest(
+ classes = {
+ CamelAutoConfiguration.class,
+ KameletLocalBeanClassFourTest.class,
+ }
+)
+
+public class KameletLocalBeanClassFourTest {
+
+ @Autowired
+ ProducerTemplate template;
+
+ @EndpointInject("mock:result")
+ MockEndpoint mock;
+
+ @Test
+ public void testOne() throws Exception {
+ mock.expectedBodiesReceived("Hi John we are going to Moes");
+
+ template.sendBody("direct:bar", "John");
+
+ mock.assertIsSatisfied();
+ }
+
+ // **********************************************
+ //
+ // test set-up
+ //
+ // **********************************************
+
+ @Bean
+ protected RoutesBuilder createRouteBuilder() {
+ return new RouteBuilder() {
+ @Override
+ public void configure() {
+ routeTemplate("whereTo")
+ .templateParameter("bar")
+ .templateBean("myBar")
+ .typeClass(MyBar.class)
+ .property("bar", "{{bar}}")
+ .end()
+ .from("kamelet:source")
+ // must use {{myBar}} to refer to the local bean
+ .to("bean:{{myBar}}");
+
+ from("direct:bar")
+ .kamelet("whereTo?bar=Moes")
+ .to("mock:result");
+ }
+ };
+ }
+
+ public static class MyBar {
+
+ private String bar;
+
+ public String getBar() {
+ return bar;
+ }
+
+ public void setBar(String bar) {
+ this.bar = bar;
+ }
+
+ public String where(String name) {
+ return "Hi " + name + " we are going to " + bar;
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletLocalBeanClassTest.java b/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletLocalBeanClassTest.java
new file mode 100644
index 00000000000..dbe239bc278
--- /dev/null
+++ b/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletLocalBeanClassTest.java
@@ -0,0 +1,92 @@
+/*
+ * 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.component.kamelet.springboot;
+
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.jupiter.api.Test;
+import org.apache.camel.spring.boot.CamelAutoConfiguration;
+import org.apache.camel.EndpointInject;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.component.mock.MockEndpoint;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.annotation.Bean;
+import org.springframework.test.annotation.DirtiesContext;
+import org.apache.camel.test.spring.junit5.CamelSpringBootTest;
+
+@DirtiesContext
+@CamelSpringBootTest
+@SpringBootTest(
+ classes = {
+ CamelAutoConfiguration.class,
+ KameletLocalBeanClassTest.class,
+ }
+)
+
+public class KameletLocalBeanClassTest {
+
+ @Autowired
+ ProducerTemplate template;
+
+ @EndpointInject("mock:result")
+ MockEndpoint mock;
+
+ @Test
+ public void testOne() throws Exception {
+ mock.expectedBodiesReceived("Hi John we are going to Murphys");
+
+ template.sendBody("direct:bar", "John");
+
+ mock.assertIsSatisfied();
+ }
+
+ // **********************************************
+ //
+ // test set-up
+ //
+ // **********************************************
+
+ @Bean
+ protected RoutesBuilder createRouteBuilder() {
+ return new RouteBuilder() {
+ @Override
+ public void configure() {
+ routeTemplate("whereTo")
+ .templateBean("myBar", MyBar.class)
+ .from("kamelet:source")
+ // must use {{myBar}} to refer to the local bean
+ .to("bean:{{myBar}}");
+
+ from("direct:bar")
+ .kamelet("whereTo")
+ .to("mock:result");
+ }
+ };
+ }
+
+ public static class MyBar {
+
+ private final String bar = "Murphys";
+
+ public String where(String name) {
+ return "Hi " + name + " we are going to " + bar;
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletLocalBeanClassThreeTest.java b/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletLocalBeanClassThreeTest.java
new file mode 100644
index 00000000000..0bcbae02229
--- /dev/null
+++ b/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletLocalBeanClassThreeTest.java
@@ -0,0 +1,104 @@
+/*
+ * 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.component.kamelet.springboot;
+
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.jupiter.api.Test;
+import org.apache.camel.spring.boot.CamelAutoConfiguration;
+import org.apache.camel.EndpointInject;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.component.mock.MockEndpoint;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.annotation.Bean;
+import org.springframework.test.annotation.DirtiesContext;
+import org.apache.camel.test.spring.junit5.CamelSpringBootTest;
+
+@DirtiesContext
+@CamelSpringBootTest
+@SpringBootTest(
+ classes = {
+ CamelAutoConfiguration.class,
+ KameletLocalBeanClassThreeTest.class,
+ }
+)
+
+public class KameletLocalBeanClassThreeTest {
+
+ @Autowired
+ ProducerTemplate template;
+
+ @EndpointInject("mock:result")
+ MockEndpoint mock;
+
+ @Test
+ public void testOne() throws Exception {
+ mock.expectedBodiesReceived("Hi John we are going to Moes");
+
+ template.sendBody("direct:bar", "John");
+
+ mock.assertIsSatisfied();
+ }
+
+ // **********************************************
+ //
+ // test set-up
+ //
+ // **********************************************
+
+ @Bean
+ protected RoutesBuilder createRouteBuilder() {
+ return new RouteBuilder() {
+ @Override
+ public void configure() {
+ routeTemplate("whereTo")
+ .templateParameter("bar")
+ .templateBean("myBar")
+ .typeClass(MyBar.class)
+ .property("bar", "{{bar}}")
+ .end()
+ .from("kamelet:source")
+ // must use {{myBar}} to refer to the local bean
+ .to("bean:{{myBar}}");
+
+ from("direct:bar")
+ .kamelet("whereTo?bar=Moes")
+ .to("mock:result");
+ }
+ };
+ }
+
+ public static class MyBar {
+
+ private String bar;
+
+ public String getBar() {
+ return bar;
+ }
+
+ public void setBar(String bar) {
+ this.bar = bar;
+ }
+
+ public String where(String name) {
+ return "Hi " + name + " we are going to " + bar;
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletLocalBeanClassTwoTest.java b/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletLocalBeanClassTwoTest.java
new file mode 100644
index 00000000000..31f35e51192
--- /dev/null
+++ b/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletLocalBeanClassTwoTest.java
@@ -0,0 +1,92 @@
+/*
+ * 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.component.kamelet.springboot;
+
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.jupiter.api.Test;
+import org.apache.camel.spring.boot.CamelAutoConfiguration;
+import org.apache.camel.EndpointInject;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.component.mock.MockEndpoint;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.annotation.Bean;
+import org.springframework.test.annotation.DirtiesContext;
+import org.apache.camel.test.spring.junit5.CamelSpringBootTest;
+
+@DirtiesContext
+@CamelSpringBootTest
+@SpringBootTest(
+ classes = {
+ CamelAutoConfiguration.class,
+ KameletLocalBeanClassTwoTest.class,
+ }
+)
+
+public class KameletLocalBeanClassTwoTest {
+
+ @Autowired
+ ProducerTemplate template;
+
+ @EndpointInject("mock:result")
+ MockEndpoint mock;
+
+ @Test
+ public void testOne() throws Exception {
+ mock.expectedBodiesReceived("Hi John we are going to Murphys");
+
+ template.sendBody("direct:bar", "John");
+
+ mock.assertIsSatisfied();
+ }
+
+ // **********************************************
+ //
+ // test set-up
+ //
+ // **********************************************
+
+ @Bean
+ protected RoutesBuilder createRouteBuilder() {
+ return new RouteBuilder() {
+ @Override
+ public void configure() {
+ routeTemplate("whereTo")
+ .templateBean("myBar", "#class:org.apache.camel.component.kamelet.springboot.KameletLocalBeanClassTwoTest$MyBar")
+ .from("kamelet:source")
+ // must use {{myBar}} to refer to the local bean
+ .to("bean:{{myBar}}");
+
+ from("direct:bar")
+ .kamelet("whereTo")
+ .to("mock:result");
+ }
+ };
+ }
+
+ public static class MyBar {
+
+ private final String bar = "Murphys";
+
+ public String where(String name) {
+ return "Hi " + name + " we are going to " + bar;
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletLocalBeanConfigureTest.java b/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletLocalBeanConfigureTest.java
new file mode 100644
index 00000000000..f1089e40091
--- /dev/null
+++ b/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletLocalBeanConfigureTest.java
@@ -0,0 +1,116 @@
+/*
+ * 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.component.kamelet.springboot;
+
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.spring.boot.CamelAutoConfiguration;
+import org.apache.camel.EndpointInject;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.component.mock.MockEndpoint;
+
+import org.junit.jupiter.api.Test;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.annotation.Bean;
+import org.springframework.test.annotation.DirtiesContext;
+import org.apache.camel.test.spring.junit5.CamelSpringBootTest;
+
+@DirtiesContext
+@CamelSpringBootTest
+@SpringBootTest(
+ classes = {
+ CamelAutoConfiguration.class,
+ KameletLocalBeanConfigureTest.class,
+ }
+)
+
+public class KameletLocalBeanConfigureTest {
+
+ @Autowired
+ ProducerTemplate template;
+
+ @EndpointInject("mock:result")
+ MockEndpoint mock;
+
+ @Test
+ public void testOne() throws Exception {
+ mock.expectedBodiesReceived("Hi John we are going to Moes");
+
+ template.sendBody("direct:moe", "John");
+
+ mock.assertIsSatisfied();
+ }
+
+ @Test
+ public void testTwo() throws Exception {
+ mock.reset();
+ mock.expectedBodiesReceived("Hi Jack we are going to Shamrock",
+ "Hi Mary we are going to Moes");
+
+ template.sendBody("direct:shamrock", "Jack");
+ template.sendBody("direct:moe", "Mary");
+
+ mock.assertIsSatisfied();
+ }
+
+ // **********************************************
+ //
+ // test set-up
+ //
+ // **********************************************
+
+ @Bean
+ protected RoutesBuilder createRouteBuilder() {
+ return new RouteBuilder() {
+ @Override
+ public void configure() {
+ routeTemplate("whereTo")
+ .templateParameter("bar") // name of bar
+ .configure(rtc -> {
+ // create local bean with id myBar which can be used in the routes via {{myBar}}
+ rtc.bind("myBar", MyBar.class, new MyBar(rtc.getProperty("bar", String.class)));
+ })
+ .from("kamelet:source")
+ // must use {{myBar}} to refer to the local bean
+ .to("bean:{{myBar}}");
+
+ from("direct:shamrock")
+ .kamelet("whereTo?bar=Shamrock")
+ .to("mock:result");
+
+ from("direct:moe")
+ .kamelet("whereTo?bar=Moes")
+ .to("mock:result");
+ }
+ };
+ }
+
+ private static class MyBar {
+
+ private final String bar;
+
+ public MyBar(String bar) {
+ this.bar = bar;
+ }
+
+ public String where(String name) {
+ return "Hi " + name + " we are going to " + bar;
+ }
+ }
+}
\ No newline at end of file
diff --git a/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletLocalBeanGroovyExternalTest.java b/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletLocalBeanGroovyExternalTest.java
new file mode 100644
index 00000000000..1a9c2b676fd
--- /dev/null
+++ b/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletLocalBeanGroovyExternalTest.java
@@ -0,0 +1,100 @@
+/*
+ * 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.component.kamelet.springboot;
+
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.jupiter.api.Test;
+import org.apache.camel.spring.boot.CamelAutoConfiguration;
+import org.apache.camel.EndpointInject;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.component.mock.MockEndpoint;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.annotation.Bean;
+import org.springframework.test.annotation.DirtiesContext;
+import org.apache.camel.test.spring.junit5.CamelSpringBootTest;
+
+@DirtiesContext
+@CamelSpringBootTest
+@SpringBootTest(
+ classes = {
+ CamelAutoConfiguration.class,
+ KameletLocalBeanGroovyExternalTest.class,
+ }
+)
+
+public class KameletLocalBeanGroovyExternalTest {
+
+ @Autowired
+ ProducerTemplate template;
+
+ @EndpointInject("mock:result")
+ MockEndpoint mock;
+
+ @Test
+ public void testOne() throws Exception {
+ mock.expectedBodiesReceived("Hi John we are going to Moes");
+
+ template.sendBody("direct:moe", "John");
+
+ mock.assertIsSatisfied();
+ }
+
+ @Test
+ public void testTwo() throws Exception {
+ mock.reset();
+ mock.expectedBodiesReceived("Hi Jack we are going to Shamrock",
+ "Hi Mary we are going to Moes");
+
+ template.sendBody("direct:shamrock", "Jack");
+ template.sendBody("direct:moe", "Mary");
+
+ mock.assertIsSatisfied();
+ }
+
+ // **********************************************
+ //
+ // test set-up
+ //
+ // **********************************************
+
+ @Bean
+ protected RoutesBuilder createRouteBuilder() {
+ return new RouteBuilder() {
+ @Override
+ public void configure() {
+ routeTemplate("whereTo")
+ .templateParameter("bar") // name of bar
+ .templateBean("myBar", "groovy", "resource:classpath:mybar.groovy")
+ .from("kamelet:source")
+ // must use {{myBar}} to refer to the local bean
+ .to("bean:{{myBar}}");
+
+ from("direct:shamrock")
+ .kamelet("whereTo?bar=Shamrock")
+ .to("mock:result");
+
+ from("direct:moe")
+ .kamelet("whereTo?bar=Moes")
+ .to("mock:result");
+ }
+ };
+ }
+
+}
\ No newline at end of file
diff --git a/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletLocalBeanGroovyTest.java b/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletLocalBeanGroovyTest.java
new file mode 100644
index 00000000000..bf9066b6080
--- /dev/null
+++ b/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletLocalBeanGroovyTest.java
@@ -0,0 +1,86 @@
+/*
+ * 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.component.kamelet.springboot;
+
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.jupiter.api.Test;
+import org.apache.camel.spring.boot.CamelAutoConfiguration;
+import org.apache.camel.EndpointInject;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.component.mock.MockEndpoint;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.annotation.Bean;
+import org.springframework.test.annotation.DirtiesContext;
+import org.apache.camel.test.spring.junit5.CamelSpringBootTest;
+
+@DirtiesContext
+@CamelSpringBootTest
+@SpringBootTest(
+ classes = {
+ CamelAutoConfiguration.class,
+ KameletLocalBeanGroovyTest.class,
+ }
+)
+
+public class KameletLocalBeanGroovyTest {
+
+ @Autowired
+ ProducerTemplate template;
+
+ @EndpointInject("mock:result")
+ MockEndpoint mock;
+
+ @Test
+ public void testOne() throws Exception {
+ mock.expectedBodiesReceived("Hi John we are going to Gr8t");
+
+ template.sendBody("direct:start", "John");
+
+ mock.assertIsSatisfied();
+ }
+
+ // **********************************************
+ //
+ // test set-up
+ //
+ // **********************************************
+
+ @Bean
+ protected RoutesBuilder createRouteBuilder() {
+ return new RouteBuilder() {
+ @Override
+ public void configure() {
+ routeTemplate("whereTo")
+ .templateBean("myBar", "groovy",
+ "def bean = new org.apache.camel.component.kamelet.springboot.MyInjectBar()\n"
+ + "bean.bar = 'Gr8t'\n"
+ + "return bean")
+ .from("kamelet:source")
+ // must use {{myBar}} to refer to the local bean
+ .to("bean:{{myBar}}");
+
+ from("direct:start")
+ .kamelet("whereTo")
+ .to("mock:result");
+ }
+ };
+ }
+
+}
\ No newline at end of file
diff --git a/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletLocalBeanIoCTest.java b/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletLocalBeanIoCTest.java
new file mode 100644
index 00000000000..6e367ed3e3d
--- /dev/null
+++ b/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletLocalBeanIoCTest.java
@@ -0,0 +1,101 @@
+/*
+ * 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.component.kamelet.springboot;
+
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.jupiter.api.Test;
+import org.apache.camel.spring.boot.CamelAutoConfiguration;
+import org.apache.camel.EndpointInject;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.component.mock.MockEndpoint;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.annotation.Bean;
+import org.springframework.test.annotation.DirtiesContext;
+import org.apache.camel.test.spring.junit5.CamelSpringBootTest;
+
+@DirtiesContext
+@CamelSpringBootTest
+@SpringBootTest(
+ classes = {
+ CamelAutoConfiguration.class,
+ KameletLocalBeanIoCTest.class,
+ }
+)
+
+public class KameletLocalBeanIoCTest {
+
+ @Autowired
+ ProducerTemplate template;
+
+ @EndpointInject("mock:result")
+ MockEndpoint mock;
+
+ @Test
+ public void testOne() throws Exception {
+ mock.expectedBodiesReceived("Hi John we are going to Moes");
+
+ template.sendBody("direct:moe", "John");
+
+ mock.assertIsSatisfied();
+ }
+
+ @Test
+ public void testTwo() throws Exception {
+ mock.reset();
+ mock.expectedBodiesReceived("Hi Jack we are going to Shamrock",
+ "Hi Mary we are going to Moes");
+
+ template.sendBody("direct:shamrock", "Jack");
+ template.sendBody("direct:moe", "Mary");
+
+ mock.assertIsSatisfied();
+ }
+
+ // **********************************************
+ //
+ // test set-up
+ //
+ // **********************************************
+
+ @Bean
+ protected RoutesBuilder createRouteBuilder() {
+ return new RouteBuilder() {
+ @Override
+ public void configure() {
+ routeTemplate("whereTo")
+ .templateParameter("bar") // name of bar
+ // use dependency injection to create the local bean via its fqn class name
+ .templateBean("myBar", MyInjectBar.class)
+ .from("kamelet:source")
+ // must use {{myBar}} to refer to the local bean
+ .to("bean:{{myBar}}");
+
+ from("direct:shamrock")
+ .kamelet("whereTo?bar=Shamrock")
+ .to("mock:result");
+
+ from("direct:moe")
+ .kamelet("whereTo?bar=Moes")
+ .to("mock:result");
+ }
+ };
+ }
+
+}
\ No newline at end of file
diff --git a/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletLocalBeanJoorExternalTest.java b/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletLocalBeanJoorExternalTest.java
new file mode 100644
index 00000000000..f496b5e2309
--- /dev/null
+++ b/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletLocalBeanJoorExternalTest.java
@@ -0,0 +1,103 @@
+/*
+ * 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.component.kamelet.springboot;
+
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.condition.EnabledForJreRange;
+import org.junit.jupiter.api.condition.JRE;
+import org.apache.camel.spring.boot.CamelAutoConfiguration;
+import org.apache.camel.EndpointInject;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.component.mock.MockEndpoint;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.annotation.Bean;
+import org.springframework.test.annotation.DirtiesContext;
+import org.apache.camel.test.spring.junit5.CamelSpringBootTest;
+
+@DirtiesContext
+@CamelSpringBootTest
+@SpringBootTest(
+ classes = {
+ CamelAutoConfiguration.class,
+ KameletLocalBeanJoorExternalTest.class,
+ }
+)
+
+@EnabledForJreRange(min = JRE.JAVA_11)
+public class KameletLocalBeanJoorExternalTest {
+
+ @Autowired
+ ProducerTemplate template;
+
+ @EndpointInject("mock:result")
+ MockEndpoint mock;
+
+ @Test
+ public void testOne() throws Exception {
+ mock.expectedBodiesReceived("Hi John we are going to Moes");
+
+ template.sendBody("direct:moe", "John");
+
+ mock.assertIsSatisfied();
+ }
+
+ @Test
+ public void testTwo() throws Exception {
+ mock.reset();
+ mock.expectedBodiesReceived("Hi Jack we are going to Shamrock",
+ "Hi Mary we are going to Moes");
+
+ template.sendBody("direct:shamrock", "Jack");
+ template.sendBody("direct:moe", "Mary");
+
+ mock.assertIsSatisfied();
+ }
+
+ // **********************************************
+ //
+ // test set-up
+ //
+ // **********************************************
+
+ @Bean
+ protected RoutesBuilder createRouteBuilder() {
+ return new RouteBuilder() {
+ @Override
+ public void configure() {
+ routeTemplate("whereTo")
+ .templateParameter("bar") // name of bar
+ .templateBean("myBar", "joor", "resource:classpath:mybar.joor")
+ .from("kamelet:source")
+ // must use {{myBar}} to refer to the local bean
+ .to("bean:{{myBar}}");
+
+ from("direct:shamrock")
+ .kamelet("whereTo?bar=Shamrock")
+ .to("mock:result");
+
+ from("direct:moe")
+ .kamelet("whereTo?bar=Moes")
+ .to("mock:result");
+ }
+ };
+ }
+
+}
\ No newline at end of file
diff --git a/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletLocalBeanLanguageTest.java b/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletLocalBeanLanguageTest.java
new file mode 100644
index 00000000000..cddc6a9ade7
--- /dev/null
+++ b/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletLocalBeanLanguageTest.java
@@ -0,0 +1,121 @@
+/*
+ * 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.component.kamelet.springboot;
+
+import org.apache.camel.RouteTemplateContext;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.jupiter.api.Test;
+import org.apache.camel.spring.boot.CamelAutoConfiguration;
+import org.apache.camel.EndpointInject;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.component.mock.MockEndpoint;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.annotation.Bean;
+import org.springframework.test.annotation.DirtiesContext;
+import org.apache.camel.test.spring.junit5.CamelSpringBootTest;
+
+@DirtiesContext
+@CamelSpringBootTest
+@SpringBootTest(
+ classes = {
+ CamelAutoConfiguration.class,
+ KameletLocalBeanLanguageTest.class,
+ }
+)
+
+public class KameletLocalBeanLanguageTest {
+
+ @Autowired
+ ProducerTemplate template;
+
+ @EndpointInject("mock:result")
+ MockEndpoint mock;
+
+ @Test
+ public void testOne() throws Exception {
+ mock.expectedBodiesReceived("Hi John we are going to Moes");
+
+ template.sendBody("direct:moe", "John");
+
+ mock.assertIsSatisfied();
+ }
+
+ @Test
+ public void testTwo() throws Exception {
+ mock.reset();
+ mock.expectedBodiesReceived("Hi Jack we are going to Shamrock",
+ "Hi Mary we are going to Moes");
+
+ template.sendBody("direct:shamrock", "Jack");
+ template.sendBody("direct:moe", "Mary");
+
+ mock.assertIsSatisfied();
+ }
+
+ // **********************************************
+ //
+ // test set-up
+ //
+ // **********************************************
+
+ @Bean
+ protected RoutesBuilder createRouteBuilder() {
+ return new RouteBuilder() {
+ @Override
+ public void configure() {
+ routeTemplate("whereTo")
+ .templateParameter("bar") // name of bar
+ .templateBean("myBar", "bean",
+ "org.apache.camel.component.kamelet.springboot.KameletLocalBeanLanguageTest?method=createMyBar")
+ .from("kamelet:source")
+ // must use {{myBar}} to refer to the local bean
+ .to("bean:{{myBar}}");
+
+ from("direct:shamrock")
+ .kamelet("whereTo?bar=Shamrock")
+ .to("mock:result");
+
+ from("direct:moe")
+ .kamelet("whereTo?bar=Moes")
+ .to("mock:result");
+ }
+ };
+ }
+
+ public static MyBar createMyBar(RouteTemplateContext rtc) {
+ // use rtc as parameter so we can use that to get the template parameters when creating the local bean
+ // the method can be static or not (static is possible best)
+ return new MyBar(rtc.getProperty("bar", String.class));
+ }
+
+ private static class MyBar {
+
+ private final String bar;
+
+ public MyBar(String bar) {
+ this.bar = bar;
+ }
+
+ public String where(String name) {
+ return "Hi " + name + " we are going to " + bar;
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletLocalBeanSupplierTest.java b/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletLocalBeanSupplierTest.java
new file mode 100644
index 00000000000..8f706e0b54b
--- /dev/null
+++ b/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletLocalBeanSupplierTest.java
@@ -0,0 +1,108 @@
+/*
+ * 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.component.kamelet.springboot;
+
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.jupiter.api.Test;
+import org.apache.camel.spring.boot.CamelAutoConfiguration;
+import org.apache.camel.EndpointInject;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.component.mock.MockEndpoint;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.annotation.Bean;
+import org.springframework.test.annotation.DirtiesContext;
+import org.apache.camel.test.spring.junit5.CamelSpringBootTest;
+
+@DirtiesContext
+@CamelSpringBootTest
+@SpringBootTest(
+ classes = {
+ CamelAutoConfiguration.class,
+ KameletLocalBeanSupplierTest.class,
+ }
+)
+
+public class KameletLocalBeanSupplierTest {
+
+ @Autowired
+ ProducerTemplate template;
+
+ @EndpointInject("mock:result")
+ MockEndpoint mock;
+
+ private final AtomicInteger counter = new AtomicInteger();
+
+ @Test
+ public void testSupplier() throws Exception {
+ mock.expectedBodiesReceived("Hello John go to number 2", "Hi Mary go to number 1");
+
+ template.sendBody("direct:hello", "John");
+ template.sendBody("direct:hi", "Mary");
+
+ mock.assertIsSatisfied();
+ }
+
+ // **********************************************
+ //
+ // test set-up
+ //
+ // **********************************************
+
+ @Bean
+ protected RoutesBuilder createRouteBuilder() {
+ return new RouteBuilder() {
+ @Override
+ public void configure() {
+ routeTemplate("whereTo")
+ .templateParameter("foo")
+ .templateBean("myBar", () -> new MyStaticBar(counter.incrementAndGet()))
+ .from("kamelet:source")
+ // must use {{myBar}} to refer to the local bean
+ .setBody(simple("{{foo}} ${body}"))
+ .to("bean:{{myBar}}");
+
+ from("direct:hi")
+ .kamelet("whereTo?foo=Hi")
+ .to("mock:result");
+
+ from("direct:hello")
+ .kamelet("whereTo?foo=Hello")
+ .to("mock:result");
+ }
+ };
+ }
+
+ private class MyStaticBar {
+
+ private int number;
+
+ public MyStaticBar(int number) {
+ this.number = number;
+ }
+
+ public String whereTo(String name) {
+ return name + " go to number " + number;
+ }
+
+ }
+
+}
\ No newline at end of file
diff --git a/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletLocalBeanTest.java b/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletLocalBeanTest.java
new file mode 100644
index 00000000000..e44785662a5
--- /dev/null
+++ b/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletLocalBeanTest.java
@@ -0,0 +1,112 @@
+/*
+ * 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.component.kamelet.springboot;
+
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.jupiter.api.Test;
+import org.apache.camel.spring.boot.CamelAutoConfiguration;
+import org.apache.camel.EndpointInject;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.component.mock.MockEndpoint;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.annotation.Bean;
+import org.springframework.test.annotation.DirtiesContext;
+import org.apache.camel.test.spring.junit5.CamelSpringBootTest;
+
+@DirtiesContext
+@CamelSpringBootTest
+@SpringBootTest(
+ classes = {
+ CamelAutoConfiguration.class,
+ KameletLocalBeanTest.class,
+ }
+)
+
+public class KameletLocalBeanTest {
+
+ @Autowired
+ ProducerTemplate template;
+
+ @EndpointInject("mock:result")
+ MockEndpoint mock;
+
+ @Test
+ public void testOne() throws Exception {
+ mock.expectedBodiesReceived("Hi John we are going to Moes");
+
+ template.sendBody("direct:moe", "John");
+
+ mock.assertIsSatisfied();
+ }
+
+ @Test
+ public void testTwo() throws Exception {
+ mock.reset();
+ mock.expectedBodiesReceived("Hi Jack we are going to Shamrock",
+ "Hi Mary we are going to Moes");
+
+ template.sendBody("direct:shamrock", "Jack");
+ template.sendBody("direct:moe", "Mary");
+
+ mock.assertIsSatisfied();
+ }
+
+ // **********************************************
+ //
+ // test set-up
+ //
+ // **********************************************
+
+ @Bean
+ protected RoutesBuilder createRouteBuilder() {
+ return new RouteBuilder() {
+ @Override
+ public void configure() {
+ routeTemplate("whereTo")
+ .templateParameter("bar") // name of bar
+ .templateBean("myBar", MyBar.class, rtc -> new MyBar(rtc.getProperty("bar", String.class)))
+ .from("kamelet:source")
+ // must use {{myBar}} to refer to the local bean
+ .to("bean:{{myBar}}");
+
+ from("direct:shamrock")
+ .kamelet("whereTo?bar=Shamrock")
+ .to("mock:result");
+
+ from("direct:moe")
+ .kamelet("whereTo?bar=Moes")
+ .to("mock:result");
+ }
+ };
+ }
+
+ private static class MyBar {
+
+ private final String bar;
+
+ public MyBar(String bar) {
+ this.bar = bar;
+ }
+
+ public String where(String name) {
+ return "Hi " + name + " we are going to " + bar;
+ }
+ }
+}
\ No newline at end of file
diff --git a/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletLocalBeanTypeTest.java b/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletLocalBeanTypeTest.java
new file mode 100644
index 00000000000..0b9b46e0083
--- /dev/null
+++ b/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletLocalBeanTypeTest.java
@@ -0,0 +1,102 @@
+/*
+ * 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.component.kamelet.springboot;
+
+import org.apache.camel.BindToRegistry;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.jupiter.api.Test;
+import org.apache.camel.spring.boot.CamelAutoConfiguration;
+import org.apache.camel.EndpointInject;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.component.mock.MockEndpoint;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.annotation.Bean;
+import org.springframework.test.annotation.DirtiesContext;
+import org.apache.camel.test.spring.junit5.CamelSpringBootTest;
+
+@DirtiesContext
+@CamelSpringBootTest
+@SpringBootTest(
+ classes = {
+ CamelAutoConfiguration.class,
+ KameletLocalBeanTypeTest.class,
+ KameletLocalBeanTypeTest.Bar.class,
+ KameletLocalBeanTypeTest.MyBar.class,
+ }
+)
+
+public class KameletLocalBeanTypeTest {
+
+ @Autowired
+ ProducerTemplate template;
+
+ @EndpointInject("mock:result")
+ MockEndpoint mock;
+
+ @BindToRegistry("myBar")
+ private MyBar bar = new MyBar();
+
+ @Test
+ public void testOne() throws Exception {
+ mock.expectedBodiesReceived("Hi John we are going to Murphys");
+
+ template.sendBody("direct:bar", "John");
+
+ mock.assertIsSatisfied();
+ }
+
+ // **********************************************
+ //
+ // test set-up
+ //
+ // **********************************************
+
+ @Bean
+ protected RoutesBuilder createRouteBuilder() {
+ return new RouteBuilder() {
+ @Override
+ public void configure() {
+ routeTemplate("whereTo")
+ .templateBean("myBar", "#type:org.apache.camel.component.kamelet.springboot.KameletLocalBeanTypeTest$Bar")
+ .from("kamelet:source")
+ // must use {{myBar}} to refer to the local bean
+ .to("bean:{{myBar}}");
+
+ from("direct:bar")
+ .kamelet("whereTo")
+ .to("mock:result");
+ }
+ };
+ }
+
+ public interface Bar {
+ String where(String name);
+ }
+
+ public static class MyBar implements Bar {
+
+ private final String bar = "Murphys";
+
+ public String where(String name) {
+ return "Hi " + name + " we are going to " + bar;
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletLocationTest.java b/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletLocationTest.java
new file mode 100644
index 00000000000..2978feb4e7d
--- /dev/null
+++ b/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletLocationTest.java
@@ -0,0 +1,145 @@
+/*
+ * 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.component.kamelet.springboot;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.spi.Resource;
+import org.apache.camel.spi.RoutesBuilderLoader;
+import org.junit.jupiter.api.Test;
+import org.apache.camel.spring.boot.CamelAutoConfiguration;
+import org.apache.camel.EndpointInject;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.component.mock.MockEndpoint;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.annotation.Bean;
+import org.springframework.test.annotation.DirtiesContext;
+import org.apache.camel.test.spring.junit5.CamelSpringBootTest;
+
+@DirtiesContext
+@CamelSpringBootTest
+@SpringBootTest(
+ classes = {
+ CamelAutoConfiguration.class,
+ KameletLocationTest.class,
+ }
+)
+
+public class KameletLocationTest {
+
+ @Autowired
+ ProducerTemplate template;
+
+ @EndpointInject("mock:result")
+ MockEndpoint mock;
+
+ @Autowired
+ private CamelContext context;
+
+ protected CamelContext createCamelContext() throws Exception {
+ context.getRegistry().bind("routes-builder-loader-xml", new MyRoutesLoader());
+ return context;
+ }
+
+ @Test
+ public void testOne() throws Exception {
+ mock.expectedBodiesReceived("HELLO");
+
+ template.sendBody("direct:start", "Hello");
+
+ mock.assertIsSatisfied();
+ }
+
+ @Test
+ public void testTwo() throws Exception {
+ mock.reset();
+ mock.expectedBodiesReceived("HELLO", "WORLD");
+
+ template.sendBody("direct:start", "Hello");
+ template.sendBody("direct:start", "World");
+
+ mock.assertIsSatisfied();
+ }
+
+ // we cannot use camel-xml-io-dsl to load the XML route so we fool Camel
+ // and use this class that has the route template hardcoded from java
+ public class MyRoutesLoader implements RoutesBuilderLoader {
+
+
+ @Override
+ public CamelContext getCamelContext() {
+ return context;
+ }
+
+ @Override
+ public void setCamelContext(CamelContext camelContext) {
+ context = camelContext;
+ }
+
+ @Override
+ public String getSupportedExtension() {
+ return "xml";
+ }
+
+ @Override
+ public RoutesBuilder loadRoutesBuilder(Resource resource) {
+ return new RouteBuilder() {
+ @Override
+ public void configure() {
+ routeTemplate("upper")
+ .from("kamelet:source")
+ .transform().simple("${body.toUpperCase()}");
+
+ from("direct:start")
+ .kamelet("upper?location=file:resource:classpath:upper-kamelet.xml")
+ .to("mock:result");
+ }
+ };
+ }
+
+ @Override
+ public void start() {
+ // noop
+ }
+
+ @Override
+ public void stop() {
+ // noop
+ }
+ }
+
+ // **********************************************
+ //
+ // test set-up
+ //
+ // **********************************************
+
+ @Bean
+ protected RoutesBuilder createRouteBuilder() {
+ return new RouteBuilder() {
+ @Override
+ public void configure() {
+ from("direct:start")
+ .kamelet("upper?location=file:src/test/resources/upper-kamelet.xml")
+ .to("mock:result");
+ }
+ };
+ }
+}
\ No newline at end of file
diff --git a/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletRecipientListTest.java b/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletRecipientListTest.java
new file mode 100644
index 00000000000..d78c6adaf73
--- /dev/null
+++ b/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletRecipientListTest.java
@@ -0,0 +1,91 @@
+/*
+ * 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.component.kamelet.springboot;
+
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.jupiter.api.Test;
+import org.apache.camel.spring.boot.CamelAutoConfiguration;
+import org.apache.camel.EndpointInject;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.component.mock.MockEndpoint;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.annotation.Bean;
+import org.springframework.test.annotation.DirtiesContext;
+import org.apache.camel.test.spring.junit5.CamelSpringBootTest;
+
+@DirtiesContext
+@CamelSpringBootTest
+@SpringBootTest(
+ classes = {
+ CamelAutoConfiguration.class,
+ KameletRecipientListTest.class,
+ }
+)
+
+public class KameletRecipientListTest {
+
+ @Autowired
+ ProducerTemplate template;
+
+ @EndpointInject("mock:foo")
+ MockEndpoint mock1;
+
+ @EndpointInject("mock:bar")
+ MockEndpoint mock2;
+
+ @EndpointInject("mock:result")
+ MockEndpoint mock;
+
+ @Test
+ public void testRecipientList() throws Exception {
+ mock1.expectedBodiesReceived("A");
+ mock2.expectedBodiesReceived("B");
+
+ template.sendBody("direct:foo", "A");
+ template.sendBody("direct:bar", "B");
+
+ mock.assertIsSatisfied();
+ }
+
+ // **********************************************
+ //
+ // test set-up
+ //
+ // **********************************************
+
+ @Bean
+ protected RoutesBuilder createRouteBuilder() {
+ return new RouteBuilder() {
+ @Override
+ public void configure() {
+ routeTemplate("broker")
+ .templateParameter("queue")
+ .from("kamelet:source")
+ .recipientList(constant("mock:{{queue}}"));
+
+ from("direct:foo")
+ .kamelet("broker?queue=foo");
+
+ from("direct:bar")
+ .kamelet("broker?queue=bar");
+ }
+ };
+ }
+}
\ No newline at end of file
diff --git a/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletRouteDumpTest.java b/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletRouteDumpTest.java
new file mode 100644
index 00000000000..f77b1ea73e5
--- /dev/null
+++ b/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletRouteDumpTest.java
@@ -0,0 +1,88 @@
+/*
+ * 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.component.kamelet.springboot;
+
+import java.util.UUID;
+
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.CamelContext;
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.jupiter.api.Test;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import org.apache.camel.spring.boot.CamelAutoConfiguration;
+import org.apache.camel.FluentProducerTemplate;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.annotation.Bean;
+import org.springframework.test.annotation.DirtiesContext;
+import org.apache.camel.test.spring.junit5.CamelSpringBootTest;
+
+@DirtiesContext
+@CamelSpringBootTest
+@SpringBootTest(
+ classes = {
+ CamelAutoConfiguration.class,
+ KameletRouteDumpTest.class,
+ }
+)
+
+public class KameletRouteDumpTest {
+
+ @Autowired
+ FluentProducerTemplate fluentTemplate;
+
+ @Autowired
+ private CamelContext context;
+
+ protected void postProcessTest() throws Exception {
+ context.setDumpRoutes(true);
+ }
+
+ @Test
+ public void canProduceToKamelet() {
+ String body = UUID.randomUUID().toString();
+
+ assertThat(
+ fluentTemplate.toF("direct:templateEmbedded", body).request(String.class)).isEqualTo("test");
+ }
+
+ // **********************************************
+ //
+ // test set-up
+ //
+ // **********************************************
+
+ @Bean
+ protected RoutesBuilder createRouteBuilder() {
+ return new RouteBuilder() {
+ @Override
+ public void configure() {
+ routeTemplate("setBody")
+ .templateParameter("bodyValue")
+ .from("kamelet:source")
+ .setBody().constant("{{bodyValue}}")
+ .to("kamelet:sink");
+
+ from("direct:templateEmbedded").id("test")
+ .kamelet("setBody?bodyValue=test")
+ .to("log:TEST?showAll=true&multiline=true");
+ }
+ };
+ }
+}
\ No newline at end of file
diff --git a/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletRouteTest.java b/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletRouteTest.java
new file mode 100644
index 00000000000..0e89d371553
--- /dev/null
+++ b/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletRouteTest.java
@@ -0,0 +1,112 @@
+/*
+ * 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.component.kamelet.springboot;
+
+import java.util.UUID;
+
+import org.apache.camel.FailedToCreateRouteException;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.jupiter.api.Test;
+import org.apache.camel.spring.boot.CamelAutoConfiguration;
+import org.apache.camel.FluentProducerTemplate;
+import org.apache.camel.CamelContext;
+
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.annotation.Bean;
+import org.springframework.test.annotation.DirtiesContext;
+import org.apache.camel.test.spring.junit5.CamelSpringBootTest;
+
+@DirtiesContext
+@CamelSpringBootTest
+@SpringBootTest(
+ classes = {
+ CamelAutoConfiguration.class,
+ KameletRouteTest.class,
+ }
+)
+
+public class KameletRouteTest {
+
+ @Autowired
+ private CamelContext context;
+
+ @Autowired
+ FluentProducerTemplate fluentTemplate;
+
+ @Test
+ public void testSingle() {
+ String body = UUID.randomUUID().toString();
+
+ assertThat(
+ fluentTemplate.toF("direct:single").withBody(body).request(String.class)).isEqualTo("a-" + body);
+ }
+
+ @Test
+ public void testChain() {
+ String body = UUID.randomUUID().toString();
+
+ assertThat(
+ fluentTemplate.toF("direct:chain").withBody(body).request(String.class)).isEqualTo("b-a-" + body);
+ }
+
+ @Test
+ public void duplicateRouteId() {
+ RouteBuilder rb = new RouteBuilder(context) {
+ @Override
+ public void configure() {
+ from("direct:start")
+ .to("kamelet:echo/test?prefix=test");
+ }
+ };
+
+ assertThrows(FailedToCreateRouteException.class, () -> rb.addRoutesToCamelContext(context));
+ }
+
+ // **********************************************
+ //
+ // test set-up
+ //
+ // **********************************************
+
+ @Bean
+ protected RoutesBuilder createRouteBuilder() {
+ return new RouteBuilder() {
+ @Override
+ public void configure() {
+ routeTemplate("echo")
+ .templateParameter("prefix")
+ .from("kamelet:source")
+ .setBody().simple("{{prefix}}-${body}");
+
+ from("direct:single").routeId("test")
+ .to("kamelet:echo?prefix=a")
+ .log("${body}");
+
+ from("direct:chain")
+ .to("kamelet:echo/1?prefix=a")
+ .to("kamelet:echo/2?prefix=b")
+ .log("${body}");
+ }
+ };
+ }
+}
\ No newline at end of file
diff --git a/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletToDTest.java b/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletToDTest.java
new file mode 100644
index 00000000000..4fa53aba85d
--- /dev/null
+++ b/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletToDTest.java
@@ -0,0 +1,91 @@
+/*
+ * 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.component.kamelet.springboot;
+
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.jupiter.api.Test;
+import org.apache.camel.spring.boot.CamelAutoConfiguration;
+import org.apache.camel.EndpointInject;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.component.mock.MockEndpoint;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.annotation.Bean;
+import org.springframework.test.annotation.DirtiesContext;
+import org.apache.camel.test.spring.junit5.CamelSpringBootTest;
+
+@DirtiesContext
+@CamelSpringBootTest
+@SpringBootTest(
+ classes = {
+ CamelAutoConfiguration.class,
+ KameletToDTest.class,
+ }
+)
+
+public class KameletToDTest {
+
+ @Autowired
+ ProducerTemplate template;
+
+ @EndpointInject("mock:foo")
+ MockEndpoint mock1;
+
+ @EndpointInject("mock:bar")
+ MockEndpoint mock2;
+
+ @EndpointInject("mock:result")
+ MockEndpoint mock;
+
+ @Test
+ public void testToD() throws Exception {
+ mock1.expectedBodiesReceived("A");
+ mock2.expectedBodiesReceived("B");
+
+ template.sendBody("direct:foo", "A");
+ template.sendBody("direct:bar", "B");
+
+ mock.assertIsSatisfied();
+ }
+
+ // **********************************************
+ //
+ // test set-up
+ //
+ // **********************************************
+
+ @Bean
+ protected RoutesBuilder createRouteBuilder() {
+ return new RouteBuilder() {
+ @Override
+ public void configure() {
+ routeTemplate("broker")
+ .templateParameter("queue")
+ .from("kamelet:source")
+ .toD("mock:{{queue}}");
+
+ from("direct:foo")
+ .kamelet("broker?queue=foo");
+
+ from("direct:bar")
+ .kamelet("broker?queue=bar");
+ }
+ };
+ }
+}
\ No newline at end of file
diff --git a/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletUoWIssueTest.java b/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletUoWIssueTest.java
new file mode 100644
index 00000000000..002887f460b
--- /dev/null
+++ b/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletUoWIssueTest.java
@@ -0,0 +1,98 @@
+/*
+ * 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.component.kamelet.springboot;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.ExtendedExchange;
+import org.apache.camel.Processor;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.support.SynchronizationAdapter;
+import org.junit.jupiter.api.Test;
+import org.apache.camel.spring.boot.CamelAutoConfiguration;
+import org.apache.camel.EndpointInject;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.component.mock.MockEndpoint;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.annotation.Bean;
+import org.springframework.test.annotation.DirtiesContext;
+import org.apache.camel.test.spring.junit5.CamelSpringBootTest;
+
+@DirtiesContext
+@CamelSpringBootTest
+@SpringBootTest(
+ classes = {
+ CamelAutoConfiguration.class,
+ KameletUoWIssueTest.class,
+ }
+)
+
+public class KameletUoWIssueTest {
+
+ @Autowired
+ ProducerTemplate template;
+
+ @EndpointInject("mock:foo")
+ MockEndpoint mock1;
+
+ @EndpointInject("mock:result")
+ MockEndpoint mock;
+
+ @Test
+ public void testUoW() throws Exception {
+ mock1.expectedBodiesReceived("A", "Done");
+
+ template.sendBody("direct:foo", "A");
+
+ mock.assertIsSatisfied();
+ }
+
+ // **********************************************
+ //
+ // test set-up
+ //
+ // **********************************************
+
+ @Bean
+ protected RoutesBuilder createRouteBuilder() {
+ return new RouteBuilder() {
+ @Override
+ public void configure() {
+ routeTemplate("broker")
+ .templateParameter("queue")
+ .from("kamelet:source")
+ .process(new Processor() {
+ @Override
+ public void process(Exchange exchange) {
+ exchange.adapt(ExtendedExchange.class).addOnCompletion(new SynchronizationAdapter() {
+ @Override
+ public void onDone(Exchange exchange) {
+ super.onDone(exchange);
+ template.sendBody("mock:foo", "Done");
+ }
+ });
+ }
+ }).to("mock:{{queue}}");
+
+ from("direct:foo")
+ .to("kamelet:broker?queue=foo");
+ }
+ };
+ }
+}
\ No newline at end of file
diff --git a/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletValidationTest.java b/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletValidationTest.java
new file mode 100644
index 00000000000..f9251fb165c
--- /dev/null
+++ b/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletValidationTest.java
@@ -0,0 +1,69 @@
+/*
+ * 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.component.kamelet.springboot;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.RuntimeCamelException;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.spring.boot.CamelAutoConfiguration;
+import org.apache.camel.test.spring.junit5.CamelSpringBootTest;
+
+import org.junit.jupiter.api.Test;
+import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.annotation.Bean;
+import org.springframework.test.annotation.DirtiesContext;
+
+@DirtiesContext
+@CamelSpringBootTest
+@SpringBootTest(
+ classes = {
+ CamelAutoConfiguration.class,
+ KameletValidationTest.class,
+ }
+)
+public class KameletValidationTest {
+
+ @Autowired
+ private CamelContext context;
+
+ @Test
+ public void validation() throws Exception {
+ assertThatExceptionOfType(RuntimeCamelException.class)
+ .isThrownBy(this::addRoute)
+ .withRootCauseExactlyInstanceOf(IllegalArgumentException.class)
+ .havingRootCause()
+ .withMessageContaining("bodyValue").withMessageContaining("setBody");
+ }
+
+ void addRoute() throws Exception {
+ context.addRoutes(new RouteBuilder() {
+ @Override
+ public void configure() {
+ routeTemplate("setBody")
+ .templateParameter("bodyValue")
+ .from("kamelet:source")
+ .setBody().constant("{{bodyValue}}");
+
+ from("direct:start")
+ .to("kamelet:setBody/test");
+ }
+ });
+ }
+}
\ No newline at end of file
diff --git a/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletWireTapTest.java b/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletWireTapTest.java
new file mode 100644
index 00000000000..95bcea38edf
--- /dev/null
+++ b/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/KameletWireTapTest.java
@@ -0,0 +1,91 @@
+/*
+ * 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.component.kamelet.springboot;
+
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.jupiter.api.Test;
+import org.apache.camel.spring.boot.CamelAutoConfiguration;
+import org.apache.camel.EndpointInject;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.component.mock.MockEndpoint;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.annotation.Bean;
+import org.springframework.test.annotation.DirtiesContext;
+import org.apache.camel.test.spring.junit5.CamelSpringBootTest;
+
+@DirtiesContext
+@CamelSpringBootTest
+@SpringBootTest(
+ classes = {
+ CamelAutoConfiguration.class,
+ KameletWireTapTest.class,
+ }
+)
+
+public class KameletWireTapTest {
+
+ @Autowired
+ ProducerTemplate template;
+
+ @EndpointInject("mock:foo")
+ MockEndpoint mock1;
+
+ @EndpointInject("mock:result")
+ MockEndpoint mock;
+
+ @EndpointInject("mock:bar")
+ MockEndpoint mock2;
+
+ @Test
+ public void testWireTap() throws Exception {
+ mock1.expectedBodiesReceived("A");
+ mock2.expectedBodiesReceived("B");
+
+ template.sendBody("direct:foo", "A");
+ template.sendBody("direct:bar", "B");
+
+ mock.assertIsSatisfied();
+ }
+
+ // **********************************************
+ //
+ // test set-up
+ //
+ // **********************************************
+
+ @Bean
+ protected RoutesBuilder createRouteBuilder() {
+ return new RouteBuilder() {
+ @Override
+ public void configure() {
+ routeTemplate("broker")
+ .templateParameter("queue")
+ .from("kamelet:source")
+ .wireTap("mock:{{queue}}");
+
+ from("direct:foo")
+ .kamelet("broker?queue=foo");
+
+ from("direct:bar")
+ .kamelet("broker?queue=bar");
+ }
+ };
+ }
+}
\ No newline at end of file
diff --git a/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/MyInjectBar.java b/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/MyInjectBar.java
new file mode 100644
index 00000000000..37dad69657e
--- /dev/null
+++ b/components-starter/camel-kamelet-starter/src/test/java/org/apache/camel/component/kamelet/springboot/MyInjectBar.java
@@ -0,0 +1,37 @@
+/*
+ * 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.component.kamelet.springboot;
+
+import org.apache.camel.PropertyInject;
+
+public class MyInjectBar {
+
+ @PropertyInject("{{bar}}")
+ private String bar;
+
+ public String getBar() {
+ return bar;
+ }
+
+ public void setBar(String bar) {
+ this.bar = bar;
+ }
+
+ public String where(String name) {
+ return "Hi " + name + " we are going to " + bar;
+ }
+}
\ No newline at end of file
diff --git a/components-starter/camel-kamelet-starter/src/test/resources/kamelet.test.properties b/components-starter/camel-kamelet-starter/src/test/resources/kamelet.test.properties
new file mode 100644
index 00000000000..50120f5e6c8
--- /dev/null
+++ b/components-starter/camel-kamelet-starter/src/test/resources/kamelet.test.properties
@@ -0,0 +1,26 @@
+## ---------------------------------------------------------------------------
+## 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.kamelet.setBody.bodyValue=from-template
+camel.kamelet.setBody.test.bodyValue=from-route
+camel.kamelet.setBody.someId.bodyValue=from-route-someId
+
+proxy.usr=u+sr
+proxy.pwd=p+wd
+raw.proxy.usr=RAW(u+sr)
+raw.proxy.pwd=RAW(p+wd)
+bodyValue=from-uri
\ No newline at end of file
diff --git a/components-starter/camel-kamelet-starter/src/test/resources/log4j2.properties b/components-starter/camel-kamelet-starter/src/test/resources/log4j2.properties
new file mode 100644
index 00000000000..a7342dd1c3c
--- /dev/null
+++ b/components-starter/camel-kamelet-starter/src/test/resources/log4j2.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.
+## ---------------------------------------------------------------------------
+
+appender.file.type = File
+appender.file.name = file
+appender.file.fileName = target/camel-kamelet-test.log
+appender.file.layout.type = PatternLayout
+appender.file.layout.pattern = %d [%-15.15t] %-5p %-30.30c{1} - %m%n
+
+appender.out.type = Console
+appender.out.name = out
+appender.out.layout.type = PatternLayout
+appender.out.layout.pattern = [%30.30t] %-30.30c{1} %-5p %m%n
+
+rootLogger.level = INFO
+rootLogger.appenderRef.file.ref = file
+#rootLogger.appenderRef.out.ref = out
+
+logger.camel-kamelet.name = org.apache.camel.component.kamelet
+logger.camel-kamelet.level = DEBUG
\ No newline at end of file
diff --git a/components-starter/camel-kamelet-starter/src/test/resources/mybar.groovy b/components-starter/camel-kamelet-starter/src/test/resources/mybar.groovy
new file mode 100644
index 00000000000..06393e55be5
--- /dev/null
+++ b/components-starter/camel-kamelet-starter/src/test/resources/mybar.groovy
@@ -0,0 +1,22 @@
+/*
+ * 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.
+ */
+import org.apache.camel.component.kamelet.springboot.MyInjectBar
+
+def bean = new MyInjectBar()
+// rtc is RouteTemplateContext
+bean.bar = rtc.getProperty('bar')
+return bean
\ No newline at end of file
diff --git a/components-starter/camel-kamelet-starter/src/test/resources/mybar.joor b/components-starter/camel-kamelet-starter/src/test/resources/mybar.joor
new file mode 100644
index 00000000000..08800518499
--- /dev/null
+++ b/components-starter/camel-kamelet-starter/src/test/resources/mybar.joor
@@ -0,0 +1,4 @@
+var bean = new org.apache.camel.component.kamelet.springboot.MyInjectBar();
+// rtc is RouteTemplateContext
+bean.setBar(rtc.getProperty('bar', String.class));
+return bean;
\ No newline at end of file
diff --git a/components-starter/camel-kamelet-starter/src/test/resources/upper-kamelet.xml b/components-starter/camel-kamelet-starter/src/test/resources/upper-kamelet.xml
new file mode 100644
index 00000000000..2d72415809a
--- /dev/null
+++ b/components-starter/camel-kamelet-starter/src/test/resources/upper-kamelet.xml
@@ -0,0 +1,23 @@
+<?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.
+-->
+<routeTemplate id="upper">
+ <route>
+ <from uri="kamelet:source"/>
+ <transform>
+ <simple>${body.toUpperCase()}</simple>
+ </transform>
+ </route>
+</routeTemplate>
\ No newline at end of file