camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject svn commit: r1463826 - in /camel/trunk/camel-core/src/test: java/org/apache/camel/processor/SplitterTest.java resources/org/apache/camel/processor/simple.txt
Date Wed, 03 Apr 2013 05:13:34 GMT
Author: ningjiang
Date: Wed Apr  3 05:13:34 2013
New Revision: 1463826

URL: http://svn.apache.org/r1463826
Log:
CAMEL-6231 added an simple unit test

Added:
    camel/trunk/camel-core/src/test/resources/org/apache/camel/processor/simple.txt
Modified:
    camel/trunk/camel-core/src/test/java/org/apache/camel/processor/SplitterTest.java

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/SplitterTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/SplitterTest.java?rev=1463826&r1=1463825&r2=1463826&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/processor/SplitterTest.java (original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/processor/SplitterTest.java Wed
Apr  3 05:13:34 2013
@@ -16,6 +16,8 @@
  */
 package org.apache.camel.processor;
 
+import java.io.File;
+import java.net.URL;
 import java.util.Arrays;
 import java.util.Iterator;
 import java.util.List;
@@ -161,8 +163,19 @@ public class SplitterTest extends Contex
         assertMessageHeader(out, "foo", "bar");
         assertEquals((Integer) 5, result.getProperty("aggregated", Integer.class));
     }
+    
+    public void testSplitterWithStreamingAndFileBody() throws Exception {
+        URL url = this.getClass().getResource("/org/apache/camel/processor/simple.txt");
+        assertNotNull("We should find this simple file here.", url);
+        File file = new File(url.getFile());
+        sendToSplitterWithStreaming(file);
+    }
+    
+    public void testSplitterWithStreamingAndStringBody() throws Exception {
+        sendToSplitterWithStreaming("James,Guillaume,Hiram,Rob,Roman");
+    }
 
-    public void testSplitterWithStreaming() throws Exception {
+    public void sendToSplitterWithStreaming(final Object body) throws Exception {
         MockEndpoint resultEndpoint = getMockEndpoint("mock:result");
         resultEndpoint.expectedMessageCount(5);
         resultEndpoint.expectedHeaderReceived("foo", "bar");
@@ -170,7 +183,7 @@ public class SplitterTest extends Contex
         template.request("direct:streaming", new Processor() {
             public void process(Exchange exchange) {
                 Message in = exchange.getIn();
-                in.setBody("James,Guillaume,Hiram,Rob,Roman");
+                in.setBody(body);
                 in.setHeader("foo", "bar");
             }
         });

Added: camel/trunk/camel-core/src/test/resources/org/apache/camel/processor/simple.txt
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/resources/org/apache/camel/processor/simple.txt?rev=1463826&view=auto
==============================================================================
--- camel/trunk/camel-core/src/test/resources/org/apache/camel/processor/simple.txt (added)
+++ camel/trunk/camel-core/src/test/resources/org/apache/camel/processor/simple.txt Wed Apr
 3 05:13:34 2013
@@ -0,0 +1 @@
+James,Guillaume,Hiram,Rob,Roman
\ No newline at end of file



Mime
View raw message