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: Better reuse the IOHelper utility to close the Spring contexts.
Date Fri, 07 Feb 2014 08:47:18 GMT
Updated Branches:
  refs/heads/master 714e2b460 -> acee7685d


CAMEL-6365: Better reuse the IOHelper utility to close the Spring contexts.

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

Branch: refs/heads/master
Commit: acee7685d8daa64441f63b26f000072c3a7a932a
Parents: 714e2b4
Author: Babak Vahdat <bvahdat@apache.org>
Authored: Fri Feb 7 09:47:03 2014 +0100
Committer: Babak Vahdat <bvahdat@apache.org>
Committed: Fri Feb 7 09:47:03 2014 +0100

----------------------------------------------------------------------
 .../config/SpringSecurityAuthorizationPolicyConfigTest.java   | 6 ++----
 .../src/main/java/org/apache/camel/spring/Main.java           | 3 ++-
 .../org/apache/camel/spring/DefaultStreamCachingTest.java     | 3 ++-
 .../org/apache/camel/spring/config/AnotherCamelProxyTest.java | 3 ++-
 .../camel/spring/config/CamelContextAutoStartupTest.java      | 5 ++---
 .../camel/spring/config/CamelContextFactoryBeanTest.java      | 7 +++----
 .../java/org/apache/camel/spring/config/CamelProxyTest.java   | 3 ++-
 .../apache/camel/spring/config/CamelProxyUsingRefTest.java    | 3 ++-
 .../camel/spring/config/RouteAutoStartupPropertiesTest.java   | 5 ++---
 .../org/apache/camel/spring/config/RouteBuilderRefTest.java   | 3 ++-
 .../camel/spring/config/scan/SpringComponentScanTest.java     | 7 +++----
 .../scan/SpringComponentScanWithDeprecatedPackagesTest.java   | 7 +++----
 .../spring/handler/ErrorHandlerDefinitionParserTest.java      | 3 ++-
 13 files changed, 29 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/acee7685/components/camel-spring-security/src/test/java/org/apache/camel/component/spring/security/config/SpringSecurityAuthorizationPolicyConfigTest.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-security/src/test/java/org/apache/camel/component/spring/security/config/SpringSecurityAuthorizationPolicyConfigTest.java
b/components/camel-spring-security/src/test/java/org/apache/camel/component/spring/security/config/SpringSecurityAuthorizationPolicyConfigTest.java
index e6de636..348429a 100644
--- a/components/camel-spring-security/src/test/java/org/apache/camel/component/spring/security/config/SpringSecurityAuthorizationPolicyConfigTest.java
+++ b/components/camel-spring-security/src/test/java/org/apache/camel/component/spring/security/config/SpringSecurityAuthorizationPolicyConfigTest.java
@@ -17,6 +17,7 @@
 package org.apache.camel.component.spring.security.config;
 
 import org.apache.camel.component.spring.security.SpringSecurityAuthorizationPolicy;
+import org.apache.camel.util.IOHelper;
 import org.junit.After;
 import org.junit.Assert;
 import org.junit.Before;
@@ -36,10 +37,7 @@ public class SpringSecurityAuthorizationPolicyConfigTest extends Assert
{
     
     @After
     public void tearDown() {
-        if (context != null) {
-            context.close();
-        }
-        
+        IOHelper.close(context);
     }
     
     @Test

http://git-wip-us.apache.org/repos/asf/camel/blob/acee7685/components/camel-spring/src/main/java/org/apache/camel/spring/Main.java
----------------------------------------------------------------------
diff --git a/components/camel-spring/src/main/java/org/apache/camel/spring/Main.java b/components/camel-spring/src/main/java/org/apache/camel/spring/Main.java
index ba3389d..c0e9a90 100644
--- a/components/camel-spring/src/main/java/org/apache/camel/spring/Main.java
+++ b/components/camel-spring/src/main/java/org/apache/camel/spring/Main.java
@@ -26,6 +26,7 @@ import org.apache.camel.CamelContext;
 import org.apache.camel.ProducerTemplate;
 import org.apache.camel.impl.MainSupport;
 import org.apache.camel.spring.handler.CamelNamespaceHandler;
+import org.apache.camel.util.IOHelper;
 import org.apache.camel.view.ModelFileGenerator;
 import org.springframework.context.ApplicationContext;
 import org.springframework.context.support.AbstractApplicationContext;
@@ -149,7 +150,7 @@ public class Main extends MainSupport {
         super.doStop();
         if (applicationContext != null) {
             LOG.debug("Stopping Spring ApplicationContext: " + applicationContext.getId());
-            applicationContext.close();
+            IOHelper.close(applicationContext);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/acee7685/components/camel-spring/src/test/java/org/apache/camel/spring/DefaultStreamCachingTest.java
----------------------------------------------------------------------
diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/DefaultStreamCachingTest.java
b/components/camel-spring/src/test/java/org/apache/camel/spring/DefaultStreamCachingTest.java
index 2facd10..c017729 100644
--- a/components/camel-spring/src/test/java/org/apache/camel/spring/DefaultStreamCachingTest.java
+++ b/components/camel-spring/src/test/java/org/apache/camel/spring/DefaultStreamCachingTest.java
@@ -18,6 +18,7 @@ package org.apache.camel.spring;
 
 import junit.framework.TestCase;
 import org.apache.camel.CamelContext;
+import org.apache.camel.util.IOHelper;
 import org.springframework.context.support.AbstractApplicationContext;
 import org.springframework.context.support.ClassPathXmlApplicationContext;
 
@@ -30,7 +31,7 @@ public class DefaultStreamCachingTest extends TestCase {
         assertFalse("StreamCaching should not be enabled", camelContext.isStreamCaching());
 
         // we're done so let's properly close the application context
-        appContext.close();
+        IOHelper.close(appContext);
     }
 
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/acee7685/components/camel-spring/src/test/java/org/apache/camel/spring/config/AnotherCamelProxyTest.java
----------------------------------------------------------------------
diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/config/AnotherCamelProxyTest.java
b/components/camel-spring/src/test/java/org/apache/camel/spring/config/AnotherCamelProxyTest.java
index ce2a478..21cf67e 100644
--- a/components/camel-spring/src/test/java/org/apache/camel/spring/config/AnotherCamelProxyTest.java
+++ b/components/camel-spring/src/test/java/org/apache/camel/spring/config/AnotherCamelProxyTest.java
@@ -18,6 +18,7 @@ package org.apache.camel.spring.config;
 
 import junit.framework.TestCase;
 
+import org.apache.camel.util.IOHelper;
 import org.springframework.context.support.AbstractApplicationContext;
 import org.springframework.context.support.ClassPathXmlApplicationContext;
 
@@ -36,7 +37,7 @@ public class AnotherCamelProxyTest extends TestCase {
         assertEquals("Bye Camel", reply);
 
         // we're done so let's properly close the application context
-        ac.close();
+        IOHelper.close(ac);
         // END SNIPPET: e1
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/acee7685/components/camel-spring/src/test/java/org/apache/camel/spring/config/CamelContextAutoStartupTest.java
----------------------------------------------------------------------
diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/config/CamelContextAutoStartupTest.java
b/components/camel-spring/src/test/java/org/apache/camel/spring/config/CamelContextAutoStartupTest.java
index 6e81018..7406a1f 100644
--- a/components/camel-spring/src/test/java/org/apache/camel/spring/config/CamelContextAutoStartupTest.java
+++ b/components/camel-spring/src/test/java/org/apache/camel/spring/config/CamelContextAutoStartupTest.java
@@ -20,6 +20,7 @@ import junit.framework.TestCase;
 import org.apache.camel.ProducerTemplate;
 import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.spring.SpringCamelContext;
+import org.apache.camel.util.IOHelper;
 import org.springframework.context.support.AbstractXmlApplicationContext;
 import org.springframework.context.support.ClassPathXmlApplicationContext;
 
@@ -83,9 +84,7 @@ public class CamelContextAutoStartupTest extends TestCase {
 
     @Override
     protected void tearDown() throws Exception {
-        if (ac != null) {
-            ac.close();
-        }
+        IOHelper.close(ac);
         super.tearDown();
     }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/acee7685/components/camel-spring/src/test/java/org/apache/camel/spring/config/CamelContextFactoryBeanTest.java
----------------------------------------------------------------------
diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/config/CamelContextFactoryBeanTest.java
b/components/camel-spring/src/test/java/org/apache/camel/spring/config/CamelContextFactoryBeanTest.java
index 796e140..9542d2d 100644
--- a/components/camel-spring/src/test/java/org/apache/camel/spring/config/CamelContextFactoryBeanTest.java
+++ b/components/camel-spring/src/test/java/org/apache/camel/spring/config/CamelContextFactoryBeanTest.java
@@ -25,6 +25,7 @@ import org.apache.camel.Route;
 import org.apache.camel.impl.EventDrivenConsumerRoute;
 import org.apache.camel.management.JmxSystemPropertyKeys;
 import org.apache.camel.spring.SpringCamelContext;
+import org.apache.camel.util.IOHelper;
 import org.springframework.beans.factory.support.BeanDefinitionRegistry;
 import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
 import org.springframework.context.support.AbstractApplicationContext;
@@ -52,10 +53,8 @@ public class CamelContextFactoryBeanTest extends XmlConfigTestSupport {
         // enable JMX
         System.clearProperty(JmxSystemPropertyKeys.DISABLED);
 
-        if (applicationContext != null) {
-            // we're done so let's properly close the application context
-            applicationContext.close();
-        }
+        // we're done so let's properly close the application context
+        IOHelper.close(applicationContext);
     }
 
     public void testClassPathRouteLoading() throws Exception {

http://git-wip-us.apache.org/repos/asf/camel/blob/acee7685/components/camel-spring/src/test/java/org/apache/camel/spring/config/CamelProxyTest.java
----------------------------------------------------------------------
diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/config/CamelProxyTest.java
b/components/camel-spring/src/test/java/org/apache/camel/spring/config/CamelProxyTest.java
index 65f6b81..79b63e1 100644
--- a/components/camel-spring/src/test/java/org/apache/camel/spring/config/CamelProxyTest.java
+++ b/components/camel-spring/src/test/java/org/apache/camel/spring/config/CamelProxyTest.java
@@ -19,6 +19,7 @@ package org.apache.camel.spring.config;
 import org.apache.camel.TestSupport;
 import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.spring.SpringCamelContext;
+import org.apache.camel.util.IOHelper;
 import org.springframework.context.support.AbstractApplicationContext;
 import org.springframework.context.support.ClassPathXmlApplicationContext;
 
@@ -53,7 +54,7 @@ public class CamelProxyTest extends TestSupport {
         result.assertIsSatisfied();
 
         // we're done so let's properly close the application context
-        ac.close();
+        IOHelper.close(ac);
     }
     
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/acee7685/components/camel-spring/src/test/java/org/apache/camel/spring/config/CamelProxyUsingRefTest.java
----------------------------------------------------------------------
diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/config/CamelProxyUsingRefTest.java
b/components/camel-spring/src/test/java/org/apache/camel/spring/config/CamelProxyUsingRefTest.java
index 3151288..12a0462 100644
--- a/components/camel-spring/src/test/java/org/apache/camel/spring/config/CamelProxyUsingRefTest.java
+++ b/components/camel-spring/src/test/java/org/apache/camel/spring/config/CamelProxyUsingRefTest.java
@@ -18,6 +18,7 @@ package org.apache.camel.spring.config;
 
 import junit.framework.TestCase;
 
+import org.apache.camel.util.IOHelper;
 import org.springframework.context.support.AbstractApplicationContext;
 import org.springframework.context.support.ClassPathXmlApplicationContext;
 
@@ -35,7 +36,7 @@ public class CamelProxyUsingRefTest extends TestCase {
         assertEquals("Hello World", reply);
 
         // we're done so let's properly close the application context
-        ac.close();
+        IOHelper.close(ac);
     }
 
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/acee7685/components/camel-spring/src/test/java/org/apache/camel/spring/config/RouteAutoStartupPropertiesTest.java
----------------------------------------------------------------------
diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/config/RouteAutoStartupPropertiesTest.java
b/components/camel-spring/src/test/java/org/apache/camel/spring/config/RouteAutoStartupPropertiesTest.java
index 16200df..799c55e 100644
--- a/components/camel-spring/src/test/java/org/apache/camel/spring/config/RouteAutoStartupPropertiesTest.java
+++ b/components/camel-spring/src/test/java/org/apache/camel/spring/config/RouteAutoStartupPropertiesTest.java
@@ -20,6 +20,7 @@ import junit.framework.TestCase;
 import org.apache.camel.ProducerTemplate;
 import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.spring.SpringCamelContext;
+import org.apache.camel.util.IOHelper;
 import org.springframework.context.support.AbstractXmlApplicationContext;
 import org.springframework.context.support.ClassPathXmlApplicationContext;
 
@@ -74,9 +75,7 @@ public class RouteAutoStartupPropertiesTest extends TestCase {
 
     @Override
     protected void tearDown() throws Exception {
-        if (ac != null) {
-            ac.close();
-        }
+        IOHelper.close(ac);
         super.tearDown();
     }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/acee7685/components/camel-spring/src/test/java/org/apache/camel/spring/config/RouteBuilderRefTest.java
----------------------------------------------------------------------
diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/config/RouteBuilderRefTest.java
b/components/camel-spring/src/test/java/org/apache/camel/spring/config/RouteBuilderRefTest.java
index d6a5e13..9a00735 100644
--- a/components/camel-spring/src/test/java/org/apache/camel/spring/config/RouteBuilderRefTest.java
+++ b/components/camel-spring/src/test/java/org/apache/camel/spring/config/RouteBuilderRefTest.java
@@ -17,6 +17,7 @@
 package org.apache.camel.spring.config;
 
 import org.apache.camel.CamelContext;
+import org.apache.camel.util.IOHelper;
 import org.springframework.context.support.AbstractApplicationContext;
 import org.springframework.context.support.ClassPathXmlApplicationContext;
 
@@ -32,7 +33,7 @@ public class RouteBuilderRefTest extends XmlConfigTestSupport {
         assertValidContext(context);
 
         // we're done so let's properly close the application context
-        applicationContext.close();
+        IOHelper.close(applicationContext);
     }
 
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/acee7685/components/camel-spring/src/test/java/org/apache/camel/spring/config/scan/SpringComponentScanTest.java
----------------------------------------------------------------------
diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/config/scan/SpringComponentScanTest.java
b/components/camel-spring/src/test/java/org/apache/camel/spring/config/scan/SpringComponentScanTest.java
index 2f78105..decb01a 100644
--- a/components/camel-spring/src/test/java/org/apache/camel/spring/config/scan/SpringComponentScanTest.java
+++ b/components/camel-spring/src/test/java/org/apache/camel/spring/config/scan/SpringComponentScanTest.java
@@ -21,6 +21,7 @@ import java.util.concurrent.TimeUnit;
 import org.apache.camel.ContextTestSupport;
 import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.model.ModelCamelContext;
+import org.apache.camel.util.IOHelper;
 import org.springframework.context.support.AbstractApplicationContext;
 import org.springframework.context.support.ClassPathXmlApplicationContext;
 
@@ -41,10 +42,8 @@ public class SpringComponentScanTest extends ContextTestSupport {
 
     @Override
     protected void tearDown() throws Exception {
-        if (applicationContext != null) {
-            // we're done so let's properly close the application context
-            applicationContext.close();
-        }
+        // we're done so let's properly close the application context
+        IOHelper.close(applicationContext);
 
         super.tearDown();
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/acee7685/components/camel-spring/src/test/java/org/apache/camel/spring/config/scan/SpringComponentScanWithDeprecatedPackagesTest.java
----------------------------------------------------------------------
diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/config/scan/SpringComponentScanWithDeprecatedPackagesTest.java
b/components/camel-spring/src/test/java/org/apache/camel/spring/config/scan/SpringComponentScanWithDeprecatedPackagesTest.java
index 9fadf4a..fed033a 100644
--- a/components/camel-spring/src/test/java/org/apache/camel/spring/config/scan/SpringComponentScanWithDeprecatedPackagesTest.java
+++ b/components/camel-spring/src/test/java/org/apache/camel/spring/config/scan/SpringComponentScanWithDeprecatedPackagesTest.java
@@ -20,6 +20,7 @@ package org.apache.camel.spring.config.scan;
 import org.apache.camel.ContextTestSupport;
 import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.model.ModelCamelContext;
+import org.apache.camel.util.IOHelper;
 import org.springframework.context.support.AbstractApplicationContext;
 import org.springframework.context.support.ClassPathXmlApplicationContext;
 
@@ -37,10 +38,8 @@ public class SpringComponentScanWithDeprecatedPackagesTest extends ContextTestSu
 
     @Override
     protected void tearDown() throws Exception {
-        if (applicationContext != null) {
-            // we're done so let's properly close the application context
-            applicationContext.close();
-        }
+        // we're done so let's properly close the application context
+        IOHelper.close(applicationContext);
 
         super.tearDown();
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/acee7685/components/camel-spring/src/test/java/org/apache/camel/spring/handler/ErrorHandlerDefinitionParserTest.java
----------------------------------------------------------------------
diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/handler/ErrorHandlerDefinitionParserTest.java
b/components/camel-spring/src/test/java/org/apache/camel/spring/handler/ErrorHandlerDefinitionParserTest.java
index 072df88..570cd21 100644
--- a/components/camel-spring/src/test/java/org/apache/camel/spring/handler/ErrorHandlerDefinitionParserTest.java
+++ b/components/camel-spring/src/test/java/org/apache/camel/spring/handler/ErrorHandlerDefinitionParserTest.java
@@ -24,6 +24,7 @@ import org.apache.camel.builder.DefaultErrorHandlerBuilder;
 import org.apache.camel.builder.LoggingErrorHandlerBuilder;
 import org.apache.camel.processor.RedeliveryPolicy;
 import org.apache.camel.spring.spi.TransactionErrorHandlerBuilder;
+import org.apache.camel.util.IOHelper;
 import org.springframework.context.support.ClassPathXmlApplicationContext;
 
 public class ErrorHandlerDefinitionParserTest extends TestCase {
@@ -34,7 +35,7 @@ public class ErrorHandlerDefinitionParserTest extends TestCase {
     }
 
     public void tearDown() throws Exception {
-        ctx.close();        
+        IOHelper.close(ctx);
     }
     
     public void testLoggingErrorHandler() {


Mime
View raw message