Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 7CDEB200BAB for ; Sat, 22 Oct 2016 11:49:09 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 7B492160AEF; Sat, 22 Oct 2016 09:49:09 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id C06C2160ADF for ; Sat, 22 Oct 2016 11:49:08 +0200 (CEST) Received: (qmail 24423 invoked by uid 500); 22 Oct 2016 09:49:08 -0000 Mailing-List: contact commits-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list commits@camel.apache.org Received: (qmail 24411 invoked by uid 99); 22 Oct 2016 09:49:07 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 22 Oct 2016 09:49:07 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id BE56CE0451; Sat, 22 Oct 2016 09:49:07 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: davsclaus@apache.org To: commits@camel.apache.org Message-Id: <213553be93a541d8a4f32107aedf5ce7@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: camel git commit: Added a test class to ensure CAMEL-10322 non-regression Date: Sat, 22 Oct 2016 09:49:07 +0000 (UTC) archived-at: Sat, 22 Oct 2016 09:49:09 -0000 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 Authored: Fri Oct 21 16:44:04 2016 +0200 Committer: Claus Ibsen 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"); + } + }; + } + +}