Repository: camel
Updated Branches:
  refs/heads/camel-2.16.x 385df5fb4 -> bfd2d1f03
  refs/heads/master e55597f17 -> 8a68d4bc9


Added unit test


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

Branch: refs/heads/master
Commit: 362873aacf64f3b8abad457ac3a9216d1ad1303a
Parents: e55597f
Author: Claus Ibsen <davscl...@apache.org>
Authored: Sat Nov 7 09:33:27 2015 +0100
Committer: Claus Ibsen <davscl...@apache.org>
Committed: Sat Nov 7 09:33:27 2015 +0100

----------------------------------------------------------------------
 .../camel/commands/ContextListCommandTest.java  | 33 ++++++++++++++++++++
 1 file changed, 33 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/362873aa/platforms/commands/commands-core/src/test/java/org/apache/camel/commands/ContextListCommandTest.java
----------------------------------------------------------------------
diff --git 
a/platforms/commands/commands-core/src/test/java/org/apache/camel/commands/ContextListCommandTest.java
 
b/platforms/commands/commands-core/src/test/java/org/apache/camel/commands/ContextListCommandTest.java
index 1e1c782..24f2042 100644
--- 
a/platforms/commands/commands-core/src/test/java/org/apache/camel/commands/ContextListCommandTest.java
+++ 
b/platforms/commands/commands-core/src/test/java/org/apache/camel/commands/ContextListCommandTest.java
@@ -21,6 +21,7 @@ import java.io.OutputStream;
 import java.io.PrintStream;
 
 import org.apache.camel.CamelContext;
+import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.impl.DefaultCamelContext;
 import org.apache.camel.impl.ExplicitCamelContextNameStrategy;
 import org.junit.Test;
@@ -59,4 +60,36 @@ public class ContextListCommandTest {
         context.stop();
     }
 
+    @Test
+    public void testEndpointStats() throws Exception {
+        CamelContext context = new DefaultCamelContext();
+        context.setNameStrategy(new 
ExplicitCamelContextNameStrategy("foobar"));
+        context.addRoutes(new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from("direct:start").to("mock:result");
+            }
+        });
+        context.start();
+
+        context.createProducerTemplate().sendBody("direct:start", "Hello 
World");
+
+        CamelController controller = new DummyCamelController(context);
+
+        OutputStream os = new ByteArrayOutputStream();
+        PrintStream ps = new PrintStream(os);
+
+        EndpointStatisticCommand command = new 
EndpointStatisticCommand("foobar", false, null);
+        command.execute(controller, ps, null);
+
+        String out = os.toString();
+        assertNotNull(out);
+        LOG.info("\n\n{}\n", out);
+
+        assertTrue(out.contains("direct://start"));
+        assertTrue(out.contains("mock://result"));
+
+        context.stop();
+    }
+
 }

Reply via email to