Author: ningjiang
Date: Mon Aug  9 12:03:58 2010
New Revision: 983601

URL: http://svn.apache.org/viewvc?rev=983601&view=rev
Log:
CAMEL-3038 OSGi integration test support should provide a method to set the 
Current thread classloader

Modified:
    
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/OSGiIntegrationTestSupport.java
    
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/VelocityTest.java
    
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/shiro/ShiroAuthenticationTest.java

Modified: 
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/OSGiIntegrationTestSupport.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/OSGiIntegrationTestSupport.java?rev=983601&r1=983600&r2=983601&view=diff
==============================================================================
--- 
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/OSGiIntegrationTestSupport.java
 (original)
+++ 
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/OSGiIntegrationTestSupport.java
 Mon Aug  9 12:03:58 2010
@@ -45,12 +45,17 @@ public class OSGiIntegrationTestSupport 
     protected BundleContext bundleContext;
         
     protected CamelContext createCamelContext() throws Exception {
+        setThreadContextClassLoader();
         CamelContextFactory factory = new CamelContextFactory();
         factory.setBundleContext(bundleContext);
         LOG.info("Get the bundleContext is " + bundleContext);
         return factory.createContext();
     }
     
+    protected void setThreadContextClassLoader() {
+        // set the thread context classloader current bundle classloader
+        
Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
+    }
     
     public static UrlReference getCamelKarafFeatureUrl() {
         String springVersion = System.getProperty("springVersion");

Modified: 
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/VelocityTest.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/VelocityTest.java?rev=983601&r1=983600&r2=983601&view=diff
==============================================================================
--- 
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/VelocityTest.java
 (original)
+++ 
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/VelocityTest.java
 Mon Aug  9 12:03:58 2010
@@ -61,8 +61,6 @@ public class VelocityTest extends OSGiIn
     protected RouteBuilder createRouteBuilder() {
         return new RouteBuilder() {
             public void configure() {
-                // need to update the CCL to current bundle's as it could be 
no defined
-                
Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
                 // START SNIPPET: example
                 from("direct:a").
                         to("velocity:org/apache/camel/itest/osgi/example.vm");

Modified: 
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/shiro/ShiroAuthenticationTest.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/shiro/ShiroAuthenticationTest.java?rev=983601&r1=983600&r2=983601&view=diff
==============================================================================
--- 
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/shiro/ShiroAuthenticationTest.java
 (original)
+++ 
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/shiro/ShiroAuthenticationTest.java
 Mon Aug  9 12:03:58 2010
@@ -119,8 +119,6 @@ public class ShiroAuthenticationTest ext
          
         return new RouteBuilder() {
             public void configure() {
-                // need to update the CCL as it could be no defined
-                
Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
                 
                 final ShiroSecurityPolicy securityPolicy = new 
ShiroSecurityPolicy("classpath:/org/apache/camel/itest/osgi/shiro/securityconfig.ini",
 passPhrase);
                 


Reply via email to