Author: ningjiang
Date: Wed Mar 30 09:17:43 2011
New Revision: 1086877

URL: http://svn.apache.org/viewvc?rev=1086877&view=rev
Log:
CAMEL-3819 Introduce a flag not to start the camel context for running the 
camel system integration test with OSGi container

Modified:
    
camel/trunk/components/camel-test/src/main/java/org/apache/camel/test/junit4/CamelSpringTestSupport.java
    
camel/trunk/examples/camel-example-cxf-proxy/src/test/java/org/apache/camel/example/reportincident/ReportIncidentRoutesTest.java
    
camel/trunk/examples/camel-example-cxf/src/test/java/org/apache/camel/example/camel/transport/CamelTransportClientServerTest.java
    
camel/trunk/examples/camel-example-loan-broker/src/test/java/org/apache/camel/loanbroker/webservice/version/LoanBrokerTest.java
    camel/trunk/examples/pom.xml

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=1086877&r1=1086876&r2=1086877&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 Mar 30 09:17:43 2011
@@ -47,9 +47,13 @@ public abstract class CamelSpringTestSup
     @Override
     @Before
     public void setUp() throws Exception {
-        applicationContext = createApplicationContext();
-        assertNotNull("Should have created a valid spring context", 
applicationContext);
-        super.setUp();
+        if 
(!"true".equalsIgnoreCase(System.getProperty("skipStartingCamelContext"))) {
+            applicationContext = createApplicationContext();
+            assertNotNull("Should have created a valid spring context", 
applicationContext);
+            super.setUp();
+        } else {
+            log.info("Detect the system property, test skips starting camel 
context!");
+        }
     }
 
     @Override

Modified: 
camel/trunk/examples/camel-example-cxf-proxy/src/test/java/org/apache/camel/example/reportincident/ReportIncidentRoutesTest.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-cxf-proxy/src/test/java/org/apache/camel/example/reportincident/ReportIncidentRoutesTest.java?rev=1086877&r1=1086876&r2=1086877&view=diff
==============================================================================
--- 
camel/trunk/examples/camel-example-cxf-proxy/src/test/java/org/apache/camel/example/reportincident/ReportIncidentRoutesTest.java
 (original)
+++ 
camel/trunk/examples/camel-example-cxf-proxy/src/test/java/org/apache/camel/example/reportincident/ReportIncidentRoutesTest.java
 Wed Mar 30 09:17:43 2011
@@ -33,9 +33,13 @@ public class ReportIncidentRoutesTest {
     protected Main main;
 
     protected void startCamel() throws Exception {
-        main = new Main();
-        main.setApplicationContextUri("META-INF/spring/camel-config.xml");
-        main.start();
+        if 
(!"true".equalsIgnoreCase(System.getProperty("skipStartingCamelContext"))) {
+            main = new Main();
+            main.setApplicationContextUri("META-INF/spring/camel-config.xml");
+            main.start();
+        } else {
+            System.out.println("Detect the system property, test skips 
starting camel context!");
+        }
     }
     
     protected void stopCamel() throws Exception {

Modified: 
camel/trunk/examples/camel-example-cxf/src/test/java/org/apache/camel/example/camel/transport/CamelTransportClientServerTest.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-cxf/src/test/java/org/apache/camel/example/camel/transport/CamelTransportClientServerTest.java?rev=1086877&r1=1086876&r2=1086877&view=diff
==============================================================================
--- 
camel/trunk/examples/camel-example-cxf/src/test/java/org/apache/camel/example/camel/transport/CamelTransportClientServerTest.java
 (original)
+++ 
camel/trunk/examples/camel-example-cxf/src/test/java/org/apache/camel/example/camel/transport/CamelTransportClientServerTest.java
 Wed Mar 30 09:17:43 2011
@@ -35,7 +35,11 @@ public class CamelTransportClientServerT
     
     @BeforeClass
     public static void startUpServer() throws Exception {
-        context = new ClassPathXmlApplicationContext(new 
String[]{"/META-INF/spring/CamelTransportSpringConfig.xml"});   
+        if 
(!"true".equalsIgnoreCase(System.getProperty("skipStartingCamelContext"))) {
+            context = new ClassPathXmlApplicationContext(new 
String[]{"/META-INF/spring/CamelTransportSpringConfig.xml"});
+        } else {
+            System.out.println("Detect the system property, test skips 
starting camel context!");
+        }
     }
     
     @AfterClass

Modified: 
camel/trunk/examples/camel-example-loan-broker/src/test/java/org/apache/camel/loanbroker/webservice/version/LoanBrokerTest.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-loan-broker/src/test/java/org/apache/camel/loanbroker/webservice/version/LoanBrokerTest.java?rev=1086877&r1=1086876&r2=1086877&view=diff
==============================================================================
--- 
camel/trunk/examples/camel-example-loan-broker/src/test/java/org/apache/camel/loanbroker/webservice/version/LoanBrokerTest.java
 (original)
+++ 
camel/trunk/examples/camel-example-loan-broker/src/test/java/org/apache/camel/loanbroker/webservice/version/LoanBrokerTest.java
 Wed Mar 30 09:17:43 2011
@@ -29,7 +29,11 @@ public class LoanBrokerTest extends Asse
     
     @Before
     public void startServices() throws Exception {
-        applicationContext = new ClassPathXmlApplicationContext(new 
String[]{"/META-INF/spring/webServiceCamelContext.xml"});
+        if 
(!"true".equalsIgnoreCase(System.getProperty("skipStartingCamelContext"))) {
+            applicationContext = new ClassPathXmlApplicationContext(new 
String[]{"/META-INF/spring/webServiceCamelContext.xml"});
+        } else {
+            System.out.println("Detect the system property, test skips 
starting camel context!");
+        }
     }
     
     @After

Modified: camel/trunk/examples/pom.xml
URL: 
http://svn.apache.org/viewvc/camel/trunk/examples/pom.xml?rev=1086877&r1=1086876&r2=1086877&view=diff
==============================================================================
--- camel/trunk/examples/pom.xml (original)
+++ camel/trunk/examples/pom.xml Wed Mar 30 09:17:43 2011
@@ -64,8 +64,35 @@
     <module>camel-example-spring-security</module>
     <module>camel-example-tracer</module>
   </modules>
+ 
+  <properties>
+    <skip.starting.camel.context>false</skip.starting.camel.context>
+  </properties>
+
+  <build>
+    <plugins>
+      <plugin>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <configuration>
+          <forkMode>pertest</forkMode>
+          <includes>
+            <include>**/*Test.*</include>
+          </includes>
+          <systemPropertyVariables>
+             
<skipStartingCamelContext>${skip.starting.camel.context}</skipStartingCamelContext>
+          </systemPropertyVariables>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
 
   <profiles>
+    <profile>
+       <id>container-test</id>
+       <properties>
+          <skip.starting.camel.context>true</skip.starting.camel.context>
+       </properties>
+    </profile>
     <!-- 
       This profile allows you to add a repository to the repo list so that 
       you can test the examples out against a staged version of the camel 
distribution 


Reply via email to