From 298c3fb7ae60160d77385539b24f797c60152a9c Mon Sep 17 00:00:00 2001
From: brinn <brinn>
Date: Thu, 24 Jul 2008 17:52:21 +0000
Subject: [PATCH] fix: strange test failure, make test robust

SVN: 7474
---
 .../systemsx/cisd/datamover/IncomingProcessorTest.java | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/datamover/sourceTest/java/ch/systemsx/cisd/datamover/IncomingProcessorTest.java b/datamover/sourceTest/java/ch/systemsx/cisd/datamover/IncomingProcessorTest.java
index 4f7127e0808..1729dd4ba2d 100644
--- a/datamover/sourceTest/java/ch/systemsx/cisd/datamover/IncomingProcessorTest.java
+++ b/datamover/sourceTest/java/ch/systemsx/cisd/datamover/IncomingProcessorTest.java
@@ -88,8 +88,6 @@ public final class IncomingProcessorTest
 
     private static final String EXAMPLE_SCRIPT = "echo hello world";
 
-    private static final File TEST_FILE = new File(TEST_FOLDER, "blabla.txt");
-
     private BufferedAppender logRecorder;
 
     private Mockery context;
@@ -301,7 +299,7 @@ public final class IncomingProcessorTest
     @Test
     public void testWithDataCompletedScriptWhichFailsInitially() throws IOException
     {
-        createExampleScript(EXAMPLE_SCRIPT + "\nrm -v " + TEST_FILE.toString().replace('\\', '/'));
+        createExampleScript("exit 1");
         final File testDataFile = new File(incomingDir, "test-data.txt");
         testDataFile.createNewFile();
         final File markerFile = new File(incomingDir, MarkerFile.createRequiresDeletionBeforeCreationMarker().getName());
@@ -318,7 +316,11 @@ public final class IncomingProcessorTest
                             markerFile.renameTo(result);
                             return result;
                         }
+
                     });
+
+                    one(mover).tryMove(testDataFile, copyCompleteDir, "");
+                    will(returnValue(new File(copyCompleteDir, testDataFile.getName())));
                 }
             });
 
@@ -339,7 +341,7 @@ public final class IncomingProcessorTest
 
         logRecorder.resetLogContent();
         operationAppender.reset();
-        TEST_FILE.createNewFile();
+        createExampleScript("exit 0"); // now the script will run fine
         dataMoverTimerTask.run(); // 4. round finds changed status, thus log
         assertTrue(logRecorder.getLogContent().length() > 0);
         operationAppender.verifyLogHasHappened();
-- 
GitLab