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/12/10 11:22:19 UTC

[1/2] camel git commit: CAMEL-9409: wiretap - Allow to use endpoint injected instance

Repository: camel
Updated Branches:
  refs/heads/camel-2.16.x daff7aad8 -> 572df64ce
  refs/heads/master ac9a7940b -> 1b7c19622


CAMEL-9409: wiretap - Allow to use endpoint injected instance


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

Branch: refs/heads/master
Commit: 1b7c1962246afd6acbac0451802b8c504d740ec5
Parents: ac9a794
Author: Claus Ibsen <da...@apache.org>
Authored: Thu Dec 10 11:21:21 2015 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Thu Dec 10 11:21:32 2015 +0100

----------------------------------------------------------------------
 .../apache/camel/model/ProcessorDefinition.java | 16 +++++++
 .../camel/processor/WireTapLogEndpointTest.java | 44 ++++++++++++++++++++
 2 files changed, 60 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/1b7c1962/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java b/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java
index 55dd19e..eacb304 100644
--- a/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java
@@ -2250,6 +2250,22 @@ public abstract class ProcessorDefinition<Type extends ProcessorDefinition<Type>
      * destination gets a copy of the original message to avoid the processors
      * interfering with each other using {@link ExchangePattern#InOnly}.
      *
+     * @param endpoint  the endpoint to wiretap to
+     * @return the builder
+     */
+    public WireTapDefinition<Type> wireTap(Endpoint endpoint) {
+        WireTapDefinition answer = new WireTapDefinition();
+        answer.setUri(endpoint.getEndpointUri());
+        addOutput(answer);
+        return answer;
+    }
+
+    /**
+     * <a href="http://camel.apache.org/wiretap.html">WireTap EIP:</a>
+     * Sends messages to all its child outputs; so that each processor and
+     * destination gets a copy of the original message to avoid the processors
+     * interfering with each other using {@link ExchangePattern#InOnly}.
+     *
      * @param uri  the dynamic endpoint to wiretap to (resolved using simple language by default)
      * @return the builder
      */

http://git-wip-us.apache.org/repos/asf/camel/blob/1b7c1962/camel-core/src/test/java/org/apache/camel/processor/WireTapLogEndpointTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/processor/WireTapLogEndpointTest.java b/camel-core/src/test/java/org/apache/camel/processor/WireTapLogEndpointTest.java
new file mode 100644
index 0000000..5f5a75b
--- /dev/null
+++ b/camel-core/src/test/java/org/apache/camel/processor/WireTapLogEndpointTest.java
@@ -0,0 +1,44 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.processor;
+
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.Endpoint;
+import org.apache.camel.builder.RouteBuilder;
+
+public class WireTapLogEndpointTest extends ContextTestSupport {
+
+    public void testWireTapLog() throws Exception {
+        getMockEndpoint("mock:result").expectedMessageCount(1);
+
+        template.sendBody("direct:start", "Hello World");
+
+        assertMockEndpointsSatisfied();
+    }
+    
+    protected RouteBuilder createRouteBuilder() {
+        return new RouteBuilder() {
+            public void configure() {
+                Endpoint tap = endpoint("log:com.foo.MyApp?level=WARN");
+
+                from("direct:start")
+                    .wireTap(tap)
+                    .to("mock:result");
+            }
+        };
+    }
+}
\ No newline at end of file


[2/2] camel git commit: CAMEL-9409: wiretap - Allow to use endpoint injected instance

Posted by da...@apache.org.
CAMEL-9409: wiretap - Allow to use endpoint injected instance


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

Branch: refs/heads/camel-2.16.x
Commit: 572df64ce56f38da66606cbc8d9b482dc0819d84
Parents: daff7aa
Author: Claus Ibsen <da...@apache.org>
Authored: Thu Dec 10 11:21:21 2015 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Thu Dec 10 11:22:09 2015 +0100

----------------------------------------------------------------------
 .../apache/camel/model/ProcessorDefinition.java | 16 +++++++
 .../camel/processor/WireTapLogEndpointTest.java | 44 ++++++++++++++++++++
 2 files changed, 60 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/572df64c/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java b/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java
index 2ddb383..7bb512f 100644
--- a/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java
@@ -2250,6 +2250,22 @@ public abstract class ProcessorDefinition<Type extends ProcessorDefinition<Type>
      * destination gets a copy of the original message to avoid the processors
      * interfering with each other using {@link ExchangePattern#InOnly}.
      *
+     * @param endpoint  the endpoint to wiretap to
+     * @return the builder
+     */
+    public WireTapDefinition<Type> wireTap(Endpoint endpoint) {
+        WireTapDefinition answer = new WireTapDefinition();
+        answer.setUri(endpoint.getEndpointUri());
+        addOutput(answer);
+        return answer;
+    }
+
+    /**
+     * <a href="http://camel.apache.org/wiretap.html">WireTap EIP:</a>
+     * Sends messages to all its child outputs; so that each processor and
+     * destination gets a copy of the original message to avoid the processors
+     * interfering with each other using {@link ExchangePattern#InOnly}.
+     *
      * @param uri  the dynamic endpoint to wiretap to (resolved using simple language by default)
      * @return the builder
      */

http://git-wip-us.apache.org/repos/asf/camel/blob/572df64c/camel-core/src/test/java/org/apache/camel/processor/WireTapLogEndpointTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/processor/WireTapLogEndpointTest.java b/camel-core/src/test/java/org/apache/camel/processor/WireTapLogEndpointTest.java
new file mode 100644
index 0000000..5f5a75b
--- /dev/null
+++ b/camel-core/src/test/java/org/apache/camel/processor/WireTapLogEndpointTest.java
@@ -0,0 +1,44 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.processor;
+
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.Endpoint;
+import org.apache.camel.builder.RouteBuilder;
+
+public class WireTapLogEndpointTest extends ContextTestSupport {
+
+    public void testWireTapLog() throws Exception {
+        getMockEndpoint("mock:result").expectedMessageCount(1);
+
+        template.sendBody("direct:start", "Hello World");
+
+        assertMockEndpointsSatisfied();
+    }
+    
+    protected RouteBuilder createRouteBuilder() {
+        return new RouteBuilder() {
+            public void configure() {
+                Endpoint tap = endpoint("log:com.foo.MyApp?level=WARN");
+
+                from("direct:start")
+                    .wireTap(tap)
+                    .to("mock:result");
+            }
+        };
+    }
+}
\ No newline at end of file