camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject camel git commit: Polished
Date Fri, 02 Jan 2015 16:42:24 GMT
Repository: camel
Updated Branches:
  refs/heads/master a0f1a40a7 -> ca3ae74f7


Polished


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

Branch: refs/heads/master
Commit: ca3ae74f7d44ce36b6f8872d90b41ae57d38bc52
Parents: a0f1a40
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Fri Jan 2 17:42:14 2015 +0100
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Fri Jan 2 17:42:14 2015 +0100

----------------------------------------------------------------------
 .../camel/management/ManagedSanitizeTest.java   |  5 +--
 .../ManagedUnregisterProducerTest.java          | 47 ++++++++------------
 ...intMustBeStartedBeforeSendProcessorTest.java |  1 -
 3 files changed, 21 insertions(+), 32 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/ca3ae74f/camel-core/src/test/java/org/apache/camel/management/ManagedSanitizeTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/management/ManagedSanitizeTest.java
b/camel-core/src/test/java/org/apache/camel/management/ManagedSanitizeTest.java
index 09fd8c0..deb1b5f 100644
--- a/camel-core/src/test/java/org/apache/camel/management/ManagedSanitizeTest.java
+++ b/camel-core/src/test/java/org/apache/camel/management/ManagedSanitizeTest.java
@@ -39,9 +39,8 @@ public class ManagedSanitizeTest extends ManagementTestSupport {
 
         ObjectName name = ObjectName.getInstance("org.apache.camel:context=camel-1,type=endpoints,name=\"stub://foo\\?password=xxxxxx&username=foo\"");
         assertTrue("Should be registered", mbeanServer.isRegistered(name));
-        // TODO: fix browsable endpoint mbean
-        // String uri = (String) mbeanServer.getAttribute(name, "EndpointUri");
-        // assertEquals("stub://foo?password=xxxxxx&username=foo", uri);
+        String uri = (String) mbeanServer.getAttribute(name, "EndpointUri");
+        assertEquals("stub://foo?password=xxxxxx&username=foo", uri);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/camel/blob/ca3ae74f/camel-core/src/test/java/org/apache/camel/management/ManagedUnregisterProducerTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/management/ManagedUnregisterProducerTest.java
b/camel-core/src/test/java/org/apache/camel/management/ManagedUnregisterProducerTest.java
index 05e2da1..41b682e 100644
--- a/camel-core/src/test/java/org/apache/camel/management/ManagedUnregisterProducerTest.java
+++ b/camel-core/src/test/java/org/apache/camel/management/ManagedUnregisterProducerTest.java
@@ -16,9 +16,10 @@
  */
 package org.apache.camel.management;
 
-import org.apache.camel.Endpoint;
-import org.apache.camel.Exchange;
-import org.apache.camel.Producer;
+import java.util.Set;
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+
 import org.apache.camel.builder.RouteBuilder;
 
 /**
@@ -32,41 +33,31 @@ public class ManagedUnregisterProducerTest extends ManagementTestSupport
{
             return;
         }
 
-        // send a message so the managed producer is started
-        // do this "manually" to avoid camel managing the direct:start producer as well
-        // this makes the unit test easier as we only have 1 managed producer = mock:result
-        Endpoint endpoint = context.getEndpoint("direct:start");
-        Producer producer = endpoint.createProducer();
-        Exchange exchange = endpoint.createExchange();
-        exchange.getIn().setBody("Hello World");
-
-        producer.start();
-        producer.process(exchange);
-        producer.stop();
-
-        // TODO: producers are not managed due they can lead to memory leak CAMEL-2484
+        getMockEndpoint("mock:result").expectedMessageCount(1);
+        template.sendBody("direct:start", "Hello World");
+        assertMockEndpointsSatisfied();
 
-//        MBeanServer mbeanServer = getMBeanServer();
+        MBeanServer mbeanServer = getMBeanServer();
 
-//        Set<ObjectName> set = mbeanServer.queryNames(new ObjectName("*:type=producers,*"),
null);
-//        assertEquals(0, set.size());
+        Set<ObjectName> set = mbeanServer.queryNames(new ObjectName("*:type=producers,*"),
null);
+        assertEquals(1, set.size());
 
-//        ObjectName on = set.iterator().next();
+        ObjectName on = set.iterator().next();
 
-//        assertTrue("Should be registered", mbeanServer.isRegistered(on));
-//        String uri = (String) mbeanServer.getAttribute(on, "EndpointUri");
-//        assertEquals("mock://result", uri);
+        assertTrue("Should be registered", mbeanServer.isRegistered(on));
+        String uri = (String) mbeanServer.getAttribute(on, "EndpointUri");
+        assertEquals("mock://result", uri);
 
         // TODO: populating route id on producers is not implemented yet
-//        String routeId = (String) mbeanServer.getAttribute(on, "RouteId");
-//        assertEquals("route1", routeId);
+        // String routeId = (String) mbeanServer.getAttribute(on, "RouteId");
+        // assertEquals("route1", routeId);
 
-//        Boolean singleton = (Boolean) mbeanServer.getAttribute(on, "Singleton");
-//        assertEquals(Boolean.TRUE, singleton);
+        Boolean singleton = (Boolean) mbeanServer.getAttribute(on, "Singleton");
+        assertEquals(Boolean.TRUE, singleton);
 
         context.stop();
 
-//        assertFalse("Should no longer be registered", mbeanServer.isRegistered(on));
+        assertFalse("Should no longer be registered", mbeanServer.isRegistered(on));
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/camel/blob/ca3ae74f/camel-core/src/test/java/org/apache/camel/processor/EndpointMustBeStartedBeforeSendProcessorTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/processor/EndpointMustBeStartedBeforeSendProcessorTest.java
b/camel-core/src/test/java/org/apache/camel/processor/EndpointMustBeStartedBeforeSendProcessorTest.java
index 12d870c..19cd537 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/EndpointMustBeStartedBeforeSendProcessorTest.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/EndpointMustBeStartedBeforeSendProcessorTest.java
@@ -118,7 +118,6 @@ public class EndpointMustBeStartedBeforeSendProcessorTest extends ContextTestSup
     private final class MyEndpoint extends DefaultEndpoint {
 
         private MyEndpoint(String endpointUri, CamelContext camelContext) {
-            // FIXME: another endpoint that works without a Component
             setCamelContext(camelContext);
             setEndpointUri(endpointUri);
         }


Mime
View raw message