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:35 UTC

[1/3] git commit: Fixed the BlueprintPackageScan2Test

Updated Branches:
  refs/heads/master 5b0d4822d -> b176b5fb2


Fixed the BlueprintPackageScan2Test


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

Branch: refs/heads/master
Commit: 69fad4f8899ffd0f9b201d739c0ae7743e453f43
Parents: 5b0d482
Author: Willem Jiang <ni...@apache.org>
Authored: Sun Oct 20 10:57:38 2013 +0800
Committer: Willem Jiang <ni...@apache.org>
Committed: Sun Oct 20 11:07:40 2013 +0800

----------------------------------------------------------------------
 .../org/apache/camel/test/blueprint/BlueprintPackageScan2Test.java | 2 --
 .../resources/org/apache/camel/test/blueprint/packagescan2.xml     | 2 +-
 2 files changed, 1 insertion(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/69fad4f8/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/BlueprintPackageScan2Test.java
----------------------------------------------------------------------
diff --git a/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/BlueprintPackageScan2Test.java b/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/BlueprintPackageScan2Test.java
index fae9828..86e0b18 100644
--- a/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/BlueprintPackageScan2Test.java
+++ b/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/BlueprintPackageScan2Test.java
@@ -16,13 +16,11 @@
  */
 package org.apache.camel.test.blueprint;
 
-import org.junit.Ignore;
 import org.junit.Test;
 
 /**
  *
  */
-@Ignore("Issue with @EndpointInject")
 public class BlueprintPackageScan2Test extends CamelBlueprintTestSupport {
 
     @Override

http://git-wip-us.apache.org/repos/asf/camel/blob/69fad4f8/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/packagescan2.xml
----------------------------------------------------------------------
diff --git a/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/packagescan2.xml b/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/packagescan2.xml
index 3100043..2ba47ff 100644
--- a/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/packagescan2.xml
+++ b/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/packagescan2.xml
@@ -22,7 +22,7 @@
 
   <camelContext xmlns="http://camel.apache.org/schema/blueprint">
 	  <packageScan>
-		  <package>org.apache.camel.test.blueprint.scan</package>
+		  <package>org.apache.camel.test.blueprint.scan2</package>
 	  </packageScan>
 
     <endpoint id="foo" uri="direct:start"/>


[3/3] git commit: Added an unit test for SpringPackageScanBuilder

Posted by ni...@apache.org.
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>


[2/3] git commit: Added an unit test for BlueprintPackageScanBuilder

Posted by ni...@apache.org.
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 <ni...@apache.org>
Authored: Sun Oct 20 12:25:24 2013 +0800
Committer: Willem Jiang <ni...@apache.org>
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 @@
+<?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.
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+           xsi:schemaLocation="
+             http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">
+
+  <camelContext xmlns="http://camel.apache.org/schema/blueprint">
+	  <package>org.apache.camel.test.blueprint.builder</package>
+  </camelContext>
+
+</blueprint>