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 2010/10/07 09:55:28 UTC
svn commit: r1005355 - in /camel/trunk/components/camel-spring/src/test:
java/org/apache/camel/spring/processor/SpringSplitterBodyTest.java
resources/org/apache/camel/spring/processor/SpringSplitterBodyTest.xml
Author: davsclaus
Date: Thu Oct 7 07:55:28 2010
New Revision: 1005355
URL: http://svn.apache.org/viewvc?rev=1005355&view=rev
Log:
Added test based on forum issue.
Added:
camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringSplitterBodyTest.java
camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringSplitterBodyTest.xml
- copied, changed from r1005331, camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringSplitterStopOnExceptionTest.xml
Added: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringSplitterBodyTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringSplitterBodyTest.java?rev=1005355&view=auto
==============================================================================
--- camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringSplitterBodyTest.java (added)
+++ camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringSplitterBodyTest.java Thu Oct 7 07:55:28 2010
@@ -0,0 +1,51 @@
+/**
+ * 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 java.util.ArrayList;
+import java.util.List;
+
+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;
+
+/**
+ * @version $Revision$
+ */
+public class SpringSplitterBodyTest extends SpringTestSupport {
+
+ @Override
+ protected AbstractXmlApplicationContext createApplicationContext() {
+ return new ClassPathXmlApplicationContext("org/apache/camel/spring/processor/SpringSplitterBodyTest.xml");
+ }
+
+ public void testSplitBody() throws InterruptedException {
+ MockEndpoint mock = getMockEndpoint("mock:split");
+ mock.expectedBodiesReceived("A", "B", "C");
+
+ List<String> list = new ArrayList<String>();
+ list.add("A");
+ list.add("B");
+ list.add("C");
+
+ template.sendBody("direct:start", list);
+
+ assertMockEndpointsSatisfied();
+ }
+
+}
Copied: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringSplitterBodyTest.xml (from r1005331, camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringSplitterStopOnExceptionTest.xml)
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringSplitterBodyTest.xml?p2=camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringSplitterBodyTest.xml&p1=camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringSplitterStopOnExceptionTest.xml&r1=1005331&r2=1005355&rev=1005355&view=diff
==============================================================================
--- camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringSplitterStopOnExceptionTest.xml (original)
+++ camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringSplitterBodyTest.xml Thu Oct 7 07:55:28 2010
@@ -22,17 +22,17 @@
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
">
- <bean id="myProcessor" class="org.apache.camel.processor.SplitterStopOnExceptionTest$MyProcessor"/>
-
+ <!-- START SNIPPET: e1 -->
<camelContext xmlns="http://camel.apache.org/schema/spring">
<route>
<from uri="direct:start"/>
- <split stopOnException="true">
- <tokenize token=","/>
- <process ref="myProcessor"/>
+ <split>
+ <!-- split the body, which contains a List with the data to be splitted -->
+ <simple>body</simple>
<to uri="mock:split"/>
</split>
</route>
</camelContext>
+ <!-- END SNIPPET: e1 -->
</beans>