camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r1232835 - in /camel/trunk/components: camel-spring/src/test/resources/ camel-spring/src/test/resources/org/apache/camel/spring/processor/ camel-test-blueprint/src/main/java/org/apache/camel/test/blueprint/ camel-test-blueprint/src/test/jav...
Date Wed, 18 Jan 2012 11:21:48 GMT
Author: davsclaus
Date: Wed Jan 18 11:21:48 2012
New Revision: 1232835

URL: http://svn.apache.org/viewvc?rev=1232835&view=rev
Log:
CAMEL-4913: camel-blueprint now supports using custom namespaces in the xml file.

Added:
    camel/trunk/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/xpath/
    camel/trunk/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/xpath/XPathFilterWithNamespaceTest.java
      - copied, changed from r1232750, camel/trunk/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/management/ManagedNamePatternFixedTest.java
    camel/trunk/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/xpath/
    camel/trunk/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/xpath/xpathFilterWithNamespaceTest.xml
      - copied, changed from r1232750, camel/trunk/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/management/managedNamePatternFixedTest.xml
Modified:
    camel/trunk/components/camel-spring/src/test/resources/log4j.properties
    camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/xpathFilterWithNamespace.xml
    camel/trunk/components/camel-test-blueprint/src/main/java/org/apache/camel/test/blueprint/CamelBlueprintTestSupport.java
    camel/trunk/components/camel-test-blueprint/src/test/resources/log4j.properties

Modified: camel/trunk/components/camel-spring/src/test/resources/log4j.properties
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/resources/log4j.properties?rev=1232835&r1=1232834&r2=1232835&view=diff
==============================================================================
--- camel/trunk/components/camel-spring/src/test/resources/log4j.properties (original)
+++ camel/trunk/components/camel-spring/src/test/resources/log4j.properties Wed Jan 18 11:21:48
2012
@@ -18,7 +18,7 @@
 #
 # The logging properties used for eclipse testing, We want to see debug output on the console.
 #
-log4j.rootLogger=INFO, file
+log4j.rootLogger=INFO, out
 
 log4j.logger.org.springframework=WARN
 #log4j.logger.org.apache.camel.impl.converter=WARN

Modified: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/xpathFilterWithNamespace.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/xpathFilterWithNamespace.xml?rev=1232835&r1=1232834&r2=1232835&view=diff
==============================================================================
--- camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/xpathFilterWithNamespace.xml
(original)
+++ camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/xpathFilterWithNamespace.xml
Wed Jan 18 11:21:48 2012
@@ -28,7 +28,7 @@
     <route>
       <from uri="direct:start"/>
       <filter>
-        <xpath>/foo:person[@name='James']</xpath>
+        <xpath logNamespaces="true">/foo:person[@name='James']</xpath>
         <to uri="mock:result"/>
       </filter>
     </route>

Modified: camel/trunk/components/camel-test-blueprint/src/main/java/org/apache/camel/test/blueprint/CamelBlueprintTestSupport.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-test-blueprint/src/main/java/org/apache/camel/test/blueprint/CamelBlueprintTestSupport.java?rev=1232835&r1=1232834&r2=1232835&view=diff
==============================================================================
--- camel/trunk/components/camel-test-blueprint/src/main/java/org/apache/camel/test/blueprint/CamelBlueprintTestSupport.java
(original)
+++ camel/trunk/components/camel-test-blueprint/src/main/java/org/apache/camel/test/blueprint/CamelBlueprintTestSupport.java
Wed Jan 18 11:21:48 2012
@@ -75,6 +75,9 @@ public abstract class CamelBlueprintTest
     protected TinyBundle createTestBundle() {
         TinyBundle bundle = TinyBundles.newBundle();
         for (URL url : getBlueprintDescriptors()) {
+            if (url == null) {
+                throw new IllegalArgumentException("getBlueprintDescriptors() returns null");
+            }
             bundle.add("OSGI-INF/blueprint/blueprint-" + url.getFile().replace("/", "-"),
url);
         }
         bundle.set("Manifest-Version", "2")

Copied: camel/trunk/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/xpath/XPathFilterWithNamespaceTest.java
(from r1232750, camel/trunk/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/management/ManagedNamePatternFixedTest.java)
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/xpath/XPathFilterWithNamespaceTest.java?p2=camel/trunk/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/xpath/XPathFilterWithNamespaceTest.java&p1=camel/trunk/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/management/ManagedNamePatternFixedTest.java&r1=1232750&r2=1232835&rev=1232835&view=diff
==============================================================================
--- camel/trunk/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/management/ManagedNamePatternFixedTest.java
(original)
+++ camel/trunk/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/xpath/XPathFilterWithNamespaceTest.java
Wed Jan 18 11:21:48 2012
@@ -14,38 +14,41 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.camel.test.blueprint.management;
+package org.apache.camel.test.blueprint.xpath;
 
 import java.net.URL;
 import java.util.Collection;
 import java.util.Collections;
 
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-
 import org.apache.camel.test.blueprint.CamelBlueprintTestSupport;
 import org.junit.Test;
 
-public class ManagedNamePatternFixedTest extends CamelBlueprintTestSupport {
+public class XPathFilterWithNamespaceTest extends CamelBlueprintTestSupport {
+
+    protected String matchingBody = "<person name='James' city='London' xmlns='http://example.com/person'/>";
+    protected String notMatchingBody = "<person name='Hiram' city='Tampa' xmlns='http://example.com/person'/>";
 
     @Override
     protected Collection<URL> getBlueprintDescriptors() {
-        return Collections.singleton(getClass().getResource("managedNamePatternFixedTest.xml"));
+        return Collections.singleton(getClass().getResource("xpathFilterWithNamespaceTest.xml"));
     }
 
     @Test
-    public void testManagedNamePattern() throws Exception {
-        getMockEndpoint("mock:result").expectedMessageCount(1);
-        template.sendBody("direct:start", "World");
+    public void testSendMatchingMessage() throws Exception {
+        getMockEndpoint("mock:result").expectedBodiesReceived(matchingBody);
+
+        sendBody("direct:start", matchingBody);
+
         assertMockEndpointsSatisfied();
+    }
 
-        MBeanServer mbeanServer = context.getManagementStrategy().getManagementAgent().getMBeanServer();
+    @Test
+    public void testSendNotMatchingMessage() throws Exception {
+        getMockEndpoint("mock:result").expectedMessageCount(0);
 
-        assertEquals("cool", context.getManagementName());
+        sendBody("direct:start", notMatchingBody);
 
-        ObjectName on = ObjectName.getInstance("org.apache.camel:context=localhost/" + context.getManagementName()
-                + ",type=context,name=\"" + context.getName() + "\"");
-        assertTrue("Should be registered", mbeanServer.isRegistered(on));
+        assertMockEndpointsSatisfied();
     }
 
 }

Modified: camel/trunk/components/camel-test-blueprint/src/test/resources/log4j.properties
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-test-blueprint/src/test/resources/log4j.properties?rev=1232835&r1=1232834&r2=1232835&view=diff
==============================================================================
--- camel/trunk/components/camel-test-blueprint/src/test/resources/log4j.properties (original)
+++ camel/trunk/components/camel-test-blueprint/src/test/resources/log4j.properties Wed Jan
18 11:21:48 2012
@@ -22,7 +22,7 @@ log4j.rootLogger=INFO, file
 
 log4j.logger.org.springframework=WARN
 #log4j.logger.org.apache.camel=DEBUG
-log4j.logger.org.apache.camel.management=DEBUG
+#log4j.logger.org.apache.camel.management=DEBUG
 #log4j.logger.org.apache.camel.test.junit4=DEBUG
 
 # CONSOLE appender not used by default

Copied: camel/trunk/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/xpath/xpathFilterWithNamespaceTest.xml
(from r1232750, camel/trunk/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/management/managedNamePatternFixedTest.xml)
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/xpath/xpathFilterWithNamespaceTest.xml?p2=camel/trunk/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/xpath/xpathFilterWithNamespaceTest.xml&p1=camel/trunk/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/management/managedNamePatternFixedTest.xml&r1=1232750&r2=1232835&rev=1232835&view=diff
==============================================================================
--- camel/trunk/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/management/managedNamePatternFixedTest.xml
(original)
+++ camel/trunk/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/xpath/xpathFilterWithNamespaceTest.xml
Wed Jan 18 11:21:48 2012
@@ -15,20 +15,16 @@
     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">
-
-  <bean id="naming" class="org.apache.camel.management.DefaultManagementNamingStrategy">
-    <property name="hostName" value="localhost"/>
-    <property name="domainName" value="org.apache.camel"/>
-  </bean>
-
-  <!-- START SNIPPET: example -->
-  <camelContext managementNamePattern="cool" xmlns="http://camel.apache.org/schema/blueprint">
-    <jmxAgent id="agent"/>
+<blueprint xmlns:foo="http://example.com/person"
+           xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" >
 
+  <camelContext xmlns="http://camel.apache.org/schema/blueprint">
     <route>
       <from uri="direct:start"/>
-      <to uri="mock:result"/>
+      <filter>
+        <xpath logNamespaces="true">/foo:person[@name='James']</xpath>
+        <to uri="mock:result"/>
+      </filter>
     </route>
   </camelContext>
 



Mime
View raw message