Author: davsclaus
Date: Sun Apr 29 12:50:07 2012
New Revision: 1331907

URL: http://svn.apache.org/viewvc?rev=1331907&view=rev
Log:
CAMEL-5224: Do not delete done file if noop=true

Added:
    
camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FilerConsumerDoneFileNoopTest.java
      - copied, changed from r1331906, 
camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FilerConsumerDoneFileNameTest.java
Modified:
    
camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileOnCompletion.java

Modified: 
camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileOnCompletion.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileOnCompletion.java?rev=1331907&r1=1331906&r2=1331907&view=diff
==============================================================================
--- 
camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileOnCompletion.java
 (original)
+++ 
camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileOnCompletion.java
 Sun Apr 29 12:50:07 2012
@@ -109,8 +109,8 @@ public class GenericFileOnCompletion<T> 
             endpoint.getIdempotentRepository().add(absoluteFileName);
         }
 
-        // delete done file if used
-        if (endpoint.getDoneFileName() != null) {
+        // delete done file if used (and not noop=true)
+        if (endpoint.getDoneFileName() != null && !endpoint.isNoop()) {
             // done file must be in same path as the original input file
             String doneFileName = 
endpoint.createDoneFileName(absoluteFileName);
             ObjectHelper.notEmpty(doneFileName, "doneFileName", endpoint);
@@ -133,7 +133,6 @@ public class GenericFileOnCompletion<T> 
         } catch (Exception e) {
             handleException(e);
         }
-
     }
 
     /**

Copied: 
camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FilerConsumerDoneFileNoopTest.java
 (from r1331906, 
camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FilerConsumerDoneFileNameTest.java)
URL: 
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FilerConsumerDoneFileNoopTest.java?p2=camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FilerConsumerDoneFileNoopTest.java&p1=camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FilerConsumerDoneFileNameTest.java&r1=1331906&r2=1331907&rev=1331907&view=diff
==============================================================================
--- 
camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FilerConsumerDoneFileNameTest.java
 (original)
+++ 
camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FilerConsumerDoneFileNoopTest.java
 Sun Apr 29 12:50:07 2012
@@ -25,7 +25,7 @@ import org.apache.camel.builder.RouteBui
 /**
  * Unit test for writing done files
  */
-public class FilerConsumerDoneFileNameTest extends ContextTestSupport {
+public class FilerConsumerDoneFileNoopTest extends ContextTestSupport {
 
     @Override
     protected void setUp() throws Exception {
@@ -53,13 +53,13 @@ public class FilerConsumerDoneFileNameTe
         assertMockEndpointsSatisfied();
         oneExchangeDone.matchesMockWaitTime();
 
-        // done file should be deleted now
+        // done file should be kept now
         File file = new File("target/done/done").getAbsoluteFile();
-        assertFalse("Done file should be deleted: " + file, file.exists());
+        assertTrue("Done file should be not be deleted: " + file, 
file.exists());
 
-        // as well the original file should be moved to backup
-        file = new File("target/done/.camel/hello.txt").getAbsoluteFile();
-        assertTrue("Original file should be moved: " + file, file.exists());
+        // as well the original file should be kept due noop
+        file = new File("target/done/hello.txt").getAbsoluteFile();
+        assertTrue("Original file should be kept: " + file, file.exists());
     }
 
     @Override
@@ -67,7 +67,7 @@ public class FilerConsumerDoneFileNameTe
         return new RouteBuilder() {
             @Override
             public void configure() throws Exception {
-                
from("file:target/done?doneFileName=done&initialDelay=0&delay=10").to("mock:result");
+                
from("file:target/done?doneFileName=done&noop=true").to("mock:result");
             }
         };
     }


Reply via email to