camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject camel git commit: Added a test class to ensure CAMEL-10322 non-regression
Date Sat, 22 Oct 2016 09:49:07 GMT
Repository: camel
Updated Branches:
  refs/heads/master 3184b9c71 -> 891298aab


Added a test class to ensure CAMEL-10322 non-regression


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

Branch: refs/heads/master
Commit: 891298aab46a18bfd6b725914d0c8d3459a3baae
Parents: 3184b9c
Author: aldettinger <aldettinger@gmail.com>
Authored: Fri Oct 21 16:44:04 2016 +0200
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Sat Oct 22 11:47:08 2016 +0200

----------------------------------------------------------------------
 .../AdviceWithWeaveByStringOnChoiceTest.java    | 55 ++++++++++++++++++++
 1 file changed, 55 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/891298aa/camel-core/src/test/java/org/apache/camel/processor/interceptor/AdviceWithWeaveByStringOnChoiceTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/processor/interceptor/AdviceWithWeaveByStringOnChoiceTest.java
b/camel-core/src/test/java/org/apache/camel/processor/interceptor/AdviceWithWeaveByStringOnChoiceTest.java
new file mode 100644
index 0000000..186d301
--- /dev/null
+++ b/camel-core/src/test/java/org/apache/camel/processor/interceptor/AdviceWithWeaveByStringOnChoiceTest.java
@@ -0,0 +1,55 @@
+/**
+ * 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.interceptor;
+
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.builder.AdviceWithRouteBuilder;
+import org.apache.camel.builder.RouteBuilder;
+
+/**
+ * This test ensures non-regression for bug CAMEL-10322.
+ */
+public class AdviceWithWeaveByStringOnChoiceTest extends ContextTestSupport {
+
+    public void testWeaveByToStringShoultNotThrowUnsupportedOperationException() throws Exception
{
+        context.getRouteDefinitions().get(0).adviceWith(context, new AdviceWithRouteBuilder()
{
+            @Override
+            public void configure() throws Exception {
+                weaveByToString(".*mock:foo.*").replace().to("mock:bar");
+            }
+        });
+        context.start();
+
+        getMockEndpoint("mock:foo").expectedMessageCount(0);
+        getMockEndpoint("mock:bar").expectedMessageCount(1);
+
+        template.sendBody("direct:start", "Hello World");
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from("direct:start").choice().when(simple("true")).to("mock:foo");
+            }
+        };
+    }
+
+}


Mime
View raw message