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 2019/01/08 08:34:39 UTC

[camel] branch master updated: Added test based on SO: https://stackoverflow.com/questions/54023107/apache-camel-how-to-implement-an-optional-consumer-for-a-wire-tap/54049958

This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/master by this push:
     new b77fd72  Added test based on SO: https://stackoverflow.com/questions/54023107/apache-camel-how-to-implement-an-optional-consumer-for-a-wire-tap/54049958
b77fd72 is described below

commit b77fd7258442c44d0aa59498152421ed6c2452f0
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Tue Jan 8 09:16:15 2019 +0100

    Added test based on SO: https://stackoverflow.com/questions/54023107/apache-camel-how-to-implement-an-optional-consumer-for-a-wire-tap/54049958
---
 .../component/direct/DirectNoConsumerTest.java     | 27 +++++++++++++++++-----
 1 file changed, 21 insertions(+), 6 deletions(-)

diff --git a/camel-core/src/test/java/org/apache/camel/component/direct/DirectNoConsumerTest.java b/camel-core/src/test/java/org/apache/camel/component/direct/DirectNoConsumerTest.java
index 7c10ee4..60a07bc 100644
--- a/camel-core/src/test/java/org/apache/camel/component/direct/DirectNoConsumerTest.java
+++ b/camel-core/src/test/java/org/apache/camel/component/direct/DirectNoConsumerTest.java
@@ -83,11 +83,27 @@ public class DirectNoConsumerTest extends ContextTestSupport {
 
         context.start();
 
-        try {
-            template.sendBody("direct:start", "Hello World");
-        } catch (CamelExecutionException e) {
-            assertIsInstanceOf(DirectConsumerNotAvailableException.class, e.getCause());
-        }
+        template.sendBody("direct:start", "Hello World");
+    }
+
+    @Test
+    public void testWireTapFailIfNoConsumerFalse() throws Exception {
+        context.getComponent("direct", DirectComponent.class).setBlock(false);
+
+        context.addRoutes(new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from("direct:start").wireTap("direct:foo?failIfNoConsumers=false").to("mock:foo");
+            }
+        });
+
+        context.start();
+
+        getMockEndpoint("mock:foo").expectedMessageCount(1);
+
+        template.sendBody("direct:start", "Hello World");
+
+        assertMockEndpointsSatisfied();
     }
 
     @Test
@@ -138,7 +154,6 @@ public class DirectNoConsumerTest extends ContextTestSupport {
         template.sendBody("direct:in", "Hello World");
 
         assertMockEndpointsSatisfied();
-
     }
 
     @Test