camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hadr...@apache.org
Subject svn commit: r961574 - in /camel/trunk/camel-core/src/test/java/org/apache/camel: builder/ component/direct/ impl/ management/
Date Thu, 08 Jul 2010 05:40:52 GMT
Author: hadrian
Date: Thu Jul  8 05:40:52 2010
New Revision: 961574

URL: http://svn.apache.org/viewvc?rev=961574&view=rev
Log:
CAMEL-2716. Change super class for tests using a CamelContext to TestSupport

Modified:
    camel/trunk/camel-core/src/test/java/org/apache/camel/builder/BuilderWithScopesTest.java
    camel/trunk/camel-core/src/test/java/org/apache/camel/component/direct/DirectNoMultipleConsumersTest.java
    camel/trunk/camel-core/src/test/java/org/apache/camel/impl/DefaultCamelContextAutoStartupTest.java
    camel/trunk/camel-core/src/test/java/org/apache/camel/impl/DefaultCamelContextTest.java
    camel/trunk/camel-core/src/test/java/org/apache/camel/management/ManagedRouteStopAndStartCleanupTest.java

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/builder/BuilderWithScopesTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/BuilderWithScopesTest.java?rev=961574&r1=961573&r2=961574&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/builder/BuilderWithScopesTest.java
(original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/builder/BuilderWithScopesTest.java
Thu Jul  8 05:40:52 2010
@@ -90,6 +90,7 @@ public class BuilderWithScopesTest exten
 
         order.clear();
         CamelContext container = new DefaultCamelContext();
+        container.disableJMX();
 
         container.addRoutes(builder);
         container.start();
@@ -104,6 +105,8 @@ public class BuilderWithScopesTest exten
 
         log.debug("Invocation order:" + order);
         assertEquals(expected, order);
+        
+        container.stop();
     }
 
     public void testRouteWithFilterEnd() throws Exception {

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/component/direct/DirectNoMultipleConsumersTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/component/direct/DirectNoMultipleConsumersTest.java?rev=961574&r1=961573&r2=961574&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/component/direct/DirectNoMultipleConsumersTest.java
(original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/component/direct/DirectNoMultipleConsumersTest.java
Thu Jul  8 05:40:52 2010
@@ -16,19 +16,20 @@
  */
 package org.apache.camel.component.direct;
 
-import junit.framework.TestCase;
 import org.apache.camel.CamelContext;
 import org.apache.camel.FailedToStartRouteException;
+import org.apache.camel.TestSupport;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.impl.DefaultCamelContext;
 
 /**
  * MultipleConsumers option test.
  */
-public class DirectNoMultipleConsumersTest extends TestCase {
+public class DirectNoMultipleConsumersTest extends TestSupport {
 
     public void testNoMultipleConsumersTest() throws Exception {
         CamelContext container = new DefaultCamelContext();
+        container.disableJMX();
 
         container.addRoutes(new RouteBuilder() {
             public void configure() throws Exception {
@@ -43,7 +44,8 @@ public class DirectNoMultipleConsumersTe
             fail("Should have thrown an FailedToStartRouteException");
         } catch (FailedToStartRouteException e) {
             // expected
+        } finally {
+            container.stop();
         }
     }
-
 }
\ No newline at end of file

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/impl/DefaultCamelContextAutoStartupTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/impl/DefaultCamelContextAutoStartupTest.java?rev=961574&r1=961573&r2=961574&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/impl/DefaultCamelContextAutoStartupTest.java
(original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/impl/DefaultCamelContextAutoStartupTest.java
Thu Jul  8 05:40:52 2010
@@ -16,17 +16,18 @@
  */
 package org.apache.camel.impl;
 
-import junit.framework.TestCase;
+import org.apache.camel.TestSupport;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
 
 /**
  * @version $Revision$
  */
-public class DefaultCamelContextAutoStartupTest extends TestCase {
+public class DefaultCamelContextAutoStartupTest extends TestSupport {
 
     public void testAutoStartupFalse() throws Exception {
         DefaultCamelContext camel = new DefaultCamelContext(new SimpleRegistry());
+        camel.disableJMX();
         camel.setAutoStartup(false);
 
         camel.addRoutes(new RouteBuilder() {
@@ -53,10 +54,13 @@ public class DefaultCamelContextAutoStar
         camel.createProducerTemplate().sendBody("direct:start", "Hello World");
 
         mock.assertIsSatisfied();
+        
+        camel.stop();
     }
 
     public void testAutoStartupTrue() throws Exception {
         DefaultCamelContext camel = new DefaultCamelContext(new SimpleRegistry());
+        camel.disableJMX();
         camel.setAutoStartup(true);
 
         camel.addRoutes(new RouteBuilder() {
@@ -76,6 +80,7 @@ public class DefaultCamelContextAutoStar
         camel.createProducerTemplate().sendBody("direct:start", "Hello World");
 
         mock.assertIsSatisfied();
+        
+        camel.stop();
     }
-
 }

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/impl/DefaultCamelContextTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/impl/DefaultCamelContextTest.java?rev=961574&r1=961573&r2=961574&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/impl/DefaultCamelContextTest.java
(original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/impl/DefaultCamelContextTest.java
Thu Jul  8 05:40:52 2010
@@ -19,12 +19,12 @@ package org.apache.camel.impl;
 import java.util.List;
 import java.util.Map;
 
-import junit.framework.TestCase;
 import org.apache.camel.Component;
 import org.apache.camel.Endpoint;
 import org.apache.camel.NoSuchEndpointException;
 import org.apache.camel.ResolveEndpointFailedException;
 import org.apache.camel.Route;
+import org.apache.camel.TestSupport;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.bean.BeanComponent;
 import org.apache.camel.component.direct.DirectComponent;
@@ -35,10 +35,11 @@ import org.apache.camel.util.CamelContex
 /**
  * @version $Revision$
  */
-public class DefaultCamelContextTest extends TestCase {
+public class DefaultCamelContextTest extends TestSupport {
 
     public void testAutoCreateComponentsOn() {
         DefaultCamelContext ctx = new DefaultCamelContext();
+        ctx.disableJMX();
         Component component = ctx.getComponent("bean");
         assertNotNull(component);
         assertEquals(component.getClass(), BeanComponent.class);
@@ -46,6 +47,7 @@ public class DefaultCamelContextTest ext
 
     public void testAutoCreateComponentsOff() {
         DefaultCamelContext ctx = new DefaultCamelContext();
+        ctx.disableJMX();
         ctx.setAutoCreateComponents(false);
         Component component = ctx.getComponent("bean");
         assertNull(component);
@@ -53,6 +55,7 @@ public class DefaultCamelContextTest ext
 
     public void testGetComponents() throws Exception {
         DefaultCamelContext ctx = new DefaultCamelContext();
+        ctx.disableJMX();
         Component component = ctx.getComponent("bean");
         assertNotNull(component);
 
@@ -63,6 +66,7 @@ public class DefaultCamelContextTest ext
 
     public void testGetEndpoint() throws Exception {
         DefaultCamelContext ctx = new DefaultCamelContext();
+        ctx.disableJMX();
         Endpoint endpoint = ctx.getEndpoint("log:foo");
         assertNotNull(endpoint);
 
@@ -76,6 +80,7 @@ public class DefaultCamelContextTest ext
 
     public void testGetEndpointNotFound() throws Exception {
         DefaultCamelContext ctx = new DefaultCamelContext();
+        ctx.disableJMX();
         try {
             ctx.getEndpoint("xxx:foo");
             fail("Should have thrown a ResolveEndpointFailedException");
@@ -86,6 +91,7 @@ public class DefaultCamelContextTest ext
 
     public void testGetEndpointNoScheme() throws Exception {
         DefaultCamelContext ctx = new DefaultCamelContext();
+        ctx.disableJMX();
         try {
             CamelContextHelper.getMandatoryEndpoint(ctx, "log.foo");
             fail("Should have thrown a NoSuchEndpointException");
@@ -96,6 +102,7 @@ public class DefaultCamelContextTest ext
 
     public void testRestartCamelContext() throws Exception {
         DefaultCamelContext ctx = new DefaultCamelContext();
+        ctx.disableJMX();
         ctx.addRoutes(new RouteBuilder() {
             @Override
             public void configure() throws Exception {
@@ -116,6 +123,7 @@ public class DefaultCamelContextTest ext
 
     public void testName() {
         DefaultCamelContext ctx = new DefaultCamelContext();
+        ctx.disableJMX();
         assertNotNull("Should have a default name", ctx.getName());
         ctx.setName("foo");
         assertEquals("foo", ctx.getName());
@@ -126,11 +134,13 @@ public class DefaultCamelContextTest ext
 
     public void testVersion() {
         DefaultCamelContext ctx = new DefaultCamelContext();
+        ctx.disableJMX();
         assertNotNull("Should have a version", ctx.getVersion());
     }
 
     public void testHasComponent() {
         DefaultCamelContext ctx = new DefaultCamelContext();
+        ctx.disableJMX();
         assertNull(ctx.hasComponent("log"));
 
         ctx.addComponent("log", new LogComponent());
@@ -139,6 +149,7 @@ public class DefaultCamelContextTest ext
 
     public void testGetComponent() {
         DefaultCamelContext ctx = new DefaultCamelContext();
+        ctx.disableJMX();
         ctx.addComponent("log", new LogComponent());
 
         LogComponent log = ctx.getComponent("log", LogComponent.class);
@@ -154,14 +165,16 @@ public class DefaultCamelContextTest ext
 
     public void testGetEndpointMap() throws Exception {
         DefaultCamelContext ctx = new DefaultCamelContext();
+        ctx.disableJMX();
         ctx.addEndpoint("mock://foo", new MockEndpoint("mock://foo"));
 
-        Map map = ctx.getEndpointMap();
+        Map<String, Endpoint> map = ctx.getEndpointMap();
         assertEquals(1, map.size());
     }
 
     public void testHasEndpoint() throws Exception {
         DefaultCamelContext ctx = new DefaultCamelContext();
+        ctx.disableJMX();
         ctx.addEndpoint("mock://foo", new MockEndpoint("mock://foo"));
 
         assertNotNull(ctx.hasEndpoint("mock://foo"));
@@ -177,6 +190,7 @@ public class DefaultCamelContextTest ext
 
     public void testGetRouteById() throws Exception {
         DefaultCamelContext ctx = new DefaultCamelContext();
+        ctx.disableJMX();
         ctx.addRoutes(new RouteBuilder() {
             @Override
             public void configure() throws Exception {
@@ -191,6 +205,7 @@ public class DefaultCamelContextTest ext
         assertEquals("direct://start", route.getConsumer().getEndpoint().getEndpointUri());
 
         assertNull(ctx.getRoute("unknown"));
+        ctx.stop();
     }
 
 }

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/management/ManagedRouteStopAndStartCleanupTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/management/ManagedRouteStopAndStartCleanupTest.java?rev=961574&r1=961573&r2=961574&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/management/ManagedRouteStopAndStartCleanupTest.java
(original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/management/ManagedRouteStopAndStartCleanupTest.java
Thu Jul  8 05:40:52 2010
@@ -36,7 +36,6 @@ public class ManagedRouteStopAndStartCle
         return true;
     }
 
-    @SuppressWarnings("unchecked")
     public void testStopAndStartRoute() throws Exception {
         MBeanServer mbeanServer = context.getManagementStrategy().getManagementAgent().getMBeanServer();
         ObjectName on = getRouteObjectName(mbeanServer);



Mime
View raw message