camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r807501 - in /camel/trunk/camel-core/src/test/java/org/apache/camel: impl/DefaultCamelContextTest.java issues/TwoTimerWithJMXIssue.java management/JmxInstrumentationUsingPlatformMBSTest.java
Date Tue, 25 Aug 2009 06:58:03 GMT
Author: davsclaus
Date: Tue Aug 25 06:58:02 2009
New Revision: 807501

URL: http://svn.apache.org/viewvc?rev=807501&view=rev
Log:
unit test polished

Modified:
    camel/trunk/camel-core/src/test/java/org/apache/camel/impl/DefaultCamelContextTest.java
    camel/trunk/camel-core/src/test/java/org/apache/camel/issues/TwoTimerWithJMXIssue.java
    camel/trunk/camel-core/src/test/java/org/apache/camel/management/JmxInstrumentationUsingPlatformMBSTest.java

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=807501&r1=807500&r2=807501&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
Tue Aug 25 06:58:02 2009
@@ -91,16 +91,15 @@
             }            
         });
         ctx.start();
-        assertEquals("Should have one RouteService", ctx.getRouteServices().size(), 1); 
      
+        assertEquals("Should have one RouteService", 1, ctx.getRouteServices().size());
         String routesString = ctx.getRoutes().toString();
         ctx.stop();
-        assertEquals("The RouteService should be removed ", ctx.getRouteServices().size(),
1);
+        assertEquals("The RouteService should NOT be removed even when we stop", 1, ctx.getRouteServices().size());
         ctx.start();
-        assertEquals("Should have one RouteService", ctx.getRouteServices().size(), 1);
-        //System.out.println("The routes is " + ctx.getRoutes());
+        assertEquals("Should have one RouteService", 1, ctx.getRouteServices().size());
         assertEquals("The Routes should be same", routesString, ctx.getRoutes().toString());
         ctx.stop();
-        assertEquals("The RouteService should be removed ", ctx.getRouteServices().size(),
1);        
+        assertEquals("The RouteService should NOT be removed even when we stop", 1, ctx.getRouteServices().size());
     }
 
 }

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/issues/TwoTimerWithJMXIssue.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/issues/TwoTimerWithJMXIssue.java?rev=807501&r1=807500&r2=807501&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/issues/TwoTimerWithJMXIssue.java
(original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/issues/TwoTimerWithJMXIssue.java
Tue Aug 25 06:58:02 2009
@@ -20,6 +20,7 @@
 import org.apache.camel.ContextTestSupport;
 import org.apache.camel.Processor;
 import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.model.ProcessorDefinition;
 import org.apache.camel.spi.InterceptStrategy;
 
@@ -37,7 +38,10 @@
     }
 
     public void testFromWithNoOutputs() throws Exception {
-        Thread.sleep(500);
+        MockEndpoint mock = getMockEndpoint("mock:result");
+        mock.expectedMinimumMessageCount(2);
+
+        assertMockEndpointsSatisfied();
 
         assertTrue("Counter should be 2 or higher", counter >= 2);
     }
@@ -48,7 +52,7 @@
             public void configure() throws Exception {
                 context.addInterceptStrategy(new MyTracer());
 
-                from("timer://kickoff_1?period=250").from("timer://kickoff_2?period=250&delay=10");
+                from("timer://kickoff_1?period=250").from("timer://kickoff_2?period=250&delay=10").to("mock:result");
             }
         };
     }
@@ -56,7 +60,7 @@
     private class MyTracer implements InterceptStrategy {
 
         public Processor wrapProcessorInInterceptors(CamelContext context, ProcessorDefinition
definition, Processor target, Processor nextTarget)
-            throws Exception {
+                throws Exception {
             assertNotNull(target);
             counter++;
             return target;

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/management/JmxInstrumentationUsingPlatformMBSTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/management/JmxInstrumentationUsingPlatformMBSTest.java?rev=807501&r1=807500&r2=807501&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/management/JmxInstrumentationUsingPlatformMBSTest.java
(original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/management/JmxInstrumentationUsingPlatformMBSTest.java
Tue Aug 25 06:58:02 2009
@@ -57,19 +57,17 @@
     @SuppressWarnings("unchecked")
     protected MBeanServerConnection getMBeanConnection() throws Exception {
         if (mbsc == null) {
-            List<MBeanServer> servers =
-                    (List<MBeanServer>)MBeanServerFactory.findMBeanServer(null);
+            List<MBeanServer> servers = (List<MBeanServer>)MBeanServerFactory.findMBeanServer(null);
 
             for (MBeanServer server : servers) {
                 if (domainName.equals(server.getDefaultDomain())) {
-
                     mbsc = server;
                     break;
                 }
             }
         }
+
         return mbsc;
     }
 
-
 }



Mime
View raw message