svn commit: r564139 - in /activemq/camel/trunk/camel-core/src: main/java/org/apache/camel/component/file/FileExchange.java test/java/org/apache/camel/component/file/FileExchangeTest.java

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r564139 - in /activemq/camel/trunk/camel-core/src: main/java/org/apache/camel/component/file/FileExchange.java test/java/org/apache/camel/component/file/FileExchangeTest.java

jstrachan-2
Author: jstrachan
Date: Thu Aug  9 01:28:57 2007
New Revision: 564139

URL: http://svn.apache.org/viewvc?view=rev&rev=564139
Log:
added test case and patch for issue brought up here: http://www.nabble.com/Problem-with-ETL-example-tf4235529s22882.html#a12064538

Modified:
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileExchange.java
    activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileExchangeTest.java

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileExchange.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileExchange.java?view=diff&rev=564139&r1=564138&r2=564139
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileExchange.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileExchange.java Thu Aug  9 01:28:57 2007
@@ -50,7 +50,7 @@
         this.file = file;
     }
 
-    public Exchange copy() {
+    public Exchange newInstance() {
         return new FileExchange(getContext(), getFile());
     }
 }

Modified: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileExchangeTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileExchangeTest.java?view=diff&rev=564139&r1=564138&r2=564139
==============================================================================
--- activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileExchangeTest.java (original)
+++ activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileExchangeTest.java Thu Aug  9 01:28:57 2007
@@ -40,6 +40,18 @@
         assertNotNull("Should have a body!", body);
     }
 
+    public void testCopyAfterBodyChanged() throws Exception {
+        FileExchange original = new FileExchange(context, file);
+        Object expectedBody = 1234;
+        original.getIn().setBody(expectedBody);
+        Exchange exchange = original.copy();
+        FileExchange copy = assertIsInstanceOf(FileExchange.class, exchange);
+        assertEquals("File", file, copy.getFile());
+        Object body = copy.getIn().getBody();
+        assertNotNull("Should have a body!", body);
+        assertEquals("Copied exchange in body", expectedBody, body);
+    }
+
     public void testPipelineCopy() throws Exception {
         Processor myProcessor = new Processor() {
             public void process(Exchange exchange) throws Exception {