camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r779924 - in /camel/trunk: camel-core/src/main/java/org/apache/camel/component/file/ camel-core/src/main/java/org/apache/camel/util/ camel-core/src/test/java/org/apache/camel/component/file/ camel-core/src/test/java/org/apache/camel/languag...
Date Fri, 29 May 2009 10:48:50 GMT
Author: davsclaus
Date: Fri May 29 10:48:49 2009
New Revision: 779924

URL: http://svn.apache.org/viewvc?rev=779924&view=rev
Log:
CAMEL-1653: Added fileExist option to file based component with 4 options out of the box. Is now default Override instead of Append as before. Also added Append support in the FTP component.

Added:
    camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileExist.java   (with props)
    camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileProducerFileExistAppendNoFileBeforeTest.java   (with props)
    camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileProducerFileExistAppendTest.java   (with props)
    camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileProducerFileExistFailTest.java   (with props)
    camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileProducerFileExistIgnoreTest.java   (with props)
    camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileProducerFileExistOverrideNoFileBeforeTest.java   (with props)
    camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileProducerFileExistOverrideTest.java   (with props)
    camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileExistAppendNoFileBeforeTest.java   (with props)
    camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileExistAppendTest.java   (with props)
    camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileExistFailTest.java   (with props)
    camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileExistIgnoreTest.java   (with props)
    camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileExistOverrideNoFileBeforeTest.java   (with props)
    camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileExistOverrideTest.java   (with props)
Modified:
    camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileOperations.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileEndpoint.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/util/FileUtil.java
    camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/BeanToFileTest.java
    camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/DirectoryCreateIssueTest.java
    camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileHeaderFileNameProducedTest.java
    camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileMEPInOutTest.java
    camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileProduceAppendTest.java
    camel/trunk/camel-core/src/test/java/org/apache/camel/language/FileLanguageTest.java
    camel/trunk/components/camel-freemarker/src/test/java/org/apache/camel/component/freemarker/FreemarkerContentCacheTest.java
    camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpConsumer.java
    camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpOperations.java
    camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpOperations.java
    camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpToAsciiFileNoBodyConversionTest.java
    camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpToAsciiFileTest.java
    camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpToBinaryFileTest.java
    camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpToFileNoFileNameHeaderTest.java
    camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/issues/JmsFilenameHeaderTest.java
    camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringOnCompletionWhenTest.xml
    camel/trunk/components/camel-stringtemplate/src/test/java/org/apache/camel/component/stringtemplate/StringTemplateContentCacheTest.java
    camel/trunk/components/camel-velocity/src/test/java/org/apache/camel/component/velocity/VelocityContentCacheTest.java
    camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/jms/FileToJmsTest.java
    camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/jetty/JettyFileMulticastTest-context.xml

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileOperations.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileOperations.java?rev=779924&r1=779923&r2=779924&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileOperations.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileOperations.java Fri May 29 10:48:49 2009
@@ -138,12 +138,26 @@
     public boolean storeFile(String fileName, GenericFileExchange<File> exchange) throws GenericFileOperationFailedException {
         ObjectHelper.notNull(endpoint, "endpoint");
 
+        File file = new File(fileName);
+
+        // if an existing file already exsists what should we do?
+        if (file.exists()) {
+            if (endpoint.getFileExist() == GenericFileExist.Ignore) {
+                // ignore but indicate that the file was written
+                if (LOG.isTraceEnabled()) {
+                    LOG.trace("An existing file already exists: " + file + ". Ignore and do not override it.");
+                }
+                return true;
+            } else if (endpoint.getFileExist() == GenericFileExist.Fail) {
+                throw new GenericFileOperationFailedException("File already exist: " + file + ". Cannot write new file.");
+            }
+        }
+
         // we can write the file by 3 different techniques
         // 1. write file to file
         // 2. rename a file from a local work path
         // 3. write stream to file
 
-        File file = new File(fileName);
         try {
 
             // is the body file based
@@ -244,10 +258,11 @@
      * or override any existing content.
      */
     private FileChannel prepareOutputFileChannel(File target, FileChannel out) throws IOException {
-        if (endpoint.isAppend()) {
+        if (endpoint.getFileExist() == GenericFileExist.Append) {
             out = new RandomAccessFile(target, "rw").getChannel();
             out = out.position(out.size());
         } else {
+            // will override
             out = new FileOutputStream(target).getChannel();
         }
         return out;

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileEndpoint.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileEndpoint.java?rev=779924&r1=779923&r2=779924&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileEndpoint.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileEndpoint.java Fri May 29 10:48:49 2009
@@ -55,7 +55,7 @@
     protected String localWorkDirectory;
     protected boolean autoCreate = true;
     protected int bufferSize = 128 * 1024;
-    protected boolean append = true;
+    protected GenericFileExist fileExist = GenericFileExist.Override;
     protected boolean noop;
     protected boolean recursive;
     protected boolean delete;
@@ -352,12 +352,12 @@
         this.bufferSize = bufferSize;
     }
 
-    public boolean isAppend() {
-        return append;
+    public GenericFileExist getFileExist() {
+        return fileExist;
     }
 
-    public void setAppend(boolean append) {
-        this.append = append;
+    public void setFileExist(GenericFileExist fileExist) {
+        this.fileExist = fileExist;
     }
 
     public boolean isAutoCreate() {

Added: camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileExist.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileExist.java?rev=779924&view=auto
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileExist.java (added)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileExist.java Fri May 29 10:48:49 2009
@@ -0,0 +1,27 @@
+/**
+ * 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.component.file;
+
+/**
+ * Represent the kinds of options when writing a file and what to do in case of an existing file exists.
+ *
+ * @version $Revision$
+ */
+public enum GenericFileExist {
+
+    Override, Append, Fail, Ignore
+}

Propchange: camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileExist.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileExist.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/util/FileUtil.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/util/FileUtil.java?rev=779924&r1=779923&r2=779924&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/util/FileUtil.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/util/FileUtil.java Fri May 29 10:48:49 2009
@@ -354,6 +354,24 @@
     }
 
     /**
+     * Returns only the leading path (returns <tt>null</tt> if no path)
+     */
+    public static String onlyPath(String name) {
+        if (name == null) {
+            return null;
+        }
+        int pos = name.lastIndexOf("/");
+        if (pos == -1) {
+            pos = name.lastIndexOf(File.separator);
+        }
+        if (pos != -1) {
+            return name.substring(0, pos);
+        }
+        // no path
+        return null;
+    }
+
+    /**
      * Compacts a path by stacking it and reducing <tt>..</tt>
      */
     public static String compactPath(String path) {

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/BeanToFileTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/BeanToFileTest.java?rev=779924&r1=779923&r2=779924&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/BeanToFileTest.java (original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/BeanToFileTest.java Fri May 29 10:48:49 2009
@@ -52,7 +52,7 @@
                 from("direct:in").
                     to("bean:myBean").
                     setHeader(Exchange.FILE_NAME, constant("BeanToFileTest.txt")).
-                    to("file://target/?append=false", "mock:result");
+                    to("file://target/?fileExist=Override", "mock:result");
             }
         };
     }

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/DirectoryCreateIssueTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/DirectoryCreateIssueTest.java?rev=779924&r1=779923&r2=779924&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/DirectoryCreateIssueTest.java (original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/DirectoryCreateIssueTest.java Fri May 29 10:48:49 2009
@@ -50,7 +50,7 @@
 
                     from("direct:file" + i)
                         .setHeader(Exchange.FILE_NAME, constant("file" + i + ".txt"))
-                        .to("file://" + path + "/?append=false&noop=true", "mock:result");
+                        .to("file://" + path + "/?fileExist=Override&noop=true", "mock:result");
                 }
 
                 from("seda:testFileCreatedAsDir")

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileHeaderFileNameProducedTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileHeaderFileNameProducedTest.java?rev=779924&r1=779923&r2=779924&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileHeaderFileNameProducedTest.java (original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileHeaderFileNameProducedTest.java Fri May 29 10:48:49 2009
@@ -43,7 +43,7 @@
         return new RouteBuilder() {
             public void configure() throws Exception {
                 from("direct:in")
-                    .to("file://target/?append=false")
+                    .to("file://target/?fileExist=Override")
                     .to("mock:result");
             }
         };

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileMEPInOutTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileMEPInOutTest.java?rev=779924&r1=779923&r2=779924&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileMEPInOutTest.java (original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileMEPInOutTest.java Fri May 29 10:48:49 2009
@@ -43,7 +43,7 @@
         return new RouteBuilder() {
             public void configure() throws Exception {
                 from("direct:in")
-                    .to("file://target/?append=false")
+                    .to("file://target/?fileExist=Override")
                     .to("mock:result");
             }
         };

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileProduceAppendTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileProduceAppendTest.java?rev=779924&r1=779923&r2=779924&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileProduceAppendTest.java (original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileProduceAppendTest.java Fri May 29 10:48:49 2009
@@ -64,7 +64,7 @@
             public void configure() {
                 from("direct:start")
                     .setHeader(Exchange.FILE_NAME, constant("hello.txt"))
-                    .to("file://target/test-file-append?append=true", "mock:result");
+                    .to("file://target/test-file-append?fileExist=Append", "mock:result");
             }
         };
     }

Added: camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileProducerFileExistAppendNoFileBeforeTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileProducerFileExistAppendNoFileBeforeTest.java?rev=779924&view=auto
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileProducerFileExistAppendNoFileBeforeTest.java (added)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileProducerFileExistAppendNoFileBeforeTest.java Fri May 29 10:48:49 2009
@@ -0,0 +1,54 @@
+/**
+ * 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.component.file;
+
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.Exchange;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+
+/**
+ * @version $Revision$
+ */
+public class FileProducerFileExistAppendNoFileBeforeTest extends ContextTestSupport {
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+        deleteDirectory("target/file");
+    }
+
+    public void testAppend() throws Exception {
+        MockEndpoint mock = getMockEndpoint("mock:result");
+        mock.expectedBodiesReceived("Bye World");
+        mock.expectedFileExists("target/file/hello.txt", "Bye World");
+
+        template.sendBodyAndHeader("file://target/file?fileExist=Append", "Bye World", Exchange.FILE_NAME, "hello.txt");
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from("file://target/file?noop=true&delay=1000").to("mock:result");
+            }
+        };
+    }
+}
\ No newline at end of file

Propchange: camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileProducerFileExistAppendNoFileBeforeTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileProducerFileExistAppendNoFileBeforeTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileProducerFileExistAppendTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileProducerFileExistAppendTest.java?rev=779924&view=auto
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileProducerFileExistAppendTest.java (added)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileProducerFileExistAppendTest.java Fri May 29 10:48:49 2009
@@ -0,0 +1,55 @@
+/**
+ * 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.component.file;
+
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.Exchange;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+
+/**
+ * @version $Revision$
+ */
+public class FileProducerFileExistAppendTest extends ContextTestSupport {
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+        deleteDirectory("target/file");
+        template.sendBodyAndHeader("file://target/file", "Hello World\n", Exchange.FILE_NAME, "hello.txt");
+    }
+
+    public void testAppend() throws Exception {
+        MockEndpoint mock = getMockEndpoint("mock:result");
+        mock.expectedBodiesReceived("Hello World\nBye World");
+        mock.expectedFileExists("target/file/hello.txt", "Hello World\nBye World");
+
+        template.sendBodyAndHeader("file://target/file?fileExist=Append", "Bye World", Exchange.FILE_NAME, "hello.txt");
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from("file://target/file?noop=true&delay=1000").to("mock:result");
+            }
+        };
+    }
+}
\ No newline at end of file

Propchange: camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileProducerFileExistAppendTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileProducerFileExistAppendTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileProducerFileExistFailTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileProducerFileExistFailTest.java?rev=779924&view=auto
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileProducerFileExistFailTest.java (added)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileProducerFileExistFailTest.java Fri May 29 10:48:49 2009
@@ -0,0 +1,60 @@
+/**
+ * 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.component.file;
+
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.Exchange;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+
+/**
+ * @version $Revision$
+ */
+public class FileProducerFileExistFailTest extends ContextTestSupport {
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+        deleteDirectory("target/file");
+        template.sendBodyAndHeader("file://target/file", "Hello World", Exchange.FILE_NAME, "hello.txt");
+    }
+
+    public void testFail() throws Exception {
+        MockEndpoint mock = getMockEndpoint("mock:result");
+        mock.expectedBodiesReceived("Hello World");
+        mock.expectedFileExists("target/file/hello.txt", "Hello World");
+
+        try {
+            template.sendBodyAndHeader("file://target/file?fileExist=Fail", "Bye World", Exchange.FILE_NAME, "hello.txt");
+            fail("Should have thrown a GenericFileOperationFailedException");
+        } catch (GenericFileOperationFailedException e) {
+            assertEquals("File already exist: target/file/hello.txt. Cannot write new file.", e.getMessage());
+        }
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from("file://target/file?noop=true&delay=1000").to("mock:result");
+            }
+        };
+    }
+}
\ No newline at end of file

Propchange: camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileProducerFileExistFailTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileProducerFileExistFailTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileProducerFileExistIgnoreTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileProducerFileExistIgnoreTest.java?rev=779924&view=auto
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileProducerFileExistIgnoreTest.java (added)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileProducerFileExistIgnoreTest.java Fri May 29 10:48:49 2009
@@ -0,0 +1,55 @@
+/**
+ * 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.component.file;
+
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.Exchange;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+
+/**
+ * @version $Revision$
+ */
+public class FileProducerFileExistIgnoreTest extends ContextTestSupport {
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+        deleteDirectory("target/file");
+        template.sendBodyAndHeader("file://target/file", "Hello World", Exchange.FILE_NAME, "hello.txt");
+    }
+
+    public void testIgnore() throws Exception {
+        MockEndpoint mock = getMockEndpoint("mock:result");
+        mock.expectedBodiesReceived("Hello World");
+        mock.expectedFileExists("target/file/hello.txt", "Hello World");
+
+        template.sendBodyAndHeader("file://target/file?fileExist=Ignore", "Bye World", Exchange.FILE_NAME, "hello.txt");
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from("file://target/file?noop=true&delay=1000").to("mock:result");
+            }
+        };
+    }
+}
\ No newline at end of file

Propchange: camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileProducerFileExistIgnoreTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileProducerFileExistIgnoreTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileProducerFileExistOverrideNoFileBeforeTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileProducerFileExistOverrideNoFileBeforeTest.java?rev=779924&view=auto
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileProducerFileExistOverrideNoFileBeforeTest.java (added)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileProducerFileExistOverrideNoFileBeforeTest.java Fri May 29 10:48:49 2009
@@ -0,0 +1,54 @@
+/**
+ * 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.component.file;
+
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.Exchange;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+
+/**
+ * @version $Revision$
+ */
+public class FileProducerFileExistOverrideNoFileBeforeTest extends ContextTestSupport {
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+        deleteDirectory("target/file");
+    }
+
+    public void testOverride() throws Exception {
+        MockEndpoint mock = getMockEndpoint("mock:result");
+        mock.expectedBodiesReceived("Bye World");
+        mock.expectedFileExists("target/file/hello.txt", "Bye World");
+
+        template.sendBodyAndHeader("file://target/file?fileExist=Override", "Bye World", Exchange.FILE_NAME, "hello.txt");
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from("file://target/file?noop=true&delay=1000").to("mock:result");
+            }
+        };
+    }
+}
\ No newline at end of file

Propchange: camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileProducerFileExistOverrideNoFileBeforeTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileProducerFileExistOverrideNoFileBeforeTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileProducerFileExistOverrideTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileProducerFileExistOverrideTest.java?rev=779924&view=auto
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileProducerFileExistOverrideTest.java (added)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileProducerFileExistOverrideTest.java Fri May 29 10:48:49 2009
@@ -0,0 +1,55 @@
+/**
+ * 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.component.file;
+
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.Exchange;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+
+/**
+ * @version $Revision$
+ */
+public class FileProducerFileExistOverrideTest extends ContextTestSupport {
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+        deleteDirectory("target/file");
+        template.sendBodyAndHeader("file://target/file", "Hello World", Exchange.FILE_NAME, "hello.txt");
+    }
+
+    public void testOverride() throws Exception {
+        MockEndpoint mock = getMockEndpoint("mock:result");
+        mock.expectedBodiesReceived("Bye World");
+        mock.expectedFileExists("target/file/hello.txt", "Bye World");
+
+        template.sendBodyAndHeader("file://target/file?fileExist=Override", "Bye World", Exchange.FILE_NAME, "hello.txt");
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from("file://target/file?noop=true&delay=1000").to("mock:result");
+            }
+        };
+    }
+}

Propchange: camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileProducerFileExistOverrideTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileProducerFileExistOverrideTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/language/FileLanguageTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/language/FileLanguageTest.java?rev=779924&r1=779923&r2=779924&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/language/FileLanguageTest.java (original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/language/FileLanguageTest.java Fri May 29 10:48:49 2009
@@ -111,7 +111,7 @@
 
     public Exchange createExchange() {
         // create the file
-        String uri = "file://target/filelanguage";
+        String uri = "file://target/filelanguage?fileExist=Override";
         template.sendBodyAndHeader(uri, "Hello World", Exchange.FILE_NAME, "test/hello.txt");
 
         // get the file handle

Modified: camel/trunk/components/camel-freemarker/src/test/java/org/apache/camel/component/freemarker/FreemarkerContentCacheTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-freemarker/src/test/java/org/apache/camel/component/freemarker/FreemarkerContentCacheTest.java?rev=779924&r1=779923&r2=779924&view=diff
==============================================================================
--- camel/trunk/components/camel-freemarker/src/test/java/org/apache/camel/component/freemarker/FreemarkerContentCacheTest.java (original)
+++ camel/trunk/components/camel-freemarker/src/test/java/org/apache/camel/component/freemarker/FreemarkerContentCacheTest.java Fri May 29 10:48:49 2009
@@ -30,7 +30,7 @@
         super.setUp();
 
         // create a vm file in the classpath as this is the tricky reloading stuff
-        template.sendBodyAndHeader("file://target/test-classes/org/apache/camel/component/freemarker?append=false", "Hello ${headers.name}", Exchange.FILE_NAME, "hello.ftl");
+        template.sendBodyAndHeader("file://target/test-classes/org/apache/camel/component/freemarker?fileExist=Override", "Hello ${headers.name}", Exchange.FILE_NAME, "hello.ftl");
     }
 
     public void testNotCached() throws Exception {
@@ -41,7 +41,7 @@
         mock.assertIsSatisfied();
 
         // now change content in the file in the classpath and try again
-        template.sendBodyAndHeader("file://target/test-classes/org/apache/camel/component/freemarker?append=false", "Bye ${headers.name}", Exchange.FILE_NAME, "hello.ftl");
+        template.sendBodyAndHeader("file://target/test-classes/org/apache/camel/component/freemarker?fileExist=Override", "Bye ${headers.name}", Exchange.FILE_NAME, "hello.ftl");
 
         mock.reset();
         mock.expectedBodiesReceived("Bye Paris");
@@ -58,7 +58,7 @@
         mock.assertIsSatisfied();
 
         // now change content in the file in the classpath and try again
-        template.sendBodyAndHeader("file://target/test-classes/org/apache/camel/component/freemarker?append=false", "Bye ${headers.name}", Exchange.FILE_NAME, "hello.ftl");
+        template.sendBodyAndHeader("file://target/test-classes/org/apache/camel/component/freemarker?fileExist=Override", "Bye ${headers.name}", Exchange.FILE_NAME, "hello.ftl");
 
         mock.reset();
         // we must expected the original filecontent as the cache is enabled, so its Hello and not Bye

Modified: camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpConsumer.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpConsumer.java?rev=779924&r1=779923&r2=779924&view=diff
==============================================================================
--- camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpConsumer.java (original)
+++ camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpConsumer.java Fri May 29 10:48:49 2009
@@ -91,7 +91,7 @@
 
         // the relative filename, skip the leading endpoint configured path
         String relativePath = ObjectHelper.after(absoluteFileName, endpointPath);
-        // skip trailing /
+        // skip leading /
         relativePath = FileUtil.stripLeadingSeparator(relativePath);
         answer.setRelativeFilePath(relativePath);
 

Modified: camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpOperations.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpOperations.java?rev=779924&r1=779923&r2=779924&view=diff
==============================================================================
--- camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpOperations.java (original)
+++ camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpOperations.java Fri May 29 10:48:49 2009
@@ -31,6 +31,7 @@
 import org.apache.camel.component.file.GenericFileEndpoint;
 import org.apache.camel.component.file.GenericFileExchange;
 import org.apache.camel.component.file.GenericFileOperationFailedException;
+import org.apache.camel.component.file.GenericFileExist;
 import org.apache.camel.util.FileUtil;
 import org.apache.camel.util.ObjectHelper;
 import org.apache.commons.logging.Log;
@@ -272,9 +273,28 @@
     }
 
     public boolean storeFile(String name, GenericFileExchange<FTPFile> exchange) throws GenericFileOperationFailedException {
+
+        // if an existing file already exsists what should we do?
+        if (endpoint.getFileExist() == GenericFileExist.Ignore || endpoint.getFileExist() == GenericFileExist.Fail) {
+            boolean existFile = existFile(name);
+            if (existFile && endpoint.getFileExist() == GenericFileExist.Ignore) {
+                // ignore but indicate that the file was written
+                if (LOG.isTraceEnabled()) {
+                    LOG.trace("An existing file already exists: " + name + ". Ignore and do not override it.");
+                }
+                return true;
+            } else if (existFile && endpoint.getFileExist() == GenericFileExist.Fail) {
+                throw new GenericFileOperationFailedException("File already exist: " + name + ". Cannot write new file.");
+            }
+        }
+
         InputStream is = exchange.getIn().getBody(InputStream.class);
         try {
-            return client.storeFile(name, is);
+            if (endpoint.getFileExist() == GenericFileExist.Append) {
+                return client.appendFile(name, is);
+            } else {
+                return client.storeFile(name, is);
+            }
         } catch (IOException e) {
             throw new GenericFileOperationFailedException(client.getReplyCode(), client.getReplyString(), e.getMessage(), e);
         } finally {
@@ -282,6 +302,27 @@
         }
     }
 
+    private boolean existFile(String name) {
+        // check whether a file already exists
+        String directory = FileUtil.onlyPath(name);
+        if (directory == null) {
+            return false;
+        }
+
+        String onlyName = FileUtil.stripPath(name);
+        try {
+            String[] names = client.listNames(directory);
+            for (String existing : names) {
+                if (existing.equals(onlyName)) {
+                    return true;
+                }
+            }
+            return false;
+        } catch (IOException e) {
+            throw new GenericFileOperationFailedException(client.getReplyCode(), client.getReplyString(), e.getMessage(), e);
+        }
+    }
+
     public String getCurrentDirectory() throws GenericFileOperationFailedException {
         try {
             return client.printWorkingDirectory();

Modified: camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpOperations.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpOperations.java?rev=779924&r1=779923&r2=779924&view=diff
==============================================================================
--- camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpOperations.java (original)
+++ camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpOperations.java Fri May 29 10:48:49 2009
@@ -38,8 +38,10 @@
 import org.apache.camel.component.file.GenericFileEndpoint;
 import org.apache.camel.component.file.GenericFileExchange;
 import org.apache.camel.component.file.GenericFileOperationFailedException;
+import org.apache.camel.component.file.GenericFileExist;
 import org.apache.camel.util.ExchangeHelper;
 import org.apache.camel.util.ObjectHelper;
+import org.apache.camel.util.FileUtil;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import static org.apache.camel.util.ObjectHelper.isNotEmpty;
@@ -358,9 +360,28 @@
     }
 
     public boolean storeFile(String name, GenericFileExchange<ChannelSftp.LsEntry> exchange) throws GenericFileOperationFailedException {
+        // if an existing file already exsists what should we do?
+        if (endpoint.getFileExist() == GenericFileExist.Ignore || endpoint.getFileExist() == GenericFileExist.Fail) {
+            boolean existFile = existFile(name);
+            if (existFile && endpoint.getFileExist() == GenericFileExist.Ignore) {
+                // ignore but indicate that the file was written
+                if (LOG.isTraceEnabled()) {
+                    LOG.trace("An existing file already exists: " + name + ". Ignore and do not override it.");
+                }
+                return true;
+            } else if (existFile && endpoint.getFileExist() == GenericFileExist.Fail) {
+                throw new GenericFileOperationFailedException("File already exist: " + name + ". Cannot write new file.");
+            }
+        }
+
         try {
             InputStream in = ExchangeHelper.getMandatoryInBody(exchange, InputStream.class);
-            channel.put(in, name);
+            if (endpoint.getFileExist() == GenericFileExist.Append) {
+                channel.put(in, name, ChannelSftp.APPEND);
+            } else {
+                // override is default
+                channel.put(in, name);
+            }
             return true;
         } catch (SftpException e) {
             throw new GenericFileOperationFailedException("Cannot store file: " + name, e);
@@ -369,4 +390,26 @@
         }
     }
 
+    private boolean existFile(String name) {
+        // check whether a file already exists
+        String directory = FileUtil.onlyPath(name);
+        if (directory == null) {
+            return false;
+        }
+
+        String onlyName = FileUtil.stripPath(name);
+        try {
+            Vector files = channel.ls(directory);
+            for (Object file : files) {
+                ChannelSftp.LsEntry entry = (ChannelSftp.LsEntry) file;
+                if (entry.getFilename().equals(onlyName)) {
+                    return true;
+                }
+            }
+            return false;
+        } catch (SftpException e) {
+            throw new GenericFileOperationFailedException(e.getMessage(), e);
+        }
+    }
+
 }
\ No newline at end of file

Modified: camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpToAsciiFileNoBodyConversionTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpToAsciiFileNoBodyConversionTest.java?rev=779924&r1=779923&r2=779924&view=diff
==============================================================================
--- camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpToAsciiFileNoBodyConversionTest.java (original)
+++ camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpToAsciiFileNoBodyConversionTest.java Fri May 29 10:48:49 2009
@@ -60,7 +60,7 @@
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {
             public void configure() throws Exception {
-                String fileUrl = "file:target/ftptest/?append=false&noop=true";
+                String fileUrl = "file:target/ftptest/?fileExist=Override&noop=true";
                 from(getFtpUrl()).to(fileUrl, "mock:result");
             }
         };

Modified: camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpToAsciiFileTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpToAsciiFileTest.java?rev=779924&r1=779923&r2=779924&view=diff
==============================================================================
--- camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpToAsciiFileTest.java (original)
+++ camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpToAsciiFileTest.java Fri May 29 10:48:49 2009
@@ -30,7 +30,7 @@
 public class FromFtpToAsciiFileTest extends FtpServerTestSupport {
 
     private String getFtpUrl() {
-        return "ftp://admin@localhost:" + getPort() + "/tmp3/camel?password=admin&binary=false";
+        return "ftp://admin@localhost:" + getPort() + "/tmp3/camel?password=admin&binary=false&fileExist=Override";
     }
 
     public void testFtpRoute() throws Exception {
@@ -67,7 +67,7 @@
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {
             public void configure() throws Exception {
-                String fileUrl = "file:target/ftptest/?append=false&noop=true";
+                String fileUrl = "file:target/ftptest/?fileExist=Override&noop=true";
                 from(getFtpUrl()).setHeader(Exchange.FILE_NAME, constant("deleteme.txt")).
                         convertBodyTo(String.class).to(fileUrl).to("mock:result");
             }

Modified: camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpToBinaryFileTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpToBinaryFileTest.java?rev=779924&r1=779923&r2=779924&view=diff
==============================================================================
--- camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpToBinaryFileTest.java (original)
+++ camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpToBinaryFileTest.java Fri May 29 10:48:49 2009
@@ -73,7 +73,7 @@
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {
             public void configure() throws Exception {
-                String fileUrl = "file:target/ftptest/?noop=true&append=false";
+                String fileUrl = "file:target/ftptest/?noop=true&fileExist=Override";
                 from(getFtpUrl()).setHeader(Exchange.FILE_NAME, constant("deleteme.jpg"))
                         .to(fileUrl, "mock:result");
             }

Modified: camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpToFileNoFileNameHeaderTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpToFileNoFileNameHeaderTest.java?rev=779924&r1=779923&r2=779924&view=diff
==============================================================================
--- camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpToFileNoFileNameHeaderTest.java (original)
+++ camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpToFileNoFileNameHeaderTest.java Fri May 29 10:48:49 2009
@@ -68,7 +68,7 @@
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {
             public void configure() throws Exception {
-                String fileUrl = "file:target/ftptest/?append=false&noop=true";
+                String fileUrl = "file:target/ftptest/?fileExist=Override&noop=true";
                 // we do not set any filename in the header property so the filename should be the one
                 // from the FTP server we downloaded
                 from(getFtpUrl()).convertBodyTo(String.class).to(fileUrl).to("mock:result");

Added: camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileExistAppendNoFileBeforeTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileExistAppendNoFileBeforeTest.java?rev=779924&view=auto
==============================================================================
--- camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileExistAppendNoFileBeforeTest.java (added)
+++ camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileExistAppendNoFileBeforeTest.java Fri May 29 10:48:49 2009
@@ -0,0 +1,59 @@
+/**
+ * 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.component.file.remote;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+
+/**
+ * @version $Revision$
+ */
+public class FtpProducerFileExistAppendNoFileBeforeTest extends FtpServerTestSupport {
+
+    private String getFtpUrl() {
+        return "ftp://admin@localhost:" + getPort() + "/exist?password=admin&delay=2000&noop=true&fileExist=Append";
+    }
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+        deleteDirectory(FTP_ROOT_DIR + "exist");
+        deleteDirectory("target/exist");
+    }
+
+    public void testAppend() throws Exception {
+        MockEndpoint mock = getMockEndpoint("mock:result");
+        mock.expectedBodiesReceived("Bye World");
+        mock.expectedFileExists(FTP_ROOT_DIR + "exist/hello.txt", "Bye World");
+
+        template.sendBodyAndHeader(getFtpUrl(), "Bye World", Exchange.FILE_NAME, "hello.txt");
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from(getFtpUrl()).to("mock:result");
+            }
+        };
+    }
+
+}
\ No newline at end of file

Propchange: camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileExistAppendNoFileBeforeTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileExistAppendNoFileBeforeTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileExistAppendTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileExistAppendTest.java?rev=779924&view=auto
==============================================================================
--- camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileExistAppendTest.java (added)
+++ camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileExistAppendTest.java Fri May 29 10:48:49 2009
@@ -0,0 +1,61 @@
+/**
+ * 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.component.file.remote;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+
+/**
+ * @version $Revision$
+ */
+public class FtpProducerFileExistAppendTest extends FtpServerTestSupport {
+
+    private String getFtpUrl() {
+        return "ftp://admin@localhost:" + getPort() + "/exist?password=admin&delay=2000&noop=true&fileExist=Append";
+    }
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+        deleteDirectory(FTP_ROOT_DIR + "exist");
+        deleteDirectory("target/exist");
+
+        template.sendBodyAndHeader(getFtpUrl(), "Hello World\n", Exchange.FILE_NAME, "hello.txt");
+    }
+
+    public void testAppend() throws Exception {
+        MockEndpoint mock = getMockEndpoint("mock:result");
+        mock.expectedBodiesReceived("Hello World\nBye World");
+        mock.expectedFileExists(FTP_ROOT_DIR + "exist/hello.txt", "Hello World\nBye World");
+
+        template.sendBodyAndHeader(getFtpUrl(), "Bye World", Exchange.FILE_NAME, "hello.txt");
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from(getFtpUrl()).to("mock:result");
+            }
+        };
+    }
+
+}
\ No newline at end of file

Propchange: camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileExistAppendTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileExistAppendTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileExistFailTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileExistFailTest.java?rev=779924&view=auto
==============================================================================
--- camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileExistFailTest.java (added)
+++ camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileExistFailTest.java Fri May 29 10:48:49 2009
@@ -0,0 +1,67 @@
+/**
+ * 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.component.file.remote;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.file.GenericFileOperationFailedException;
+import org.apache.camel.component.mock.MockEndpoint;
+
+/**
+ * @version $Revision$
+ */
+public class FtpProducerFileExistFailTest extends FtpServerTestSupport {
+
+    private String getFtpUrl() {
+        return "ftp://admin@localhost:" + getPort() + "/exist?password=admin&delay=2000&noop=true&fileExist=Fail";
+    }
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+        deleteDirectory(FTP_ROOT_DIR + "exist");
+        deleteDirectory("target/exist");
+
+        template.sendBodyAndHeader(getFtpUrl(), "Hello World", Exchange.FILE_NAME, "hello.txt");
+    }
+
+    public void testFail() throws Exception {
+        MockEndpoint mock = getMockEndpoint("mock:result");
+        mock.expectedBodiesReceived("Hello World");
+        mock.expectedFileExists(FTP_ROOT_DIR + "exist/hello.txt", "Hello World");
+
+        try {
+            template.sendBodyAndHeader(getFtpUrl(), "Bye World", Exchange.FILE_NAME, "hello.txt");
+            fail("Should have thrown a GenericFileOperationFailedException");
+        } catch (GenericFileOperationFailedException e) {
+            assertEquals("File already exist: exist/hello.txt. Cannot write new file.", e.getMessage());
+        }
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from(getFtpUrl()).to("mock:result");
+            }
+        };
+    }
+
+}
\ No newline at end of file

Propchange: camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileExistFailTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileExistFailTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileExistIgnoreTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileExistIgnoreTest.java?rev=779924&view=auto
==============================================================================
--- camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileExistIgnoreTest.java (added)
+++ camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileExistIgnoreTest.java Fri May 29 10:48:49 2009
@@ -0,0 +1,61 @@
+/**
+ * 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.component.file.remote;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+
+/**
+ * @version $Revision$
+ */
+public class FtpProducerFileExistIgnoreTest extends FtpServerTestSupport {
+
+    private String getFtpUrl() {
+        return "ftp://admin@localhost:" + getPort() + "/exist?password=admin&delay=2000&noop=true&fileExist=Ignore";
+    }
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+        deleteDirectory(FTP_ROOT_DIR + "exist");
+        deleteDirectory("target/exist");
+
+        template.sendBodyAndHeader(getFtpUrl(), "Hello World", Exchange.FILE_NAME, "hello.txt");
+    }
+
+    public void testIgnore() throws Exception {
+        MockEndpoint mock = getMockEndpoint("mock:result");
+        mock.expectedBodiesReceived("Hello World");
+        mock.expectedFileExists(FTP_ROOT_DIR + "exist/hello.txt", "Hello World");
+
+        template.sendBodyAndHeader(getFtpUrl(), "Bye World", Exchange.FILE_NAME, "hello.txt");
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from(getFtpUrl()).to("mock:result");
+            }
+        };
+    }
+
+}
\ No newline at end of file

Propchange: camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileExistIgnoreTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileExistIgnoreTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileExistOverrideNoFileBeforeTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileExistOverrideNoFileBeforeTest.java?rev=779924&view=auto
==============================================================================
--- camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileExistOverrideNoFileBeforeTest.java (added)
+++ camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileExistOverrideNoFileBeforeTest.java Fri May 29 10:48:49 2009
@@ -0,0 +1,59 @@
+/**
+ * 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.component.file.remote;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+
+/**
+ * @version $Revision$
+ */
+public class FtpProducerFileExistOverrideNoFileBeforeTest extends FtpServerTestSupport {
+
+    private String getFtpUrl() {
+        return "ftp://admin@localhost:" + getPort() + "/exist?password=admin&delay=2000&noop=true&fileExist=Override";
+    }
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+        deleteDirectory(FTP_ROOT_DIR + "exist");
+        deleteDirectory("target/exist");
+    }
+
+    public void testOverride() throws Exception {
+        MockEndpoint mock = getMockEndpoint("mock:result");
+        mock.expectedBodiesReceived("Bye World");
+        mock.expectedFileExists(FTP_ROOT_DIR + "exist/hello.txt", "Bye World");
+
+        template.sendBodyAndHeader(getFtpUrl(), "Bye World", Exchange.FILE_NAME, "hello.txt");
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from(getFtpUrl()).to("mock:result");
+            }
+        };
+    }
+
+}
\ No newline at end of file

Propchange: camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileExistOverrideNoFileBeforeTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileExistOverrideNoFileBeforeTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileExistOverrideTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileExistOverrideTest.java?rev=779924&view=auto
==============================================================================
--- camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileExistOverrideTest.java (added)
+++ camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileExistOverrideTest.java Fri May 29 10:48:49 2009
@@ -0,0 +1,61 @@
+/**
+ * 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.component.file.remote;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+
+/**
+ * @version $Revision$
+ */
+public class FtpProducerFileExistOverrideTest extends FtpServerTestSupport {
+
+    private String getFtpUrl() {
+        return "ftp://admin@localhost:" + getPort() + "/exist?password=admin&delay=2000&noop=true&fileExist=Override";
+    }
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+        deleteDirectory(FTP_ROOT_DIR + "exist");
+        deleteDirectory("target/exist");
+
+        template.sendBodyAndHeader(getFtpUrl(), "Hello World", Exchange.FILE_NAME, "hello.txt");
+    }
+
+    public void testOverride() throws Exception {
+        MockEndpoint mock = getMockEndpoint("mock:result");
+        mock.expectedBodiesReceived("Bye World");
+        mock.expectedFileExists(FTP_ROOT_DIR + "exist/hello.txt", "Bye World");
+
+        template.sendBodyAndHeader(getFtpUrl(), "Bye World", Exchange.FILE_NAME, "hello.txt");
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from(getFtpUrl()).to("mock:result");
+            }
+        };
+    }
+
+}

Propchange: camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileExistOverrideTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileExistOverrideTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/issues/JmsFilenameHeaderTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/issues/JmsFilenameHeaderTest.java?rev=779924&r1=779923&r2=779924&view=diff
==============================================================================
--- camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/issues/JmsFilenameHeaderTest.java (original)
+++ camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/issues/JmsFilenameHeaderTest.java Fri May 29 10:48:49 2009
@@ -64,7 +64,7 @@
                 from("direct:in").to("activemq:test.a");
                 from("activemq:test.a").to("direct:save");
 
-                from("direct:save").to("file://target?append=false", "mock:result");
+                from("direct:save").to("file://target?fileExist=Override", "mock:result");
             }
         };
     }

Modified: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringOnCompletionWhenTest.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringOnCompletionWhenTest.xml?rev=779924&r1=779923&r2=779924&view=diff
==============================================================================
--- camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringOnCompletionWhenTest.xml (original)
+++ camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringOnCompletionWhenTest.xml Fri May 29 10:48:49 2009
@@ -27,7 +27,7 @@
             <from uri="direct:start"/>
             <onCompletion>
                 <onWhen>
-                    <simple>{$in.body} contains 'Hello'</simple>
+                    <simple>${in.body} contains 'Hello'</simple>
                 </onWhen>
                 <to uri="log:sync"/>
                 <to uri="mock:sync"/>

Modified: camel/trunk/components/camel-stringtemplate/src/test/java/org/apache/camel/component/stringtemplate/StringTemplateContentCacheTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-stringtemplate/src/test/java/org/apache/camel/component/stringtemplate/StringTemplateContentCacheTest.java?rev=779924&r1=779923&r2=779924&view=diff
==============================================================================
--- camel/trunk/components/camel-stringtemplate/src/test/java/org/apache/camel/component/stringtemplate/StringTemplateContentCacheTest.java (original)
+++ camel/trunk/components/camel-stringtemplate/src/test/java/org/apache/camel/component/stringtemplate/StringTemplateContentCacheTest.java Fri May 29 10:48:49 2009
@@ -30,7 +30,7 @@
         super.setUp();
 
         // create a tm file in the classpath as this is the tricky reloading stuff
-        template.sendBodyAndHeader("file://target/test-classes/org/apache/camel/component/stringtemplate?append=false", "Hello $headers.name$", Exchange.FILE_NAME, "hello.tm");
+        template.sendBodyAndHeader("file://target/test-classes/org/apache/camel/component/stringtemplate?fileExist=Override", "Hello $headers.name$", Exchange.FILE_NAME, "hello.tm");
     }
 
     public void testNotCached() throws Exception {
@@ -41,7 +41,7 @@
         mock.assertIsSatisfied();
 
         // now change content in the file in the classpath and try again
-        template.sendBodyAndHeader("file://target/test-classes/org/apache/camel/component/stringtemplate?append=false", "Bye $headers.name$", Exchange.FILE_NAME, "hello.tm");
+        template.sendBodyAndHeader("file://target/test-classes/org/apache/camel/component/stringtemplate?fileExist=Override", "Bye $headers.name$", Exchange.FILE_NAME, "hello.tm");
 
         mock.reset();
         mock.expectedBodiesReceived("Bye Paris");
@@ -58,7 +58,7 @@
         mock.assertIsSatisfied();
 
         // now change content in the file in the classpath and try again
-        template.sendBodyAndHeader("file://target/test-classes/org/apache/camel/component/stringtemplate?append=false", "Bye $headers.name$", Exchange.FILE_NAME, "hello.tm");
+        template.sendBodyAndHeader("file://target/test-classes/org/apache/camel/component/stringtemplate?fileExist=Override", "Bye $headers.name$", Exchange.FILE_NAME, "hello.tm");
 
         mock.reset();
         // we must expected the original filecontent as the cache is enabled, so its Hello and not Bye

Modified: camel/trunk/components/camel-velocity/src/test/java/org/apache/camel/component/velocity/VelocityContentCacheTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-velocity/src/test/java/org/apache/camel/component/velocity/VelocityContentCacheTest.java?rev=779924&r1=779923&r2=779924&view=diff
==============================================================================
--- camel/trunk/components/camel-velocity/src/test/java/org/apache/camel/component/velocity/VelocityContentCacheTest.java (original)
+++ camel/trunk/components/camel-velocity/src/test/java/org/apache/camel/component/velocity/VelocityContentCacheTest.java Fri May 29 10:48:49 2009
@@ -30,7 +30,7 @@
         super.setUp();
 
         // create a vm file in the classpath as this is the tricky reloading stuff
-        template.sendBodyAndHeader("file://target/test-classes/org/apache/camel/component/velocity?append=false", "Hello $headers.name", Exchange.FILE_NAME, "hello.vm");
+        template.sendBodyAndHeader("file://target/test-classes/org/apache/camel/component/velocity?fileExist=Override", "Hello $headers.name", Exchange.FILE_NAME, "hello.vm");
     }
 
     public void testNotCached() throws Exception {
@@ -41,7 +41,7 @@
         mock.assertIsSatisfied();
 
         // now change content in the file in the classpath and try again
-        template.sendBodyAndHeader("file://target/test-classes/org/apache/camel/component/velocity?append=false", "Bye $headers.name", Exchange.FILE_NAME, "hello.vm");
+        template.sendBodyAndHeader("file://target/test-classes/org/apache/camel/component/velocity?fileExist=Override", "Bye $headers.name", Exchange.FILE_NAME, "hello.vm");
 
         mock.reset();
         mock.expectedBodiesReceived("Bye Paris");
@@ -58,7 +58,7 @@
         mock.assertIsSatisfied();
 
         // now change content in the file in the classpath and try again
-        template.sendBodyAndHeader("file://target/test-classes/org/apache/camel/component/velocity?append=false", "Bye $headers.name", Exchange.FILE_NAME, "hello.vm");
+        template.sendBodyAndHeader("file://target/test-classes/org/apache/camel/component/velocity?fileExist=Override", "Bye $headers.name", Exchange.FILE_NAME, "hello.vm");
 
         mock.reset();
         // we must expected the original filecontent as the cache is enabled, so its Hello and not Bye
@@ -76,7 +76,7 @@
         mock.assertIsSatisfied();
 
         // now change content in the file in the classpath and try again
-        template.sendBodyAndHeader("file://target/test-classes/org/apache/camel/component/velocity?append=false", "Bye $headers.name", Exchange.FILE_NAME, "hello.vm");
+        template.sendBodyAndHeader("file://target/test-classes/org/apache/camel/component/velocity?fileExist=Override", "Bye $headers.name", Exchange.FILE_NAME, "hello.vm");
 
         mock.reset();
         // we must expected the original filecontent as the cache is enabled, so its Hello and not Bye

Modified: camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/jms/FileToJmsTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/jms/FileToJmsTest.java?rev=779924&r1=779923&r2=779924&view=diff
==============================================================================
--- camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/jms/FileToJmsTest.java (original)
+++ camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/jms/FileToJmsTest.java Fri May 29 10:48:49 2009
@@ -39,7 +39,7 @@
     public void testFileToJms() throws Exception {
         result.expectedBodiesReceived("Hello World");
 
-        template.sendBodyAndHeader("file://target/jmsfile?append=false", "Hello World", Exchange.FILE_NAME, "hello.txt");
+        template.sendBodyAndHeader("file://target/jmsfile?fileExist=Override", "Hello World", Exchange.FILE_NAME, "hello.txt");
 
         result.assertIsSatisfied();
     }

Modified: camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/jetty/JettyFileMulticastTest-context.xml
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/jetty/JettyFileMulticastTest-context.xml?rev=779924&r1=779923&r2=779924&view=diff
==============================================================================
--- camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/jetty/JettyFileMulticastTest-context.xml (original)
+++ camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/jetty/JettyFileMulticastTest-context.xml Fri May 29 10:48:49 2009
@@ -44,7 +44,7 @@
         <setHeader headerName="CamelFileName">
            <constant>test.xml</constant>
         </setHeader>
-        <to uri="file://target?append=false"/>
+        <to uri="file://target?fileExist=Override"/>
         <to uri="mock:fileEndpoint"/>
     </route>
     <route>



Mime
View raw message