You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2015/03/17 08:04:41 UTC

[1/2] camel git commit: CAMEL-8498 CamelContextFactoryBean missing setEndpoints method

Repository: camel
Updated Branches:
  refs/heads/master 245b41126 -> 676ad3324


CAMEL-8498 CamelContextFactoryBean missing setEndpoints method


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

Branch: refs/heads/master
Commit: d1f7154709addbc8bb040735171c7e13139b6dbf
Parents: 245b411
Author: Keith Babo <kb...@redhat.com>
Authored: Mon Mar 16 17:46:04 2015 -0400
Committer: Keith Babo <kb...@redhat.com>
Committed: Mon Mar 16 17:46:04 2015 -0400

----------------------------------------------------------------------
 components/camel-spring/pom.xml                 |  6 +++
 .../camel/spring/CamelContextFactoryBean.java   |  4 ++
 .../spring/CamelContextFactoryBeanTest.java     | 43 ++++++++++++++++++++
 .../META-INF/spring/context-with-endpoint.xml   | 28 +++++++++++++
 4 files changed, 81 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/d1f71547/components/camel-spring/pom.xml
----------------------------------------------------------------------
diff --git a/components/camel-spring/pom.xml b/components/camel-spring/pom.xml
index 1e83875..00958e2 100644
--- a/components/camel-spring/pom.xml
+++ b/components/camel-spring/pom.xml
@@ -166,6 +166,12 @@
       <artifactId>slf4j-log4j12</artifactId>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>xmlunit</groupId>
+      <artifactId>xmlunit</artifactId>
+      <version>${xmlunit-version}</version>
+      <scope>test</scope>
+    </dependency>
 
       <!-- for testing Spring AOP at class level -->
       <dependency>

http://git-wip-us.apache.org/repos/asf/camel/blob/d1f71547/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java
----------------------------------------------------------------------
diff --git a/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java b/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java
index a93f61c..1c02e5f 100644
--- a/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java
+++ b/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java
@@ -426,6 +426,10 @@ public class CamelContextFactoryBean extends AbstractCamelContextFactoryBean<Spr
         return endpoints;
     }
 
+    public void setEndpoints(List<CamelEndpointFactoryBean> endpoints) {
+        this.endpoints = endpoints;
+    }
+
     public List<CamelRedeliveryPolicyFactoryBean> getRedeliveryPolicies() {
         return redeliveryPolicies;
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/d1f71547/components/camel-spring/src/test/java/org/apache/camel/spring/CamelContextFactoryBeanTest.java
----------------------------------------------------------------------
diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/CamelContextFactoryBeanTest.java b/components/camel-spring/src/test/java/org/apache/camel/spring/CamelContextFactoryBeanTest.java
index cbfff08..6119d56 100644
--- a/components/camel-spring/src/test/java/org/apache/camel/spring/CamelContextFactoryBeanTest.java
+++ b/components/camel-spring/src/test/java/org/apache/camel/spring/CamelContextFactoryBeanTest.java
@@ -16,11 +16,22 @@
  */
 package org.apache.camel.spring;
 
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.util.LinkedList;
+import java.util.List;
+
+import javax.xml.bind.JAXBContext;
+
 import junit.framework.TestCase;
 
 import org.apache.camel.impl.ActiveMQUuidGenerator;
 import org.apache.camel.impl.SimpleUuidGenerator;
 import org.apache.camel.spi.UuidGenerator;
+import org.custommonkey.xmlunit.XMLAssert;
+import org.custommonkey.xmlunit.XMLUnit;
 import org.springframework.context.support.StaticApplicationContext;
 
 /**
@@ -56,4 +67,36 @@ public class CamelContextFactoryBeanTest extends TestCase {
         
         assertTrue(uuidGenerator instanceof SimpleUuidGenerator);
     }
+
+    public void testSetEndpoints() throws Exception {
+        // Create a new Camel context and add an endpoint
+        CamelContextFactoryBean camelContext = new CamelContextFactoryBean();
+        List<CamelEndpointFactoryBean> endpoints = new LinkedList<CamelEndpointFactoryBean>();
+        CamelEndpointFactoryBean endpoint = new CamelEndpointFactoryBean();
+        endpoint.setId("endpoint1");
+        endpoint.setUri("mock:end");
+        endpoints.add(endpoint);
+        camelContext.setEndpoints(endpoints);
+
+        // Compare the new context with our reference context
+        Reader expectedContext = null;
+        try {
+            expectedContext = new InputStreamReader(getClass().getResourceAsStream(
+                    "/META-INF/spring/context-with-endpoint.xml"));
+            String createdContext = contextAsString(camelContext);
+            XMLUnit.setIgnoreWhitespace(true);
+            XMLAssert.assertXMLEqual(expectedContext, new StringReader(createdContext));
+        } finally {
+            if (expectedContext != null) {
+                expectedContext.close();
+            }
+        }
+    }
+
+    private String contextAsString(CamelContextFactoryBean context) throws Exception {
+        StringWriter stringOut = new StringWriter();
+        JAXBContext jaxb = JAXBContext.newInstance(CamelContextFactoryBean.class);
+        jaxb.createMarshaller().marshal(context, stringOut);
+        return stringOut.toString();
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/d1f71547/components/camel-spring/src/test/resources/META-INF/spring/context-with-endpoint.xml
----------------------------------------------------------------------
diff --git a/components/camel-spring/src/test/resources/META-INF/spring/context-with-endpoint.xml b/components/camel-spring/src/test/resources/META-INF/spring/context-with-endpoint.xml
new file mode 100644
index 0000000..d731405
--- /dev/null
+++ b/components/camel-spring/src/test/resources/META-INF/spring/context-with-endpoint.xml
@@ -0,0 +1,28 @@
+<?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.
+-->
+
+<!--
+
+  An example Camel Context which can be used to test marshalling and
+  unmarshalling with CamelContextFactoryBean.
+
+ -->
+
+<camelContext xmlns="http://camel.apache.org/schema/spring">
+    <endpoint id="endpoint1" uri="mock:end"/>
+</camelContext>


[2/2] camel git commit: CAMEL-8498 CamelContextFactoryBean missing setEndpoints method. Fixed tests

Posted by da...@apache.org.
CAMEL-8498 CamelContextFactoryBean missing setEndpoints method. Fixed tests


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

Branch: refs/heads/master
Commit: 676ad3324d84cd876c222be3413d61842897e510
Parents: d1f7154
Author: Claus Ibsen <da...@apache.org>
Authored: Tue Mar 17 08:05:35 2015 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Tue Mar 17 08:05:35 2015 +0100

----------------------------------------------------------------------
 .../spring/CamelContextFactoryBeanTest.java     | 10 +++----
 .../META-INF/spring/context-with-endpoint.xml   | 28 --------------------
 .../camel/spring/context-with-endpoint.xml      | 28 ++++++++++++++++++++
 3 files changed, 31 insertions(+), 35 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/676ad332/components/camel-spring/src/test/java/org/apache/camel/spring/CamelContextFactoryBeanTest.java
----------------------------------------------------------------------
diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/CamelContextFactoryBeanTest.java b/components/camel-spring/src/test/java/org/apache/camel/spring/CamelContextFactoryBeanTest.java
index 6119d56..53bddf9 100644
--- a/components/camel-spring/src/test/java/org/apache/camel/spring/CamelContextFactoryBeanTest.java
+++ b/components/camel-spring/src/test/java/org/apache/camel/spring/CamelContextFactoryBeanTest.java
@@ -22,14 +22,13 @@ import java.io.StringReader;
 import java.io.StringWriter;
 import java.util.LinkedList;
 import java.util.List;
-
 import javax.xml.bind.JAXBContext;
 
 import junit.framework.TestCase;
-
 import org.apache.camel.impl.ActiveMQUuidGenerator;
 import org.apache.camel.impl.SimpleUuidGenerator;
 import org.apache.camel.spi.UuidGenerator;
+import org.apache.camel.util.IOHelper;
 import org.custommonkey.xmlunit.XMLAssert;
 import org.custommonkey.xmlunit.XMLUnit;
 import org.springframework.context.support.StaticApplicationContext;
@@ -81,15 +80,12 @@ public class CamelContextFactoryBeanTest extends TestCase {
         // Compare the new context with our reference context
         Reader expectedContext = null;
         try {
-            expectedContext = new InputStreamReader(getClass().getResourceAsStream(
-                    "/META-INF/spring/context-with-endpoint.xml"));
+            expectedContext = new InputStreamReader(getClass().getResourceAsStream("/org/apache/camel/spring/context-with-endpoint.xml"));
             String createdContext = contextAsString(camelContext);
             XMLUnit.setIgnoreWhitespace(true);
             XMLAssert.assertXMLEqual(expectedContext, new StringReader(createdContext));
         } finally {
-            if (expectedContext != null) {
-                expectedContext.close();
-            }
+            IOHelper.close(expectedContext);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/676ad332/components/camel-spring/src/test/resources/META-INF/spring/context-with-endpoint.xml
----------------------------------------------------------------------
diff --git a/components/camel-spring/src/test/resources/META-INF/spring/context-with-endpoint.xml b/components/camel-spring/src/test/resources/META-INF/spring/context-with-endpoint.xml
deleted file mode 100644
index d731405..0000000
--- a/components/camel-spring/src/test/resources/META-INF/spring/context-with-endpoint.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?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.
--->
-
-<!--
-
-  An example Camel Context which can be used to test marshalling and
-  unmarshalling with CamelContextFactoryBean.
-
- -->
-
-<camelContext xmlns="http://camel.apache.org/schema/spring">
-    <endpoint id="endpoint1" uri="mock:end"/>
-</camelContext>

http://git-wip-us.apache.org/repos/asf/camel/blob/676ad332/components/camel-spring/src/test/resources/org/apache/camel/spring/context-with-endpoint.xml
----------------------------------------------------------------------
diff --git a/components/camel-spring/src/test/resources/org/apache/camel/spring/context-with-endpoint.xml b/components/camel-spring/src/test/resources/org/apache/camel/spring/context-with-endpoint.xml
new file mode 100644
index 0000000..d731405
--- /dev/null
+++ b/components/camel-spring/src/test/resources/org/apache/camel/spring/context-with-endpoint.xml
@@ -0,0 +1,28 @@
+<?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.
+-->
+
+<!--
+
+  An example Camel Context which can be used to test marshalling and
+  unmarshalling with CamelContextFactoryBean.
+
+ -->
+
+<camelContext xmlns="http://camel.apache.org/schema/spring">
+    <endpoint id="endpoint1" uri="mock:end"/>
+</camelContext>