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 2011/06/11 15:42:16 UTC
svn commit: r1134634 - in /camel/trunk/components/camel-spring/src/test:
java/org/apache/camel/spring/processor/SpringSetHeaderXPathResultTypeTest.java
resources/org/apache/camel/spring/processor/SpringSetHeaderXPathResultTypeTest.xml
Author: davsclaus
Date: Sat Jun 11 13:42:16 2011
New Revision: 1134634
URL: http://svn.apache.org/viewvc?rev=1134634&view=rev
Log:
Added test to ensure resultType attribute is working as expected on <xpath> in XML DSL.
Added:
camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringSetHeaderXPathResultTypeTest.java
camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringSetHeaderXPathResultTypeTest.xml
- copied, changed from r1134557, camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringSetHeaderTest-context.xml
Added: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringSetHeaderXPathResultTypeTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringSetHeaderXPathResultTypeTest.java?rev=1134634&view=auto
==============================================================================
--- camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringSetHeaderXPathResultTypeTest.java (added)
+++ camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringSetHeaderXPathResultTypeTest.java Sat Jun 11 13:42:16 2011
@@ -0,0 +1,46 @@
+/**
+ * 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.processor;
+
+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 SpringSetHeaderXPathResultTypeTest extends SpringTestSupport {
+
+ public void testXPathResultType() throws Exception {
+ MockEndpoint mock = getMockEndpoint("mock:result");
+ mock.expectedMessageCount(1);
+ mock.message(0).header("foo").isInstanceOf(Boolean.class);
+ mock.message(0).header("foo").isEqualTo(true);
+ mock.message(0).header("bar").isInstanceOf(Boolean.class);
+ mock.message(0).header("bar").isEqualTo(false);
+
+ template.sendBody("direct:start", "<hello>World</hello>");
+
+ assertMockEndpointsSatisfied();
+ }
+
+ @Override
+ protected AbstractXmlApplicationContext createApplicationContext() {
+ return new ClassPathXmlApplicationContext("org/apache/camel/spring/processor/SpringSetHeaderXPathResultTypeTest.xml");
+ }
+}
Copied: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringSetHeaderXPathResultTypeTest.xml (from r1134557, camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringSetHeaderTest-context.xml)
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringSetHeaderXPathResultTypeTest.xml?p2=camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringSetHeaderXPathResultTypeTest.xml&p1=camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringSetHeaderTest-context.xml&r1=1134557&r2=1134634&rev=1134634&view=diff
==============================================================================
--- camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringSetHeaderTest-context.xml (original)
+++ camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringSetHeaderXPathResultTypeTest.xml Sat Jun 11 13:42:16 2011
@@ -22,15 +22,18 @@
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
">
- <!-- START SNIPPET: example -->
<camelContext xmlns="http://camel.apache.org/schema/spring">
<route>
- <from uri="seda:a"/>
- <setHeader headerName="oldBodyValue">
- <simple>body</simple>
+ <from uri="direct:start"/>
+ <!-- is there a hello tag in the body -->
+ <setHeader headerName="foo">
+ <xpath resultType="java.lang.Boolean">/hello</xpath>
</setHeader>
- <to uri="mock:b"/>
+ <!-- is there a bye tag in the body -->
+ <setHeader headerName="bar">
+ <xpath resultType="java.lang.Boolean">/bye</xpath>
+ </setHeader>
+ <to uri="mock:result"/>
</route>
</camelContext>
- <!-- END SNIPPET: example -->
</beans>