Return-Path: X-Original-To: apmail-camel-commits-archive@www.apache.org Delivered-To: apmail-camel-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id D442110C87 for ; Sun, 20 Oct 2013 04:28:43 +0000 (UTC) Received: (qmail 76347 invoked by uid 500); 20 Oct 2013 04:28:41 -0000 Delivered-To: apmail-camel-commits-archive@camel.apache.org Received: (qmail 76164 invoked by uid 500); 20 Oct 2013 04:28:41 -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 76068 invoked by uid 99); 20 Oct 2013 04:28:36 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 20 Oct 2013 04:28:36 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 2AB4644A14; Sun, 20 Oct 2013 04:28:35 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: ningjiang@apache.org To: commits@camel.apache.org Date: Sun, 20 Oct 2013 04:28:37 -0000 Message-Id: In-Reply-To: <7bc6c18fb500463086a931b831e4b229@git.apache.org> References: <7bc6c18fb500463086a931b831e4b229@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [3/3] git commit: Added an unit test for SpringPackageScanBuilder Added an unit test for SpringPackageScanBuilder Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/b176b5fb Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/b176b5fb Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/b176b5fb Branch: refs/heads/master Commit: b176b5fb29d26f46694e968d6a4403f276908d5e Parents: 51b6440 Author: Willem Jiang Authored: Sun Oct 20 12:26:07 2013 +0800 Committer: Willem Jiang Committed: Sun Oct 20 12:26:07 2013 +0800 ---------------------------------------------------------------------- .../spring/config/CamelSpringPackageTest.java | 40 ++++++++++++++++++++ .../routebuilder/AbstractRouteBuilder.java | 30 +++++++++++++++ .../config/routebuilder/my/MyRouteBuilder.java | 30 +++++++++++++++ .../camel/spring/config/routeBuilderPackage.xml | 32 ++++++++++++++++ 4 files changed, 132 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/b176b5fb/components/camel-spring/src/test/java/org/apache/camel/spring/config/CamelSpringPackageTest.java ---------------------------------------------------------------------- diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/config/CamelSpringPackageTest.java b/components/camel-spring/src/test/java/org/apache/camel/spring/config/CamelSpringPackageTest.java new file mode 100644 index 0000000..c73fcf5 --- /dev/null +++ b/components/camel-spring/src/test/java/org/apache/camel/spring/config/CamelSpringPackageTest.java @@ -0,0 +1,40 @@ +/** + * 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.spring.config; + +import org.apache.camel.component.mock.MockEndpoint; +import org.apache.camel.spring.SpringTestSupport; +import org.springframework.context.support.AbstractXmlApplicationContext; +import org.springframework.context.support.ClassPathXmlApplicationContext; + +public class CamelSpringPackageTest extends SpringTestSupport { + + @Override + protected AbstractXmlApplicationContext createApplicationContext() { + return new ClassPathXmlApplicationContext(new String[] {"org/apache/camel/spring/config/routeBuilderPackage.xml"}); + } + + public void testRouteExcluded() throws InterruptedException { + assertEquals(1, context.getRoutes().size()); + MockEndpoint mock = getMockEndpoint("mock:result"); + mock.expectedMessageCount(1); + sendBody("direct:start", "dropped like a hot rock"); + + mock.assertIsSatisfied(); + } + +} http://git-wip-us.apache.org/repos/asf/camel/blob/b176b5fb/components/camel-spring/src/test/java/org/apache/camel/spring/config/routebuilder/AbstractRouteBuilder.java ---------------------------------------------------------------------- diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/config/routebuilder/AbstractRouteBuilder.java b/components/camel-spring/src/test/java/org/apache/camel/spring/config/routebuilder/AbstractRouteBuilder.java new file mode 100644 index 0000000..b1ea20d --- /dev/null +++ b/components/camel-spring/src/test/java/org/apache/camel/spring/config/routebuilder/AbstractRouteBuilder.java @@ -0,0 +1,30 @@ +/** + * 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.spring.config.routebuilder; + +import org.apache.camel.builder.RouteBuilder; + +public abstract class AbstractRouteBuilder extends RouteBuilder { + + protected abstract String getResult(); + + @Override + public void configure() throws Exception { + from("direct:start").to(getResult()); + } + +} http://git-wip-us.apache.org/repos/asf/camel/blob/b176b5fb/components/camel-spring/src/test/java/org/apache/camel/spring/config/routebuilder/my/MyRouteBuilder.java ---------------------------------------------------------------------- diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/config/routebuilder/my/MyRouteBuilder.java b/components/camel-spring/src/test/java/org/apache/camel/spring/config/routebuilder/my/MyRouteBuilder.java new file mode 100644 index 0000000..e1b9f59 --- /dev/null +++ b/components/camel-spring/src/test/java/org/apache/camel/spring/config/routebuilder/my/MyRouteBuilder.java @@ -0,0 +1,30 @@ +/** + * 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.spring.config.routebuilder.my; + +import org.apache.camel.spring.config.routebuilder.AbstractRouteBuilder; + +public class MyRouteBuilder extends AbstractRouteBuilder { + + @Override + protected String getResult() { + return "mock:result"; + } + + + +} http://git-wip-us.apache.org/repos/asf/camel/blob/b176b5fb/components/camel-spring/src/test/resources/org/apache/camel/spring/config/routeBuilderPackage.xml ---------------------------------------------------------------------- diff --git a/components/camel-spring/src/test/resources/org/apache/camel/spring/config/routeBuilderPackage.xml b/components/camel-spring/src/test/resources/org/apache/camel/spring/config/routeBuilderPackage.xml new file mode 100644 index 0000000..43230c1 --- /dev/null +++ b/components/camel-spring/src/test/resources/org/apache/camel/spring/config/routeBuilderPackage.xml @@ -0,0 +1,32 @@ + + + + + + org.apache.camel.spring.config.routebuilder + + +