You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by al...@apache.org on 2019/08/05 13:35:41 UTC
[camel] 08/09: CAMEL-13342: Implemented a first version of a
proof-of-concept for camel-test-spring/SpringExtension with JUnit 5
This is an automated email from the ASF dual-hosted git repository.
aldettinger pushed a commit to branch CAMEL-13342-JUNIT5-EXPLORATORY
in repository https://gitbox.apache.org/repos/asf/camel.git
commit b306b3475ca57166d320c2ec170ebf53b4680a0c
Author: aldettinger <al...@gmail.com>
AuthorDate: Wed Jul 17 17:20:28 2019 +0200
CAMEL-13342: Implemented a first version of a proof-of-concept for camel-test-spring/SpringExtension with JUnit 5
---
.../test/junit5/spring/CamelSpringRunner.java | 83 --------------
.../camel/test/junit5/spring/CamelSpringTest.java | 39 +++++++
.../patterns/DebugSpringCamelContextTest.java | 40 +++++++
.../test/junit5/patterns/DebugSpringTest.java | 83 ++++++++++++++
.../camel/test/junit5/patterns/MyProduceBean.java | 41 +++++++
.../camel/test/junit5/patterns/MySender.java | 25 +++++
.../test/junit5/patterns/ProduceBeanTest.java | 42 +++++++
.../junit5/patterns/ProducerBeanInjectTest.java | 40 +++++++
.../camel/test/junit5/patterns/SimpleMockTest.java | 63 +++++++++++
.../spring/CamelSpringActiveProfileTest.java | 56 +++++++++
...CamelSpringDisableJmxInheritedOverrideTest.java | 32 ++++++
.../spring/CamelSpringDisableJmxInheritedTest.java | 21 ++++
.../junit5/spring/CamelSpringDisableJmxTest.java | 33 ++++++
.../spring/CamelSpringExcludeRoutesTest.java | 32 ++++++
.../CamelSpringMockEndpointsAndSkipTest.java | 57 ++++++++++
.../spring/CamelSpringMockEndpointsTest.java | 58 ++++++++++
...ingOverridePropertiesForPropertyInjectTest.java | 54 +++++++++
.../spring/CamelSpringOverridePropertiesTest.java | 69 ++++++++++++
.../test/junit5/spring/CamelSpringPlainTest.java | 125 +++++++++++++++++++++
.../CamelSpringPropertiesLocationElementTest.java | 64 +++++++++++
...amelSpringProvidesBreakpointInherritedTest.java | 22 ++++
.../spring/CamelSpringProvidesBreakpointTest.java | 67 +++++++++++
...lSpringRouteProcessorDumpRouteCoverageTest.java | 57 ++++++++++
...SpringShutdownTimeoutInheritedOverrideTest.java | 35 ++++++
.../CamelSpringShutdownTimeoutInheritedTest.java | 22 ++++
.../spring/CamelSpringShutdownTimeoutTest.java | 35 ++++++
.../spring/CamelSpringTestPropertySourceTest.java | 46 ++++++++
.../CamelSpringTestSupportActiveProfileTest.java | 51 +++++++++
.../spring/CamelSpringUseAdviceWithTest.java | 52 +++++++++
.../spring/TestPropertyInjectRouteBuilder.java | 33 ++++++
.../camel/test/junit5/spring/TestRouteBuilder.java | 30 +++++
...InterceptSendToEndpointWithLoadbalancerTest.xml | 32 ++++++
.../junit5/issues/AdviceWithOnCompletionTest.xml | 39 +++++++
.../AdviceWithOnExceptionMultipleIssueTest.xml | 49 ++++++++
.../junit5/issues/MockEndpointsAndSkipTest.xml | 37 ++++++
.../test/junit5/patterns/ProduceBeanInjectTest.xml | 39 +++++++
.../camel/test/junit5/patterns/ProduceBeanTest.xml | 35 ++++++
.../camel/test/junit5/patterns/SimpleMockTest.xml | 33 ++++++
.../test/junit5/patterns/applicationContext.xml | 40 +++++++
.../CamelSpringActiveProfileTest-context.xml | 43 +++++++
...ridePropertiesForPropertyInjectTest-context.xml | 36 ++++++
.../CamelSpringOverridePropertiesTest-context.xml | 42 +++++++
.../junit5/spring/CamelSpringPlainTest-context.xml | 56 +++++++++
...SpringPropertiesLocationElementTest-context.xml | 49 ++++++++
.../CamelSpringTestPropertySourceTest-context.xml | 41 +++++++
.../properties-location-element-1.properties | 18 +++
.../properties-location-element-2.properties | 18 +++
.../properties-location-element-3.properties | 18 +++
.../camel/test/junit5/spring/test.properties | 20 ++++
49 files changed, 2069 insertions(+), 83 deletions(-)
diff --git a/components/camel-test-spring/src/main/java/org/apache/camel/test/junit5/spring/CamelSpringRunner.java b/components/camel-test-spring/src/main/java/org/apache/camel/test/junit5/spring/CamelSpringRunner.java
deleted file mode 100644
index d64ce29..0000000
--- a/components/camel-test-spring/src/main/java/org/apache/camel/test/junit5/spring/CamelSpringRunner.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.test.junit5.spring;
-
-import java.util.List;
-
-import org.junit.runners.model.InitializationError;
-import org.springframework.test.context.TestContextManager;
-import org.springframework.test.context.TestExecutionListener;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-
-/**
- * An implementation bringing the functionality of {@link org.apache.camel.test.spring.CamelSpringTestSupport} to
- * Spring Test based test cases. This approach allows developers to implement tests
- * for their Spring based applications/routes using the typical Spring Test conventions
- * for test development.
- */
-public class CamelSpringRunner extends SpringJUnit4ClassRunner {
-
- public CamelSpringRunner(Class<?> clazz) throws InitializationError {
- super(clazz);
- }
-
- /**
- * Returns the specialized manager instance that provides tight integration between Camel testing
- * features and Spring.
- *
- * @return a new instance of {@link CamelTestContextManager}.
- */
- @Override
- protected TestContextManager createTestContextManager(Class<?> clazz) {
- return new CamelTestContextManager(clazz);
- }
-
- /**
- * An implementation providing additional integration between Spring Test and Camel
- * testing features.
- */
- public static final class CamelTestContextManager extends TestContextManager {
-
- public CamelTestContextManager(Class<?> testClass) {
- super(testClass);
-
- // is Camel already registered
- if (!alreadyRegistered()) {
- // inject Camel first, and then disable jmx and add the stop-watch
- List<TestExecutionListener> list = getTestExecutionListeners();
- list.add(0, new CamelSpringTestContextLoaderTestExecutionListener());
- list.add(1, new DisableJmxTestExecutionListener());
- list.add(2, new StopWatchTestExecutionListener());
- }
- }
-
- private boolean alreadyRegistered() {
- List<TestExecutionListener> list = getTestExecutionListeners();
- if (list != null) {
- for (TestExecutionListener listener : list) {
- if (listener instanceof CamelSpringTestContextLoaderTestExecutionListener) {
- return true;
- }
- }
- }
-
- return false;
- }
-
- }
-
-}
diff --git a/components/camel-test-spring/src/main/java/org/apache/camel/test/junit5/spring/CamelSpringTest.java b/components/camel-test-spring/src/main/java/org/apache/camel/test/junit5/spring/CamelSpringTest.java
new file mode 100644
index 0000000..b43e77f
--- /dev/null
+++ b/components/camel-test-spring/src/main/java/org/apache/camel/test/junit5/spring/CamelSpringTest.java
@@ -0,0 +1,39 @@
+/*
+ * 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.test.junit5.spring;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.springframework.test.context.BootstrapWith;
+import org.springframework.test.context.TestExecutionListeners;
+import org.springframework.test.context.junit.jupiter.SpringExtension;
+
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.TYPE})
+@ExtendWith(SpringExtension.class)
+@BootstrapWith(CamelTestContextBootstrapper.class)
+@TestExecutionListeners(value = {CamelSpringTestContextLoaderTestExecutionListener.class, DisableJmxTestExecutionListener.class,
+ StopWatchTestExecutionListener.class}, mergeMode = TestExecutionListeners.MergeMode.MERGE_WITH_DEFAULTS)
+public @interface CamelSpringTest {
+
+}
diff --git a/components/camel-test-spring/src/test/java/org/apache/camel/test/junit5/patterns/DebugSpringCamelContextTest.java b/components/camel-test-spring/src/test/java/org/apache/camel/test/junit5/patterns/DebugSpringCamelContextTest.java
new file mode 100644
index 0000000..340dc22
--- /dev/null
+++ b/components/camel-test-spring/src/test/java/org/apache/camel/test/junit5/patterns/DebugSpringCamelContextTest.java
@@ -0,0 +1,40 @@
+/*
+ * 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.test.junit5.patterns;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.springframework.context.support.AbstractApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+
+public class DebugSpringCamelContextTest extends DebugSpringTest {
+
+ @Override
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ @Override
+ public void configure() throws Exception {
+ // there is no route to be used
+ }
+ };
+ }
+
+ @Override
+ protected AbstractApplicationContext createApplicationContext() {
+ return new ClassPathXmlApplicationContext("org/apache/camel/test/junit5/patterns/applicationContext.xml");
+ }
+}
diff --git a/components/camel-test-spring/src/test/java/org/apache/camel/test/junit5/patterns/DebugSpringTest.java b/components/camel-test-spring/src/test/java/org/apache/camel/test/junit5/patterns/DebugSpringTest.java
new file mode 100644
index 0000000..c9138a3
--- /dev/null
+++ b/components/camel-test-spring/src/test/java/org/apache/camel/test/junit5/patterns/DebugSpringTest.java
@@ -0,0 +1,83 @@
+/*
+ * 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.test.junit5.patterns;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.model.ProcessorDefinition;
+import org.apache.camel.test.junit5.spring.CamelSpringTestSupport;
+import org.junit.jupiter.api.Test;
+import org.springframework.context.support.AbstractApplicationContext;
+import org.springframework.context.support.GenericApplicationContext;
+
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+public class DebugSpringTest extends CamelSpringTestSupport {
+ private boolean debugged;
+
+ @Override
+ public boolean isUseDebugger() {
+ // must enable debugger
+ return true;
+ }
+
+ @Override
+ protected void debugBefore(Exchange exchange, Processor processor,
+ ProcessorDefinition<?> definition, String id, String shortName) {
+ // this method is invoked before we are about to enter the given processor
+ // from your Java editor you can just add a breakpoint in the code line below
+ log.info("Before " + definition + " with body " + exchange.getIn().getBody());
+ debugged = true;
+ }
+
+
+ @Test
+ public void testDebugger() throws Exception {
+ // set mock expectations
+ getMockEndpoint("mock:a").expectedMessageCount(1);
+ getMockEndpoint("mock:b").expectedMessageCount(1);
+
+ // send a message
+ template.sendBody("direct:start", "World");
+
+ // assert mocks
+ assertMockEndpointsSatisfied();
+ assertTrue(debugged, "The debugger is not called!");
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ @Override
+ public void configure() throws Exception {
+ // this is the route we want to debug
+ from("direct:start")
+ .to("mock:a")
+ .transform(body().prepend("Hello "))
+ .to("mock:b");
+ }
+ };
+ }
+
+
+ @Override
+ protected AbstractApplicationContext createApplicationContext() {
+ return new GenericApplicationContext();
+ }
+
+}
diff --git a/components/camel-test-spring/src/test/java/org/apache/camel/test/junit5/patterns/MyProduceBean.java b/components/camel-test-spring/src/test/java/org/apache/camel/test/junit5/patterns/MyProduceBean.java
new file mode 100644
index 0000000..ba33b34
--- /dev/null
+++ b/components/camel-test-spring/src/test/java/org/apache/camel/test/junit5/patterns/MyProduceBean.java
@@ -0,0 +1,41 @@
+/*
+ * 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.test.junit5.patterns;
+
+import org.apache.camel.EndpointInject;
+import org.apache.camel.Produce;
+import org.apache.camel.ProducerTemplate;
+
+/**
+ *
+ */
+public class MyProduceBean {
+
+ @Produce("mock:result")
+ MySender sender;
+
+ @EndpointInject("direct:start")
+ ProducerTemplate template;
+
+ public void doSomething(String body) {
+ sender.send(body);
+ }
+
+ public ProducerTemplate getProducerTemplate() {
+ return template;
+ }
+}
diff --git a/components/camel-test-spring/src/test/java/org/apache/camel/test/junit5/patterns/MySender.java b/components/camel-test-spring/src/test/java/org/apache/camel/test/junit5/patterns/MySender.java
new file mode 100644
index 0000000..0188296
--- /dev/null
+++ b/components/camel-test-spring/src/test/java/org/apache/camel/test/junit5/patterns/MySender.java
@@ -0,0 +1,25 @@
+/*
+ * 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.test.junit5.patterns;
+
+/**
+ *
+ */
+public interface MySender {
+
+ void send(String body);
+}
diff --git a/components/camel-test-spring/src/test/java/org/apache/camel/test/junit5/patterns/ProduceBeanTest.java b/components/camel-test-spring/src/test/java/org/apache/camel/test/junit5/patterns/ProduceBeanTest.java
new file mode 100644
index 0000000..101d97a
--- /dev/null
+++ b/components/camel-test-spring/src/test/java/org/apache/camel/test/junit5/patterns/ProduceBeanTest.java
@@ -0,0 +1,42 @@
+/*
+ * 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.test.junit5.patterns;
+
+import org.apache.camel.test.junit5.spring.CamelSpringTestSupport;
+import org.junit.jupiter.api.Test;
+import org.springframework.context.support.AbstractApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+/**
+ *
+ */
+public class ProduceBeanTest extends CamelSpringTestSupport {
+
+ @Test
+ public void testProduceBean() throws Exception {
+ getMockEndpoint("mock:result").expectedMessageCount(1);
+
+ template.sendBody("direct:start", "Hello World");
+
+ assertMockEndpointsSatisfied();
+ }
+
+ @Override
+ protected AbstractApplicationContext createApplicationContext() {
+ return new ClassPathXmlApplicationContext("org/apache/camel/test/junit5/patterns/ProduceBeanTest.xml");
+ }
+}
diff --git a/components/camel-test-spring/src/test/java/org/apache/camel/test/junit5/patterns/ProducerBeanInjectTest.java b/components/camel-test-spring/src/test/java/org/apache/camel/test/junit5/patterns/ProducerBeanInjectTest.java
new file mode 100644
index 0000000..147847c
--- /dev/null
+++ b/components/camel-test-spring/src/test/java/org/apache/camel/test/junit5/patterns/ProducerBeanInjectTest.java
@@ -0,0 +1,40 @@
+/*
+ * 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.test.junit5.patterns;
+
+import org.apache.camel.test.junit5.spring.CamelSpringTestSupport;
+import org.junit.jupiter.api.Test;
+import org.springframework.context.support.AbstractApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+
+public class ProducerBeanInjectTest extends CamelSpringTestSupport {
+
+ @Test
+ public void checkProducerBeanInjection() {
+ MyProduceBean bean = applicationContext.getBean("myProduceBean", MyProduceBean.class);
+ assertNotNull(bean.getProducerTemplate(), "The producerTemplate should not be null.");
+ assertEquals(bean.getProducerTemplate().requestBody("Camel"), "Camel rocks!", "Get a wrong response");
+ }
+
+ protected AbstractApplicationContext createApplicationContext() {
+ return new ClassPathXmlApplicationContext("org/apache/camel/test/junit5/patterns/ProduceBeanInjectTest.xml");
+ }
+
+}
diff --git a/components/camel-test-spring/src/test/java/org/apache/camel/test/junit5/patterns/SimpleMockTest.java b/components/camel-test-spring/src/test/java/org/apache/camel/test/junit5/patterns/SimpleMockTest.java
new file mode 100644
index 0000000..a693ad9
--- /dev/null
+++ b/components/camel-test-spring/src/test/java/org/apache/camel/test/junit5/patterns/SimpleMockTest.java
@@ -0,0 +1,63 @@
+/*
+ * 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.test.junit5.patterns;
+
+import org.apache.camel.EndpointInject;
+import org.apache.camel.Produce;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.junit5.spring.CamelSpringTestSupport;
+import org.junit.jupiter.api.Test;
+import org.springframework.context.support.AbstractApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+public class SimpleMockTest extends CamelSpringTestSupport {
+
+ @EndpointInject("mock:result")
+ protected MockEndpoint resultEndpoint;
+
+ @Produce("direct:start")
+ protected ProducerTemplate template;
+
+ @Override
+ protected AbstractApplicationContext createApplicationContext() {
+ return new ClassPathXmlApplicationContext("org/apache/camel/test/junit5/patterns/SimpleMockTest.xml");
+ }
+
+ @Test
+ public void testMock() throws Exception {
+ String expectedBody = "Hello World";
+
+ resultEndpoint.expectedBodiesReceived(expectedBody);
+
+ template.sendBodyAndHeader(expectedBody, "foo", "bar");
+
+ resultEndpoint.assertIsSatisfied();
+ }
+
+ @Test
+ public void testMockAgain() throws Exception {
+ String expectedBody = "Bye World";
+
+ resultEndpoint.expectedBodiesReceived(expectedBody);
+
+ template.sendBodyAndHeader(expectedBody, "foo", "bar");
+
+ resultEndpoint.assertIsSatisfied();
+ }
+
+}
diff --git a/components/camel-test-spring/src/test/java/org/apache/camel/test/junit5/spring/CamelSpringActiveProfileTest.java b/components/camel-test-spring/src/test/java/org/apache/camel/test/junit5/spring/CamelSpringActiveProfileTest.java
new file mode 100644
index 0000000..64bb894
--- /dev/null
+++ b/components/camel-test-spring/src/test/java/org/apache/camel/test/junit5/spring/CamelSpringActiveProfileTest.java
@@ -0,0 +1,56 @@
+/*
+ * 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.test.junit5.spring;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.Produce;
+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.test.context.ActiveProfiles;
+import org.springframework.test.context.ContextConfiguration;
+
+// START SNIPPET: e1
+
+/**
+ * Spring style testing with annotations to configure and setup the test.
+ * <p/>
+ * As we do next extend any base test class, we need to inject our resources
+ * for testing such as the {@link CamelContext} and {@link ProducerTemplate}.
+ */
+@ContextConfiguration
+@ActiveProfiles("test")
+@CamelSpringTest
+public class CamelSpringActiveProfileTest {
+
+ @Autowired
+ protected CamelContext camelContext;
+
+ @Produce(value = "direct:start", context = "camelContext")
+ protected ProducerTemplate start;
+
+ @Test
+ public void testLoadActiveProfile() throws InterruptedException {
+ MockEndpoint mock = camelContext.getEndpoint("mock:test", MockEndpoint.class);
+ mock.expectedBodiesReceived("Hello World");
+ start.sendBody("World");
+ mock.assertIsSatisfied();
+ }
+
+}
+// END SNIPPET: e1
diff --git a/components/camel-test-spring/src/test/java/org/apache/camel/test/junit5/spring/CamelSpringDisableJmxInheritedOverrideTest.java b/components/camel-test-spring/src/test/java/org/apache/camel/test/junit5/spring/CamelSpringDisableJmxInheritedOverrideTest.java
new file mode 100644
index 0000000..d40c4fa
--- /dev/null
+++ b/components/camel-test-spring/src/test/java/org/apache/camel/test/junit5/spring/CamelSpringDisableJmxInheritedOverrideTest.java
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.test.junit5.spring;
+
+import org.apache.camel.impl.engine.DefaultManagementStrategy;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+@DisableJmx
+public class CamelSpringDisableJmxInheritedOverrideTest
+ extends CamelSpringDisableJmxTest {
+
+ @Test
+ public void testJmx() throws Exception {
+ assertEquals(DefaultManagementStrategy.class, camelContext.getManagementStrategy().getClass());
+ }
+}
diff --git a/components/camel-test-spring/src/test/java/org/apache/camel/test/junit5/spring/CamelSpringDisableJmxInheritedTest.java b/components/camel-test-spring/src/test/java/org/apache/camel/test/junit5/spring/CamelSpringDisableJmxInheritedTest.java
new file mode 100644
index 0000000..e57afdf
--- /dev/null
+++ b/components/camel-test-spring/src/test/java/org/apache/camel/test/junit5/spring/CamelSpringDisableJmxInheritedTest.java
@@ -0,0 +1,21 @@
+/*
+ * 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.test.junit5.spring;
+
+public class CamelSpringDisableJmxInheritedTest
+ extends CamelSpringDisableJmxTest {
+}
diff --git a/components/camel-test-spring/src/test/java/org/apache/camel/test/junit5/spring/CamelSpringDisableJmxTest.java b/components/camel-test-spring/src/test/java/org/apache/camel/test/junit5/spring/CamelSpringDisableJmxTest.java
new file mode 100644
index 0000000..c9000c7
--- /dev/null
+++ b/components/camel-test-spring/src/test/java/org/apache/camel/test/junit5/spring/CamelSpringDisableJmxTest.java
@@ -0,0 +1,33 @@
+/*
+ * 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.test.junit5.spring;
+
+import org.apache.camel.management.JmxManagementStrategy;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+@DisableJmx(false)
+public class CamelSpringDisableJmxTest
+ extends CamelSpringPlainTest {
+
+ @Test
+ @Override
+ public void testJmx() throws Exception {
+ assertEquals(JmxManagementStrategy.class, camelContext.getManagementStrategy().getClass());
+ }
+}
diff --git a/components/camel-test-spring/src/test/java/org/apache/camel/test/junit5/spring/CamelSpringExcludeRoutesTest.java b/components/camel-test-spring/src/test/java/org/apache/camel/test/junit5/spring/CamelSpringExcludeRoutesTest.java
new file mode 100644
index 0000000..5a0c632
--- /dev/null
+++ b/components/camel-test-spring/src/test/java/org/apache/camel/test/junit5/spring/CamelSpringExcludeRoutesTest.java
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.test.junit5.spring;
+
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertNull;
+
+@ExcludeRoutes(TestRouteBuilder.class)
+public class CamelSpringExcludeRoutesTest
+ extends CamelSpringPlainTest {
+
+ @Override
+ @Test
+ public void testExcludedRoute() {
+ assertNull(camelContext.getRoute("excludedRoute"));
+ }
+}
diff --git a/components/camel-test-spring/src/test/java/org/apache/camel/test/junit5/spring/CamelSpringMockEndpointsAndSkipTest.java b/components/camel-test-spring/src/test/java/org/apache/camel/test/junit5/spring/CamelSpringMockEndpointsAndSkipTest.java
new file mode 100644
index 0000000..87af61c
--- /dev/null
+++ b/components/camel-test-spring/src/test/java/org/apache/camel/test/junit5/spring/CamelSpringMockEndpointsAndSkipTest.java
@@ -0,0 +1,57 @@
+/*
+ * 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.test.junit5.spring;
+
+import org.apache.camel.EndpointInject;
+import org.apache.camel.ServiceStatus;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.component.seda.SedaEndpoint;
+import org.apache.camel.spi.InterceptSendToEndpoint;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+
+@MockEndpointsAndSkip("{{mock.skip}}")
+public class CamelSpringMockEndpointsAndSkipTest
+ extends CamelSpringPlainTest {
+
+ @EndpointInject(value = "mock:seda:context2.seda", context = "camelContext2")
+ protected MockEndpoint mock;
+
+ @EndpointInject(value = "seda:context2.seda", context = "camelContext2")
+ private InterceptSendToEndpoint original;
+
+ @Test
+ @Override
+ public void testPositive() throws Exception {
+ assertEquals(ServiceStatus.Started, camelContext.getStatus());
+ assertEquals(ServiceStatus.Started, camelContext2.getStatus());
+
+ mockA.expectedBodiesReceived("David");
+ mockB.expectedBodiesReceived("Hello David");
+ mock.expectedBodiesReceived("Hello David");
+
+ start.sendBody("David");
+ start2.sendBody("David");
+
+ MockEndpoint.assertIsSatisfied(camelContext);
+ MockEndpoint.assertIsSatisfied(camelContext2);
+ assertTrue(((SedaEndpoint) original.getOriginalEndpoint()).getExchanges().isEmpty(), "Original endpoint was invoked");
+ }
+}
diff --git a/components/camel-test-spring/src/test/java/org/apache/camel/test/junit5/spring/CamelSpringMockEndpointsTest.java b/components/camel-test-spring/src/test/java/org/apache/camel/test/junit5/spring/CamelSpringMockEndpointsTest.java
new file mode 100644
index 0000000..34708e7
--- /dev/null
+++ b/components/camel-test-spring/src/test/java/org/apache/camel/test/junit5/spring/CamelSpringMockEndpointsTest.java
@@ -0,0 +1,58 @@
+/*
+ * 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.test.junit5.spring;
+
+import org.apache.camel.EndpointInject;
+import org.apache.camel.ServiceStatus;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.component.seda.SedaEndpoint;
+import org.apache.camel.spi.InterceptSendToEndpoint;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+@MockEndpoints("seda:context2.seda")
+public class CamelSpringMockEndpointsTest
+ extends CamelSpringPlainTest {
+
+ @EndpointInject(value = "mock:seda:context2.seda", context = "camelContext2")
+ protected MockEndpoint mock;
+
+ @EndpointInject(value = "seda:context2.seda", context = "camelContext2")
+ private InterceptSendToEndpoint original;
+
+ @Test
+ @Override
+ public void testPositive() throws Exception {
+
+ assertEquals(ServiceStatus.Started, camelContext.getStatus());
+ assertEquals(ServiceStatus.Started, camelContext2.getStatus());
+
+ mockA.expectedBodiesReceived("David");
+ mockB.expectedBodiesReceived("Hello David");
+ mockC.expectedBodiesReceived("David");
+ mock.expectedBodiesReceived("Hello David");
+
+ start.sendBody("David");
+ start2.sendBody("David");
+
+ MockEndpoint.assertIsSatisfied(camelContext);
+ MockEndpoint.assertIsSatisfied(camelContext2);
+ assertTrue(((SedaEndpoint) original.getOriginalEndpoint()).getExchanges().size() == 1, "Original endpoint should be invoked");
+ }
+}
diff --git a/components/camel-test-spring/src/test/java/org/apache/camel/test/junit5/spring/CamelSpringOverridePropertiesForPropertyInjectTest.java b/components/camel-test-spring/src/test/java/org/apache/camel/test/junit5/spring/CamelSpringOverridePropertiesForPropertyInjectTest.java
new file mode 100644
index 0000000..18cef45
--- /dev/null
+++ b/components/camel-test-spring/src/test/java/org/apache/camel/test/junit5/spring/CamelSpringOverridePropertiesForPropertyInjectTest.java
@@ -0,0 +1,54 @@
+/*
+ * 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.test.junit5.spring;
+
+import java.util.Properties;
+
+import org.apache.camel.Produce;
+import org.apache.camel.ProducerTemplate;
+import org.junit.jupiter.api.Test;
+import org.springframework.test.annotation.DirtiesContext;
+import org.springframework.test.context.ContextConfiguration;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.Is.is;
+
+@ContextConfiguration()
+@DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD)
+@CamelSpringTest
+public class CamelSpringOverridePropertiesForPropertyInjectTest {
+
+ private static final String EXPECTED_PROPERTY_VALUE = "The value is overriden";
+
+ @Produce(value = "direct:start-override-route")
+ private ProducerTemplate start;
+
+ @UseOverridePropertiesWithPropertiesComponent
+ public static Properties override() {
+ Properties answer = new Properties();
+ answer.put("property.to.override", EXPECTED_PROPERTY_VALUE);
+ return answer;
+ }
+
+ @Test
+ public void testOverride() throws Exception {
+ String response = start.requestBody((Object)"ignored", String.class);
+
+ assertThat(response, is(EXPECTED_PROPERTY_VALUE));
+ }
+
+}
diff --git a/components/camel-test-spring/src/test/java/org/apache/camel/test/junit5/spring/CamelSpringOverridePropertiesTest.java b/components/camel-test-spring/src/test/java/org/apache/camel/test/junit5/spring/CamelSpringOverridePropertiesTest.java
new file mode 100644
index 0000000..c87e110
--- /dev/null
+++ b/components/camel-test-spring/src/test/java/org/apache/camel/test/junit5/spring/CamelSpringOverridePropertiesTest.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.test.junit5.spring;
+
+import java.util.Properties;
+
+import org.apache.camel.EndpointInject;
+import org.apache.camel.Produce;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.junit.jupiter.api.Test;
+import org.springframework.test.annotation.DirtiesContext;
+import org.springframework.test.context.ContextConfiguration;
+
+@ContextConfiguration()
+// Put here to prevent Spring context caching across tests and test methods since some tests inherit
+// from this test and therefore use the same Spring context. Also because we want to reset the
+// Camel context and mock endpoints between test methods automatically.
+@DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD)
+@CamelSpringTest
+public class CamelSpringOverridePropertiesTest {
+
+ @Produce("direct:start")
+ private ProducerTemplate start;
+
+ @EndpointInject("mock:a")
+ private MockEndpoint mockA;
+
+ @EndpointInject("mock:test")
+ private MockEndpoint mockTest;
+
+ @EndpointInject("mock:foo")
+ private MockEndpoint mockFoo;
+
+ @UseOverridePropertiesWithPropertiesComponent
+ public static Properties override() {
+ Properties answer = new Properties();
+ answer.put("cool.end", "mock:foo");
+ return answer;
+ }
+
+ @Test
+ public void testOverride() throws Exception {
+ mockA.expectedBodiesReceived("Camel");
+ mockTest.expectedMessageCount(0);
+ mockFoo.expectedBodiesReceived("Hello Camel");
+
+ start.sendBody("Camel");
+
+ mockA.assertIsSatisfied();
+ mockTest.assertIsSatisfied();
+ mockFoo.assertIsSatisfied();
+ }
+
+}
diff --git a/components/camel-test-spring/src/test/java/org/apache/camel/test/junit5/spring/CamelSpringPlainTest.java b/components/camel-test-spring/src/test/java/org/apache/camel/test/junit5/spring/CamelSpringPlainTest.java
new file mode 100644
index 0000000..508e7b8
--- /dev/null
+++ b/components/camel-test-spring/src/test/java/org/apache/camel/test/junit5/spring/CamelSpringPlainTest.java
@@ -0,0 +1,125 @@
+/*
+ * 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.test.junit5.spring;
+
+import java.util.concurrent.TimeUnit;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.EndpointInject;
+import org.apache.camel.Produce;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.ServiceStatus;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.impl.engine.DefaultManagementStrategy;
+import org.apache.camel.util.StopWatch;
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.test.annotation.DirtiesContext;
+import org.springframework.test.annotation.DirtiesContext.ClassMode;
+import org.springframework.test.context.ContextConfiguration;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+
+// START SNIPPET: e1
+// tag::example[]
+@ContextConfiguration()
+// Put here to prevent Spring context caching across tests and test methods since some tests inherit
+// from this test and therefore use the same Spring context. Also because we want to reset the
+// Camel context and mock endpoints between test methods automatically.
+@DirtiesContext(classMode = ClassMode.AFTER_EACH_TEST_METHOD)
+@CamelSpringTest
+public class CamelSpringPlainTest {
+
+ @Autowired
+ protected CamelContext camelContext;
+
+ @Autowired
+ protected CamelContext camelContext2;
+
+ @EndpointInject(value = "mock:a", context = "camelContext")
+ protected MockEndpoint mockA;
+
+ @EndpointInject(value = "mock:b", context = "camelContext")
+ protected MockEndpoint mockB;
+
+ @EndpointInject(value = "mock:c", context = "camelContext2")
+ protected MockEndpoint mockC;
+
+ @Produce(value = "direct:start", context = "camelContext")
+ protected ProducerTemplate start;
+
+ @Produce(value = "direct:start2", context = "camelContext2")
+ protected ProducerTemplate start2;
+
+ @Test
+ public void testPositive() throws Exception {
+ assertEquals(ServiceStatus.Started, camelContext.getStatus());
+ assertEquals(ServiceStatus.Started, camelContext2.getStatus());
+
+ mockA.expectedBodiesReceived("David");
+ mockB.expectedBodiesReceived("Hello David");
+ mockC.expectedBodiesReceived("David");
+
+ start.sendBody("David");
+ start2.sendBody("David");
+
+ MockEndpoint.assertIsSatisfied(camelContext);
+ MockEndpoint.assertIsSatisfied(camelContext2);
+ }
+
+ @Test
+ public void testJmx() throws Exception {
+ assertEquals(DefaultManagementStrategy.class, camelContext.getManagementStrategy().getClass());
+ }
+
+ @Test
+ public void testShutdownTimeout() throws Exception {
+ assertEquals(10, camelContext.getShutdownStrategy().getTimeout());
+ assertEquals(TimeUnit.SECONDS, camelContext.getShutdownStrategy().getTimeUnit());
+ }
+
+ @Test
+ public void testStopwatch() {
+ StopWatch stopWatch = StopWatchTestExecutionListener.getStopWatch();
+
+ assertNotNull(stopWatch);
+ assertTrue(stopWatch.taken() < 100);
+ }
+
+ @Test
+ public void testExcludedRoute() {
+ assertNotNull(camelContext.getRoute("excludedRoute"));
+ }
+
+ @Test
+ public void testProvidesBreakpoint() {
+ assertNull(camelContext.getDebugger());
+ assertNull(camelContext2.getDebugger());
+ }
+
+ @Test
+ public void testRouteCoverage() throws Exception {
+ // noop
+ }
+
+}
+// end::example[]
+// END SNIPPET: e1
diff --git a/components/camel-test-spring/src/test/java/org/apache/camel/test/junit5/spring/CamelSpringPropertiesLocationElementTest.java b/components/camel-test-spring/src/test/java/org/apache/camel/test/junit5/spring/CamelSpringPropertiesLocationElementTest.java
new file mode 100644
index 0000000..a02fe71
--- /dev/null
+++ b/components/camel-test-spring/src/test/java/org/apache/camel/test/junit5/spring/CamelSpringPropertiesLocationElementTest.java
@@ -0,0 +1,64 @@
+/*
+ * 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.test.junit5.spring;
+
+import java.util.List;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.EndpointInject;
+import org.apache.camel.Produce;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.component.properties.PropertiesComponent;
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.test.annotation.DirtiesContext;
+import org.springframework.test.context.ContextConfiguration;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+
+@ContextConfiguration()
+@DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD)
+@CamelSpringTest
+public class CamelSpringPropertiesLocationElementTest {
+ @Autowired
+ protected CamelContext context;
+ @Produce
+ private ProducerTemplate producer;
+ @EndpointInject("mock:result")
+ private MockEndpoint mock;
+
+ @Test
+ public void testPropertiesLocationElement() throws Exception {
+ mock.expectedHeaderReceived("property-1", "property-value-1");
+ mock.expectedHeaderReceived("property-2", "property-value-2");
+ mock.expectedHeaderReceived("property-3", "property-value-3");
+
+ PropertiesComponent pc = context.getComponent("properties", PropertiesComponent.class);
+ assertNotNull(pc, "Properties component not defined");
+
+ List<String> locations = pc.getLocations();
+
+ assertNotNull(locations);
+ assertEquals(4, locations.size(), "Properties locations");
+
+ producer.sendBody("direct:start", null);
+
+ mock.assertIsSatisfied();
+ }
+}
diff --git a/components/camel-test-spring/src/test/java/org/apache/camel/test/junit5/spring/CamelSpringProvidesBreakpointInherritedTest.java b/components/camel-test-spring/src/test/java/org/apache/camel/test/junit5/spring/CamelSpringProvidesBreakpointInherritedTest.java
new file mode 100644
index 0000000..3154fae
--- /dev/null
+++ b/components/camel-test-spring/src/test/java/org/apache/camel/test/junit5/spring/CamelSpringProvidesBreakpointInherritedTest.java
@@ -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.
+ */
+package org.apache.camel.test.junit5.spring;
+
+public class CamelSpringProvidesBreakpointInherritedTest
+ extends CamelSpringProvidesBreakpointTest {
+
+}
diff --git a/components/camel-test-spring/src/test/java/org/apache/camel/test/junit5/spring/CamelSpringProvidesBreakpointTest.java b/components/camel-test-spring/src/test/java/org/apache/camel/test/junit5/spring/CamelSpringProvidesBreakpointTest.java
new file mode 100644
index 0000000..7889817
--- /dev/null
+++ b/components/camel-test-spring/src/test/java/org/apache/camel/test/junit5/spring/CamelSpringProvidesBreakpointTest.java
@@ -0,0 +1,67 @@
+/*
+ * 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.test.junit5.spring;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.NamedNode;
+import org.apache.camel.Processor;
+import org.apache.camel.processor.interceptor.BreakpointSupport;
+import org.apache.camel.spi.Breakpoint;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+public class CamelSpringProvidesBreakpointTest
+ extends CamelSpringPlainTest {
+
+ @ProvidesBreakpoint
+ public static Breakpoint createBreakpoint() {
+ return new TestBreakpoint();
+ }
+
+ @Test
+ @Override
+ public void testProvidesBreakpoint() {
+ assertNotNull(camelContext.getDebugger());
+ assertNotNull(camelContext2.getDebugger());
+
+ start.sendBody("David");
+
+ assertNotNull(camelContext.getDebugger());
+ assertNotNull(camelContext.getDebugger().getBreakpoints());
+ assertEquals(1, camelContext.getDebugger().getBreakpoints().size());
+
+ assertTrue(camelContext.getDebugger().getBreakpoints().get(0) instanceof TestBreakpoint);
+ assertTrue(((TestBreakpoint) camelContext.getDebugger().getBreakpoints().get(0)).isBreakpointHit());
+ }
+
+ private static final class TestBreakpoint extends BreakpointSupport {
+
+ private boolean breakpointHit;
+
+ @Override
+ public void beforeProcess(Exchange exchange, Processor processor, NamedNode definition) {
+ breakpointHit = true;
+ }
+
+ public boolean isBreakpointHit() {
+ return breakpointHit;
+ }
+ }
+}
diff --git a/components/camel-test-spring/src/test/java/org/apache/camel/test/junit5/spring/CamelSpringRouteProcessorDumpRouteCoverageTest.java b/components/camel-test-spring/src/test/java/org/apache/camel/test/junit5/spring/CamelSpringRouteProcessorDumpRouteCoverageTest.java
new file mode 100644
index 0000000..16e4957
--- /dev/null
+++ b/components/camel-test-spring/src/test/java/org/apache/camel/test/junit5/spring/CamelSpringRouteProcessorDumpRouteCoverageTest.java
@@ -0,0 +1,57 @@
+/*
+ * 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.test.junit5.spring;
+
+import java.io.File;
+
+import org.apache.camel.management.JmxManagementStrategy;
+import org.apache.camel.test.junit5.TestSupport;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+@EnableRouteCoverage
+public class CamelSpringRouteProcessorDumpRouteCoverageTest extends CamelSpringPlainTest {
+
+ @BeforeAll
+ public static void prepareFiles() throws Exception {
+ TestSupport.deleteDirectory("target/camel-route-coverage");
+ }
+
+ @Test
+ @Disabled("@TODO: This test seems to run alone but not amongst other tests")
+ public void testJmx() throws Exception {
+ // JMX is enabled with route coverage
+ assertEquals(JmxManagementStrategy.class, camelContext.getManagementStrategy().getClass());
+ }
+
+ @Override
+ public void testRouteCoverage() throws Exception {
+ camelContext.stop();
+ camelContext2.stop();
+
+ // there should be files
+ String[] names = new File("target/camel-route-coverage").list();
+ assertNotNull(names);
+ assertTrue(names.length > 0);
+ }
+
+}
diff --git a/components/camel-test-spring/src/test/java/org/apache/camel/test/junit5/spring/CamelSpringShutdownTimeoutInheritedOverrideTest.java b/components/camel-test-spring/src/test/java/org/apache/camel/test/junit5/spring/CamelSpringShutdownTimeoutInheritedOverrideTest.java
new file mode 100644
index 0000000..5764c93
--- /dev/null
+++ b/components/camel-test-spring/src/test/java/org/apache/camel/test/junit5/spring/CamelSpringShutdownTimeoutInheritedOverrideTest.java
@@ -0,0 +1,35 @@
+/*
+ * 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.test.junit5.spring;
+
+import java.util.concurrent.TimeUnit;
+
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+@ShutdownTimeout
+public class CamelSpringShutdownTimeoutInheritedOverrideTest
+ extends CamelSpringShutdownTimeoutTest {
+
+ @Test
+ @Override
+ public void testShutdownTimeout() throws Exception {
+ assertEquals(10, camelContext.getShutdownStrategy().getTimeout());
+ assertEquals(TimeUnit.SECONDS, camelContext.getShutdownStrategy().getTimeUnit());
+ }
+}
diff --git a/components/camel-test-spring/src/test/java/org/apache/camel/test/junit5/spring/CamelSpringShutdownTimeoutInheritedTest.java b/components/camel-test-spring/src/test/java/org/apache/camel/test/junit5/spring/CamelSpringShutdownTimeoutInheritedTest.java
new file mode 100644
index 0000000..a146d8a
--- /dev/null
+++ b/components/camel-test-spring/src/test/java/org/apache/camel/test/junit5/spring/CamelSpringShutdownTimeoutInheritedTest.java
@@ -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.
+ */
+package org.apache.camel.test.junit5.spring;
+
+public class CamelSpringShutdownTimeoutInheritedTest
+ extends CamelSpringShutdownTimeoutTest {
+
+}
diff --git a/components/camel-test-spring/src/test/java/org/apache/camel/test/junit5/spring/CamelSpringShutdownTimeoutTest.java b/components/camel-test-spring/src/test/java/org/apache/camel/test/junit5/spring/CamelSpringShutdownTimeoutTest.java
new file mode 100644
index 0000000..7bca1b5
--- /dev/null
+++ b/components/camel-test-spring/src/test/java/org/apache/camel/test/junit5/spring/CamelSpringShutdownTimeoutTest.java
@@ -0,0 +1,35 @@
+/*
+ * 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.test.junit5.spring;
+
+import java.util.concurrent.TimeUnit;
+
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+@ShutdownTimeout(value = 11, timeUnit = TimeUnit.MILLISECONDS)
+public class CamelSpringShutdownTimeoutTest
+ extends CamelSpringPlainTest {
+
+ @Test
+ @Override
+ public void testShutdownTimeout() throws Exception {
+ assertEquals(11, camelContext.getShutdownStrategy().getTimeout());
+ assertEquals(TimeUnit.MILLISECONDS, camelContext.getShutdownStrategy().getTimeUnit());
+ }
+}
diff --git a/components/camel-test-spring/src/test/java/org/apache/camel/test/junit5/spring/CamelSpringTestPropertySourceTest.java b/components/camel-test-spring/src/test/java/org/apache/camel/test/junit5/spring/CamelSpringTestPropertySourceTest.java
new file mode 100644
index 0000000..a745834
--- /dev/null
+++ b/components/camel-test-spring/src/test/java/org/apache/camel/test/junit5/spring/CamelSpringTestPropertySourceTest.java
@@ -0,0 +1,46 @@
+/*
+ * 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.test.junit5.spring;
+
+import org.apache.camel.EndpointInject;
+import org.apache.camel.Produce;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.junit.jupiter.api.Test;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.TestPropertySource;
+
+@ContextConfiguration
+@TestPropertySource(properties = "fixedBody=Camel")
+@CamelSpringTest
+public class CamelSpringTestPropertySourceTest {
+
+ @Produce("direct:in")
+ private ProducerTemplate start;
+
+ @EndpointInject("mock:out")
+ private MockEndpoint end;
+
+ @Test
+ public void readsFileAndInlinedPropertiesFromAnnotation() throws Exception {
+ end.expectedBodiesReceived("Camel");
+
+ start.sendBody("Aardvark");
+
+ end.assertIsSatisfied();
+ }
+}
diff --git a/components/camel-test-spring/src/test/java/org/apache/camel/test/junit5/spring/CamelSpringTestSupportActiveProfileTest.java b/components/camel-test-spring/src/test/java/org/apache/camel/test/junit5/spring/CamelSpringTestSupportActiveProfileTest.java
new file mode 100644
index 0000000..c4a6400
--- /dev/null
+++ b/components/camel-test-spring/src/test/java/org/apache/camel/test/junit5/spring/CamelSpringTestSupportActiveProfileTest.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.test.junit5.spring;
+
+import org.junit.jupiter.api.Test;
+import org.springframework.context.support.AbstractApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+// START SNIPPET: e1
+
+/**
+ * Just extend the CamelSpringTestSupport and use Camel test kit for easy Camel based unit testing.
+ */
+public class CamelSpringTestSupportActiveProfileTest extends CamelSpringTestSupport {
+
+ @Override
+ protected AbstractApplicationContext createApplicationContext() {
+ // must not refresh when using active profiles
+ // lets reuse the xml file from the other test
+ return new ClassPathXmlApplicationContext(new String[]{"org/apache/camel/test/junit5/spring/CamelSpringActiveProfileTest-context.xml"}, false);
+ }
+
+ @Override
+ protected String[] activeProfiles() {
+ // return the active profiles to be used
+ return new String[]{"test"};
+ }
+
+ @Test
+ public void testLoadActiveProfile() throws InterruptedException {
+ getMockEndpoint("mock:test").expectedBodiesReceived("Hello World");
+ template.sendBody("direct:start", "World");
+ assertMockEndpointsSatisfied();
+ }
+
+}
+// END SNIPPET: e1
diff --git a/components/camel-test-spring/src/test/java/org/apache/camel/test/junit5/spring/CamelSpringUseAdviceWithTest.java b/components/camel-test-spring/src/test/java/org/apache/camel/test/junit5/spring/CamelSpringUseAdviceWithTest.java
new file mode 100644
index 0000000..6140fb1
--- /dev/null
+++ b/components/camel-test-spring/src/test/java/org/apache/camel/test/junit5/spring/CamelSpringUseAdviceWithTest.java
@@ -0,0 +1,52 @@
+/*
+ * 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.test.junit5.spring;
+
+import org.apache.camel.ServiceStatus;
+import org.apache.camel.util.StopWatch;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+@UseAdviceWith
+public class CamelSpringUseAdviceWithTest extends CamelSpringPlainTest {
+
+ @BeforeEach
+ public void testContextStarted() throws Exception {
+
+ assertEquals(ServiceStatus.Stopped, camelContext.getStatus());
+ assertEquals(ServiceStatus.Stopped, camelContext2.getStatus());
+ camelContext.start();
+ camelContext2.start();
+
+ // just sleep a little to simulate testing take a bit time
+ Thread.sleep(1000);
+ }
+
+ @Test
+ public void testStopwatch() {
+ StopWatch stopWatch = StopWatchTestExecutionListener.getStopWatch();
+
+ assertNotNull(stopWatch);
+ long taken = stopWatch.taken();
+ assertTrue(taken > 0, taken + " > 0, but was: " + taken);
+ assertTrue(taken < 3000, taken + " < 3000, but was: " + taken);
+ }
+}
diff --git a/components/camel-test-spring/src/test/java/org/apache/camel/test/junit5/spring/TestPropertyInjectRouteBuilder.java b/components/camel-test-spring/src/test/java/org/apache/camel/test/junit5/spring/TestPropertyInjectRouteBuilder.java
new file mode 100644
index 0000000..0ef4ca9
--- /dev/null
+++ b/components/camel-test-spring/src/test/java/org/apache/camel/test/junit5/spring/TestPropertyInjectRouteBuilder.java
@@ -0,0 +1,33 @@
+/*
+ * 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.test.junit5.spring;
+
+import org.apache.camel.PropertyInject;
+import org.apache.camel.builder.RouteBuilder;
+
+public class TestPropertyInjectRouteBuilder extends RouteBuilder {
+
+ @PropertyInject("{{property.to.override}}")
+ private String propertyToOverride;
+
+ @Override
+ public void configure() throws Exception {
+ from("direct:start-override-route")
+ .transform(constant(propertyToOverride));
+ }
+
+}
diff --git a/components/camel-test-spring/src/test/java/org/apache/camel/test/junit5/spring/TestRouteBuilder.java b/components/camel-test-spring/src/test/java/org/apache/camel/test/junit5/spring/TestRouteBuilder.java
new file mode 100644
index 0000000..838652c
--- /dev/null
+++ b/components/camel-test-spring/src/test/java/org/apache/camel/test/junit5/spring/TestRouteBuilder.java
@@ -0,0 +1,30 @@
+/*
+ * 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.test.junit5.spring;
+
+import org.apache.camel.builder.RouteBuilder;
+
+public class TestRouteBuilder extends RouteBuilder {
+
+ @Override
+ public void configure() throws Exception {
+
+ from("direct:z")
+ .routeId("excludedRoute")
+ .to("log:org.apache.camel.test.junit4.spring");
+ }
+}
diff --git a/components/camel-test-spring/src/test/resources/org/apache/camel/test/junit5/issues/AdviceWithInterceptSendToEndpointWithLoadbalancerTest.xml b/components/camel-test-spring/src/test/resources/org/apache/camel/test/junit5/issues/AdviceWithInterceptSendToEndpointWithLoadbalancerTest.xml
new file mode 100644
index 0000000..9570008
--- /dev/null
+++ b/components/camel-test-spring/src/test/resources/org/apache/camel/test/junit5/issues/AdviceWithInterceptSendToEndpointWithLoadbalancerTest.xml
@@ -0,0 +1,32 @@
+<?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.
+
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:camel="http://camel.apache.org/schema/spring"
+ xsi:schemaLocation="
+ http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd ">
+
+ <bean id="route" class="org.apache.camel.test.issues.AdviceWithInterceptSendToEndpointWithLoadbalancerTest.LoadbalancerTestRoute" />
+
+ <camelContext xmlns="http://camel.apache.org/schema/spring">
+ <camel:routeBuilder ref="route"/>
+ </camelContext>
+</beans>
\ No newline at end of file
diff --git a/components/camel-test-spring/src/test/resources/org/apache/camel/test/junit5/issues/AdviceWithOnCompletionTest.xml b/components/camel-test-spring/src/test/resources/org/apache/camel/test/junit5/issues/AdviceWithOnCompletionTest.xml
new file mode 100644
index 0000000..ad80f65
--- /dev/null
+++ b/components/camel-test-spring/src/test/resources/org/apache/camel/test/junit5/issues/AdviceWithOnCompletionTest.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:camel="http://camel.apache.org/schema/spring"
+ xsi:schemaLocation="
+ http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd ">
+
+ <camelContext xmlns="http://camel.apache.org/schema/spring">
+
+ <onCompletion>
+ <to uri="mock:complete"/>
+ </onCompletion>
+
+ <route>
+ <from uri="file:start"/>
+ <to uri="log:end"/>
+ </route>
+
+ </camelContext>
+</beans>
\ No newline at end of file
diff --git a/components/camel-test-spring/src/test/resources/org/apache/camel/test/junit5/issues/AdviceWithOnExceptionMultipleIssueTest.xml b/components/camel-test-spring/src/test/resources/org/apache/camel/test/junit5/issues/AdviceWithOnExceptionMultipleIssueTest.xml
new file mode 100644
index 0000000..030be6c
--- /dev/null
+++ b/components/camel-test-spring/src/test/resources/org/apache/camel/test/junit5/issues/AdviceWithOnExceptionMultipleIssueTest.xml
@@ -0,0 +1,49 @@
+<?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.
+
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:camel="http://camel.apache.org/schema/spring"
+ xsi:schemaLocation="
+ http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd ">
+
+ <camelContext xmlns="http://camel.apache.org/schema/spring">
+
+ <onException>
+ <exception>java.lang.Exception</exception>
+ <handled>
+ <constant>true</constant>
+ </handled>
+ <to uri="mock:error"/>
+ </onException>
+
+ <route id="RouteA">
+ <from uri="direct:startA"/>
+ <to uri="mock:resultA"/>
+ </route>
+
+ <route id="RouteB">
+ <from uri="direct:startB"/>
+ <to uri="mock:resultB"/>
+ </route>
+
+ </camelContext>
+
+</beans>
\ No newline at end of file
diff --git a/components/camel-test-spring/src/test/resources/org/apache/camel/test/junit5/issues/MockEndpointsAndSkipTest.xml b/components/camel-test-spring/src/test/resources/org/apache/camel/test/junit5/issues/MockEndpointsAndSkipTest.xml
new file mode 100644
index 0000000..e96d01a
--- /dev/null
+++ b/components/camel-test-spring/src/test/resources/org/apache/camel/test/junit5/issues/MockEndpointsAndSkipTest.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:camel="http://camel.apache.org/schema/spring"
+ xsi:schemaLocation="
+ http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd ">
+
+ <camelContext xmlns="http://camel.apache.org/schema/spring">
+
+ <route>
+ <from uri="direct:start"/>
+ <to uri="log:foo"/>
+ <to uri="seda:foo"/>
+ </route>
+
+ </camelContext>
+
+</beans>
\ No newline at end of file
diff --git a/components/camel-test-spring/src/test/resources/org/apache/camel/test/junit5/patterns/ProduceBeanInjectTest.xml b/components/camel-test-spring/src/test/resources/org/apache/camel/test/junit5/patterns/ProduceBeanInjectTest.xml
new file mode 100644
index 0000000..beef19b
--- /dev/null
+++ b/components/camel-test-spring/src/test/resources/org/apache/camel/test/junit5/patterns/ProduceBeanInjectTest.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:camel="http://camel.apache.org/schema/spring"
+ xsi:schemaLocation="
+ http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd ">
+
+
+ <camelContext id="camelContext" xmlns="http://camel.apache.org/schema/spring">
+ <route>
+ <from uri="direct:start"/>
+ <transform>
+ <simple>${in.body} rocks!</simple>
+ </transform>
+ </route>
+ </camelContext>
+
+ <bean id="myProduceBean" class="org.apache.camel.test.junit5.patterns.MyProduceBean"/>
+
+</beans>
\ No newline at end of file
diff --git a/components/camel-test-spring/src/test/resources/org/apache/camel/test/junit5/patterns/ProduceBeanTest.xml b/components/camel-test-spring/src/test/resources/org/apache/camel/test/junit5/patterns/ProduceBeanTest.xml
new file mode 100644
index 0000000..13863a8
--- /dev/null
+++ b/components/camel-test-spring/src/test/resources/org/apache/camel/test/junit5/patterns/ProduceBeanTest.xml
@@ -0,0 +1,35 @@
+<?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.
+
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:camel="http://camel.apache.org/schema/spring"
+ xsi:schemaLocation="
+ http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd ">
+
+<camelContext id="camelContext" xmlns="http://camel.apache.org/schema/spring">
+
+ <route>
+ <from uri="direct:start"/>
+ <bean beanType="org.apache.camel.test.junit5.patterns.MyProduceBean"/>
+ </route>
+ </camelContext>
+
+</beans>
\ No newline at end of file
diff --git a/components/camel-test-spring/src/test/resources/org/apache/camel/test/junit5/patterns/SimpleMockTest.xml b/components/camel-test-spring/src/test/resources/org/apache/camel/test/junit5/patterns/SimpleMockTest.xml
new file mode 100644
index 0000000..6f84464
--- /dev/null
+++ b/components/camel-test-spring/src/test/resources/org/apache/camel/test/junit5/patterns/SimpleMockTest.xml
@@ -0,0 +1,33 @@
+<?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.
+
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd ">
+
+ <camelContext xmlns="http://camel.apache.org/schema/spring">
+ <route>
+ <from uri="direct:start"/>
+ <to uri="mock:result"/>
+ </route>
+ </camelContext>
+
+</beans>
\ No newline at end of file
diff --git a/components/camel-test-spring/src/test/resources/org/apache/camel/test/junit5/patterns/applicationContext.xml b/components/camel-test-spring/src/test/resources/org/apache/camel/test/junit5/patterns/applicationContext.xml
new file mode 100644
index 0000000..17179a4
--- /dev/null
+++ b/components/camel-test-spring/src/test/resources/org/apache/camel/test/junit5/patterns/applicationContext.xml
@@ -0,0 +1,40 @@
+<?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.
+
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:camel="http://camel.apache.org/schema/spring"
+ xsi:schemaLocation="
+ http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd ">
+
+
+ <camelContext id="camelContext" xmlns="http://camel.apache.org/schema/spring" trace="true" autoStartup="true" >
+
+ <route>
+ <from uri="direct:start" />
+ <to uri="mock:a" />
+ <transform>
+ <simple>Hello ${body}</simple>
+ </transform>
+ <to uri="mock:b" />
+ </route>
+ </camelContext>
+
+</beans>
\ No newline at end of file
diff --git a/components/camel-test-spring/src/test/resources/org/apache/camel/test/junit5/spring/CamelSpringActiveProfileTest-context.xml b/components/camel-test-spring/src/test/resources/org/apache/camel/test/junit5/spring/CamelSpringActiveProfileTest-context.xml
new file mode 100644
index 0000000..a188ede
--- /dev/null
+++ b/components/camel-test-spring/src/test/resources/org/apache/camel/test/junit5/spring/CamelSpringActiveProfileTest-context.xml
@@ -0,0 +1,43 @@
+<?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.
+
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:camel="http://camel.apache.org/schema/spring"
+ xsi:schemaLocation="
+ http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd ">
+
+ <camelContext id="camelContext" xmlns="http://camel.apache.org/schema/spring">
+ <route>
+ <from uri="direct:start" />
+ <transform>
+ <simple>Hello ${body}</simple>
+ </transform>
+ <to uri="properties:{{cool.end}}" />
+ </route>
+ </camelContext>
+
+ <!-- setup the profile for testing -->
+ <beans profile="test">
+ <bean id="bridgePropertyPlaceholder" class="org.apache.camel.spring.spi.BridgePropertyPlaceholderConfigurer">
+ <property name="location" value="classpath:org/apache/camel/test/junit5/spring/test.properties"/>
+ </bean>
+ </beans>
+</beans>
\ No newline at end of file
diff --git a/components/camel-test-spring/src/test/resources/org/apache/camel/test/junit5/spring/CamelSpringOverridePropertiesForPropertyInjectTest-context.xml b/components/camel-test-spring/src/test/resources/org/apache/camel/test/junit5/spring/CamelSpringOverridePropertiesForPropertyInjectTest-context.xml
new file mode 100644
index 0000000..a7510b2
--- /dev/null
+++ b/components/camel-test-spring/src/test/resources/org/apache/camel/test/junit5/spring/CamelSpringOverridePropertiesForPropertyInjectTest-context.xml
@@ -0,0 +1,36 @@
+<?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.
+
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd ">
+
+ <bean id="bridgePropertyPlaceholder" class="org.apache.camel.spring.spi.BridgePropertyPlaceholderConfigurer">
+ <property name="location" value="classpath:org/apache/camel/test/junit5/spring/test.properties"/>
+ </bean>
+
+ <bean id="testRouteBuilder" class="org.apache.camel.test.junit5.spring.TestPropertyInjectRouteBuilder"></bean>
+
+ <camelContext id="camelContext" xmlns="http://camel.apache.org/schema/spring">
+ <routeBuilder ref="testRouteBuilder"/>
+ </camelContext>
+
+</beans>
\ No newline at end of file
diff --git a/components/camel-test-spring/src/test/resources/org/apache/camel/test/junit5/spring/CamelSpringOverridePropertiesTest-context.xml b/components/camel-test-spring/src/test/resources/org/apache/camel/test/junit5/spring/CamelSpringOverridePropertiesTest-context.xml
new file mode 100644
index 0000000..712e4dd
--- /dev/null
+++ b/components/camel-test-spring/src/test/resources/org/apache/camel/test/junit5/spring/CamelSpringOverridePropertiesTest-context.xml
@@ -0,0 +1,42 @@
+<?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.
+
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd ">
+
+ <bean id="bridgePropertyPlaceholder" class="org.apache.camel.spring.spi.BridgePropertyPlaceholderConfigurer">
+ <property name="location" value="classpath:org/apache/camel/test/junit5/spring/test.properties"/>
+ </bean>
+
+ <camelContext id="camelContext" xmlns="http://camel.apache.org/schema/spring">
+ <route>
+ <from uri="direct:start"/>
+ <to uri="mock:a"/>
+ <transform>
+ <simple>Hello ${body}</simple>
+ </transform>
+ <to uri="{{cool.end}}"/>
+ </route>
+ </camelContext>
+
+
+</beans>
\ No newline at end of file
diff --git a/components/camel-test-spring/src/test/resources/org/apache/camel/test/junit5/spring/CamelSpringPlainTest-context.xml b/components/camel-test-spring/src/test/resources/org/apache/camel/test/junit5/spring/CamelSpringPlainTest-context.xml
new file mode 100644
index 0000000..218f158
--- /dev/null
+++ b/components/camel-test-spring/src/test/resources/org/apache/camel/test/junit5/spring/CamelSpringPlainTest-context.xml
@@ -0,0 +1,56 @@
+<?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.
+
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd ">
+
+ <camelContext id="camelContext" xmlns="http://camel.apache.org/schema/spring" trace="true" autoStartup="true">
+ <packageScan>
+ <package>org.apache.camel.test.junit5.spring</package>
+ </packageScan>
+ <route>
+ <from uri="direct:start"/>
+ <to uri="mock:a"/>
+ <transform>
+ <simple>Hello ${body}</simple>
+ </transform>
+ <to uri="mock:b"/>
+ </route>
+ </camelContext>
+
+ <bean id="bridgePropertyPlaceholder" class="org.apache.camel.spring.spi.BridgePropertyPlaceholderConfigurer">
+ <property name="location" value="classpath:org/apache/camel/test/junit5/spring/test.properties"/>
+ </bean>
+
+ <camelContext id="camelContext2" xmlns="http://camel.apache.org/schema/spring" trace="true" autoStartup="true">
+ <route>
+ <from uri="direct:start2"/>
+ <to uri="mock:c"/>
+ <transform>
+ <simple>Hello ${body}</simple>
+ </transform>
+ <to uri="log:org.apache.camel.test.junit5.spring"/>
+ <to uri="seda:context2.seda"/>
+ </route>
+ </camelContext>
+
+</beans>
\ No newline at end of file
diff --git a/components/camel-test-spring/src/test/resources/org/apache/camel/test/junit5/spring/CamelSpringPropertiesLocationElementTest-context.xml b/components/camel-test-spring/src/test/resources/org/apache/camel/test/junit5/spring/CamelSpringPropertiesLocationElementTest-context.xml
new file mode 100644
index 0000000..be91d6c
--- /dev/null
+++ b/components/camel-test-spring/src/test/resources/org/apache/camel/test/junit5/spring/CamelSpringPropertiesLocationElementTest-context.xml
@@ -0,0 +1,49 @@
+<?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.
+
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd ">
+
+ <camelContext xmlns="http://camel.apache.org/schema/spring">
+ <propertyPlaceholder id="property-placeholder-camel" location="classpath:org/apache/camel/test/junit5/spring/properties-location-element-3.properties">
+ <propertiesLocation resolver="classpath" path="org/apache/camel/test/junit5/spring/properties-location-element-1.properties"/>
+ <propertiesLocation resolver="classpath" path="org/apache/camel/test/junit5/spring/properties-location-element-2.properties"/>
+ <propertiesLocation resolver="classpath" path="org/apache/camel/test/junit5/spring/properties-location-element-4.properties" optional="true"/>
+ </propertyPlaceholder>
+
+ <route>
+ <from uri="direct:start"/>
+ <setHeader name="property-1">
+ <constant>{{property-key-1}}</constant>
+ </setHeader>
+ <setHeader name="property-2">
+ <constant>{{property-key-2}}</constant>
+ </setHeader>
+ <setHeader name="property-3">
+ <constant>{{property-key-3}}</constant>
+ </setHeader>
+ <to uri="mock:result"/>
+ </route>
+
+ </camelContext>
+
+</beans>
diff --git a/components/camel-test-spring/src/test/resources/org/apache/camel/test/junit5/spring/CamelSpringTestPropertySourceTest-context.xml b/components/camel-test-spring/src/test/resources/org/apache/camel/test/junit5/spring/CamelSpringTestPropertySourceTest-context.xml
new file mode 100644
index 0000000..220e140
--- /dev/null
+++ b/components/camel-test-spring/src/test/resources/org/apache/camel/test/junit5/spring/CamelSpringTestPropertySourceTest-context.xml
@@ -0,0 +1,41 @@
+<?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.
+
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
+
+ <!-- Enable PropertySource -->
+ <bean class="org.springframework.context.support.PropertySourcesPlaceholderConfigurer"/>
+
+ <bean id="myBean" class="org.apache.camel.ValueHolder">
+ <constructor-arg value="${fixedBody}"/> <!-- configured from @TestPropertySource -->
+ </bean>
+
+ <camelContext id="camelContext" xmlns="http://camel.apache.org/schema/spring" trace="true" autoStartup="true">
+ <route>
+ <from uri="direct:in"/>
+ <bean ref="myBean" method="get"/>
+ <to uri="mock:out"/>
+ </route>
+ </camelContext>
+
+</beans>
\ No newline at end of file
diff --git a/components/camel-test-spring/src/test/resources/org/apache/camel/test/junit5/spring/properties-location-element-1.properties b/components/camel-test-spring/src/test/resources/org/apache/camel/test/junit5/spring/properties-location-element-1.properties
new file mode 100644
index 0000000..81ff2b5
--- /dev/null
+++ b/components/camel-test-spring/src/test/resources/org/apache/camel/test/junit5/spring/properties-location-element-1.properties
@@ -0,0 +1,18 @@
+## ---------------------------------------------------------------------------
+## Licensed to the Apache Software Foundation (ASF) under one or more
+## contributor license agreements. See the NOTICE file distributed with
+## this work for additional information regarding copyright ownership.
+## The ASF licenses this file to You under the Apache License, Version 2.0
+## (the "License"); you may not use this file except in compliance with
+## the License. You may obtain a copy of the License at
+##
+## http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+## ---------------------------------------------------------------------------
+
+property-key-1 = property-value-1
diff --git a/components/camel-test-spring/src/test/resources/org/apache/camel/test/junit5/spring/properties-location-element-2.properties b/components/camel-test-spring/src/test/resources/org/apache/camel/test/junit5/spring/properties-location-element-2.properties
new file mode 100644
index 0000000..24ebe3f
--- /dev/null
+++ b/components/camel-test-spring/src/test/resources/org/apache/camel/test/junit5/spring/properties-location-element-2.properties
@@ -0,0 +1,18 @@
+## ---------------------------------------------------------------------------
+## Licensed to the Apache Software Foundation (ASF) under one or more
+## contributor license agreements. See the NOTICE file distributed with
+## this work for additional information regarding copyright ownership.
+## The ASF licenses this file to You under the Apache License, Version 2.0
+## (the "License"); you may not use this file except in compliance with
+## the License. You may obtain a copy of the License at
+##
+## http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+## ---------------------------------------------------------------------------
+
+property-key-2 = property-value-2
diff --git a/components/camel-test-spring/src/test/resources/org/apache/camel/test/junit5/spring/properties-location-element-3.properties b/components/camel-test-spring/src/test/resources/org/apache/camel/test/junit5/spring/properties-location-element-3.properties
new file mode 100644
index 0000000..6c94f7f
--- /dev/null
+++ b/components/camel-test-spring/src/test/resources/org/apache/camel/test/junit5/spring/properties-location-element-3.properties
@@ -0,0 +1,18 @@
+## ---------------------------------------------------------------------------
+## Licensed to the Apache Software Foundation (ASF) under one or more
+## contributor license agreements. See the NOTICE file distributed with
+## this work for additional information regarding copyright ownership.
+## The ASF licenses this file to You under the Apache License, Version 2.0
+## (the "License"); you may not use this file except in compliance with
+## the License. You may obtain a copy of the License at
+##
+## http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+## ---------------------------------------------------------------------------
+
+property-key-3 = property-value-3
diff --git a/components/camel-test-spring/src/test/resources/org/apache/camel/test/junit5/spring/test.properties b/components/camel-test-spring/src/test/resources/org/apache/camel/test/junit5/spring/test.properties
new file mode 100644
index 0000000..e8a539c
--- /dev/null
+++ b/components/camel-test-spring/src/test/resources/org/apache/camel/test/junit5/spring/test.properties
@@ -0,0 +1,20 @@
+## ---------------------------------------------------------------------------
+## Licensed to the Apache Software Foundation (ASF) under one or more
+## contributor license agreements. See the NOTICE file distributed with
+## this work for additional information regarding copyright ownership.
+## The ASF licenses this file to You under the Apache License, Version 2.0
+## (the "License"); you may not use this file except in compliance with
+## the License. You may obtain a copy of the License at
+##
+## http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+## ---------------------------------------------------------------------------
+
+cool.end=mock:test
+mock.skip=seda:*
+property.to.override=This value should be overriden