Author: davsclaus
Date: Wed May 18 09:35:08 2011
New Revision: 1124138

URL: http://svn.apache.org/viewvc?rev=1124138&view=rev
Log:
CAMEL-3960: Added stuff in spring test support I forgot.

Modified:
    
camel/trunk/components/camel-test/src/main/java/org/apache/camel/test/junit4/CamelSpringTestSupport.java

Modified: 
camel/trunk/components/camel-test/src/main/java/org/apache/camel/test/junit4/CamelSpringTestSupport.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-test/src/main/java/org/apache/camel/test/junit4/CamelSpringTestSupport.java?rev=1124138&r1=1124137&r2=1124138&view=diff
==============================================================================
--- 
camel/trunk/components/camel-test/src/main/java/org/apache/camel/test/junit4/CamelSpringTestSupport.java
 (original)
+++ 
camel/trunk/components/camel-test/src/main/java/org/apache/camel/test/junit4/CamelSpringTestSupport.java
 Wed May 18 09:35:08 2011
@@ -32,6 +32,7 @@ import org.apache.camel.util.CastUtils;
 import org.apache.camel.util.ObjectHelper;
 import org.junit.After;
 import org.junit.AfterClass;
+import org.junit.Before;
 import org.springframework.beans.factory.support.RootBeanDefinition;
 import org.springframework.context.ApplicationContext;
 import org.springframework.context.support.AbstractApplicationContext;
@@ -45,6 +46,22 @@ public abstract class CamelSpringTestSup
     protected abstract AbstractApplicationContext createApplicationContext();
 
     @Override
+    @Before
+    public void setUp() throws Exception {
+        if 
(!"true".equalsIgnoreCase(System.getProperty("skipStartingCamelContext"))) {
+            // tell camel-spring it should not trigger starting CamelContext, 
since we do that later
+            // after we are finished setting up the unit test
+            System.setProperty("maybeStartCamelContext", "false");
+            applicationContext = createApplicationContext();
+            assertNotNull("Should have created a valid spring context", 
applicationContext);
+            super.setUp();
+            System.clearProperty("maybeStartCamelContext");
+        } else {
+            log.info("Skipping starting CamelContext as system property 
skipStartingCamelContext is set to be true.");
+        }
+    }
+
+    @Override
     public void doSetUp() throws Exception {
         applicationContext = createApplicationContext();
         super.doSetUp();


Reply via email to