You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2015/11/07 09:44:50 UTC
[3/4] camel git commit: Added unit test
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/324412c0
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/324412c0
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/324412c0
Branch: refs/heads/camel-2.16.x
Commit: 324412c0d234235337f8c6e50998503b19fd08dd
Parents: 385df5f
Author: Claus Ibsen <da...@apache.org>
Authored: Sat Nov 7 09:33:27 2015 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Sat Nov 7 09:47:58 2015 +0100
----------------------------------------------------------------------
.../camel/commands/ContextListCommandTest.java | 33 ++++++++++++++++++++
1 file changed, 33 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/324412c0/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();
+ }
+
}