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 B8BB110C85 for ; Sun, 20 Oct 2013 04:28:43 +0000 (UTC) Received: (qmail 76340 invoked by uid 500); 20 Oct 2013 04:28:41 -0000 Delivered-To: apmail-camel-commits-archive@camel.apache.org Received: (qmail 76161 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 76070 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 0DD4344A13; 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:36 -0000 Message-Id: In-Reply-To: <7bc6c18fb500463086a931b831e4b229@git.apache.org> References: <7bc6c18fb500463086a931b831e4b229@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [2/3] git commit: Added an unit test for BlueprintPackageScanBuilder Added an unit test for BlueprintPackageScanBuilder Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/51b64401 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/51b64401 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/51b64401 Branch: refs/heads/master Commit: 51b64401a65f1a740df84ea835e784a7a5f13cbe Parents: 69fad4f Author: Willem Jiang Authored: Sun Oct 20 12:25:24 2013 +0800 Committer: Willem Jiang Committed: Sun Oct 20 12:25:24 2013 +0800 ---------------------------------------------------------------------- .../BlueprintPackageScanBuilderTest.java | 40 ++++++++++++++++++++ .../blueprint/builder/AbstractRouteBuilder.java | 30 +++++++++++++++ .../blueprint/builder/my/MyRouteBuilder.java | 30 +++++++++++++++ .../camel/test/blueprint/packagescan3.xml | 27 +++++++++++++ 4 files changed, 127 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/51b64401/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/BlueprintPackageScanBuilderTest.java ---------------------------------------------------------------------- diff --git a/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/BlueprintPackageScanBuilderTest.java b/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/BlueprintPackageScanBuilderTest.java new file mode 100644 index 0000000..aaa6828 --- /dev/null +++ b/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/BlueprintPackageScanBuilderTest.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.test.blueprint; + +import org.junit.Test; + +public class BlueprintPackageScanBuilderTest extends CamelBlueprintTestSupport { + + @Override + protected String getBlueprintDescriptor() { + return "org/apache/camel/test/blueprint/packagescan3.xml"; + } + + // here we have regular Junit @Test method + @Test + public void testRoute() throws Exception { + // set mock expectations + getMockEndpoint("mock:result").expectedMessageCount(1); + + // send a message + template.sendBody("direct:start", "World"); + + // assert mocks + assertMockEndpointsSatisfied(); + } +} http://git-wip-us.apache.org/repos/asf/camel/blob/51b64401/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/builder/AbstractRouteBuilder.java ---------------------------------------------------------------------- diff --git a/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/builder/AbstractRouteBuilder.java b/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/builder/AbstractRouteBuilder.java new file mode 100644 index 0000000..145f5a8 --- /dev/null +++ b/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/builder/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.test.blueprint.builder; + +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/51b64401/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/builder/my/MyRouteBuilder.java ---------------------------------------------------------------------- diff --git a/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/builder/my/MyRouteBuilder.java b/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/builder/my/MyRouteBuilder.java new file mode 100644 index 0000000..159c025 --- /dev/null +++ b/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/builder/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.test.blueprint.builder.my; + +import org.apache.camel.test.blueprint.builder.AbstractRouteBuilder; + +public class MyRouteBuilder extends AbstractRouteBuilder { + + @Override + protected String getResult() { + return "mock:result"; + } + + + +} http://git-wip-us.apache.org/repos/asf/camel/blob/51b64401/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/packagescan3.xml ---------------------------------------------------------------------- diff --git a/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/packagescan3.xml b/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/packagescan3.xml new file mode 100644 index 0000000..b924d8b --- /dev/null +++ b/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/packagescan3.xml @@ -0,0 +1,27 @@ + + + + + + org.apache.camel.test.blueprint.builder + + +