camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bvah...@apache.org
Subject git commit: CAMEL-6365: Replaced the org.springframework.context.support.AbstractApplicationContext#destroy() invocations with org.apache.camel.util.IOHelper#close().
Date Fri, 07 Feb 2014 09:40:08 GMT
Updated Branches:
  refs/heads/master 94dea7761 -> cc7835efe


CAMEL-6365: Replaced the org.springframework.context.support.AbstractApplicationContext#destroy()
invocations with org.apache.camel.util.IOHelper#close().

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

Branch: refs/heads/master
Commit: cc7835efef7f3766a974e830ea1d31e53cd83b6f
Parents: 94dea77
Author: Babak Vahdat <bvahdat@apache.org>
Authored: Fri Feb 7 10:39:52 2014 +0100
Committer: Babak Vahdat <bvahdat@apache.org>
Committed: Fri Feb 7 10:39:52 2014 +0100

----------------------------------------------------------------------
 .../camel/component/avro/AvroHttpSpringProducerTest.java    | 5 ++---
 .../camel/component/avro/AvroNettySpringConsumerTest.java   | 5 ++---
 .../camel/component/avro/AvroNettySpringProducerTest.java   | 5 ++---
 .../camel/component/cxf/AbstractCXFGreeterRouterTest.java   | 5 ++---
 .../cxf/CxfPayLoadMessageXmlBindingRouterTest.java          | 5 ++---
 .../camel/component/cxf/CxfPayLoadSoapHeaderSpringTest.java | 5 ++---
 .../component/cxf/CxfSpringCustomizedExceptionTest.java     | 5 ++---
 .../component/cxf/converter/PayLoadConvertToPOJOTest.java   | 5 ++---
 .../camel/component/cxf/jms/CxfEndpointJMSConsumerTest.java | 5 ++---
 .../camel/component/cxf/multipart/CXFMultiPartTest.java     | 5 ++---
 .../component/cxf/util/CxfEndpointUtilsWithSpringTest.java  | 5 ++---
 .../spring/integration/adapter/ConfigurationTest.java       | 4 +++-
 .../apache/camel/spring/ApplicationContextTestSupport.java  | 5 ++---
 .../camel/spring/CustomProcessorWithNamespacesTest.java     | 5 ++---
 .../camel/spring/RoutingUsingCamelContextFactoryTest.java   | 5 ++---
 .../java/org/apache/camel/spring/SpringTestSupport.java     | 5 ++---
 .../spring/remoting/SpringRemotingBeanConverterTest.java    | 3 ++-
 .../camel/spring/remoting/SpringRemotingRouteTest.java      | 3 ++-
 .../spring/remoting/SpringRemotingTwoCamelContextTest.java  | 3 ++-
 .../apache/camel/test/spring/CamelSpringTestSupport.java    | 9 ++++-----
 .../org/apache/camel/testng/CamelSpringTestSupport.java     | 9 ++++-----
 .../java/org/apache/camel/itest/osgi/jpa/JpaRouteTest.java  | 3 ++-
 .../java/org/apache/camel/itest/osgi/sql/SqlRouteTest.java  | 3 ++-
 23 files changed, 51 insertions(+), 61 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/cc7835ef/components/camel-avro/src/test/java/org/apache/camel/component/avro/AvroHttpSpringProducerTest.java
----------------------------------------------------------------------
diff --git a/components/camel-avro/src/test/java/org/apache/camel/component/avro/AvroHttpSpringProducerTest.java
b/components/camel-avro/src/test/java/org/apache/camel/component/avro/AvroHttpSpringProducerTest.java
index a1dbf03..5067154 100644
--- a/components/camel-avro/src/test/java/org/apache/camel/component/avro/AvroHttpSpringProducerTest.java
+++ b/components/camel-avro/src/test/java/org/apache/camel/component/avro/AvroHttpSpringProducerTest.java
@@ -19,6 +19,7 @@ package org.apache.camel.component.avro;
 
 import org.apache.camel.CamelContext;
 import org.apache.camel.spring.SpringCamelContext;
+import org.apache.camel.util.IOHelper;
 import org.junit.After;
 import org.springframework.context.support.AbstractApplicationContext;
 import org.springframework.context.support.ClassPathXmlApplicationContext;
@@ -32,9 +33,7 @@ public class AvroHttpSpringProducerTest extends AvroHttpProducerTest {
     public void tearDown() throws Exception {
         super.tearDown();
 
-        if (applicationContext != null) {
-            applicationContext.destroy();
-        }
+        IOHelper.close(applicationContext);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/camel/blob/cc7835ef/components/camel-avro/src/test/java/org/apache/camel/component/avro/AvroNettySpringConsumerTest.java
----------------------------------------------------------------------
diff --git a/components/camel-avro/src/test/java/org/apache/camel/component/avro/AvroNettySpringConsumerTest.java
b/components/camel-avro/src/test/java/org/apache/camel/component/avro/AvroNettySpringConsumerTest.java
index a0fe869..05f859c 100644
--- a/components/camel-avro/src/test/java/org/apache/camel/component/avro/AvroNettySpringConsumerTest.java
+++ b/components/camel-avro/src/test/java/org/apache/camel/component/avro/AvroNettySpringConsumerTest.java
@@ -21,6 +21,7 @@ import org.apache.camel.CamelContext;
 import org.apache.camel.avro.impl.KeyValueProtocolImpl;
 import org.apache.camel.avro.test.TestReflectionImpl;
 import org.apache.camel.spring.SpringCamelContext;
+import org.apache.camel.util.IOHelper;
 
 import org.junit.After;
 import org.junit.Before;
@@ -46,9 +47,7 @@ public class AvroNettySpringConsumerTest extends AvroNettyConsumerTest {
     public void tearDown() throws Exception {
         super.tearDown();
 
-        if (applicationContext != null) {
-            applicationContext.destroy();
-        }
+        IOHelper.close(applicationContext);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/camel/blob/cc7835ef/components/camel-avro/src/test/java/org/apache/camel/component/avro/AvroNettySpringProducerTest.java
----------------------------------------------------------------------
diff --git a/components/camel-avro/src/test/java/org/apache/camel/component/avro/AvroNettySpringProducerTest.java
b/components/camel-avro/src/test/java/org/apache/camel/component/avro/AvroNettySpringProducerTest.java
index fafe1b9..dfd1180 100644
--- a/components/camel-avro/src/test/java/org/apache/camel/component/avro/AvroNettySpringProducerTest.java
+++ b/components/camel-avro/src/test/java/org/apache/camel/component/avro/AvroNettySpringProducerTest.java
@@ -19,6 +19,7 @@ package org.apache.camel.component.avro;
 
 import org.apache.camel.CamelContext;
 import org.apache.camel.spring.SpringCamelContext;
+import org.apache.camel.util.IOHelper;
 import org.springframework.context.support.AbstractApplicationContext;
 import org.springframework.context.support.ClassPathXmlApplicationContext;
 
@@ -29,9 +30,7 @@ public class AvroNettySpringProducerTest extends AvroNettyProducerTest {
     @Override
     public void tearDown() throws Exception {
         super.tearDown();
-        if (applicationContext != null) {
-            applicationContext.destroy();
-        }
+        IOHelper.close(applicationContext);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/camel/blob/cc7835ef/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/AbstractCXFGreeterRouterTest.java
----------------------------------------------------------------------
diff --git a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/AbstractCXFGreeterRouterTest.java
b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/AbstractCXFGreeterRouterTest.java
index 7b3b92c..8bdec90 100644
--- a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/AbstractCXFGreeterRouterTest.java
+++ b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/AbstractCXFGreeterRouterTest.java
@@ -24,6 +24,7 @@ import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.component.http.HttpOperationFailedException;
 import org.apache.camel.spring.SpringCamelContext;
 import org.apache.camel.test.junit4.CamelTestSupport;
+import org.apache.camel.util.IOHelper;
 import org.apache.hello_world_soap_http.Greeter;
 import org.apache.hello_world_soap_http.NoSuchCodeLitFault;
 import org.junit.After;
@@ -66,9 +67,7 @@ public abstract class AbstractCXFGreeterRouterTest extends CamelTestSupport
{
     @After
     public void tearDown() throws Exception {
         
-        if (applicationContext != null) {
-            applicationContext.destroy();
-        }
+        IOHelper.close(applicationContext);
         super.tearDown();
     }
     

http://git-wip-us.apache.org/repos/asf/camel/blob/cc7835ef/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayLoadMessageXmlBindingRouterTest.java
----------------------------------------------------------------------
diff --git a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayLoadMessageXmlBindingRouterTest.java
b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayLoadMessageXmlBindingRouterTest.java
index 9116e81..0af9813 100644
--- a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayLoadMessageXmlBindingRouterTest.java
+++ b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayLoadMessageXmlBindingRouterTest.java
@@ -29,6 +29,7 @@ import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.converter.jaxp.XmlConverter;
 import org.apache.camel.spring.SpringCamelContext;
 import org.apache.camel.test.junit4.CamelTestSupport;
+import org.apache.camel.util.IOHelper;
 import org.apache.cxf.endpoint.Server;
 import org.apache.cxf.frontend.ClientFactoryBean;
 import org.apache.cxf.frontend.ClientProxyFactoryBean;
@@ -78,9 +79,7 @@ public class CxfPayLoadMessageXmlBindingRouterTest extends CamelTestSupport
{
     @After
     public void tearDown() throws Exception {
         
-        if (applicationContext != null) {
-            applicationContext.destroy();
-        }
+        IOHelper.close(applicationContext);
         super.tearDown();
     }
     

http://git-wip-us.apache.org/repos/asf/camel/blob/cc7835ef/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayLoadSoapHeaderSpringTest.java
----------------------------------------------------------------------
diff --git a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayLoadSoapHeaderSpringTest.java
b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayLoadSoapHeaderSpringTest.java
index a9de4e6..a647fd8 100644
--- a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayLoadSoapHeaderSpringTest.java
+++ b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayLoadSoapHeaderSpringTest.java
@@ -18,6 +18,7 @@ package org.apache.camel.component.cxf;
 
 import org.apache.camel.CamelContext;
 import org.apache.camel.spring.SpringCamelContext;
+import org.apache.camel.util.IOHelper;
 import org.junit.After;
 import org.junit.Before;
 import org.springframework.context.support.AbstractXmlApplicationContext;
@@ -42,9 +43,7 @@ public class CxfPayLoadSoapHeaderSpringTest extends CxfPayLoadSoapHeaderTest
{
 
     @After
     public void tearDown() throws Exception {
-        if (applicationContext != null) {
-            applicationContext.destroy();
-        }
+        IOHelper.close(applicationContext);
         super.tearDown();
     }
       

http://git-wip-us.apache.org/repos/asf/camel/blob/cc7835ef/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfSpringCustomizedExceptionTest.java
----------------------------------------------------------------------
diff --git a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfSpringCustomizedExceptionTest.java
b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfSpringCustomizedExceptionTest.java
index b294ffc..19a0a74 100644
--- a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfSpringCustomizedExceptionTest.java
+++ b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfSpringCustomizedExceptionTest.java
@@ -25,6 +25,7 @@ import org.apache.camel.ExchangePattern;
 import org.apache.camel.component.cxf.common.message.CxfConstants;
 import org.apache.camel.spring.SpringCamelContext;
 import org.apache.camel.test.junit4.CamelTestSupport;
+import org.apache.camel.util.IOHelper;
 import org.apache.cxf.binding.soap.SoapFault;
 import org.apache.cxf.interceptor.Fault;
 import org.junit.After;
@@ -65,9 +66,7 @@ public class CxfSpringCustomizedExceptionTest extends CamelTestSupport 
{
 
     @After
     public void tearDown() throws Exception {
-        if (applicationContext != null) {
-            applicationContext.destroy();
-        }
+        IOHelper.close(applicationContext);
         super.tearDown();
     }
     

http://git-wip-us.apache.org/repos/asf/camel/blob/cc7835ef/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/converter/PayLoadConvertToPOJOTest.java
----------------------------------------------------------------------
diff --git a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/converter/PayLoadConvertToPOJOTest.java
b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/converter/PayLoadConvertToPOJOTest.java
index 7326ca4..c62c7d5 100644
--- a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/converter/PayLoadConvertToPOJOTest.java
+++ b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/converter/PayLoadConvertToPOJOTest.java
@@ -26,6 +26,7 @@ import org.apache.camel.non_wrapper.types.GetPerson;
 import org.apache.camel.non_wrapper.types.GetPersonResponse;
 import org.apache.camel.spring.SpringCamelContext;
 import org.apache.camel.test.junit4.CamelTestSupport;
+import org.apache.camel.util.IOHelper;
 import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
 import org.junit.After;
 import org.junit.Before;
@@ -55,9 +56,7 @@ public class PayLoadConvertToPOJOTest extends CamelTestSupport {
 
     @After
     public void tearDown() throws Exception {
-        if (applicationContext != null) {
-            applicationContext.destroy();
-        }
+        IOHelper.close(applicationContext);
         super.tearDown();
     }
     

http://git-wip-us.apache.org/repos/asf/camel/blob/cc7835ef/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jms/CxfEndpointJMSConsumerTest.java
----------------------------------------------------------------------
diff --git a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jms/CxfEndpointJMSConsumerTest.java
b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jms/CxfEndpointJMSConsumerTest.java
index a8b3b8a..71e70ca 100644
--- a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jms/CxfEndpointJMSConsumerTest.java
+++ b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jms/CxfEndpointJMSConsumerTest.java
@@ -21,6 +21,7 @@ import org.apache.camel.Processor;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.spring.SpringCamelContext;
 import org.apache.camel.test.junit4.CamelTestSupport;
+import org.apache.camel.util.IOHelper;
 import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
 import org.apache.hello_world_soap_http.Greeter;
 import org.junit.After;
@@ -42,9 +43,7 @@ public class CxfEndpointJMSConsumerTest extends CamelTestSupport {
     @After
     public void tearDown() throws Exception {
         
-        if (applicationContext != null) {
-            applicationContext.destroy();
-        }
+        IOHelper.close(applicationContext);
         super.tearDown();
     }
     

http://git-wip-us.apache.org/repos/asf/camel/blob/cc7835ef/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/multipart/CXFMultiPartTest.java
----------------------------------------------------------------------
diff --git a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/multipart/CXFMultiPartTest.java
b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/multipart/CXFMultiPartTest.java
index a306bbb..34b3570 100644
--- a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/multipart/CXFMultiPartTest.java
+++ b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/multipart/CXFMultiPartTest.java
@@ -27,6 +27,7 @@ import org.apache.camel.cxf.multipart.types.InE;
 import org.apache.camel.cxf.multipart.types.ObjectFactory;
 import org.apache.camel.spring.SpringCamelContext;
 import org.apache.camel.test.junit4.CamelTestSupport;
+import org.apache.camel.util.IOHelper;
 import org.junit.After;
 import org.junit.AfterClass;
 import org.junit.Before;
@@ -53,9 +54,7 @@ public class CXFMultiPartTest extends CamelTestSupport {
     @After
     public void tearDown() throws Exception {
 
-        if (applicationContext != null) {
-            applicationContext.destroy();
-        }
+        IOHelper.close(applicationContext);
         super.tearDown();
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/cc7835ef/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/util/CxfEndpointUtilsWithSpringTest.java
----------------------------------------------------------------------
diff --git a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/util/CxfEndpointUtilsWithSpringTest.java
b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/util/CxfEndpointUtilsWithSpringTest.java
index 713a409..4e48268 100644
--- a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/util/CxfEndpointUtilsWithSpringTest.java
+++ b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/util/CxfEndpointUtilsWithSpringTest.java
@@ -24,6 +24,7 @@ import org.apache.camel.component.cxf.CxfEndpointUtils;
 import org.apache.camel.component.cxf.CxfSpringEndpoint;
 import org.apache.camel.component.cxf.DataFormat;
 import org.apache.camel.spring.SpringCamelContext;
+import org.apache.camel.util.IOHelper;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -42,9 +43,7 @@ public class CxfEndpointUtilsWithSpringTest extends CxfEndpointUtilsTest
{
 
     @After
     public void tearDown() throws Exception {
-        if (applicationContext != null) {
-            applicationContext.destroy();
-        }
+        IOHelper.close(applicationContext);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/camel/blob/cc7835ef/components/camel-spring-integration/src/test/java/org/apache/camel/component/spring/integration/adapter/ConfigurationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-integration/src/test/java/org/apache/camel/component/spring/integration/adapter/ConfigurationTest.java
b/components/camel-spring-integration/src/test/java/org/apache/camel/component/spring/integration/adapter/ConfigurationTest.java
index 67f1437..cb37135 100644
--- a/components/camel-spring-integration/src/test/java/org/apache/camel/component/spring/integration/adapter/ConfigurationTest.java
+++ b/components/camel-spring-integration/src/test/java/org/apache/camel/component/spring/integration/adapter/ConfigurationTest.java
@@ -16,6 +16,8 @@
  */
 package org.apache.camel.component.spring.integration.adapter;
 
+import org.apache.camel.util.IOHelper;
+
 import org.junit.After;
 import org.junit.Test;
 import org.springframework.context.support.AbstractXmlApplicationContext;
@@ -30,7 +32,7 @@ public class ConfigurationTest {
 
     @After
     public void tearDown() {
-        context.destroy();
+        IOHelper.close(context);
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/camel/blob/cc7835ef/components/camel-spring/src/test/java/org/apache/camel/spring/ApplicationContextTestSupport.java
----------------------------------------------------------------------
diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/ApplicationContextTestSupport.java
b/components/camel-spring/src/test/java/org/apache/camel/spring/ApplicationContextTestSupport.java
index ec7b377..1400988 100644
--- a/components/camel-spring/src/test/java/org/apache/camel/spring/ApplicationContextTestSupport.java
+++ b/components/camel-spring/src/test/java/org/apache/camel/spring/ApplicationContextTestSupport.java
@@ -17,6 +17,7 @@
 package org.apache.camel.spring;
 
 import junit.framework.TestCase;
+import org.apache.camel.util.IOHelper;
 import org.springframework.context.support.AbstractXmlApplicationContext;
 
 /**
@@ -38,9 +39,7 @@ public abstract class ApplicationContextTestSupport extends TestCase {
     @Override
     protected void tearDown() throws Exception {
         super.tearDown();
-        if (applicationContext != null) {
-            applicationContext.destroy();
-        }
+        IOHelper.close(applicationContext);
     }
 
 

http://git-wip-us.apache.org/repos/asf/camel/blob/cc7835ef/components/camel-spring/src/test/java/org/apache/camel/spring/CustomProcessorWithNamespacesTest.java
----------------------------------------------------------------------
diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/CustomProcessorWithNamespacesTest.java
b/components/camel-spring/src/test/java/org/apache/camel/spring/CustomProcessorWithNamespacesTest.java
index 26aef02..bdb8771 100644
--- a/components/camel-spring/src/test/java/org/apache/camel/spring/CustomProcessorWithNamespacesTest.java
+++ b/components/camel-spring/src/test/java/org/apache/camel/spring/CustomProcessorWithNamespacesTest.java
@@ -25,6 +25,7 @@ import org.apache.camel.ProducerTemplate;
 import org.apache.camel.Route;
 import org.apache.camel.TestSupport;
 import org.apache.camel.spring.example.MyProcessor;
+import org.apache.camel.util.IOHelper;
 import org.springframework.context.support.AbstractXmlApplicationContext;
 import org.springframework.context.support.ClassPathXmlApplicationContext;
 
@@ -75,8 +76,6 @@ public class CustomProcessorWithNamespacesTest extends TestSupport {
     @Override
     protected void tearDown() throws Exception {
         super.tearDown();
-        if (applicationContext != null) {
-            applicationContext.destroy();
-        }
+        IOHelper.close(applicationContext);
     }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/cc7835ef/components/camel-spring/src/test/java/org/apache/camel/spring/RoutingUsingCamelContextFactoryTest.java
----------------------------------------------------------------------
diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/RoutingUsingCamelContextFactoryTest.java
b/components/camel-spring/src/test/java/org/apache/camel/spring/RoutingUsingCamelContextFactoryTest.java
index b2afd64..9bba775 100644
--- a/components/camel-spring/src/test/java/org/apache/camel/spring/RoutingUsingCamelContextFactoryTest.java
+++ b/components/camel-spring/src/test/java/org/apache/camel/spring/RoutingUsingCamelContextFactoryTest.java
@@ -25,6 +25,7 @@ import org.apache.camel.ProducerTemplate;
 import org.apache.camel.Route;
 import org.apache.camel.TestSupport;
 import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.util.IOHelper;
 import org.springframework.context.support.AbstractXmlApplicationContext;
 import org.springframework.context.support.ClassPathXmlApplicationContext;
 
@@ -74,8 +75,6 @@ public class RoutingUsingCamelContextFactoryTest extends TestSupport {
     @Override
     protected void tearDown() throws Exception {
         super.tearDown();
-        if (applicationContext != null) {
-            applicationContext.destroy();
-        }
+        IOHelper.close(applicationContext);
     }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/cc7835ef/components/camel-spring/src/test/java/org/apache/camel/spring/SpringTestSupport.java
----------------------------------------------------------------------
diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/SpringTestSupport.java
b/components/camel-spring/src/test/java/org/apache/camel/spring/SpringTestSupport.java
index 85c93b3..1729b13 100644
--- a/components/camel-spring/src/test/java/org/apache/camel/spring/SpringTestSupport.java
+++ b/components/camel-spring/src/test/java/org/apache/camel/spring/SpringTestSupport.java
@@ -28,6 +28,7 @@ import org.apache.camel.core.xml.AbstractCamelContextFactoryBean;
 import org.apache.camel.impl.DefaultPackageScanClassResolver;
 import org.apache.camel.impl.scan.AssignableToPackageScanFilter;
 import org.apache.camel.impl.scan.InvertingPackageScanFilter;
+import org.apache.camel.util.IOHelper;
 import org.springframework.beans.factory.support.RootBeanDefinition;
 import org.springframework.context.ApplicationContext;
 import org.springframework.context.support.AbstractXmlApplicationContext;
@@ -57,9 +58,7 @@ public abstract class SpringTestSupport extends ContextTestSupport {
     @Override
     protected void tearDown() throws Exception {
         super.tearDown();
-        if (applicationContext != null) {
-            applicationContext.destroy();
-        }
+        IOHelper.close(applicationContext);
     }
 
     private static class ExcludingPackageScanClassResolver extends DefaultPackageScanClassResolver
{

http://git-wip-us.apache.org/repos/asf/camel/blob/cc7835ef/components/camel-spring/src/test/java/org/apache/camel/spring/remoting/SpringRemotingBeanConverterTest.java
----------------------------------------------------------------------
diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/remoting/SpringRemotingBeanConverterTest.java
b/components/camel-spring/src/test/java/org/apache/camel/spring/remoting/SpringRemotingBeanConverterTest.java
index fec7fea..90fe72e 100644
--- a/components/camel-spring/src/test/java/org/apache/camel/spring/remoting/SpringRemotingBeanConverterTest.java
+++ b/components/camel-spring/src/test/java/org/apache/camel/spring/remoting/SpringRemotingBeanConverterTest.java
@@ -19,6 +19,7 @@ package org.apache.camel.spring.remoting;
 import junit.framework.TestCase;
 import org.apache.camel.CamelContext;
 import org.apache.camel.spring.SpringCamelContext;
+import org.apache.camel.util.IOHelper;
 import org.springframework.context.support.AbstractXmlApplicationContext;
 import org.springframework.context.support.ClassPathXmlApplicationContext;
 
@@ -37,7 +38,7 @@ public class SpringRemotingBeanConverterTest extends TestCase {
         assertEquals("Hello from Sub" , response);
 
         camelContext.stop();
-        applicationContext.destroy();
+        IOHelper.close(applicationContext);
     }
 
     protected AbstractXmlApplicationContext createApplicationContext() {

http://git-wip-us.apache.org/repos/asf/camel/blob/cc7835ef/components/camel-spring/src/test/java/org/apache/camel/spring/remoting/SpringRemotingRouteTest.java
----------------------------------------------------------------------
diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/remoting/SpringRemotingRouteTest.java
b/components/camel-spring/src/test/java/org/apache/camel/spring/remoting/SpringRemotingRouteTest.java
index 90a9963..8092270 100644
--- a/components/camel-spring/src/test/java/org/apache/camel/spring/remoting/SpringRemotingRouteTest.java
+++ b/components/camel-spring/src/test/java/org/apache/camel/spring/remoting/SpringRemotingRouteTest.java
@@ -19,6 +19,7 @@ package org.apache.camel.spring.remoting;
 import junit.framework.TestCase;
 import org.apache.camel.CamelContext;
 import org.apache.camel.spring.SpringCamelContext;
+import org.apache.camel.util.IOHelper;
 import org.springframework.context.support.AbstractXmlApplicationContext;
 import org.springframework.context.support.ClassPathXmlApplicationContext;
 
@@ -38,7 +39,7 @@ public class SpringRemotingRouteTest extends TestCase {
         // END SNIPPET: invoke
 
         camelContext.stop();
-        applicationContext.destroy();
+        IOHelper.close(applicationContext);
     }
 
     protected AbstractXmlApplicationContext createApplicationContext() {

http://git-wip-us.apache.org/repos/asf/camel/blob/cc7835ef/components/camel-spring/src/test/java/org/apache/camel/spring/remoting/SpringRemotingTwoCamelContextTest.java
----------------------------------------------------------------------
diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/remoting/SpringRemotingTwoCamelContextTest.java
b/components/camel-spring/src/test/java/org/apache/camel/spring/remoting/SpringRemotingTwoCamelContextTest.java
index 35ce246..73569e5 100644
--- a/components/camel-spring/src/test/java/org/apache/camel/spring/remoting/SpringRemotingTwoCamelContextTest.java
+++ b/components/camel-spring/src/test/java/org/apache/camel/spring/remoting/SpringRemotingTwoCamelContextTest.java
@@ -20,6 +20,7 @@ import junit.framework.TestCase;
 
 import org.apache.camel.CamelContext;
 import org.apache.camel.spring.SpringCamelContext;
+import org.apache.camel.util.IOHelper;
 import org.springframework.context.support.AbstractXmlApplicationContext;
 import org.springframework.context.support.ClassPathXmlApplicationContext;
 
@@ -39,7 +40,7 @@ public class SpringRemotingTwoCamelContextTest extends TestCase {
        
 
         camelContext.stop();
-        applicationContext.destroy();
+        IOHelper.close(applicationContext);
     }
 
     protected AbstractXmlApplicationContext createApplicationContext() {

http://git-wip-us.apache.org/repos/asf/camel/blob/cc7835ef/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/CamelSpringTestSupport.java
----------------------------------------------------------------------
diff --git a/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/CamelSpringTestSupport.java
b/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/CamelSpringTestSupport.java
index f464ad2..b855b40 100644
--- a/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/CamelSpringTestSupport.java
+++ b/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/CamelSpringTestSupport.java
@@ -25,6 +25,7 @@ import org.apache.camel.spring.CamelBeanPostProcessor;
 import org.apache.camel.spring.SpringCamelContext;
 import org.apache.camel.test.ExcludingPackageScanClassResolver;
 import org.apache.camel.test.junit4.CamelTestSupport;
+import org.apache.camel.util.IOHelper;
 import org.apache.camel.util.ObjectHelper;
 import org.junit.After;
 import org.junit.AfterClass;
@@ -114,17 +115,15 @@ public abstract class CamelSpringTestSupport extends CamelTestSupport
{
         super.tearDown();
 
         if (!isCreateCamelContextPerClass()) {
-            if (applicationContext != null) {
-                applicationContext.destroy();
-                applicationContext = null;
-            }
+            IOHelper.close(applicationContext);
+            applicationContext = null;
         }
     }
 
     @AfterClass
     public static void tearSpringDownAfterClass() throws Exception {
         if (threadAppContext.get() != null) {
-            threadAppContext.get().destroy();
+            IOHelper.close(threadAppContext.get());
             threadAppContext.remove();
         }
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/cc7835ef/components/camel-testng/src/main/java/org/apache/camel/testng/CamelSpringTestSupport.java
----------------------------------------------------------------------
diff --git a/components/camel-testng/src/main/java/org/apache/camel/testng/CamelSpringTestSupport.java
b/components/camel-testng/src/main/java/org/apache/camel/testng/CamelSpringTestSupport.java
index 663a173..69e23ab 100644
--- a/components/camel-testng/src/main/java/org/apache/camel/testng/CamelSpringTestSupport.java
+++ b/components/camel-testng/src/main/java/org/apache/camel/testng/CamelSpringTestSupport.java
@@ -24,6 +24,7 @@ import org.apache.camel.CamelContext;
 import org.apache.camel.spring.CamelBeanPostProcessor;
 import org.apache.camel.spring.SpringCamelContext;
 import org.apache.camel.test.ExcludingPackageScanClassResolver;
+import org.apache.camel.util.IOHelper;
 import org.springframework.beans.factory.support.RootBeanDefinition;
 import org.springframework.context.ApplicationContext;
 import org.springframework.context.support.AbstractApplicationContext;
@@ -84,17 +85,15 @@ public abstract class CamelSpringTestSupport extends CamelTestSupport
{
         super.tearDown();
 
         if (!isCreateCamelContextPerClass()) {
-            if (applicationContext != null) {
-                applicationContext.destroy();
-                applicationContext = null;
-            }
+            IOHelper.close(applicationContext);
+            applicationContext = null;
         }
     }
 
     @AfterClass(alwaysRun = true)
     public static void tearSpringDownAfterClass() throws Exception {
         if (threadAppContext.get() != null) {
-            threadAppContext.get().destroy();
+            IOHelper.close(threadAppContext.get());
             threadAppContext.remove();
         }
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/cc7835ef/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jpa/JpaRouteTest.java
----------------------------------------------------------------------
diff --git a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jpa/JpaRouteTest.java
b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jpa/JpaRouteTest.java
index b0aad2c..ce40365 100644
--- a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jpa/JpaRouteTest.java
+++ b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jpa/JpaRouteTest.java
@@ -24,6 +24,7 @@ import org.apache.camel.CamelContext;
 import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.itest.osgi.OSGiIntegrationTestSupport;
 import org.apache.camel.spring.SpringCamelContext;
+import org.apache.camel.util.IOHelper;
 import org.junit.After;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -69,7 +70,7 @@ public class JpaRouteTest extends OSGiIntegrationTestSupport {
             super.tearDown();
             if (applicationContext != null) {                
                 if (applicationContext.isActive()) {
-                    applicationContext.destroy();
+                    IOHelper.close(applicationContext);
                 }
                 applicationContext = null;
             }

http://git-wip-us.apache.org/repos/asf/camel/blob/cc7835ef/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/sql/SqlRouteTest.java
----------------------------------------------------------------------
diff --git a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/sql/SqlRouteTest.java
b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/sql/SqlRouteTest.java
index 07d62d6..3ab9ee8 100644
--- a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/sql/SqlRouteTest.java
+++ b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/sql/SqlRouteTest.java
@@ -29,6 +29,7 @@ import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.component.sql.SqlConstants;
 import org.apache.camel.itest.osgi.OSGiIntegrationTestSupport;
 import org.apache.camel.spring.SpringCamelContext;
+import org.apache.camel.util.IOHelper;
 import org.junit.After;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -56,7 +57,7 @@ public class SqlRouteTest extends OSGiIntegrationTestSupport {
     @After
     public void tearDown() throws Exception {
         super.tearDown();
-        applicationContext.destroy();
+        IOHelper.close(applicationContext);
     }
 
     @Override


Mime
View raw message