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 2016/01/12 11:07:33 UTC

[1/4] camel git commit: Added some unit test as sample code

Repository: camel
Updated Branches:
  refs/heads/camel-2.15.x b7aeb46a9 -> 4f0de9ad4
  refs/heads/camel-2.16.x f7530e5d8 -> 284cc14a8
  refs/heads/master 883795ec1 -> 4e283f797


Added some unit test as sample code


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

Branch: refs/heads/master
Commit: be5478ad7fbf1048d24fb5d7ce801a48ce14376a
Parents: 883795e
Author: Claus Ibsen <da...@apache.org>
Authored: Tue Jan 12 11:04:30 2016 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Tue Jan 12 11:04:30 2016 +0100

----------------------------------------------------------------------
 .../test/patterns/SimpleMockEndpointsTest.java  | 52 +++++++++++++++++
 .../camel/test/patterns/SimpleMockTest.java     | 46 +++++++++++++++
 .../patterns/SimpleWeaveAddMockLastTest.java    | 60 ++++++++++++++++++++
 3 files changed, 158 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/be5478ad/components/camel-test/src/test/java/org/apache/camel/test/patterns/SimpleMockEndpointsTest.java
----------------------------------------------------------------------
diff --git a/components/camel-test/src/test/java/org/apache/camel/test/patterns/SimpleMockEndpointsTest.java b/components/camel-test/src/test/java/org/apache/camel/test/patterns/SimpleMockEndpointsTest.java
new file mode 100644
index 0000000..0af26aa
--- /dev/null
+++ b/components/camel-test/src/test/java/org/apache/camel/test/patterns/SimpleMockEndpointsTest.java
@@ -0,0 +1,52 @@
+/**
+ * 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.test.patterns;
+
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Test;
+
+public class SimpleMockEndpointsTest extends CamelTestSupport {
+
+    @Override
+    public String isMockEndpointsAndSkip() {
+        return "seda:queue";
+    }
+
+    @Test
+    public void testMockAndSkip() throws Exception {
+        getMockEndpoint("mock:seda:queue").expectedBodiesReceived("Bye Camel");
+
+        template.sendBody("seda:start", "Camel");
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Override
+    protected RoutesBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from("seda:start")
+                    .transform(simple("Bye ${body}"))
+                    .to("seda:queue");
+            }
+        };
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/be5478ad/components/camel-test/src/test/java/org/apache/camel/test/patterns/SimpleMockTest.java
----------------------------------------------------------------------
diff --git a/components/camel-test/src/test/java/org/apache/camel/test/patterns/SimpleMockTest.java b/components/camel-test/src/test/java/org/apache/camel/test/patterns/SimpleMockTest.java
new file mode 100644
index 0000000..1c3e00b
--- /dev/null
+++ b/components/camel-test/src/test/java/org/apache/camel/test/patterns/SimpleMockTest.java
@@ -0,0 +1,46 @@
+/**
+ * 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.test.patterns;
+
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Test;
+
+public class SimpleMockTest extends CamelTestSupport {
+
+    @Test
+    public void testMock() throws Exception {
+        getMockEndpoint("mock:result").expectedBodiesReceived("Hello World");
+
+        template.sendBody("direct:start", "Hello World");
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Override
+    protected RoutesBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from("direct:start")
+                        .to("mock:result");
+            }
+        };
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/be5478ad/components/camel-test/src/test/java/org/apache/camel/test/patterns/SimpleWeaveAddMockLastTest.java
----------------------------------------------------------------------
diff --git a/components/camel-test/src/test/java/org/apache/camel/test/patterns/SimpleWeaveAddMockLastTest.java b/components/camel-test/src/test/java/org/apache/camel/test/patterns/SimpleWeaveAddMockLastTest.java
new file mode 100644
index 0000000..125491b
--- /dev/null
+++ b/components/camel-test/src/test/java/org/apache/camel/test/patterns/SimpleWeaveAddMockLastTest.java
@@ -0,0 +1,60 @@
+/**
+ * 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.test.patterns;
+
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.builder.AdviceWithRouteBuilder;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Test;
+
+public class SimpleWeaveAddMockLastTest extends CamelTestSupport {
+
+    public boolean isUseAdviceWith() {
+        return true;
+    }
+
+    @Test
+    public void testWeaveAddMockLast() throws Exception {
+        context.getRouteDefinitions().get(0).adviceWith(context, new AdviceWithRouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                weaveAddLast().to("mock:result");
+            }
+        });
+        context.start();
+
+        getMockEndpoint("mock:result").expectedBodiesReceived("Bye Camel");
+
+        template.sendBody("seda:start", "Camel");
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Override
+    protected RoutesBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from("seda:start")
+                    .transform(simple("Bye ${body}"))
+                    .to("seda:queue");
+            }
+        };
+    }
+
+}


[2/4] camel git commit: CAMEL-9503: Fixed wrong restore of property in onCompletion

Posted by da...@apache.org.
CAMEL-9503: Fixed wrong restore of property in onCompletion


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

Branch: refs/heads/master
Commit: 4e283f797f50187156bee96965b0a4260a08d7f3
Parents: be5478a
Author: Claus Ibsen <da...@apache.org>
Authored: Tue Jan 12 11:05:19 2016 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Tue Jan 12 11:06:26 2016 +0100

----------------------------------------------------------------------
 .../java/org/apache/camel/processor/OnCompletionProcessor.java     | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/4e283f79/camel-core/src/main/java/org/apache/camel/processor/OnCompletionProcessor.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/processor/OnCompletionProcessor.java b/camel-core/src/main/java/org/apache/camel/processor/OnCompletionProcessor.java
index 29ad577..ad42440 100644
--- a/camel-core/src/main/java/org/apache/camel/processor/OnCompletionProcessor.java
+++ b/camel-core/src/main/java/org/apache/camel/processor/OnCompletionProcessor.java
@@ -169,7 +169,7 @@ public class OnCompletionProcessor extends ServiceSupport implements AsyncProces
                 exchange.setProperty(Exchange.ROLLBACK_ONLY, rollbackOnly);
             }
             if (rollbackOnlyLast != null) {
-                exchange.setProperty(Exchange.ROLLBACK_ONLY, rollbackOnlyLast);
+                exchange.setProperty(Exchange.ROLLBACK_ONLY_LAST, rollbackOnlyLast);
             }
             if (cause != null) {
                 exchange.setException(cause);


[4/4] camel git commit: CAMEL-9503: Fixed wrong restore of property in onCompletion

Posted by da...@apache.org.
CAMEL-9503: Fixed wrong restore of property in onCompletion


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

Branch: refs/heads/camel-2.15.x
Commit: 4f0de9ad4e494f17aac746650f4cca1702b9349e
Parents: b7aeb46
Author: Claus Ibsen <da...@apache.org>
Authored: Tue Jan 12 11:05:19 2016 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Tue Jan 12 11:06:58 2016 +0100

----------------------------------------------------------------------
 .../java/org/apache/camel/processor/OnCompletionProcessor.java     | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/4f0de9ad/camel-core/src/main/java/org/apache/camel/processor/OnCompletionProcessor.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/processor/OnCompletionProcessor.java b/camel-core/src/main/java/org/apache/camel/processor/OnCompletionProcessor.java
index e420772..d46034b 100644
--- a/camel-core/src/main/java/org/apache/camel/processor/OnCompletionProcessor.java
+++ b/camel-core/src/main/java/org/apache/camel/processor/OnCompletionProcessor.java
@@ -159,7 +159,7 @@ public class OnCompletionProcessor extends ServiceSupport implements AsyncProces
                 exchange.setProperty(Exchange.ROLLBACK_ONLY, rollbackOnly);
             }
             if (rollbackOnlyLast != null) {
-                exchange.setProperty(Exchange.ROLLBACK_ONLY, rollbackOnlyLast);
+                exchange.setProperty(Exchange.ROLLBACK_ONLY_LAST, rollbackOnlyLast);
             }
             if (cause != null) {
                 exchange.setException(cause);


[3/4] camel git commit: CAMEL-9503: Fixed wrong restore of property in onCompletion

Posted by da...@apache.org.
CAMEL-9503: Fixed wrong restore of property in onCompletion


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

Branch: refs/heads/camel-2.16.x
Commit: 284cc14a8c755fbcb2ba5acfd86a56c2e3e4360a
Parents: f7530e5
Author: Claus Ibsen <da...@apache.org>
Authored: Tue Jan 12 11:05:19 2016 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Tue Jan 12 11:06:44 2016 +0100

----------------------------------------------------------------------
 .../java/org/apache/camel/processor/OnCompletionProcessor.java     | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/284cc14a/camel-core/src/main/java/org/apache/camel/processor/OnCompletionProcessor.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/processor/OnCompletionProcessor.java b/camel-core/src/main/java/org/apache/camel/processor/OnCompletionProcessor.java
index 29ad577..ad42440 100644
--- a/camel-core/src/main/java/org/apache/camel/processor/OnCompletionProcessor.java
+++ b/camel-core/src/main/java/org/apache/camel/processor/OnCompletionProcessor.java
@@ -169,7 +169,7 @@ public class OnCompletionProcessor extends ServiceSupport implements AsyncProces
                 exchange.setProperty(Exchange.ROLLBACK_ONLY, rollbackOnly);
             }
             if (rollbackOnlyLast != null) {
-                exchange.setProperty(Exchange.ROLLBACK_ONLY, rollbackOnlyLast);
+                exchange.setProperty(Exchange.ROLLBACK_ONLY_LAST, rollbackOnlyLast);
             }
             if (cause != null) {
                 exchange.setException(cause);