Repository: camel
Updated Branches:
  refs/heads/master 0b7588449 -> abb03ae23


Polish the camel-cxf test code to shutdown the spring application context when 
tearing down the test


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/abb03ae2
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/abb03ae2
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/abb03ae2

Branch: refs/heads/master
Commit: abb03ae23c0497ea035345c7c1a133102c90b7de
Parents: 0b75884
Author: Willem Jiang <[email protected]>
Authored: Wed Apr 9 21:58:52 2014 +0800
Committer: Willem Jiang <[email protected]>
Committed: Wed Apr 9 21:58:52 2014 +0800

----------------------------------------------------------------------
 .../cxf/jaxrs/CxfRsProducerClientFactoryCache2Test.java   | 10 ++++++++--
 .../cxf/jaxrs/CxfRsProducerClientFactoryCacheTest.java    |  9 +++++++--
 2 files changed, 15 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/abb03ae2/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducerClientFactoryCache2Test.java
----------------------------------------------------------------------
diff --git 
a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducerClientFactoryCache2Test.java
 
b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducerClientFactoryCache2Test.java
index f6c7d23..a71946a 100644
--- 
a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducerClientFactoryCache2Test.java
+++ 
b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducerClientFactoryCache2Test.java
@@ -31,6 +31,7 @@ import org.junit.After;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
+import org.springframework.context.ApplicationContext;
 import org.springframework.context.support.AbstractApplicationContext;
 import org.springframework.context.support.ClassPathXmlApplicationContext;
 
@@ -42,11 +43,12 @@ public class CxfRsProducerClientFactoryCache2Test extends 
Assert {
 
     private CamelContext context2;
     private ProducerTemplate template2;
+    private AbstractApplicationContext applicationContext;
 
     @Before
     public void setUp() throws Exception {
-        AbstractApplicationContext ac = new 
ClassPathXmlApplicationContext("org/apache/camel/component/cxf/jaxrs/CxfRsProducerClientFactoryCacheTest2.xml");
-        context2 = SpringCamelContext.springCamelContext(ac, false);
+        applicationContext = new 
ClassPathXmlApplicationContext("org/apache/camel/component/cxf/jaxrs/CxfRsProducerClientFactoryCacheTest2.xml");
+        context2 = SpringCamelContext.springCamelContext(applicationContext, 
false);
         context2.start();
 
         template2 = context2.createProducerTemplate();
@@ -59,6 +61,10 @@ public class CxfRsProducerClientFactoryCache2Test extends 
Assert {
             context2.stop();
             template2.stop();
         }
+        // need to shutdown the application context to shutdown the bus
+        if (applicationContext != null) {
+            applicationContext.close();
+        }
     }
     
     @Test

http://git-wip-us.apache.org/repos/asf/camel/blob/abb03ae2/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducerClientFactoryCacheTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducerClientFactoryCacheTest.java
 
b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducerClientFactoryCacheTest.java
index ce2a54a..c0ebe14 100644
--- 
a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducerClientFactoryCacheTest.java
+++ 
b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducerClientFactoryCacheTest.java
@@ -41,11 +41,12 @@ public class CxfRsProducerClientFactoryCacheTest extends 
Assert {
 
     private CamelContext context1;
     private ProducerTemplate template1;
+    private AbstractApplicationContext applicationContext;
 
     @Before
     public void setUp() throws Exception {
-        AbstractApplicationContext ac = new 
ClassPathXmlApplicationContext("org/apache/camel/component/cxf/jaxrs/CxfRsProducerClientFactoryCacheTest1.xml");
-        context1 = SpringCamelContext.springCamelContext(ac, false);
+        applicationContext = new 
ClassPathXmlApplicationContext("org/apache/camel/component/cxf/jaxrs/CxfRsProducerClientFactoryCacheTest1.xml");
+        context1 = SpringCamelContext.springCamelContext(applicationContext, 
false);
         context1.start();
         template1 = context1.createProducerTemplate();
         template1.start();
@@ -57,6 +58,10 @@ public class CxfRsProducerClientFactoryCacheTest extends 
Assert {
             context1.stop();
             template1.stop();
         }
+        // need to shutdown the application context to shutdown the bus
+        if (applicationContext != null) {
+            applicationContext.close();
+        }
     }
     
     @Test

Reply via email to