diff --git a/deep_sequencing_unit/source/java/ch/ethz/bsse/cisd/dsu/dss/FlowLineFeeder.java b/deep_sequencing_unit/source/java/ch/ethz/bsse/cisd/dsu/dss/FlowLineFeeder.java index a9be637dad6488279f6fe1d4e48c39159793eb5a..144306f2bb868ad3b2f26d20cac0840915e581ee 100644 --- a/deep_sequencing_unit/source/java/ch/ethz/bsse/cisd/dsu/dss/FlowLineFeeder.java +++ b/deep_sequencing_unit/source/java/ch/ethz/bsse/cisd/dsu/dss/FlowLineFeeder.java @@ -24,6 +24,7 @@ import java.util.List; import java.util.Map; import java.util.Properties; +import ch.systemsx.cisd.common.Constants; import ch.systemsx.cisd.common.TimingParameters; import ch.systemsx.cisd.common.exceptions.ConfigurationFailureException; import ch.systemsx.cisd.common.exceptions.EnvironmentFailureException; @@ -82,7 +83,8 @@ class FlowLineFeeder implements IPostRegistrationDatasetHandler { String flowLine = extractFlowLine(file); File dropBox = createDropBoxFile(flowLine); - File flowLineDataSet = new File(dropBox, flowcellID + "_" + flowLine); + String fileName = flowcellID + "_" + flowLine; + File flowLineDataSet = new File(dropBox, fileName); if (flowLineDataSet.exists()) { throw new EnvironmentFailureException("There is already a data set for flow line " @@ -103,6 +105,9 @@ class FlowLineFeeder implements IPostRegistrationDatasetHandler + file.getAbsolutePath() + "' in folder '" + flowLineDataSet.getAbsolutePath() + "'."); } + File markerFile = new File(dropBox, Constants.IS_FINISHED_PREFIX + fileName); + flowLineDataSets.add(markerFile); + FileUtilities.writeToFile(markerFile, ""); } } @@ -198,7 +203,10 @@ class FlowLineFeeder implements IPostRegistrationDatasetHandler { for (File file : flowLineDataSets) { - fileOperations.deleteRecursively(file); + if (file.exists()) + { + fileOperations.deleteRecursively(file); + } } } diff --git a/deep_sequencing_unit/sourceTest/java/ch/ethz/bsse/cisd/dsu/dss/FlowLineFeederTest.java b/deep_sequencing_unit/sourceTest/java/ch/ethz/bsse/cisd/dsu/dss/FlowLineFeederTest.java index 20698af13e3059cb52d34226c8e4539e034d3a48..b91f946efd50575487485cc63d4f22dc3ed45f2b 100644 --- a/deep_sequencing_unit/sourceTest/java/ch/ethz/bsse/cisd/dsu/dss/FlowLineFeederTest.java +++ b/deep_sequencing_unit/sourceTest/java/ch/ethz/bsse/cisd/dsu/dss/FlowLineFeederTest.java @@ -31,6 +31,7 @@ import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; import ch.systemsx.cisd.base.tests.AbstractFileSystemTestCase; +import ch.systemsx.cisd.common.Constants; import ch.systemsx.cisd.common.exceptions.ConfigurationFailureException; import ch.systemsx.cisd.common.filesystem.FileUtilities; import ch.systemsx.cisd.common.test.AssertionUtil; @@ -186,8 +187,8 @@ public class FlowLineFeederTest extends AbstractFileSystemTestCase public void testUndoLastOperation() { testHappyCase(); - assertEquals(1, new File(workingDirectory, DROP_BOX_PREFIX + "1").list().length); - assertEquals(1, new File(workingDirectory, DROP_BOX_PREFIX + "2").list().length); + assertEquals(2, new File(workingDirectory, DROP_BOX_PREFIX + "1").list().length); + assertEquals(2, new File(workingDirectory, DROP_BOX_PREFIX + "2").list().length); flowLineFeeder.undoLastOperation(); @@ -245,7 +246,8 @@ public class FlowLineFeederTest extends AbstractFileSystemTestCase private void checkFlowLineDataSet(File originalFlowLine, String flowLineNumber) { File dropBox = new File(workingDirectory, DROP_BOX_PREFIX + flowLineNumber); - File ds = new File(dropBox, "abc_" + flowLineNumber); + String fileName = "abc_" + flowLineNumber; + File ds = new File(dropBox, fileName); assertEquals(true, ds.isDirectory()); File flowLine = new File(ds, originalFlowLine.getName()); @@ -257,6 +259,7 @@ public class FlowLineFeederTest extends AbstractFileSystemTestCase originalFlowLine.setLastModified(4711000); assertEquals(4711000, flowLine.lastModified()); assertEquals(true, new File(ds, FlowLineFeeder.META_DATA_FILE_NAME).exists()); + assertEquals(true, new File(dropBox, Constants.IS_FINISHED_PREFIX + fileName).exists()); } private Sample createFlowLineSample(int flowLineNumber)