Author: ningjiang
Date: Fri Dec  9 14:08:53 2011
New Revision: 1212433

URL: http://svn.apache.org/viewvc?rev=1212433&view=rev
Log:
Merged revisions 1212276 via svnmerge from 
https://svn.apache.org/repos/asf/camel/trunk

........
  r1212276 | ningjiang | 2011-12-09 16:27:23 +0800 (Fri, 09 Dec 2011) | 1 line
  
  CAMEL-4756 Fixed the NPE error of when setting the system property of 
skipStartingCamelContext to be true
........

Modified:
    camel/branches/camel-2.8.x/   (props changed)
    
camel/branches/camel-2.8.x/components/camel-spring/src/main/java/org/apache/camel/spring/SpringCamelContext.java
    
camel/branches/camel-2.8.x/components/camel-test/src/main/java/org/apache/camel/test/junit4/CamelSpringTestSupport.java

Propchange: camel/branches/camel-2.8.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Dec  9 14:08:53 2011
@@ -1 +1 @@
-/camel/trunk:1202148,1202167,1202204-1202206,1202215,1202223,1202659,1202685,1203879,1203978,1204338,1205124,1205372,1205412,1205429,1205431,1205713,1206116,1206414,1207743,1207784,1208301,1208930,1208964-1208965,1209006-1209007,1209382,1209401,1209477,1209845-1209846,1210113,1210771,1210830,1211363,1211414,1211773,1211811,1212275,1212408
+/camel/trunk:1202148,1202167,1202204-1202206,1202215,1202223,1202659,1202685,1203879,1203978,1204338,1205124,1205372,1205412,1205429,1205431,1205713,1206116,1206414,1207743,1207784,1208301,1208930,1208964-1208965,1209006-1209007,1209382,1209401,1209477,1209845-1209846,1210113,1210771,1210830,1211363,1211414,1211773,1211811,1212275-1212276,1212408

Propchange: camel/branches/camel-2.8.x/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: 
camel/branches/camel-2.8.x/components/camel-spring/src/main/java/org/apache/camel/spring/SpringCamelContext.java
URL: 
http://svn.apache.org/viewvc/camel/branches/camel-2.8.x/components/camel-spring/src/main/java/org/apache/camel/spring/SpringCamelContext.java?rev=1212433&r1=1212432&r2=1212433&view=diff
==============================================================================
--- 
camel/branches/camel-2.8.x/components/camel-spring/src/main/java/org/apache/camel/spring/SpringCamelContext.java
 (original)
+++ 
camel/branches/camel-2.8.x/components/camel-spring/src/main/java/org/apache/camel/spring/SpringCamelContext.java
 Fri Dec  9 14:08:53 2011
@@ -80,10 +80,12 @@ public class SpringCamelContext extends 
     }
     
     public static SpringCamelContext springCamelContext(ApplicationContext 
applicationContext, boolean maybeStart) throws Exception {
-        // lets try and look up a configured camel context in the context
-        String[] names = 
applicationContext.getBeanNamesForType(SpringCamelContext.class);
-        if (names.length == 1) {
-            return (SpringCamelContext)applicationContext.getBean(names[0], 
SpringCamelContext.class);
+        if (applicationContext != null) {
+            // lets try and look up a configured camel context in the context
+            String[] names = 
applicationContext.getBeanNamesForType(SpringCamelContext.class);
+            if (names.length == 1) {
+                return 
(SpringCamelContext)applicationContext.getBean(names[0], 
SpringCamelContext.class);
+            }
         }
         SpringCamelContext answer = new SpringCamelContext();
         answer.setApplicationContext(applicationContext);

Modified: 
camel/branches/camel-2.8.x/components/camel-test/src/main/java/org/apache/camel/test/junit4/CamelSpringTestSupport.java
URL: 
http://svn.apache.org/viewvc/camel/branches/camel-2.8.x/components/camel-test/src/main/java/org/apache/camel/test/junit4/CamelSpringTestSupport.java?rev=1212433&r1=1212432&r2=1212433&view=diff
==============================================================================
--- 
camel/branches/camel-2.8.x/components/camel-test/src/main/java/org/apache/camel/test/junit4/CamelSpringTestSupport.java
 (original)
+++ 
camel/branches/camel-2.8.x/components/camel-test/src/main/java/org/apache/camel/test/junit4/CamelSpringTestSupport.java
 Fri Dec  9 14:08:53 2011
@@ -162,14 +162,15 @@ public abstract class CamelSpringTestSup
     @Override
     protected void assertValidContext(CamelContext context) {
         super.assertValidContext(context);
-
-        List<Route> routes = context.getRoutes();
-        int routeCount = getExpectedRouteCount();
-        if (routeCount > 0) {
-            assertNotNull("Should have some routes defined", routes);
-            assertTrue("Should have at least one route", routes.size() >= 
routeCount);
+        if 
(!"true".equalsIgnoreCase(System.getProperty("skipStartingCamelContext"))) {
+            List<Route> routes = context.getRoutes();
+            int routeCount = getExpectedRouteCount();
+            if (routeCount > 0) {
+                assertNotNull("Should have some routes defined", routes);
+                assertTrue("Should have at least one route", routes.size() >= 
routeCount);
+            }
+            log.debug("Camel Routes: " + routes);
         }
-        log.debug("Camel Routes: " + routes);
     }
 
     protected int getExpectedRouteCount() {


Reply via email to