http://git-wip-us.apache.org/repos/asf/camel/blob/7764c326/components/camel-test-spring40/src/test/java/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunnerProvidesBreakpointTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-test-spring40/src/test/java/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunnerProvidesBreakpointTest.java
 
b/components/camel-test-spring40/src/test/java/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunnerProvidesBreakpointTest.java
new file mode 100644
index 0000000..ae2d637
--- /dev/null
+++ 
b/components/camel-test-spring40/src/test/java/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunnerProvidesBreakpointTest.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.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.impl.BreakpointSupport;
+import org.apache.camel.model.ProcessorDefinition;
+import org.apache.camel.spi.Breakpoint;
+
+import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+public class CamelSpringJUnit4ClassRunnerProvidesBreakpointTest 
+        extends CamelSpringJUnit4ClassRunnerPlainTest {
+
+    @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, 
ProcessorDefinition<?> definition) {
+            breakpointHit = true;
+        }
+
+        public boolean isBreakpointHit() {
+            return breakpointHit;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/7764c326/components/camel-test-spring40/src/test/java/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunnerShutdownTimeoutInheritedOverrideTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-test-spring40/src/test/java/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunnerShutdownTimeoutInheritedOverrideTest.java
 
b/components/camel-test-spring40/src/test/java/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunnerShutdownTimeoutInheritedOverrideTest.java
new file mode 100644
index 0000000..c011d1f
--- /dev/null
+++ 
b/components/camel-test-spring40/src/test/java/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunnerShutdownTimeoutInheritedOverrideTest.java
@@ -0,0 +1,34 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.test.spring;
+
+import java.util.concurrent.TimeUnit;
+
+import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+
+@ShutdownTimeout
+public class CamelSpringJUnit4ClassRunnerShutdownTimeoutInheritedOverrideTest
+        extends CamelSpringJUnit4ClassRunnerShutdownTimeoutTest {
+
+    @Test
+    @Override
+    public void testShutdownTimeout() throws Exception {
+        assertEquals(10, camelContext.getShutdownStrategy().getTimeout());
+        assertEquals(TimeUnit.SECONDS, 
camelContext.getShutdownStrategy().getTimeUnit());
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/7764c326/components/camel-test-spring40/src/test/java/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunnerShutdownTimeoutInheritedTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-test-spring40/src/test/java/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunnerShutdownTimeoutInheritedTest.java
 
b/components/camel-test-spring40/src/test/java/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunnerShutdownTimeoutInheritedTest.java
new file mode 100644
index 0000000..9f66625
--- /dev/null
+++ 
b/components/camel-test-spring40/src/test/java/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunnerShutdownTimeoutInheritedTest.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.spring;
+
+public class CamelSpringJUnit4ClassRunnerShutdownTimeoutInheritedTest
+        extends CamelSpringJUnit4ClassRunnerShutdownTimeoutTest {
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/7764c326/components/camel-test-spring40/src/test/java/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunnerShutdownTimeoutTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-test-spring40/src/test/java/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunnerShutdownTimeoutTest.java
 
b/components/camel-test-spring40/src/test/java/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunnerShutdownTimeoutTest.java
new file mode 100644
index 0000000..85a80ba
--- /dev/null
+++ 
b/components/camel-test-spring40/src/test/java/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunnerShutdownTimeoutTest.java
@@ -0,0 +1,34 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.test.spring;
+
+import java.util.concurrent.TimeUnit;
+
+import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+
+@ShutdownTimeout(value = 11, timeUnit = TimeUnit.MILLISECONDS)
+public class CamelSpringJUnit4ClassRunnerShutdownTimeoutTest
+        extends CamelSpringJUnit4ClassRunnerPlainTest {
+
+    @Test
+    @Override
+    public void testShutdownTimeout() throws Exception {
+        assertEquals(11, camelContext.getShutdownStrategy().getTimeout());
+        assertEquals(TimeUnit.MILLISECONDS, 
camelContext.getShutdownStrategy().getTimeUnit());
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/7764c326/components/camel-test-spring40/src/test/java/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunnerUseAdviceWithTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-test-spring40/src/test/java/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunnerUseAdviceWithTest.java
 
b/components/camel-test-spring40/src/test/java/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunnerUseAdviceWithTest.java
new file mode 100644
index 0000000..7cf5e06
--- /dev/null
+++ 
b/components/camel-test-spring40/src/test/java/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunnerUseAdviceWithTest.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.spring;
+
+import org.apache.camel.ServiceStatus;
+import org.apache.camel.util.StopWatch;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+@UseAdviceWith
+public class CamelSpringJUnit4ClassRunnerUseAdviceWithTest extends 
CamelSpringJUnit4ClassRunnerPlainTest {
+    
+    @Before
+    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, but was: " + taken, taken > 0);
+        assertTrue(taken + " < 3000, but was: " + taken, taken < 3000);
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/7764c326/components/camel-test-spring40/src/test/java/org/apache/camel/test/spring/CamelSpringTestSupportActiveProfileTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-test-spring40/src/test/java/org/apache/camel/test/spring/CamelSpringTestSupportActiveProfileTest.java
 
b/components/camel-test-spring40/src/test/java/org/apache/camel/test/spring/CamelSpringTestSupportActiveProfileTest.java
new file mode 100644
index 0000000..7e7445c
--- /dev/null
+++ 
b/components/camel-test-spring40/src/test/java/org/apache/camel/test/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.spring;
+
+import org.junit.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/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

http://git-wip-us.apache.org/repos/asf/camel/blob/7764c326/components/camel-test-spring40/src/test/java/org/apache/camel/test/spring/TestRouteBuilder.java
----------------------------------------------------------------------
diff --git 
a/components/camel-test-spring40/src/test/java/org/apache/camel/test/spring/TestRouteBuilder.java
 
b/components/camel-test-spring40/src/test/java/org/apache/camel/test/spring/TestRouteBuilder.java
new file mode 100644
index 0000000..52059c4
--- /dev/null
+++ 
b/components/camel-test-spring40/src/test/java/org/apache/camel/test/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.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");
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/7764c326/components/camel-test-spring40/src/test/resources/jndi.properties
----------------------------------------------------------------------
diff --git a/components/camel-test-spring40/src/test/resources/jndi.properties 
b/components/camel-test-spring40/src/test/resources/jndi.properties
new file mode 100644
index 0000000..5961589
--- /dev/null
+++ b/components/camel-test-spring40/src/test/resources/jndi.properties
@@ -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.
+## ---------------------------------------------------------------------------
+
+# START SNIPPET: jndi
+
+java.naming.factory.initial = 
org.apache.camel.util.jndi.CamelInitialContextFactory
+
+# END SNIPPET: jndi

http://git-wip-us.apache.org/repos/asf/camel/blob/7764c326/components/camel-test-spring40/src/test/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/components/camel-test-spring40/src/test/resources/log4j.properties 
b/components/camel-test-spring40/src/test/resources/log4j.properties
new file mode 100644
index 0000000..1eb13a5
--- /dev/null
+++ b/components/camel-test-spring40/src/test/resources/log4j.properties
@@ -0,0 +1,37 @@
+## ------------------------------------------------------------------------
+## Licensed to the Apache Software Foundation (ASF) under one or more
+## contributor license agreements.  See the NOTICE file distributed with
+## this work for additional information regarding copyright ownership.
+## The ASF licenses this file to You under the Apache License, Version 2.0
+## (the "License"); you may not use this file except in compliance with
+## the License.  You may obtain a copy of the License at
+##
+## http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+## ------------------------------------------------------------------------
+
+#
+# The logging properties used for testing
+#
+log4j.rootLogger=INFO, file
+
+log4j.logger.org.springframework=WARN
+#log4j.logger.org.apache.camel=DEBUG
+#log4j.logger.org.apache.camel.test.junit4=DEBUG
+
+# CONSOLE appender not used by default
+log4j.appender.out=org.apache.log4j.ConsoleAppender
+log4j.appender.out.layout=org.apache.log4j.PatternLayout
+log4j.appender.out.layout.ConversionPattern=[%30.30t] %-30.30c{1} %-5p %m%n
+#log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - 
%m%n
+
+# File appender
+log4j.appender.file=org.apache.log4j.FileAppender
+log4j.appender.file.layout=org.apache.log4j.PatternLayout
+log4j.appender.file.layout.ConversionPattern=%d %-5p %c{1} - %m %n
+log4j.appender.file.file=target/camel-spring-test.log

http://git-wip-us.apache.org/repos/asf/camel/blob/7764c326/components/camel-test-spring40/src/test/resources/org/apache/camel/test/issues/AdviceWithOnExceptionMultipleIssueTest.xml
----------------------------------------------------------------------
diff --git 
a/components/camel-test-spring40/src/test/resources/org/apache/camel/test/issues/AdviceWithOnExceptionMultipleIssueTest.xml
 
b/components/camel-test-spring40/src/test/resources/org/apache/camel/test/issues/AdviceWithOnExceptionMultipleIssueTest.xml
new file mode 100644
index 0000000..76b18ed
--- /dev/null
+++ 
b/components/camel-test-spring40/src/test/resources/org/apache/camel/test/issues/AdviceWithOnExceptionMultipleIssueTest.xml
@@ -0,0 +1,47 @@
+<?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

http://git-wip-us.apache.org/repos/asf/camel/blob/7764c326/components/camel-test-spring40/src/test/resources/org/apache/camel/test/issues/MockEndpointsAndSkipTest.xml
----------------------------------------------------------------------
diff --git 
a/components/camel-test-spring40/src/test/resources/org/apache/camel/test/issues/MockEndpointsAndSkipTest.xml
 
b/components/camel-test-spring40/src/test/resources/org/apache/camel/test/issues/MockEndpointsAndSkipTest.xml
new file mode 100644
index 0000000..81b9093
--- /dev/null
+++ 
b/components/camel-test-spring40/src/test/resources/org/apache/camel/test/issues/MockEndpointsAndSkipTest.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 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

http://git-wip-us.apache.org/repos/asf/camel/blob/7764c326/components/camel-test-spring40/src/test/resources/org/apache/camel/test/patterns/ProduceBeanInjectTest.xml
----------------------------------------------------------------------
diff --git 
a/components/camel-test-spring40/src/test/resources/org/apache/camel/test/patterns/ProduceBeanInjectTest.xml
 
b/components/camel-test-spring40/src/test/resources/org/apache/camel/test/patterns/ProduceBeanInjectTest.xml
new file mode 100644
index 0000000..a697e1d
--- /dev/null
+++ 
b/components/camel-test-spring40/src/test/resources/org/apache/camel/test/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="camelPostProcessBean" 
class="org.apache.camel.spring.CamelBeanPostProcessor" /-->
+
+    <bean id="myProduceBean" 
class="org.apache.camel.test.patterns.MyProduceBean"/>
+    
+</beans>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/7764c326/components/camel-test-spring40/src/test/resources/org/apache/camel/test/patterns/ProduceBeanTest.xml
----------------------------------------------------------------------
diff --git 
a/components/camel-test-spring40/src/test/resources/org/apache/camel/test/patterns/ProduceBeanTest.xml
 
b/components/camel-test-spring40/src/test/resources/org/apache/camel/test/patterns/ProduceBeanTest.xml
new file mode 100644
index 0000000..525ed01
--- /dev/null
+++ 
b/components/camel-test-spring40/src/test/resources/org/apache/camel/test/patterns/ProduceBeanTest.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";
+       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.patterns.MyProduceBean"/>
+               </route>
+       </camelContext>
+
+</beans>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/7764c326/components/camel-test-spring40/src/test/resources/org/apache/camel/test/patterns/applicationContext.xml
----------------------------------------------------------------------
diff --git 
a/components/camel-test-spring40/src/test/resources/org/apache/camel/test/patterns/applicationContext.xml
 
b/components/camel-test-spring40/src/test/resources/org/apache/camel/test/patterns/applicationContext.xml
new file mode 100644
index 0000000..081ae23
--- /dev/null
+++ 
b/components/camel-test-spring40/src/test/resources/org/apache/camel/test/patterns/applicationContext.xml
@@ -0,0 +1,38 @@
+<?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

http://git-wip-us.apache.org/repos/asf/camel/blob/7764c326/components/camel-test-spring40/src/test/resources/org/apache/camel/test/spring/CamelSpringActiveProfileTest-context.xml
----------------------------------------------------------------------
diff --git 
a/components/camel-test-spring40/src/test/resources/org/apache/camel/test/spring/CamelSpringActiveProfileTest-context.xml
 
b/components/camel-test-spring40/src/test/resources/org/apache/camel/test/spring/CamelSpringActiveProfileTest-context.xml
new file mode 100644
index 0000000..ceacb2d
--- /dev/null
+++ 
b/components/camel-test-spring40/src/test/resources/org/apache/camel/test/spring/CamelSpringActiveProfileTest-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";
+    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/spring/test.properties"/>
+     </bean>
+  </beans>
+</beans>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/7764c326/components/camel-test-spring40/src/test/resources/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunnerPlainTest-context.xml
----------------------------------------------------------------------
diff --git 
a/components/camel-test-spring40/src/test/resources/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunnerPlainTest-context.xml
 
b/components/camel-test-spring40/src/test/resources/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunnerPlainTest-context.xml
new file mode 100644
index 0000000..ee2e7ce
--- /dev/null
+++ 
b/components/camel-test-spring40/src/test/resources/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunnerPlainTest-context.xml
@@ -0,0 +1,50 @@
+<?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.spring</package>
+    </packageScan>
+    <route>
+      <from uri="direct:start"/>
+      <to uri="mock:a"/>
+      <transform>
+        <simple>Hello ${body}</simple>
+      </transform>
+      <to uri="mock:b"/>
+    </route>
+  </camelContext>
+
+  <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.junit4.spring"/>
+      <to uri="seda:context2.seda"/>
+    </route>
+  </camelContext>
+
+</beans>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/7764c326/components/camel-test-spring40/src/test/resources/org/apache/camel/test/spring/test.properties
----------------------------------------------------------------------
diff --git 
a/components/camel-test-spring40/src/test/resources/org/apache/camel/test/spring/test.properties
 
b/components/camel-test-spring40/src/test/resources/org/apache/camel/test/spring/test.properties
new file mode 100644
index 0000000..f891086
--- /dev/null
+++ 
b/components/camel-test-spring40/src/test/resources/org/apache/camel/test/spring/test.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.
+## ---------------------------------------------------------------------------
+
+cool.end=mock:test
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/7764c326/components/camel-test-spring41/pom.xml
----------------------------------------------------------------------
diff --git a/components/camel-test-spring41/pom.xml 
b/components/camel-test-spring41/pom.xml
deleted file mode 100644
index 8f5666b..0000000
--- a/components/camel-test-spring41/pom.xml
+++ /dev/null
@@ -1,96 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  Licensed to the Apache Software Foundation (ASF) under one or more
-  contributor license agreements.  See the NOTICE file distributed with
-  this work for additional information regarding copyright ownership.
-  The ASF licenses this file to You under the Apache License, Version 2.0
-  (the "License"); you may not use this file except in compliance with
-  the License.  You may obtain a copy of the License at
-
-  http://www.apache.org/licenses/LICENSE-2.0
-
-  Unless required by applicable law or agreed to in writing, software
-  distributed under the License is distributed on an "AS IS" BASIS,
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  See the License for the specific language governing permissions and
-  limitations under the License.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
-
-  <modelVersion>4.0.0</modelVersion>
-
-  <parent>
-    <groupId>org.apache.camel</groupId>
-    <artifactId>components</artifactId>
-    <version>2.15-SNAPSHOT</version>
-  </parent>
-
-  <artifactId>camel-test-spring41</artifactId>
-  <packaging>bundle</packaging>
-  <name>Camel :: Test :: Spring 4.1</name>
-  <description>Camel Testing Library using JUnit and Spring 4.1</description>
-
-  <properties>
-    
<camel.osgi.export.pkg>org.apache.camel.test.spring.*</camel.osgi.export.pkg>
-    <spring-version>${spring41-version}</spring-version>
-    <spring4-version>${spring41-version}</spring4-version>
-  </properties>
-
-  <dependencies>
-
-    <dependency>
-      <groupId>org.apache.camel</groupId>
-      <artifactId>camel-test</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.camel</groupId>
-      <artifactId>camel-spring</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.springframework</groupId>
-      <artifactId>spring-test</artifactId>
-      <version>${spring4-version}</version>
-    </dependency>
-    <!-- we need to override the other spring version -->
-    <dependency>
-      <groupId>org.springframework</groupId>
-      <artifactId>spring-context</artifactId>
-      <version>${spring4-version}</version>
-    </dependency>
-    <dependency>
-      <groupId>org.springframework</groupId>
-      <artifactId>spring-beans</artifactId>
-      <version>${spring4-version}</version>
-    </dependency>
-    <dependency>
-      <groupId>org.springframework</groupId>
-      <artifactId>spring-expression</artifactId>
-      <version>${spring4-version}</version>
-    </dependency>
-    <dependency>
-      <groupId>org.springframework</groupId>
-      <artifactId>spring-aop</artifactId>
-      <version>${spring4-version}</version>
-    </dependency>
-    <dependency>
-      <groupId>org.springframework</groupId>
-      <artifactId>spring-tx</artifactId>
-      <version>${spring4-version}</version>
-    </dependency>
-    <dependency>
-      <groupId>org.springframework</groupId>
-      <artifactId>spring-core</artifactId>
-      <version>${spring4-version}</version>
-    </dependency>
-
-
-    <!-- test dependencies -->
-    <dependency>
-      <groupId>org.slf4j</groupId>
-      <artifactId>slf4j-log4j12</artifactId>
-      <scope>test</scope>
-    </dependency>
-  </dependencies>
-
-</project>

http://git-wip-us.apache.org/repos/asf/camel/blob/7764c326/components/camel-test-spring41/src/main/java/org/apache/camel/test/spring/CamelSpringDelegatingTestContextLoader.java
----------------------------------------------------------------------
diff --git 
a/components/camel-test-spring41/src/main/java/org/apache/camel/test/spring/CamelSpringDelegatingTestContextLoader.java
 
b/components/camel-test-spring41/src/main/java/org/apache/camel/test/spring/CamelSpringDelegatingTestContextLoader.java
deleted file mode 100644
index a3bb4a3..0000000
--- 
a/components/camel-test-spring41/src/main/java/org/apache/camel/test/spring/CamelSpringDelegatingTestContextLoader.java
+++ /dev/null
@@ -1,321 +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.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.concurrent.TimeUnit;
-
-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>
- * <em>This loader can handle either classes or locations for configuring the 
context.</em>
- * <br>
- * NOTE: This TestContextLoader doesn't support the annotation of 
ExcludeRoutes now.
- */
-public class CamelSpringDelegatingTestContextLoader extends 
DelegatingSmartContextLoader {
-
-    protected final Logger logger = LoggerFactory.getLogger(getClass());
-
-    @Override
-    public ApplicationContext loadContext(MergedContextConfiguration 
mergedConfig) throws Exception {
-        
-        Class<?> testClass = getTestClass();
-        
-        if (logger.isDebugEnabled()) {
-            logger.debug("Loading ApplicationContext for merged context 
configuration [{}].", mergedConfig);
-        }
-        
-        // Pre CamelContext(s) instantiation setup
-        handleDisableJmx(null, testClass);
-        
-        try {
-            SpringCamelContext.setNoStart(true);
-            ConfigurableApplicationContext context = 
(ConfigurableApplicationContext) super.loadContext(mergedConfig);
-            SpringCamelContext.setNoStart(false);
-            return loadContext(context, testClass);
-        } finally {
-            cleanup(testClass);
-        }
-    }
-
-    /**
-     * Performs the bulk of the Spring application context 
loading/customization.
-     *
-     * @param context the partially configured context.  The context should 
have the bean definitions loaded, but nothing else.
-     * @param testClass the test class being executed
-     * @return the initialized (refreshed) Spring application context
-     *
-     * @throws Exception if there is an error during 
initialization/customization
-     */
-    public ApplicationContext loadContext(ConfigurableApplicationContext 
context, Class<?> testClass)
-        throws Exception {
-            
-        
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);
-        
-        // CamelContext(s) startup
-        handleCamelContextStartup(context, testClass);
-        
-        return context;
-    }
-    
-    /**
-     * Cleanup/restore global state to defaults / pre-test values after the 
test setup
-     * is complete. 
-     * 
-     * @param testClass the test class being executed
-     */
-    protected void cleanup(Class<?> testClass) {
-        SpringCamelContext.setNoStart(false);
-        
-        if (testClass.isAnnotationPresent(DisableJmx.class)) {
-            if (CamelSpringTestHelper.getOriginalJmxDisabled() == null) {
-                System.clearProperty(JmxSystemPropertyKeys.DISABLED);
-            } else {
-                System.setProperty(JmxSystemPropertyKeys.DISABLED,
-                    CamelSpringTestHelper.getOriginalJmxDisabled());
-            }
-        }
-    }
-    
-    /**
-     * 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 {
-                    logger.info("Enabling auto mocking and skipping of 
endpoints matching pattern [{}] on CamelContext with name [{}].", 
mockEndpoints, contextName);
-                    camelContext.addRegisterEndpointCallback(new 
InterceptSendToMockEndpointStrategy(mockEndpoints, true));
-                }
-            });
-        }
-    }
-    
-    
-    /**
-     * 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
-     * Spring context is being created.
-     * 
-     * @return the test class that is being executed
-     * @see CamelSpringTestHelper
-     */
-    protected Class<?> getTestClass() {
-        return CamelSpringTestHelper.getTestClass();
-    }
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/7764c326/components/camel-test-spring41/src/main/java/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunner.java
----------------------------------------------------------------------
diff --git 
a/components/camel-test-spring41/src/main/java/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunner.java
 
b/components/camel-test-spring41/src/main/java/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunner.java
deleted file mode 100644
index 3d88020..0000000
--- 
a/components/camel-test-spring41/src/main/java/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunner.java
+++ /dev/null
@@ -1,68 +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.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 CamelSpringJUnit4ClassRunner extends SpringJUnit4ClassRunner {
-
-    public CamelSpringJUnit4ClassRunner(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);
-
-            // inject Camel first, and then disable jmx and add the stop-watch
-            List<TestExecutionListener> list = getTestExecutionListeners();
-            list.add(0, new 
CamelSpringTestContextLoaderTestExecutionListener());
-            list.add(new DisableJmxTestExecutionListener());
-            list.add(new StopWatchTestExecutionListener());
-            registerTestExecutionListeners(list);
-        }
-
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/7764c326/components/camel-test-spring41/src/main/java/org/apache/camel/test/spring/CamelSpringTestContextLoader.java
----------------------------------------------------------------------
diff --git 
a/components/camel-test-spring41/src/main/java/org/apache/camel/test/spring/CamelSpringTestContextLoader.java
 
b/components/camel-test-spring41/src/main/java/org/apache/camel/test/spring/CamelSpringTestContextLoader.java
deleted file mode 100644
index e973b44..0000000
--- 
a/components/camel-test-spring41/src/main/java/org/apache/camel/test/spring/CamelSpringTestContextLoader.java
+++ /dev/null
@@ -1,473 +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.spring;
-
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.concurrent.TimeUnit;
-
-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.ExcludingPackageScanClassResolver;
-import 
org.apache.camel.test.spring.CamelSpringTestHelper.DoToSpringCamelContextsStrategy;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.support.RootBeanDefinition;
-import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.annotation.AnnotationConfigUtils;
-import org.springframework.context.support.GenericApplicationContext;
-import org.springframework.core.annotation.AnnotationUtils;
-import org.springframework.test.context.MergedContextConfiguration;
-import org.springframework.test.context.support.AbstractContextLoader;
-import org.springframework.test.context.support.AbstractGenericContextLoader;
-import org.springframework.test.context.support.GenericXmlContextLoader;
-import org.springframework.util.StringUtils;
-
-import static org.apache.camel.test.spring.CamelSpringTestHelper.getAllMethods;
-
-/**
- * Replacement for the default {@link GenericXmlContextLoader} that provides 
hooks for
- * processing some class level Camel related test annotations.
- */
-public class CamelSpringTestContextLoader extends AbstractContextLoader {
-    
-    private static final Logger LOG = 
LoggerFactory.getLogger(CamelSpringTestContextLoader.class);
-    
-    /**
-     *  Modeled after the Spring implementation in {@link 
AbstractGenericContextLoader},
-     *  this method creates and refreshes the application context while 
providing for
-     *  processing of additional Camel specific post-refresh actions.  We do 
not provide the
-     *  pre-post hooks for customization seen in {@link 
AbstractGenericContextLoader} because
-     *  they probably are unnecessary for 90+% of users.
-     *  <p/>
-     *  For some functionality, we cannot use {@link 
org.springframework.test.context.TestExecutionListener} because we need
-     *  to both produce the desired outcome during application context 
loading, and also cleanup
-     *  after ourselves even if the test class never executes.  Thus the 
listeners, which
-     *  only run if the application context is successfully initialized are 
insufficient to
-     *  provide the behavior described above.
-     */
-    @Override
-    public ApplicationContext loadContext(MergedContextConfiguration 
mergedConfig) throws Exception {
-        Class<?> testClass = getTestClass();
-        
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("Loading ApplicationContext for merged context 
configuration [{}].", mergedConfig);
-        }
-        
-        try {            
-            GenericApplicationContext context = createContext(testClass, 
mergedConfig);
-            
context.getEnvironment().setActiveProfiles(mergedConfig.getActiveProfiles());
-            loadBeanDefinitions(context, mergedConfig);
-            return loadContext(context, testClass);
-        } finally {
-            cleanup(testClass);
-        }
-    }
-    
-    /**
-     *  Modeled after the Spring implementation in {@link 
AbstractGenericContextLoader},
-     *  this method creates and refreshes the application context while 
providing for
-     *  processing of additional Camel specific post-refresh actions.  We do 
not provide the
-     *  pre-post hooks for customization seen in {@link 
AbstractGenericContextLoader} because
-     *  they probably are unnecessary for 90+% of users.
-     *  <p/>
-     *  For some functionality, we cannot use {@link 
org.springframework.test.context.TestExecutionListener} because we need
-     *  to both produce the desired outcome during application context 
loading, and also cleanup
-     *  after ourselves even if the test class never executes.  Thus the 
listeners, which
-     *  only run if the application context is successfully initialized are 
insufficient to
-     *  provide the behavior described above.
-     */
-    @Override
-    public ApplicationContext loadContext(String... locations) throws 
Exception {
-        
-        Class<?> testClass = getTestClass();
-        
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("Loading ApplicationContext for locations [" + 
StringUtils.arrayToCommaDelimitedString(locations) + "].");
-        }
-        
-        try {
-            GenericApplicationContext context = createContext(testClass, null);
-            loadBeanDefinitions(context, locations);
-            return loadContext(context, testClass);
-        } finally {
-            cleanup(testClass);
-        }
-    }
-
-    /**
-     * Returns &quot;<code>-context.xml</code>&quot;.
-     */
-    @Override
-    public String getResourceSuffix() {
-        return "-context.xml";
-    }
-    
-    /**
-     * Performs the bulk of the Spring application context 
loading/customization.
-     *
-     * @param context the partially configured context.  The context should 
have the bean definitions loaded, but nothing else.
-     * @param testClass the test class being executed
-     * @return the initialized (refreshed) Spring application context
-     *
-     * @throws Exception if there is an error during 
initialization/customization
-     */
-    protected ApplicationContext loadContext(GenericApplicationContext 
context, Class<?> testClass) throws Exception {
-            
-        AnnotationConfigUtils.registerAnnotationConfigProcessors(context);
-        
-        // Pre CamelContext(s) instantiation setup
-        handleDisableJmx(context, testClass);
-
-        // Temporarily disable CamelContext start while the contexts are 
instantiated.
-        SpringCamelContext.setNoStart(true);
-        context.refresh();
-        context.registerShutdownHook();
-        // Turn CamelContext startup back on since the context's have now been 
instantiated.
-        SpringCamelContext.setNoStart(false);
-        
-        // Post CamelContext(s) instantiation but pre CamelContext(s) start 
setup
-        handleProvidesBreakpoint(context, testClass);
-        handleShutdownTimeout(context, testClass);
-        handleMockEndpoints(context, testClass);
-        handleMockEndpointsAndSkip(context, testClass);
-        handleLazyLoadTypeConverters(context, testClass);
-        
-        // CamelContext(s) startup
-        handleCamelContextStartup(context, testClass);
-        
-        return context;
-    }
-    
-    /**
-     * Cleanup/restore global state to defaults / pre-test values after the 
test setup
-     * is complete. 
-     * 
-     * @param testClass the test class being executed
-     */
-    protected void cleanup(Class<?> testClass) {
-        SpringCamelContext.setNoStart(false);
-        
-        if (testClass.isAnnotationPresent(DisableJmx.class)) {
-            if (CamelSpringTestHelper.getOriginalJmxDisabled() == null) {
-                System.clearProperty(JmxSystemPropertyKeys.DISABLED);
-            } else {
-                System.setProperty(JmxSystemPropertyKeys.DISABLED,
-                    CamelSpringTestHelper.getOriginalJmxDisabled());
-            }
-        }
-    }
-    
-    protected void loadBeanDefinitions(GenericApplicationContext context, 
MergedContextConfiguration mergedConfig) {
-        (new 
XmlBeanDefinitionReader(context)).loadBeanDefinitions(mergedConfig.getLocations());
-    }
-    
-    protected void loadBeanDefinitions(GenericApplicationContext context, 
String... locations) {
-        (new XmlBeanDefinitionReader(context)).loadBeanDefinitions(locations);
-    }
-    
-    /**
-     * Creates and starts the Spring context while optionally starting any 
loaded Camel contexts.
-     *
-     * @param testClass the test class that is being executed
-     * @return the loaded Spring context
-     */
-    protected GenericApplicationContext createContext(Class<?> testClass, 
MergedContextConfiguration mergedConfig) {
-        ApplicationContext parentContext = null;
-        GenericApplicationContext routeExcludingContext = null;
-        
-        if (mergedConfig != null) {
-            parentContext = mergedConfig.getParentApplicationContext();
-
-        }
-        
-        if (testClass.isAnnotationPresent(ExcludeRoutes.class)) {
-            Class<?>[] excludedClasses = 
testClass.getAnnotation(ExcludeRoutes.class).value();
-            
-            if (excludedClasses.length > 0) {
-                if (LOG.isDebugEnabled()) {
-                    LOG.debug("Setting up package scanning excluded classes as 
ExcludeRoutes "
-                            + "annotation was found. Excluding [" + 
StringUtils.arrayToCommaDelimitedString(excludedClasses) + "].");
-                }
-                
-                if (parentContext == null) {
-                    routeExcludingContext = new GenericApplicationContext();
-                } else {
-                    routeExcludingContext = new 
GenericApplicationContext(parentContext);
-                }
-                
routeExcludingContext.registerBeanDefinition("excludingResolver", new 
RootBeanDefinition(ExcludingPackageScanClassResolver.class));
-                routeExcludingContext.refresh();
-                
-                ExcludingPackageScanClassResolver excludingResolver = 
routeExcludingContext.getBean("excludingResolver", 
ExcludingPackageScanClassResolver.class);
-                List<Class<?>> excluded = Arrays.asList(excludedClasses);
-                excludingResolver.setExcludedClasses(new 
HashSet<Class<?>>(excluded));
-            } else {
-                if (LOG.isDebugEnabled()) {
-                    LOG.debug("Not enabling package scanning excluded classes 
as ExcludeRoutes "
-                            + "annotation was found but no classes were 
excluded.");
-                }
-            }
-        }
-        
-        GenericApplicationContext context;
-
-        if (routeExcludingContext != null) {
-            context = new GenericApplicationContext(routeExcludingContext);
-        } else {
-            if (parentContext != null) {
-                context = new GenericApplicationContext(parentContext);
-            } else {
-                context = new GenericApplicationContext();
-            }
-        }
-        
-        return context;
-    }
-    
-    /**
-     * 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(GenericApplicationContext context, 
Class<?> testClass) {
-        
CamelSpringTestHelper.setOriginalJmxDisabledValue(System.getProperty(JmxSystemPropertyKeys.DISABLED));
-        
-        if (testClass.isAnnotationPresent(DisableJmx.class)) {
-            if (testClass.getAnnotation(DisableJmx.class).value()) {
-                LOG.info("Disabling Camel JMX globally as DisableJmx 
annotation was found and disableJmx is set to true.");
-                System.setProperty(JmxSystemPropertyKeys.DISABLED, "true");
-            } else {
-                LOG.info("Enabling Camel JMX as DisableJmx annotation was 
found and disableJmx is set to false.");
-                System.clearProperty(JmxSystemPropertyKeys.DISABLED);
-            }
-        } else {
-            LOG.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(GenericApplicationContext 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() {
-                
-                @Override
-                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) {
-                        LOG.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(GenericApplicationContext 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() {
-            
-            @Override
-            public void execute(String contextName, SpringCamelContext 
camelContext)
-                throws Exception {
-                LOG.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(GenericApplicationContext context, 
Class<?> testClass) throws Exception {
-        if (testClass.isAnnotationPresent(MockEndpoints.class)) {
-            final String mockEndpoints = 
testClass.getAnnotation(MockEndpoints.class).value();
-            CamelSpringTestHelper.doToSpringCamelContexts(context, new 
DoToSpringCamelContextsStrategy() {
-                
-                @Override
-                public void execute(String contextName, SpringCamelContext 
camelContext)
-                    throws Exception {
-                    LOG.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(GenericApplicationContext 
context, Class<?> testClass) throws Exception {
-        if (testClass.isAnnotationPresent(MockEndpointsAndSkip.class)) {
-            final String mockEndpoints = 
testClass.getAnnotation(MockEndpointsAndSkip.class).value();
-            CamelSpringTestHelper.doToSpringCamelContexts(context, new 
DoToSpringCamelContextsStrategy() {
-                
-                @Override
-                public void execute(String contextName, SpringCamelContext 
camelContext)
-                    throws Exception {
-                    LOG.info("Enabling auto mocking and skipping of endpoints 
matching pattern [{}] on CamelContext with name [{}].", mockEndpoints, 
contextName);
-                    camelContext.addRegisterEndpointCallback(new 
InterceptSendToMockEndpointStrategy(mockEndpoints, true));
-                }
-            });
-        }
-    }
-    
-    @SuppressWarnings("deprecation")
-    protected void handleLazyLoadTypeConverters(GenericApplicationContext 
context, Class<?> testClass) throws Exception {
-        final boolean lazy;
-        
-        if (testClass.isAnnotationPresent(LazyLoadTypeConverters.class)) {
-            lazy = 
testClass.getAnnotation(LazyLoadTypeConverters.class).value();
-        } else {
-            lazy = true;
-        }
-         
-        if (lazy) {
-            CamelSpringTestHelper.doToSpringCamelContexts(context, new 
DoToSpringCamelContextsStrategy() {
-                
-                @Override
-                public void execute(String contextName, SpringCamelContext 
camelContext)
-                    throws Exception {
-                    LOG.info("Enabling lazy loading of type converters on 
CamelContext with name [{}].", contextName);
-                    camelContext.setLazyLoadTypeConverters(lazy);
-                }
-            });
-        }
-    }
-    
-    /**
-     * 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(GenericApplicationContext 
context, Class<?> testClass) throws Exception {
-        boolean skip = 
"true".equalsIgnoreCase(System.getProperty("skipStartingCamelContext"));
-        if (skip) {
-            LOG.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()) {
-                LOG.info("Skipping starting CamelContext(s) as UseAdviceWith 
annotation was found and isUseAdviceWith is set to true.");
-                skip = true;
-            } else {
-                LOG.info("Starting CamelContext(s) as UseAdviceWith annotation 
was found, but isUseAdviceWith is set to false.");
-                skip = false;
-            }
-        }
-        
-        if (!skip) {
-            CamelSpringTestHelper.doToSpringCamelContexts(context, new 
DoToSpringCamelContextsStrategy() {
-                
-                @Override
-                public void execute(String contextName,
-                        SpringCamelContext camelContext) throws Exception {
-                    LOG.info("Starting CamelContext with name [{}].", 
contextName);
-                    camelContext.start();
-                }
-            });
-        }
-    }
-    
-    /**
-     * Returns the class under test in order to enable inspection of 
annotations while the
-     * Spring context is being created.
-     * 
-     * @return the test class that is being executed
-     * @see CamelSpringTestHelper
-     */
-    protected Class<?> getTestClass() {
-        return CamelSpringTestHelper.getTestClass();
-    }
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/7764c326/components/camel-test-spring41/src/main/java/org/apache/camel/test/spring/CamelSpringTestContextLoaderTestExecutionListener.java
----------------------------------------------------------------------
diff --git 
a/components/camel-test-spring41/src/main/java/org/apache/camel/test/spring/CamelSpringTestContextLoaderTestExecutionListener.java
 
b/components/camel-test-spring41/src/main/java/org/apache/camel/test/spring/CamelSpringTestContextLoaderTestExecutionListener.java
deleted file mode 100644
index c96943d..0000000
--- 
a/components/camel-test-spring41/src/main/java/org/apache/camel/test/spring/CamelSpringTestContextLoaderTestExecutionListener.java
+++ /dev/null
@@ -1,36 +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.spring;
-
-import org.springframework.test.context.TestContext;
-import org.springframework.test.context.support.AbstractTestExecutionListener;
-
-/**
- * Helper for {@link CamelSpringTestContextLoader} that sets the test class 
state
- * in {@link CamelSpringTestHelper} almost immediately before the loader 
initializes
- * the Spring context.
- * <p/>
- * Implemented as a listener as the state can be set on a {@code ThreadLocal} 
and we are pretty sure
- * that the same thread will be used to initialize the Spring context.
- */
-public class CamelSpringTestContextLoaderTestExecutionListener extends 
AbstractTestExecutionListener {
-
-    @Override
-    public void prepareTestInstance(TestContext testContext) throws Exception {
-        CamelSpringTestHelper.setTestClass(testContext.getTestClass());
-    }    
-}

Reply via email to