From de5991b3ddbb130759de6b809587ca801ac15888 Mon Sep 17 00:00:00 2001 From: felmer <felmer> Date: Thu, 8 Oct 2009 09:21:20 +0000 Subject: [PATCH] LMS-1219 add .MARKER_IS_FINISHED file SVN: 12879 --- .../ch/ethz/bsse/cisd/dsu/dss/FlowLineFeeder.java | 12 ++++++++++-- .../ethz/bsse/cisd/dsu/dss/FlowLineFeederTest.java | 9 ++++++--- 2 files changed, 16 insertions(+), 5 deletions(-) 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 a9be637dad6..144306f2bb8 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 20698af13e3..b91f946efd5 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) -- GitLab