You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ni...@apache.org on 2013/10/20 06:28:37 UTC
[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 <ni...@apache.org>
Authored: Sun Oct 20 12:26:07 2013 +0800
Committer: Willem Jiang <ni...@apache.org>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:context="http://www.springframework.org/schema/context"
+ xsi:schemaLocation="http://camel.apache.org/schema/spring
+ http://camel.apache.org/schema/spring/camel-spring.xsd
+ http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://www.springframework.org/schema/context
+ http://www.springframework.org/schema/context/spring-context.xsd">
+
+ <camelContext id="camelScan" xmlns="http://camel.apache.org/schema/spring">
+ <package>org.apache.camel.spring.config.routebuilder</package>
+ </camelContext>
+
+</beans>