You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2016/04/15 14:51:20 UTC

camel git commit: CAMEL-9332: Add support for spring-boot with the @RunWith so you can do that kind of junit testing with Camel and spring boot, and use the @MockEndpoint annotations and whatnot.

Repository: camel
Updated Branches:
  refs/heads/master 8d63ccd38 -> 11cc56e0f


CAMEL-9332: Add support for spring-boot with the @RunWith so you can do that kind of junit testing with Camel and spring boot, and use the @MockEndpoint annotations and whatnot.


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/11cc56e0
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/11cc56e0
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/11cc56e0

Branch: refs/heads/master
Commit: 11cc56e0f4b9f1efa372e8f89325d70a4845c29e
Parents: 8d63ccd
Author: Claus Ibsen <da...@apache.org>
Authored: Fri Apr 15 14:45:45 2016 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Fri Apr 15 14:50:19 2016 +0200

----------------------------------------------------------------------
 components/camel-spring-boot/pom.xml            |   2 +-
 .../camel/spring/boot/RoutesCollector.java      |  15 +-
 .../boot/mockendpoints/AdviceWithTest.java      |  68 +++++
 .../boot/mockendpoints/MockEndpointsTest.java   |  57 ++++
 .../spring/boot/mockendpoints/MyRoute.java      |  30 ++
 .../src/test/resources/application.properties   |   4 +-
 .../src/test/resources/logback.xml              |  11 +-
 .../test/spring/CamelAnnotationsHandler.java    | 281 +++++++++++++++++++
 .../CamelSpringBootExecutionListener.java       |  58 ++++
 .../CamelSpringBootJUnit4ClassRunner.java       |  67 +++++
 .../CamelSpringDelegatingTestContextLoader.java | 272 +-----------------
 .../spring/CamelTestContextBootstrapper.java    |   2 +-
 12 files changed, 596 insertions(+), 271 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/11cc56e0/components/camel-spring-boot/pom.xml
----------------------------------------------------------------------
diff --git a/components/camel-spring-boot/pom.xml b/components/camel-spring-boot/pom.xml
index 035bcff..1e7515e 100644
--- a/components/camel-spring-boot/pom.xml
+++ b/components/camel-spring-boot/pom.xml
@@ -68,7 +68,7 @@
     <!-- Testing dependencies -->
     <dependency>
       <groupId>org.apache.camel</groupId>
-      <artifactId>camel-test</artifactId>
+      <artifactId>camel-test-spring</artifactId>
       <scope>test</scope>
     </dependency>
     <dependency>

http://git-wip-us.apache.org/repos/asf/camel/blob/11cc56e0/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/RoutesCollector.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/RoutesCollector.java b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/RoutesCollector.java
index 6d589e5..5624d36 100644
--- a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/RoutesCollector.java
+++ b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/RoutesCollector.java
@@ -113,15 +113,13 @@ public class RoutesCollector implements ApplicationListener<ContextRefreshedEven
                         controller.start();
                     } else {
                         // start camel manually
-                        camelContext.start();
+                        maybeStart(camelContext);
                     }
 
                     for (CamelContextConfiguration camelContextConfiguration : camelContextConfigurations) {
                         LOG.debug("CamelContextConfiguration found. Invoking afterApplicationStart: {}", camelContextConfiguration);
                         camelContextConfiguration.afterApplicationStart(camelContext);
                     }
-
-
                 } catch (Exception e) {
                     throw new CamelSpringBootInitializationException(e);
                 }
@@ -133,6 +131,17 @@ public class RoutesCollector implements ApplicationListener<ContextRefreshedEven
         }
     }
 
+    private void maybeStart(CamelContext camelContext) throws Exception {
+        // for example from unit testing we want to start Camel later and not when Spring framework
+        // publish a ContextRefreshedEvent
+        boolean skip = "true".equalsIgnoreCase(System.getProperty("skipStartingCamelContext"));
+        if (skip) {
+            LOG.info("Skipping starting CamelContext as system property skipStartingCamelContext is set to be true.");
+        } else {
+            camelContext.start();
+        }
+    }
+
     // Helpers
 
     private void loadXmlRoutes(ApplicationContext applicationContext, CamelContext camelContext, String directory) throws Exception {

http://git-wip-us.apache.org/repos/asf/camel/blob/11cc56e0/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/mockendpoints/AdviceWithTest.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/mockendpoints/AdviceWithTest.java b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/mockendpoints/AdviceWithTest.java
new file mode 100644
index 0000000..c1fca38
--- /dev/null
+++ b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/mockendpoints/AdviceWithTest.java
@@ -0,0 +1,68 @@
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.spring.boot.mockendpoints;
+
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.builder.AdviceWithRouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.model.ModelCamelContext;
+import org.apache.camel.test.spring.CamelSpringBootJUnit4ClassRunner;
+import org.apache.camel.test.spring.UseAdviceWith;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.test.SpringApplicationConfiguration;
+
+@RunWith(CamelSpringBootJUnit4ClassRunner.class)
+@UseAdviceWith
+@SpringBootApplication
+@SpringApplicationConfiguration({AdviceWithTest.class})
+public class AdviceWithTest {
+
+    @Autowired
+    ProducerTemplate producerTemplate;
+
+    @Autowired
+    ModelCamelContext camelContext;
+
+    @Test
+    public void shouldMockEndpoints() throws Exception {
+        camelContext.getRouteDefinitions().get(0).adviceWith(camelContext, new AdviceWithRouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                replaceFromWith("seda:start");
+                weaveAddLast().to("mock:result");
+            }
+        });
+
+        camelContext.start();
+
+        MockEndpoint mock = camelContext.getEndpoint("mock:result", MockEndpoint.class);
+
+        // Given
+        String msg = "msg";
+        mock.expectedBodiesReceived(msg);
+
+        // When
+        producerTemplate.sendBody("seda:start", msg);
+
+        // Then
+        mock.assertIsSatisfied();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/11cc56e0/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/mockendpoints/MockEndpointsTest.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/mockendpoints/MockEndpointsTest.java b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/mockendpoints/MockEndpointsTest.java
new file mode 100644
index 0000000..e3bdb16
--- /dev/null
+++ b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/mockendpoints/MockEndpointsTest.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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.spring.boot.mockendpoints;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.spring.CamelSpringBootJUnit4ClassRunner;
+import org.apache.camel.test.spring.MockEndpoints;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.test.SpringApplicationConfiguration;
+
+@RunWith(CamelSpringBootJUnit4ClassRunner.class)
+@MockEndpoints
+@SpringBootApplication
+@SpringApplicationConfiguration({MockEndpointsTest.class})
+public class MockEndpointsTest {
+
+    @Autowired
+    ProducerTemplate producerTemplate;
+
+    @Autowired
+    CamelContext camelContext;
+
+    @Test
+    public void shouldMockEndpoints() throws Exception {
+        MockEndpoint mock = camelContext.getEndpoint("mock://seda:foo", MockEndpoint.class);
+
+        // Given
+        String msg = "msg";
+        mock.expectedBodiesReceived(msg);
+
+        // When
+        producerTemplate.sendBody("direct:start", msg);
+
+        // Then
+        mock.assertIsSatisfied();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/11cc56e0/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/mockendpoints/MyRoute.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/mockendpoints/MyRoute.java b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/mockendpoints/MyRoute.java
new file mode 100644
index 0000000..8f59520
--- /dev/null
+++ b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/mockendpoints/MyRoute.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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.spring.boot.mockendpoints;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.springframework.stereotype.Component;
+
+@Component
+public class MyRoute extends RouteBuilder {
+
+    @Override
+    public void configure() throws Exception {
+        from("direct:start")
+            .to("seda:foo");
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/11cc56e0/components/camel-spring-boot/src/test/resources/application.properties
----------------------------------------------------------------------
diff --git a/components/camel-spring-boot/src/test/resources/application.properties b/components/camel-spring-boot/src/test/resources/application.properties
index c82e80b..06fe56c 100644
--- a/components/camel-spring-boot/src/test/resources/application.properties
+++ b/components/camel-spring-boot/src/test/resources/application.properties
@@ -18,4 +18,6 @@
 spring.main.banner_mode=off
 
 from=direct:test
-to=mock:test
\ No newline at end of file
+to=mock:test
+
+#logging.level.org.apache.camel=DEBUG
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/11cc56e0/components/camel-spring-boot/src/test/resources/logback.xml
----------------------------------------------------------------------
diff --git a/components/camel-spring-boot/src/test/resources/logback.xml b/components/camel-spring-boot/src/test/resources/logback.xml
index 21594c9..a30af10 100644
--- a/components/camel-spring-boot/src/test/resources/logback.xml
+++ b/components/camel-spring-boot/src/test/resources/logback.xml
@@ -17,14 +17,23 @@
 -->
 <configuration>
 
+  <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+    <!-- encoders are assigned the type
+         ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
+    <encoder>
+      <pattern>%d{HH:mm:ss.SSS} [%-15.15thread] %-5level %-30.30logger - %msg%n</pattern>
+    </encoder>
+  </appender>
+
   <appender name="FILE" class="ch.qos.logback.core.FileAppender">
     <encoder>
-      <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
+      <pattern>%d{HH:mm:ss.SSS} [%-15.15thread] %-5level %-30.30logger - %msg%n</pattern>
     </encoder>
     <file>target/camel-spring-boot-test.log</file>
   </appender>
 
   <root level="INFO">
+    <!--<appender-ref ref="STDOUT"/>-->
     <appender-ref ref="FILE"/>
   </root>
 

http://git-wip-us.apache.org/repos/asf/camel/blob/11cc56e0/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/CamelAnnotationsHandler.java
----------------------------------------------------------------------
diff --git a/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/CamelAnnotationsHandler.java b/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/CamelAnnotationsHandler.java
new file mode 100644
index 0000000..596a061
--- /dev/null
+++ b/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/CamelAnnotationsHandler.java
@@ -0,0 +1,281 @@
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.spring;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.Collection;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Properties;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.camel.component.properties.PropertiesComponent;
+import org.apache.camel.impl.DefaultDebugger;
+import org.apache.camel.impl.InterceptSendToMockEndpointStrategy;
+import org.apache.camel.management.JmxSystemPropertyKeys;
+import org.apache.camel.spi.Breakpoint;
+import org.apache.camel.spi.Debugger;
+import org.apache.camel.spring.SpringCamelContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.context.ConfigurableApplicationContext;
+import org.springframework.core.annotation.AnnotationUtils;
+
+import static org.apache.camel.test.spring.CamelSpringTestHelper.getAllMethods;
+
+public final class CamelAnnotationsHandler {
+
+    private static final Logger LOGGER = LoggerFactory.getLogger(CamelAnnotationsHandler.class);
+
+    private CamelAnnotationsHandler() {
+    }
+
+    /**
+     * Handles disabling of JMX on Camel contexts based on {@link DisableJmx}.
+     *
+     * @param context the initialized Spring context
+     * @param testClass the test class being executed
+     */
+    public static void handleDisableJmx(ConfigurableApplicationContext context, Class<?> testClass) {
+        CamelSpringTestHelper.setOriginalJmxDisabledValue(System.getProperty(JmxSystemPropertyKeys.DISABLED));
+
+        if (testClass.isAnnotationPresent(DisableJmx.class)) {
+            if (testClass.getAnnotation(DisableJmx.class).value()) {
+                LOGGER.info("Disabling Camel JMX globally as DisableJmx annotation was found and disableJmx is set to true.");
+                System.setProperty(JmxSystemPropertyKeys.DISABLED, "true");
+
+            } else {
+                LOGGER.info("Enabling Camel JMX as DisableJmx annotation was found and disableJmx is set to false.");
+                System.clearProperty(JmxSystemPropertyKeys.DISABLED);
+            }
+        } else {
+            LOGGER.info("Disabling Camel JMX globally for tests by default. Use the DisableJMX annotation to override the default setting.");
+            System.setProperty(JmxSystemPropertyKeys.DISABLED, "true");
+        }
+    }
+
+    public static void handleProvidesBreakpoint(ConfigurableApplicationContext context, Class<?> testClass) throws Exception {
+        Collection<Method> methods = getAllMethods(testClass);
+        final List<Breakpoint> breakpoints = new LinkedList<Breakpoint>();
+
+        for (Method method : methods) {
+            if (AnnotationUtils.findAnnotation(method, ProvidesBreakpoint.class) != null) {
+                Class<?>[] argTypes = method.getParameterTypes();
+                if (argTypes.length != 0) {
+                    throw new IllegalArgumentException("Method [" + method.getName()
+                            + "] is annotated with ProvidesBreakpoint but is not a no-argument method.");
+                } else if (!Breakpoint.class.isAssignableFrom(method.getReturnType())) {
+                    throw new IllegalArgumentException("Method [" + method.getName()
+                            + "] is annotated with ProvidesBreakpoint but does not return a Breakpoint.");
+                } else if (!Modifier.isStatic(method.getModifiers())) {
+                    throw new IllegalArgumentException("Method [" + method.getName()
+                            + "] is annotated with ProvidesBreakpoint but is not static.");
+                } else if (!Modifier.isPublic(method.getModifiers())) {
+                    throw new IllegalArgumentException("Method [" + method.getName()
+                            + "] is annotated with ProvidesBreakpoint but is not public.");
+                }
+
+                try {
+                    breakpoints.add((Breakpoint) method.invoke(null));
+                } catch (Exception e) {
+                    throw new RuntimeException("Method [" + method.getName()
+                            + "] threw exception during evaluation.", e);
+                }
+            }
+        }
+
+        if (breakpoints.size() != 0) {
+            CamelSpringTestHelper.doToSpringCamelContexts(context, new CamelSpringTestHelper.DoToSpringCamelContextsStrategy() {
+
+                public void execute(String contextName, SpringCamelContext camelContext)
+                        throws Exception {
+                    Debugger debugger = camelContext.getDebugger();
+                    if (debugger == null) {
+                        debugger = new DefaultDebugger();
+                        camelContext.setDebugger(debugger);
+                    }
+
+                    for (Breakpoint breakpoint : breakpoints) {
+                        LOGGER.info("Adding Breakpoint [{}] to CamelContext with name [{}].", breakpoint, contextName);
+                        debugger.addBreakpoint(breakpoint);
+                    }
+                }
+            });
+        }
+    }
+
+    /**
+     * Handles updating shutdown timeouts on Camel contexts based on {@link ShutdownTimeout}.
+     *
+     * @param context the initialized Spring context
+     * @param testClass the test class being executed
+     */
+    public static void handleShutdownTimeout(ConfigurableApplicationContext context, Class<?> testClass) throws Exception {
+        final int shutdownTimeout;
+        final TimeUnit shutdownTimeUnit;
+        if (testClass.isAnnotationPresent(ShutdownTimeout.class)) {
+            shutdownTimeout = testClass.getAnnotation(ShutdownTimeout.class).value();
+            shutdownTimeUnit = testClass.getAnnotation(ShutdownTimeout.class).timeUnit();
+        } else {
+            shutdownTimeout = 10;
+            shutdownTimeUnit = TimeUnit.SECONDS;
+        }
+
+        CamelSpringTestHelper.doToSpringCamelContexts(context, new CamelSpringTestHelper.DoToSpringCamelContextsStrategy() {
+
+            public void execute(String contextName, SpringCamelContext camelContext)
+                    throws Exception {
+                LOGGER.info("Setting shutdown timeout to [{} {}] on CamelContext with name [{}].", new Object[]{shutdownTimeout, shutdownTimeUnit, contextName});
+                camelContext.getShutdownStrategy().setTimeout(shutdownTimeout);
+                camelContext.getShutdownStrategy().setTimeUnit(shutdownTimeUnit);
+            }
+        });
+    }
+
+    /**
+     * Handles auto-intercepting of endpoints with mocks based on {@link MockEndpoints}.
+     *
+     * @param context the initialized Spring context
+     * @param testClass the test class being executed
+     */
+    public static void handleMockEndpoints(ConfigurableApplicationContext context, Class<?> testClass) throws Exception {
+        if (testClass.isAnnotationPresent(MockEndpoints.class)) {
+            final String mockEndpoints = testClass.getAnnotation(MockEndpoints.class).value();
+            CamelSpringTestHelper.doToSpringCamelContexts(context, new CamelSpringTestHelper.DoToSpringCamelContextsStrategy() {
+
+                public void execute(String contextName, SpringCamelContext camelContext)
+                        throws Exception {
+                    LOGGER.info("Enabling auto mocking of endpoints matching pattern [{}] on CamelContext with name [{}].", mockEndpoints, contextName);
+                    camelContext.addRegisterEndpointCallback(new InterceptSendToMockEndpointStrategy(mockEndpoints));
+                }
+            });
+        }
+    }
+
+    /**
+     * Handles auto-intercepting of endpoints with mocks based on {@link MockEndpointsAndSkip} and skipping the
+     * original endpoint.
+     *
+     * @param context the initialized Spring context
+     * @param testClass the test class being executed
+     */
+    public static void handleMockEndpointsAndSkip(ConfigurableApplicationContext context, Class<?> testClass) throws Exception {
+        if (testClass.isAnnotationPresent(MockEndpointsAndSkip.class)) {
+            final String mockEndpoints = testClass.getAnnotation(MockEndpointsAndSkip.class).value();
+            CamelSpringTestHelper.doToSpringCamelContexts(context, new CamelSpringTestHelper.DoToSpringCamelContextsStrategy() {
+
+                public void execute(String contextName, SpringCamelContext camelContext)
+                        throws Exception {
+                    // resovle the property place holders of the mockEndpoints
+                    String mockEndpointsValue = camelContext.resolvePropertyPlaceholders(mockEndpoints);
+                    LOGGER.info("Enabling auto mocking and skipping of endpoints matching pattern [{}] on CamelContext with name [{}].", mockEndpointsValue, contextName);
+                    camelContext.addRegisterEndpointCallback(new InterceptSendToMockEndpointStrategy(mockEndpointsValue, true));
+                }
+            });
+        }
+    }
+
+    /**
+     * Handles override this method to include and override properties with the Camel {@link org.apache.camel.component.properties.PropertiesComponent}.
+     *
+     * @param context the initialized Spring context
+     * @param testClass the test class being executed
+     */
+    public static void handleUseOverridePropertiesWithPropertiesComponent(ConfigurableApplicationContext context, Class<?> testClass) throws Exception {
+        Collection<Method> methods = getAllMethods(testClass);
+        final List<Properties> properties = new LinkedList<Properties>();
+
+        for (Method method : methods) {
+            if (AnnotationUtils.findAnnotation(method, UseOverridePropertiesWithPropertiesComponent.class) != null) {
+                Class<?>[] argTypes = method.getParameterTypes();
+                if (argTypes.length > 0) {
+                    throw new IllegalArgumentException("Method [" + method.getName()
+                            + "] is annotated with UseOverridePropertiesWithPropertiesComponent but is not a no-argument method.");
+                } else if (!Properties.class.isAssignableFrom(method.getReturnType())) {
+                    throw new IllegalArgumentException("Method [" + method.getName()
+                            + "] is annotated with UseOverridePropertiesWithPropertiesComponent but does not return a java.util.Properties.");
+                } else if (!Modifier.isStatic(method.getModifiers())) {
+                    throw new IllegalArgumentException("Method [" + method.getName()
+                            + "] is annotated with UseOverridePropertiesWithPropertiesComponent but is not static.");
+                } else if (!Modifier.isPublic(method.getModifiers())) {
+                    throw new IllegalArgumentException("Method [" + method.getName()
+                            + "] is annotated with UseOverridePropertiesWithPropertiesComponent but is not public.");
+                }
+
+                try {
+                    properties.add((Properties) method.invoke(null));
+                } catch (Exception e) {
+                    throw new RuntimeException("Method [" + method.getName()
+                            + "] threw exception during evaluation.", e);
+                }
+            }
+        }
+
+        if (properties.size() != 0) {
+            CamelSpringTestHelper.doToSpringCamelContexts(context, new CamelSpringTestHelper.DoToSpringCamelContextsStrategy() {
+                public void execute(String contextName, SpringCamelContext camelContext) throws Exception {
+                    PropertiesComponent pc = camelContext.getComponent("properties", PropertiesComponent.class);
+                    Properties extra = new Properties();
+                    for (Properties prop : properties) {
+                        extra.putAll(prop);
+                    }
+                    if (!extra.isEmpty()) {
+                        LOGGER.info("Using {} properties to override any existing properties on the PropertiesComponent on CamelContext with name [{}].", extra.size(), contextName);
+                        pc.setOverrideProperties(extra);
+                    }
+                }
+            });
+        }
+    }
+
+    /**
+     * Handles starting of Camel contexts based on {@link UseAdviceWith} and other state in the JVM.
+     *
+     * @param context the initialized Spring context
+     * @param testClass the test class being executed
+     */
+    public static void handleCamelContextStartup(ConfigurableApplicationContext context, Class<?> testClass) throws Exception {
+        boolean skip = "true".equalsIgnoreCase(System.getProperty("skipStartingCamelContext"));
+        if (skip) {
+            LOGGER.info("Skipping starting CamelContext(s) as system property skipStartingCamelContext is set to be true.");
+        } else if (testClass.isAnnotationPresent(UseAdviceWith.class)) {
+            if (testClass.getAnnotation(UseAdviceWith.class).value()) {
+                LOGGER.info("Skipping starting CamelContext(s) as UseAdviceWith annotation was found and isUseAdviceWith is set to true.");
+                skip = true;
+            } else {
+                LOGGER.info("Starting CamelContext(s) as UseAdviceWith annotation was found, but isUseAdviceWith is set to false.");
+                skip = false;
+            }
+        }
+
+        if (!skip) {
+            CamelSpringTestHelper.doToSpringCamelContexts(context, new CamelSpringTestHelper.DoToSpringCamelContextsStrategy() {
+                public void execute(String contextName,
+                                    SpringCamelContext camelContext) throws Exception {
+                    if (!camelContext.isStarted()) {
+                        LOGGER.info("Starting CamelContext with name [{}].", contextName);
+                        camelContext.start();
+                    } else {
+                        LOGGER.debug("CamelContext with name [{}] already started.", contextName);
+                    }
+                }
+            });
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/11cc56e0/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/CamelSpringBootExecutionListener.java
----------------------------------------------------------------------
diff --git a/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/CamelSpringBootExecutionListener.java b/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/CamelSpringBootExecutionListener.java
new file mode 100644
index 0000000..a7e92b9
--- /dev/null
+++ b/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/CamelSpringBootExecutionListener.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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.spring;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.context.ConfigurableApplicationContext;
+import org.springframework.test.context.TestContext;
+import org.springframework.test.context.support.AbstractTestExecutionListener;
+
+public class CamelSpringBootExecutionListener extends AbstractTestExecutionListener {
+
+    private static final Logger LOG = LoggerFactory.getLogger(CamelSpringBootExecutionListener.class);
+
+    @Override
+    public void prepareTestInstance(TestContext testContext) throws Exception {
+        LOG.info("@RunWith(CamelSpringBootJUnit4ClassRunner.class) preparing: {}", testContext.getTestClass());
+
+        Class<?> testClass = testContext.getTestClass();
+        ConfigurableApplicationContext context = (ConfigurableApplicationContext) testContext.getApplicationContext();
+
+        // Post CamelContext(s) instantiation but pre CamelContext(s) start setup
+        CamelAnnotationsHandler.handleProvidesBreakpoint(context, testClass);
+        CamelAnnotationsHandler.handleShutdownTimeout(context, testClass);
+        CamelAnnotationsHandler.handleMockEndpoints(context, testClass);
+        CamelAnnotationsHandler.handleMockEndpointsAndSkip(context, testClass);
+        CamelAnnotationsHandler.handleUseOverridePropertiesWithPropertiesComponent(context, testClass);
+    }
+
+    @Override
+    public void beforeTestMethod(TestContext testContext) throws Exception {
+        LOG.info("@RunWith(CamelSpringBootJUnit4ClassRunner.class) before: {}.{}", testContext.getTestClass(), testContext.getTestMethod().getName());
+
+        Class<?> testClass = testContext.getTestClass();
+        ConfigurableApplicationContext context = (ConfigurableApplicationContext) testContext.getApplicationContext();
+
+        // mark Camel to be startable again and start Camel
+        System.clearProperty("skipStartingCamelContext");
+
+        LOG.info("Initialized CamelSpringBootJUnit4ClassRunner now ready to start CamelContext");
+        CamelAnnotationsHandler.handleCamelContextStartup(context, testClass);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/11cc56e0/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/CamelSpringBootJUnit4ClassRunner.java
----------------------------------------------------------------------
diff --git a/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/CamelSpringBootJUnit4ClassRunner.java b/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/CamelSpringBootJUnit4ClassRunner.java
new file mode 100644
index 0000000..701f400
--- /dev/null
+++ b/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/CamelSpringBootJUnit4ClassRunner.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.spring;
+
+import org.junit.runners.model.InitializationError;
+import org.springframework.test.context.TestContextManager;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+/**
+ * An implementation bringing the functionality of {@link 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 CamelSpringBootJUnit4ClassRunner extends SpringJUnit4ClassRunner {
+
+    public CamelSpringBootJUnit4ClassRunner(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);
+
+            // turn off auto starting spring as we need to do this later
+            System.setProperty("skipStartingCamelContext", "true");
+
+            // inject Camel first, and then disable jmx and add the stop-watch
+            registerTestExecutionListeners(new CamelSpringTestContextLoaderTestExecutionListener());
+            registerTestExecutionListeners(new DisableJmxTestExecutionListener());
+            registerTestExecutionListeners(new CamelSpringBootExecutionListener());
+            registerTestExecutionListeners(new StopWatchTestExecutionListener());
+        }
+
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/11cc56e0/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/CamelSpringDelegatingTestContextLoader.java
----------------------------------------------------------------------
diff --git a/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/CamelSpringDelegatingTestContextLoader.java b/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/CamelSpringDelegatingTestContextLoader.java
index cfcc450..380fac0 100644
--- a/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/CamelSpringDelegatingTestContextLoader.java
+++ b/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/CamelSpringDelegatingTestContextLoader.java
@@ -16,34 +16,17 @@
  */
 package org.apache.camel.test.spring;
 
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.util.Collection;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Properties;
-import java.util.concurrent.TimeUnit;
-
-import org.apache.camel.component.properties.PropertiesComponent;
-import org.apache.camel.impl.DefaultDebugger;
-import org.apache.camel.impl.InterceptSendToMockEndpointStrategy;
 import org.apache.camel.management.JmxSystemPropertyKeys;
-import org.apache.camel.spi.Breakpoint;
-import org.apache.camel.spi.Debugger;
 import org.apache.camel.spring.SpringCamelContext;
-import org.apache.camel.test.spring.CamelSpringTestHelper.DoToSpringCamelContextsStrategy;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.support.BeanDefinitionRegistry;
 import org.springframework.context.ApplicationContext;
 import org.springframework.context.ConfigurableApplicationContext;
 import org.springframework.context.annotation.AnnotationConfigUtils;
-import org.springframework.core.annotation.AnnotationUtils;
 import org.springframework.test.context.MergedContextConfiguration;
 import org.springframework.test.context.support.DelegatingSmartContextLoader;
 
-import static org.apache.camel.test.spring.CamelSpringTestHelper.getAllMethods;
-
 /**
  * CamelSpringDelegatingTestContextLoader which fixes issues in Camel's JavaConfigContextLoader. (adds support for Camel's test annotations)
  * <br>
@@ -65,8 +48,8 @@ public class CamelSpringDelegatingTestContextLoader extends DelegatingSmartConte
         }
         
         // Pre CamelContext(s) instantiation setup
-        handleDisableJmx(null, testClass);
-        
+        CamelAnnotationsHandler.handleDisableJmx(null, testClass);
+
         try {
             SpringCamelContext.setNoStart(true);
             System.setProperty("skipStartingCamelContext", "true");
@@ -94,14 +77,14 @@ public class CamelSpringDelegatingTestContextLoader extends DelegatingSmartConte
         AnnotationConfigUtils.registerAnnotationConfigProcessors((BeanDefinitionRegistry) context);
 
         // Post CamelContext(s) instantiation but pre CamelContext(s) start setup
-        handleProvidesBreakpoint(context, testClass);
-        handleShutdownTimeout(context, testClass);
-        handleMockEndpoints(context, testClass);
-        handleMockEndpointsAndSkip(context, testClass);
-        handleUseOverridePropertiesWithPropertiesComponent(context, testClass);
+        CamelAnnotationsHandler.handleProvidesBreakpoint(context, testClass);
+        CamelAnnotationsHandler.handleShutdownTimeout(context, testClass);
+        CamelAnnotationsHandler.handleMockEndpoints(context, testClass);
+        CamelAnnotationsHandler.handleMockEndpointsAndSkip(context, testClass);
+        CamelAnnotationsHandler.handleUseOverridePropertiesWithPropertiesComponent(context, testClass);
         
         // CamelContext(s) startup
-        handleCamelContextStartup(context, testClass);
+        CamelAnnotationsHandler.handleCamelContextStartup(context, testClass);
         
         return context;
     }
@@ -124,245 +107,6 @@ public class CamelSpringDelegatingTestContextLoader extends DelegatingSmartConte
             }
         }
     }
-    
-    /**
-     * Handles disabling of JMX on Camel contexts based on {@link DisableJmx}.
-     *
-     * @param context the initialized Spring context
-     * @param testClass the test class being executed
-     */
-    protected void handleDisableJmx(ConfigurableApplicationContext context, Class<?> testClass) {
-        CamelSpringTestHelper.setOriginalJmxDisabledValue(System.getProperty(JmxSystemPropertyKeys.DISABLED));
-        
-        if (testClass.isAnnotationPresent(DisableJmx.class)) {
-            if (testClass.getAnnotation(DisableJmx.class).value()) {
-                logger.info("Disabling Camel JMX globally as DisableJmx annotation was found and disableJmx is set to true.");
-                System.setProperty(JmxSystemPropertyKeys.DISABLED, "true");
-                
-            } else {
-                logger.info("Enabling Camel JMX as DisableJmx annotation was found and disableJmx is set to false.");
-                System.clearProperty(JmxSystemPropertyKeys.DISABLED);
-            }
-        } else {
-            logger.info("Disabling Camel JMX globally for tests by default. Use the DisableJMX annotation to override the default setting.");
-            System.setProperty(JmxSystemPropertyKeys.DISABLED, "true");
-        }
-    }
-    
-    /**
-     * Handles the processing of the {@link ProvidesBreakpoint} annotation on a test class.  Exists here
-     * as it is needed in 
-     *
-     * @param context the initialized Spring context containing the Camel context(s) to insert breakpoints into 
-     * @param testClass the test class being processed
-     *
-     * @throws Exception if there is an error processing the class
-     */
-    protected void handleProvidesBreakpoint(ConfigurableApplicationContext context, Class<?> testClass) throws Exception {
-        Collection<Method> methods = getAllMethods(testClass);
-        final List<Breakpoint> breakpoints = new LinkedList<Breakpoint>();
-        
-        for (Method method : methods) {
-            if (AnnotationUtils.findAnnotation(method, ProvidesBreakpoint.class) != null) {
-                Class<?>[] argTypes = method.getParameterTypes();
-                if (argTypes.length != 0) {
-                    throw new IllegalArgumentException("Method [" + method.getName()
-                           + "] is annotated with ProvidesBreakpoint but is not a no-argument method.");
-                } else if (!Breakpoint.class.isAssignableFrom(method.getReturnType())) {
-                    throw new IllegalArgumentException("Method [" + method.getName()
-                           + "] is annotated with ProvidesBreakpoint but does not return a Breakpoint.");
-                } else if (!Modifier.isStatic(method.getModifiers())) {
-                    throw new IllegalArgumentException("Method [" + method.getName()
-                           + "] is annotated with ProvidesBreakpoint but is not static.");
-                } else if (!Modifier.isPublic(method.getModifiers())) {
-                    throw new IllegalArgumentException("Method [" + method.getName()
-                           + "] is annotated with ProvidesBreakpoint but is not public.");
-                }
-                
-                try {
-                    breakpoints.add((Breakpoint) method.invoke(null));
-                } catch (Exception e) {
-                    throw new RuntimeException("Method [" + method.getName()
-                           + "] threw exception during evaluation.", e);
-                }
-            }
-        }
-        
-        if (breakpoints.size() != 0) {
-            CamelSpringTestHelper.doToSpringCamelContexts(context, new DoToSpringCamelContextsStrategy() {
-                
-                public void execute(String contextName, SpringCamelContext camelContext)
-                    throws Exception {
-                    Debugger debugger = camelContext.getDebugger();
-                    if (debugger == null) {
-                        debugger = new DefaultDebugger();
-                        camelContext.setDebugger(debugger);
-                    }
-                    
-                    for (Breakpoint breakpoint : breakpoints) {
-                        logger.info("Adding Breakpoint [{}] to CamelContext with name [{}].", breakpoint, contextName);
-                        debugger.addBreakpoint(breakpoint);
-                    }
-                }
-            });
-        }
-    }
-
-
-    /**
-     * Handles updating shutdown timeouts on Camel contexts based on {@link ShutdownTimeout}.
-     *
-     * @param context the initialized Spring context
-     * @param testClass the test class being executed
-     */
-    protected void handleShutdownTimeout(ConfigurableApplicationContext context, Class<?> testClass) throws Exception {
-        final int shutdownTimeout;
-        final TimeUnit shutdownTimeUnit;
-        if (testClass.isAnnotationPresent(ShutdownTimeout.class)) {
-            shutdownTimeout = testClass.getAnnotation(ShutdownTimeout.class).value();
-            shutdownTimeUnit = testClass.getAnnotation(ShutdownTimeout.class).timeUnit();
-        } else {
-            shutdownTimeout = 10;
-            shutdownTimeUnit = TimeUnit.SECONDS;
-        }
-        
-        CamelSpringTestHelper.doToSpringCamelContexts(context, new DoToSpringCamelContextsStrategy() {
-            
-            public void execute(String contextName, SpringCamelContext camelContext)
-                throws Exception {
-                logger.info("Setting shutdown timeout to [{} {}] on CamelContext with name [{}].", new Object[]{shutdownTimeout, shutdownTimeUnit, contextName});
-                camelContext.getShutdownStrategy().setTimeout(shutdownTimeout);
-                camelContext.getShutdownStrategy().setTimeUnit(shutdownTimeUnit);
-            }
-        });
-    }
-    
-    /**
-     * Handles auto-intercepting of endpoints with mocks based on {@link MockEndpoints}.
-     *
-     * @param context the initialized Spring context
-     * @param testClass the test class being executed
-     */
-    protected void handleMockEndpoints(ConfigurableApplicationContext context, Class<?> testClass) throws Exception {
-        if (testClass.isAnnotationPresent(MockEndpoints.class)) {
-            final String mockEndpoints = testClass.getAnnotation(MockEndpoints.class).value();
-            CamelSpringTestHelper.doToSpringCamelContexts(context, new DoToSpringCamelContextsStrategy() {
-                
-                public void execute(String contextName, SpringCamelContext camelContext)
-                    throws Exception {
-                    logger.info("Enabling auto mocking of endpoints matching pattern [{}] on CamelContext with name [{}].", mockEndpoints, contextName);
-                    camelContext.addRegisterEndpointCallback(new InterceptSendToMockEndpointStrategy(mockEndpoints));
-                }
-            });
-        }
-    }
-    
-    /**
-     * Handles auto-intercepting of endpoints with mocks based on {@link MockEndpointsAndSkip} and skipping the
-     * original endpoint.
-     *
-     * @param context the initialized Spring context
-     * @param testClass the test class being executed
-     */
-    protected void handleMockEndpointsAndSkip(ConfigurableApplicationContext context, Class<?> testClass) throws Exception {
-        if (testClass.isAnnotationPresent(MockEndpointsAndSkip.class)) {
-            final String mockEndpoints = testClass.getAnnotation(MockEndpointsAndSkip.class).value();
-            CamelSpringTestHelper.doToSpringCamelContexts(context, new DoToSpringCamelContextsStrategy() {
-                
-                public void execute(String contextName, SpringCamelContext camelContext)
-                    throws Exception {
-                    // resovle the property place holders of the mockEndpoints 
-                    String mockEndpointsValue = camelContext.resolvePropertyPlaceholders(mockEndpoints);
-                    logger.info("Enabling auto mocking and skipping of endpoints matching pattern [{}] on CamelContext with name [{}].", mockEndpointsValue, contextName);
-                    camelContext.addRegisterEndpointCallback(new InterceptSendToMockEndpointStrategy(mockEndpointsValue, true));
-                }
-            });
-        }
-    }
-    
-    /**
-     * Handles override this method to include and override properties with the Camel {@link org.apache.camel.component.properties.PropertiesComponent}.
-     *
-     * @param context the initialized Spring context
-     * @param testClass the test class being executed
-     */
-    protected void handleUseOverridePropertiesWithPropertiesComponent(ConfigurableApplicationContext context, Class<?> testClass) throws Exception {
-        Collection<Method> methods = getAllMethods(testClass);
-        final List<Properties> properties = new LinkedList<Properties>();
-
-        for (Method method : methods) {
-            if (AnnotationUtils.findAnnotation(method, UseOverridePropertiesWithPropertiesComponent.class) != null) {
-                Class<?>[] argTypes = method.getParameterTypes();
-                if (argTypes.length > 0) {
-                    throw new IllegalArgumentException("Method [" + method.getName()
-                            + "] is annotated with UseOverridePropertiesWithPropertiesComponent but is not a no-argument method.");
-                } else if (!Properties.class.isAssignableFrom(method.getReturnType())) {
-                    throw new IllegalArgumentException("Method [" + method.getName()
-                            + "] is annotated with UseOverridePropertiesWithPropertiesComponent but does not return a java.util.Properties.");
-                } else if (!Modifier.isStatic(method.getModifiers())) {
-                    throw new IllegalArgumentException("Method [" + method.getName()
-                            + "] is annotated with UseOverridePropertiesWithPropertiesComponent but is not static.");
-                } else if (!Modifier.isPublic(method.getModifiers())) {
-                    throw new IllegalArgumentException("Method [" + method.getName()
-                            + "] is annotated with UseOverridePropertiesWithPropertiesComponent but is not public.");
-                }
-
-                try {
-                    properties.add((Properties) method.invoke(null));
-                } catch (Exception e) {
-                    throw new RuntimeException("Method [" + method.getName()
-                            + "] threw exception during evaluation.", e);
-                }
-            }
-        }
-
-        if (properties.size() != 0) {
-            CamelSpringTestHelper.doToSpringCamelContexts(context, new DoToSpringCamelContextsStrategy() {
-                public void execute(String contextName, SpringCamelContext camelContext) throws Exception {
-                    PropertiesComponent pc = camelContext.getComponent("properties", PropertiesComponent.class);
-                    Properties extra = new Properties();
-                    for (Properties prop : properties) {
-                        extra.putAll(prop);
-                    }
-                    if (!extra.isEmpty()) {
-                        logger.info("Using {} properties to override any existing properties on the PropertiesComponent on CamelContext with name [{}].", extra.size(), contextName);
-                        pc.setOverrideProperties(extra);
-                    }
-                }
-            });
-        }
-    }
-
-    /**
-     * Handles starting of Camel contexts based on {@link UseAdviceWith} and other state in the JVM.
-     *
-     * @param context the initialized Spring context
-     * @param testClass the test class being executed
-     */
-    protected void handleCamelContextStartup(ConfigurableApplicationContext context, Class<?> testClass) throws Exception {
-        boolean skip = "true".equalsIgnoreCase(System.getProperty("skipStartingCamelContext"));
-        if (skip) {
-            logger.info("Skipping starting CamelContext(s) as system property skipStartingCamelContext is set to be true.");
-        } else if (testClass.isAnnotationPresent(UseAdviceWith.class)) {
-            if (testClass.getAnnotation(UseAdviceWith.class).value()) {
-                logger.info("Skipping starting CamelContext(s) as UseAdviceWith annotation was found and isUseAdviceWith is set to true.");
-                skip = true;
-            } else {
-                logger.info("Starting CamelContext(s) as UseAdviceWith annotation was found, but isUseAdviceWith is set to false.");
-                skip = false;
-            }
-        }
-        
-        if (!skip) {
-            CamelSpringTestHelper.doToSpringCamelContexts(context, new DoToSpringCamelContextsStrategy() {
-                public void execute(String contextName,
-                        SpringCamelContext camelContext) throws Exception {
-                    logger.info("Starting CamelContext with name [{}].", contextName);
-                    camelContext.start();
-                }
-            });
-        }
-    }
 
     /**
      * Returns the class under test in order to enable inspection of annotations while the

http://git-wip-us.apache.org/repos/asf/camel/blob/11cc56e0/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/CamelTestContextBootstrapper.java
----------------------------------------------------------------------
diff --git a/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/CamelTestContextBootstrapper.java b/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/CamelTestContextBootstrapper.java
index 169eed1..d08540f 100644
--- a/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/CamelTestContextBootstrapper.java
+++ b/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/CamelTestContextBootstrapper.java
@@ -20,7 +20,7 @@ import org.springframework.test.context.ContextLoader;
 import org.springframework.test.context.support.DefaultTestContextBootstrapper;
 
 /**
- * To boostrap Camel for testing with Spring 4.1 onwards.
+ * To bootstrap Camel for testing with Spring 4.1 onwards.
  */
 public class CamelTestContextBootstrapper extends DefaultTestContextBootstrapper {