Repository: camel Updated Branches: refs/heads/camel-2.12.x ad9a87acf -> 3e6fcc0ac refs/heads/camel-2.13.x 685e60dc8 -> dea8545d4
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/3e6fcc0a Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/3e6fcc0a Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/3e6fcc0a Branch: refs/heads/camel-2.12.x Commit: 3e6fcc0ac545e88b8b2b7837d624d65b2df6981f Parents: ad9a87a Author: Willem Jiang <[email protected]> Authored: Wed Apr 9 21:58:52 2014 +0800 Committer: Willem Jiang <[email protected]> Committed: Wed Apr 9 22:09:15 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/3e6fcc0a/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/3e6fcc0a/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
