[jboss-svn-commits] JBL Code SVN: r25544 - in labs/jbossesb/trunk/product/rosetta: tests/src/org/jboss/soa/esb/listeners/gateway and 1 other directory.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Mon Mar 9 02:16:23 EDT 2009


Author: beve
Date: 2009-03-09 02:16:23 -0400 (Mon, 09 Mar 2009)
New Revision: 25544

Modified:
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/util/FileUtil.java
   labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/gateway/FileGatewayListenerUnitTest.java
Log:
Work for https://jira.jboss.org/jira/browse/JBESB-2401 "FileGatewayListener: Does not support overwriting of processed files."
Reverting my previous changes.


Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/util/FileUtil.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/util/FileUtil.java	2009-03-09 06:10:26 UTC (rev 25543)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/util/FileUtil.java	2009-03-09 06:16:23 UTC (rev 25544)
@@ -59,8 +59,8 @@
         }
 
         if(to.exists()) {
-            // copy the file contents from the inprocess file to the destination file.
-            return copyFile(from, to);
+            LOGGER.debug("Unable to rename file '" + from.getAbsolutePath() + "' to '" + to.getAbsolutePath() + "'.  '" + to.getAbsolutePath() + "' already exist.");
+            return false;
         }
 
         if (!from.renameTo(to))

Modified: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/gateway/FileGatewayListenerUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/gateway/FileGatewayListenerUnitTest.java	2009-03-09 06:10:26 UTC (rev 25543)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/gateway/FileGatewayListenerUnitTest.java	2009-03-09 06:16:23 UTC (rev 25544)
@@ -261,9 +261,12 @@
         writeToFile(inProcessPayload, inProcessFile);
         
         final FileGatewayListener gateway = new FileGatewayListener(createTestListenerConfig());
-        gateway.renameFile(inProcessFile, processedFile);
+        boolean renamed = gateway.renameFile(inProcessFile, processedFile);
         
-        assertEquals(inProcessPayload,  FileUtil.readTextFile(processedFile));
+        assertFalse(renamed);
+        
+        // Verify that file contents has not have been overwritten. 
+        assertEquals("firstPayload",  FileUtil.readTextFile(processedFile));
     }
     
     private void writeToFile(final String content, final File to) throws IOException




More information about the jboss-svn-commits mailing list