From d24aa387599cfa2d763103f972a782f101bffb14 Mon Sep 17 00:00:00 2001
From: felmer <felmer>
Date: Mon, 26 Oct 2009 10:22:04 +0000
Subject: [PATCH] LMS-1233, LMS-1242

SVN: 13063
---
 ...lowLineFeeder.java => FlowLaneFeeder.java} | 105 +++++++------
 .../bsse/cisd/dsu/dss/StorageProcessor.java   |   2 +-
 ...eederTest.java => FlowLaneFeederTest.java} | 142 ++++++++++++------
 3 files changed, 148 insertions(+), 101 deletions(-)
 rename deep_sequencing_unit/source/java/ch/ethz/bsse/cisd/dsu/dss/{FlowLineFeeder.java => FlowLaneFeeder.java} (76%)
 rename deep_sequencing_unit/sourceTest/java/ch/ethz/bsse/cisd/dsu/dss/{FlowLineFeederTest.java => FlowLaneFeederTest.java} (73%)

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/FlowLaneFeeder.java
similarity index 76%
rename from deep_sequencing_unit/source/java/ch/ethz/bsse/cisd/dsu/dss/FlowLineFeeder.java
rename to deep_sequencing_unit/source/java/ch/ethz/bsse/cisd/dsu/dss/FlowLaneFeeder.java
index 6855c9a0214..7437b2861b3 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/FlowLaneFeeder.java
@@ -55,39 +55,39 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.SampleIdentifier;
 import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.SampleIdentifierFactory;
 
 /**
- * Post registration data set handler which makes a hard-link copy of all flow-line files
+ * Post registration data set handler which makes a hard-link copy of all flow-lane files
  * to associated drop boxes.
  *
  * @author Franz-Josef Elmer
  */
-class FlowLineFeeder implements IPostRegistrationDatasetHandler
+class FlowLaneFeeder implements IPostRegistrationDatasetHandler
 {
     static final String META_DATA_FILE_TYPE = ".tsv";
     static final String TRANSFER_PREFIX = "transfer.";
     static final String AFFILIATION_KEY = "AFFILIATION";
     static final String EXTERNAL_SAMPLE_NAME_KEY = "EXTERNAL_SAMPLE_NAME";
-    static final String FLOW_LINE_DROP_BOX_TEMPLATE = "flow-line-drop-box-template";
+    static final String FLOW_LANE_DROP_BOX_TEMPLATE = "flow-lane-drop-box-template";
     static final String ENTITY_SEPARATOR_KEY = "entity-separator";
     static final String DEFAULT_ENTITY_SEPARATOR = "_";
     static final String FILE_TYPE = ".srf";
     
     private final static Logger operationLog =
-            LogFactory.getLogger(LogCategory.OPERATION, FlowLineFeeder.class);
+            LogFactory.getLogger(LogCategory.OPERATION, FlowLaneFeeder.class);
     
     private final IEncapsulatedOpenBISService service;
-    private final MessageFormat flowLineDropBoxTemplate;
+    private final MessageFormat flowLaneDropBoxTemplate;
     private final String entitySepaparator;
     private final IImmutableCopier copier;
     private final IFileOperations fileOperations;
     private final List<File> createdFiles = new ArrayList<File>();
     private final Map<String, File> transferDropBoxes = new HashMap<String, File>();
     
-    FlowLineFeeder(Properties properties, IEncapsulatedOpenBISService service)
+    FlowLaneFeeder(Properties properties, IEncapsulatedOpenBISService service)
     {
         this.service = service;
-        flowLineDropBoxTemplate =
+        flowLaneDropBoxTemplate =
                 new MessageFormat(PropertyUtils.getMandatoryProperty(properties,
-                        FLOW_LINE_DROP_BOX_TEMPLATE));
+                        FLOW_LANE_DROP_BOX_TEMPLATE));
         entitySepaparator = properties.getProperty(ENTITY_SEPARATOR_KEY, DEFAULT_ENTITY_SEPARATOR);
         copier = FastRecursiveHardLinkMaker.tryCreate(TimingParameters.getDefaultParameters());
         fileOperations = FileOperations.getInstance();
@@ -110,47 +110,52 @@ class FlowLineFeeder implements IPostRegistrationDatasetHandler
 
     public void handle(File originalData, DataSetInformation dataSetInformation)
     {
-        Map<String, Sample> flowLineSampleMap = createFlowLineSampleMap(dataSetInformation);
+        Map<String, Sample> flowLaneSampleMap = createFlowLaneSampleMap(dataSetInformation);
         String flowcellID = originalData.getName();
         List<File> files = new ArrayList<File>();
         findFiles(originalData, files);
+        if (files.size() < flowLaneSampleMap.size())
+        {
+            throw new EnvironmentFailureException("Only " + files.size()
+                    + " flow lane files found instead of " + flowLaneSampleMap.size() + ".");
+        }
         for (File file : files)
         {
-            String flowLine = extractFlowLine(file);
-            Sample flowLineSample = flowLineSampleMap.get(flowLine);
-            File dropBox = createDropBoxFile(flowLine);
+            String flowLane = extractFlowLane(file);
+            Sample flowLaneSample = flowLaneSampleMap.get(flowLane);
+            File dropBox = createDropBoxFile(flowLane);
             String fileName =
-                    flowLineSample.getGroup().getCode() + entitySepaparator + flowcellID
-                            + SampleIdentifier.CONTAINED_SAMPLE_CODE_SEPARARTOR_STRING + flowLine;
-            File flowLineDataSet = new File(dropBox, fileName);
-            if (flowLineDataSet.exists())
+                    flowLaneSample.getGroup().getCode() + entitySepaparator + flowcellID
+                            + SampleIdentifier.CONTAINED_SAMPLE_CODE_SEPARARTOR_STRING + flowLane;
+            File flowLaneDataSet = new File(dropBox, fileName);
+            if (flowLaneDataSet.exists())
             {
-                throw new EnvironmentFailureException("There is already a data set for flow line "
-                        + flowLine + ".");
+                throw new EnvironmentFailureException("There is already a data set for flow lane "
+                        + flowLane + ".");
             }
-            createdFiles.add(flowLineDataSet);
-            boolean success = flowLineDataSet.mkdir();
+            createdFiles.add(flowLaneDataSet);
+            boolean success = flowLaneDataSet.mkdir();
             if (success == false)
             {
                 throw new EnvironmentFailureException("Couldn't create folder '"
-                        + flowLineDataSet.getAbsolutePath() + "'.");
+                        + flowLaneDataSet.getAbsolutePath() + "'.");
             }
-            createHartLink(file, flowLineDataSet);
-            createMetaDataFileAndHartLinkInTransferDropBox(flowLineDataSet, flowLineSample, flowLine);
+            createHartLink(file, flowLaneDataSet);
+            createMetaDataFileAndHartLinkInTransferDropBox(flowLaneDataSet, flowLaneSample, flowLane);
             File markerFile = new File(dropBox, Constants.IS_FINISHED_PREFIX + fileName);
             createdFiles.add(markerFile);
             FileUtilities.writeToFile(markerFile, "");
             if (operationLog.isInfoEnabled())
             {
-                operationLog.info("Flow line file '" + file
+                operationLog.info("Flow lane file '" + file
                         + "' successfully dropped into drop box '" + dropBox
-                        + "' as '" + flowLineDataSet.getName() + "'.");
+                        + "' as '" + flowLaneDataSet.getName() + "'.");
             }
         }
 
     }
 
-    private Map<String, Sample> createFlowLineSampleMap(DataSetInformation dataSetInformation)
+    private Map<String, Sample> createFlowLaneSampleMap(DataSetInformation dataSetInformation)
     {
         SampleIdentifier sampleIdentifier = dataSetInformation.getSampleIdentifier();
         Sample flowCell = service.tryGetSampleWithExperiment(sampleIdentifier);
@@ -160,27 +165,27 @@ class FlowLineFeeder implements IPostRegistrationDatasetHandler
         }
         TechId flowCellID = new TechId(flowCell.getId());
         ListSampleCriteria criteria = ListSampleCriteria.createForContainer(flowCellID);
-        List<Sample> flowLineSamples = service.listSamples(criteria);
-        Map<String, Sample> flowLineSampleMap = new LinkedHashMap<String, Sample>();
-        for (Sample flowLineSample : flowLineSamples)
+        List<Sample> flowLaneSamples = service.listSamples(criteria);
+        Map<String, Sample> flowLaneSampleMap = new LinkedHashMap<String, Sample>();
+        for (Sample flowLaneSample : flowLaneSamples)
         {
-            flowLineSampleMap.put(flowLineSample.getSubCode(), flowLineSample);
+            flowLaneSampleMap.put(flowLaneSample.getSubCode(), flowLaneSample);
         }
-        return flowLineSampleMap;
+        return flowLaneSampleMap;
     }
 
-    private void createMetaDataFileAndHartLinkInTransferDropBox(File flowLineDataSet,
-            Sample flowLineSample, String flowLine)
+    private void createMetaDataFileAndHartLinkInTransferDropBox(File flowLaneDataSet,
+            Sample flowLaneSample, String flowLane)
     {
-        if (flowLineSample == null)
+        if (flowLaneSample == null)
         {
-            throw new UserFailureException("No flow line sample for flow line " + flowLine + " exists");
+            throw new UserFailureException("No flow lane sample for flow lane " + flowLane + " exists");
         }
         StringBuilder builder = new StringBuilder();
-        addLine(builder, "Parent", flowLineSample.getGeneratedFrom().getIdentifier());
-        addLine(builder, "Code", flowLineSample.getCode());
-        addLine(builder, "Contact Person Email", flowLineSample.getRegistrator().getEmail());
-        SampleIdentifier identifier = SampleIdentifierFactory.parse(flowLineSample.getIdentifier());
+        addLine(builder, "Parent", flowLaneSample.getGeneratedFrom().getIdentifier());
+        addLine(builder, "Code", flowLaneSample.getCode());
+        addLine(builder, "Contact Person Email", flowLaneSample.getRegistrator().getEmail());
+        SampleIdentifier identifier = SampleIdentifierFactory.parse(flowLaneSample.getIdentifier());
         IEntityProperty[] properties = service.getPropertiesOfTopSampleRegisteredFor(identifier);
         File dropBox = null;
         String externalSampleName = null;
@@ -200,16 +205,16 @@ class FlowLineFeeder implements IPostRegistrationDatasetHandler
             }
         }
         String metaFileName =
-                flowLineSample.getCode()
+                flowLaneSample.getCode()
                         + (externalSampleName == null ? "" : "_" + externalSampleName) + META_DATA_FILE_TYPE;
-        FileUtilities.writeToFile(new File(flowLineDataSet, metaFileName), builder.toString());
+        FileUtilities.writeToFile(new File(flowLaneDataSet, metaFileName), builder.toString());
         if (dropBox != null)
         {
-            createHartLink(flowLineDataSet, dropBox);
-            createdFiles.add(new File(dropBox, flowLineDataSet.getName()));
+            createHartLink(flowLaneDataSet, dropBox);
+            createdFiles.add(new File(dropBox, flowLaneDataSet.getName()));
             if (operationLog.isInfoEnabled())
             {
-                operationLog.info("Flow line data set '" + flowLineDataSet.getName()
+                operationLog.info("Flow lane data set '" + flowLaneDataSet.getName()
                         + "' successfully transfered to drop box '" + dropBox + "'");
             }
         }
@@ -232,9 +237,9 @@ class FlowLineFeeder implements IPostRegistrationDatasetHandler
         }
     }
     
-    private File createDropBoxFile(String flowLine)
+    private File createDropBoxFile(String flowLane)
     {
-        File dropBox = new File(flowLineDropBoxTemplate.format(new Object[] {flowLine}));
+        File dropBox = new File(flowLaneDropBoxTemplate.format(new Object[] {flowLane}));
         if (dropBox.exists() == false)
         {
             throw new ConfigurationFailureException("Drop box '" + dropBox + "' does not exist.");
@@ -246,17 +251,17 @@ class FlowLineFeeder implements IPostRegistrationDatasetHandler
         return dropBox;
     }
 
-    private String extractFlowLine(File file)
+    private String extractFlowLane(File file)
     {
         String name = file.getName();
         String nameWithoutType = name.substring(0, name.lastIndexOf('.'));
         int lastIndexOfUnderScore = nameWithoutType.lastIndexOf('_');
-        String flowLine = nameWithoutType;
+        String flowLane = nameWithoutType;
         if (lastIndexOfUnderScore >= 0)
         {
-            flowLine = nameWithoutType.substring(lastIndexOfUnderScore + 1);
+            flowLane = nameWithoutType.substring(lastIndexOfUnderScore + 1);
         }
-        return flowLine;
+        return flowLane;
     }
     
     private void findFiles(File file, List<File> files)
diff --git a/deep_sequencing_unit/source/java/ch/ethz/bsse/cisd/dsu/dss/StorageProcessor.java b/deep_sequencing_unit/source/java/ch/ethz/bsse/cisd/dsu/dss/StorageProcessor.java
index d220b5a0934..88a841a840a 100644
--- a/deep_sequencing_unit/source/java/ch/ethz/bsse/cisd/dsu/dss/StorageProcessor.java
+++ b/deep_sequencing_unit/source/java/ch/ethz/bsse/cisd/dsu/dss/StorageProcessor.java
@@ -32,7 +32,7 @@ public class StorageProcessor extends DelegatingStorageProcessorWithDropbox
 {
     public StorageProcessor(Properties properties)
     {
-        super(properties, new FlowLineFeeder(properties, ServiceProvider.getOpenBISService()));
+        super(properties, new FlowLaneFeeder(properties, ServiceProvider.getOpenBISService()));
     }
 
 }
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/FlowLaneFeederTest.java
similarity index 73%
rename from deep_sequencing_unit/sourceTest/java/ch/ethz/bsse/cisd/dsu/dss/FlowLineFeederTest.java
rename to deep_sequencing_unit/sourceTest/java/ch/ethz/bsse/cisd/dsu/dss/FlowLaneFeederTest.java
index 875f6f50247..d785a3a8f47 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/FlowLaneFeederTest.java
@@ -34,6 +34,7 @@ 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.exceptions.EnvironmentFailureException;
 import ch.systemsx.cisd.common.filesystem.FileUtilities;
 import ch.systemsx.cisd.common.logging.LogInitializer;
 import ch.systemsx.cisd.common.test.AssertionUtil;
@@ -54,7 +55,7 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.SampleIdentifierFa
  *
  * @author Franz-Josef Elmer
  */
-public class FlowLineFeederTest extends AbstractFileSystemTestCase
+public class FlowLaneFeederTest extends AbstractFileSystemTestCase
 {
     private static final String AFFILIATION = "fmi";
     private static final String EXTERNAL_SAMPLE_NAME = "ext23";
@@ -79,7 +80,7 @@ public class FlowLineFeederTest extends AbstractFileSystemTestCase
         return sample;
     }
     
-    private FlowLineFeeder flowLineFeeder;
+    private FlowLaneFeeder flowLaneFeeder;
     private Mockery context;
     private IEncapsulatedOpenBISService service;
     private File dropBox1;
@@ -102,11 +103,11 @@ public class FlowLineFeederTest extends AbstractFileSystemTestCase
         transferDropBox = new File(workingDirectory, TRANSFER_DROP_BOX);
         assertEquals(true, transferDropBox.mkdirs());
         Properties properties = new Properties();
-        properties.setProperty(FlowLineFeeder.FLOW_LINE_DROP_BOX_TEMPLATE, new File(
+        properties.setProperty(FlowLaneFeeder.FLOW_LANE_DROP_BOX_TEMPLATE, new File(
                 workingDirectory, DROP_BOX_PREFIX).getAbsolutePath()
                 + "{0}");
-        properties.setProperty(FlowLineFeeder.TRANSFER_PREFIX + AFFILIATION, transferDropBox.getAbsolutePath());
-        flowLineFeeder = new FlowLineFeeder(properties, service);
+        properties.setProperty(FlowLaneFeeder.TRANSFER_PREFIX + AFFILIATION, transferDropBox.getAbsolutePath());
+        flowLaneFeeder = new FlowLaneFeeder(properties, service);
     }
     
     @AfterMethod
@@ -122,11 +123,11 @@ public class FlowLineFeederTest extends AbstractFileSystemTestCase
     {
         try
         {
-            new FlowLineFeeder(new Properties(), service);
+            new FlowLaneFeeder(new Properties(), service);
             fail("ConfigurationFailureException expected");
         } catch (ConfigurationFailureException ex)
         {
-            assertEquals("Given key '" + FlowLineFeeder.FLOW_LINE_DROP_BOX_TEMPLATE
+            assertEquals("Given key '" + FlowLaneFeeder.FLOW_LANE_DROP_BOX_TEMPLATE
                     + "' not found in properties '[]'", ex.getMessage());
         }
         
@@ -138,13 +139,13 @@ public class FlowLineFeederTest extends AbstractFileSystemTestCase
     {
         File flowCell = new File(workingDirectory, SAMPLE_CODE);
         assertEquals(true, flowCell.mkdir());
-        FileUtilities.writeToFile(new File(flowCell, "s_3.srf"), "hello flow line 3");
+        FileUtilities.writeToFile(new File(flowCell, "s_3.srf"), "hello flow lane 3");
         prepareLoadFlowCellSample(EXAMPLE_FLOW_CELL_SAMPLE);
-        prepareListFlowLines(EXAMPLE_FLOW_CELL_SAMPLE, Arrays.<Sample>asList());
+        prepareListFlowLanes(EXAMPLE_FLOW_CELL_SAMPLE, Arrays.<Sample>asList());
         
         try
         {
-            flowLineFeeder.handle(flowCell, EXAMPLE_DATA_SET_INFO);
+            flowLaneFeeder.handle(flowCell, EXAMPLE_DATA_SET_INFO);
             fail("ConfigurationFailureException expected");
         } catch (ConfigurationFailureException ex)
         {
@@ -162,7 +163,7 @@ public class FlowLineFeederTest extends AbstractFileSystemTestCase
         
         try
         {
-            flowLineFeeder.handle(flowCell, EXAMPLE_DATA_SET_INFO);
+            flowLaneFeeder.handle(flowCell, EXAMPLE_DATA_SET_INFO);
             fail("UserFailureException expected");
         } catch (UserFailureException ex)
         {
@@ -174,7 +175,7 @@ public class FlowLineFeederTest extends AbstractFileSystemTestCase
     }
     
     @Test
-    public void testHappyCase()
+    public void testNotEnoughFlowLaneFiles()
     {
         File flowCell = new File(workingDirectory, SAMPLE_CODE);
         assertEquals(true, flowCell.mkdir());
@@ -183,30 +184,61 @@ public class FlowLineFeederTest extends AbstractFileSystemTestCase
         FileUtilities.writeToFile(new File(logs, "basic.log"), "hello log");
         File srfFolder = new File(flowCell, "SRF");
         assertEquals(true, srfFolder.mkdir());
-        File originalFlowLine1 = new File(srfFolder, "s_1.srf");
-        FileUtilities.writeToFile(originalFlowLine1, "hello flow line 1");
-        File originalFlowLine2 = new File(srfFolder, "2.srf");
-        FileUtilities.writeToFile(originalFlowLine2, "hello flow line 2");
+        File originalFlowLane1 = new File(srfFolder, "s_1.srf");
+        FileUtilities.writeToFile(originalFlowLane1, "hello flow lane 1");
         prepareLoadFlowCellSample(EXAMPLE_FLOW_CELL_SAMPLE);
         
-        Sample fl1 = createFlowLineSample(1);
-        Sample fl2 = createFlowLineSample(2);
-        prepareListFlowLines(EXAMPLE_FLOW_CELL_SAMPLE, Arrays.asList(fl1, fl2));
+        Sample fl1 = createFlowLaneSample(1);
+        Sample fl2 = createFlowLaneSample(2);
+        prepareListFlowLanes(EXAMPLE_FLOW_CELL_SAMPLE, Arrays.asList(fl1, fl2));
 
-        flowLineFeeder.handle(flowCell, EXAMPLE_DATA_SET_INFO);
+        try
+        {
+            flowLaneFeeder.handle(flowCell, EXAMPLE_DATA_SET_INFO);
+            fail("EnvironmentFailureException expected");
+        } catch (EnvironmentFailureException ex)
+        {
+            assertEquals("Only 1 flow lane files found instead of 2.", ex.getMessage());
+        }
+        
+        context.assertIsSatisfied();
+    }
+    
+    @Test
+    public void testHappyCase()
+    {
+        File flowCell = new File(workingDirectory, SAMPLE_CODE);
+        assertEquals(true, flowCell.mkdir());
+        File logs = new File(flowCell, "logs");
+        assertEquals(true, logs.mkdir());
+        FileUtilities.writeToFile(new File(logs, "basic.log"), "hello log");
+        File srfFolder = new File(flowCell, "SRF");
+        assertEquals(true, srfFolder.mkdir());
+        File originalFlowLane1 = new File(srfFolder, "s_1.srf");
+        FileUtilities.writeToFile(originalFlowLane1, "hello flow lane 1");
+        File originalFlowLane2 = new File(srfFolder, "2.srf");
+        FileUtilities.writeToFile(originalFlowLane2, "hello flow lane 2");
+        prepareLoadFlowCellSample(EXAMPLE_FLOW_CELL_SAMPLE);
         
-        checkFlowLineDataSet(originalFlowLine1, "1");
-        checkFlowLineDataSet(originalFlowLine2, "2");
+        Sample fl1 = createFlowLaneSample(1);
+        Sample fl2 = createFlowLaneSample(2);
+        prepareListFlowLanes(EXAMPLE_FLOW_CELL_SAMPLE, Arrays.asList(fl1, fl2));
+        prepareGetProperties(Arrays.asList(fl1, fl2));
+        
+        flowLaneFeeder.handle(flowCell, EXAMPLE_DATA_SET_INFO);
+        
+        checkFlowLaneDataSet(originalFlowLane1, "1");
+        checkFlowLaneDataSet(originalFlowLane2, "2");
         
         File[] transferedFiles = transferDropBox.listFiles();
         assertEquals(1, transferedFiles.length);
         String sampleName =
                 SAMPLE_CODE + SampleIdentifier.CONTAINED_SAMPLE_CODE_SEPARARTOR_STRING + "2";
         assertEquals("G2_" + sampleName, transferedFiles[0].getName());
-        File metaFile = getFile(transferedFiles[0], FlowLineFeeder.META_DATA_FILE_TYPE);
-        assertEquals(sampleName + "_" + EXTERNAL_SAMPLE_NAME + FlowLineFeeder.META_DATA_FILE_TYPE,
+        File metaFile = getFile(transferedFiles[0], FlowLaneFeeder.META_DATA_FILE_TYPE);
+        assertEquals(sampleName + "_" + EXTERNAL_SAMPLE_NAME + FlowLaneFeeder.META_DATA_FILE_TYPE,
                 metaFile.getName());
-        assertHardLinkOnSameFile(originalFlowLine2, getFile(transferedFiles[0], "2.srf"));
+        assertHardLinkOnSameFile(originalFlowLane2, getFile(transferedFiles[0], "2.srf"));
         
         context.assertIsSatisfied();
     }
@@ -232,7 +264,7 @@ public class FlowLineFeederTest extends AbstractFileSystemTestCase
         assertEquals(2, dropBox2.list().length);
         assertEquals(1, transferDropBox.list().length);
         
-        flowLineFeeder.undoLastOperation();
+        flowLaneFeeder.undoLastOperation();
         
         assertEquals(0, dropBox1.list().length);
         assertEquals(0, dropBox2.list().length);
@@ -250,7 +282,7 @@ public class FlowLineFeederTest extends AbstractFileSystemTestCase
             });
     }
     
-    private void prepareListFlowLines(final Sample flowCellSample, final List<Sample> flowLineSamples)
+    private void prepareListFlowLanes(final Sample flowCellSample, final List<Sample> flowLaneSamples)
     {
         context.checking(new Expectations()
             {
@@ -275,8 +307,17 @@ public class FlowLineFeederTest extends AbstractFileSystemTestCase
                                         + flowCellSample.getId());
                             }
                         }));
-                    will(returnValue(flowLineSamples));
-                    for (Sample sample : flowLineSamples)
+                    will(returnValue(flowLaneSamples));
+                }
+            });
+    }
+
+    private void prepareGetProperties(final List<Sample> flowLaneSamples)
+    {
+        context.checking(new Expectations()
+            {
+                {
+                    for (Sample sample : flowLaneSamples)
                     {
                         SampleIdentifier identifier =
                                 SampleIdentifierFactory.parse(sample.getIdentifier());
@@ -284,11 +325,12 @@ public class FlowLineFeederTest extends AbstractFileSystemTestCase
                         if (sample.getSubCode().equals("2"))
                         {
                             GenericValueEntityProperty p1 =
-                                    createProperty(FlowLineFeeder.AFFILIATION_KEY, AFFILIATION);
+                                    createProperty(FlowLaneFeeder.AFFILIATION_KEY, AFFILIATION);
                             GenericValueEntityProperty p2 =
-                                    createProperty(FlowLineFeeder.EXTERNAL_SAMPLE_NAME_KEY,
+                                    createProperty(FlowLaneFeeder.EXTERNAL_SAMPLE_NAME_KEY,
                                             EXTERNAL_SAMPLE_NAME);
-                            will(returnValue(new GenericValueEntityProperty[] {p1, p2}));
+                            will(returnValue(new GenericValueEntityProperty[]
+                                { p1, p2 }));
                         }
                     }
                 }
@@ -305,26 +347,26 @@ public class FlowLineFeederTest extends AbstractFileSystemTestCase
                 }
             });
     }
-
-    private void checkFlowLineDataSet(File originalFlowLine, String flowLineNumber)
+    
+    private void checkFlowLaneDataSet(File originalFlowLane, String flowLaneNumber)
     {
-        File dropBox = new File(workingDirectory, DROP_BOX_PREFIX + flowLineNumber);
-        String flowLineSampleCode =
+        File dropBox = new File(workingDirectory, DROP_BOX_PREFIX + flowLaneNumber);
+        String flowLaneSampleCode =
                 SAMPLE_CODE + SampleIdentifier.CONTAINED_SAMPLE_CODE_SEPARARTOR_STRING
-                        + flowLineNumber;
+                        + flowLaneNumber;
         String fileName =
-                "G" + flowLineNumber + FlowLineFeeder.DEFAULT_ENTITY_SEPARATOR + flowLineSampleCode;
+                "G" + flowLaneNumber + FlowLaneFeeder.DEFAULT_ENTITY_SEPARATOR + flowLaneSampleCode;
         File ds = new File(dropBox, fileName);
         assertEquals(true, ds.isDirectory());
 
-        File flowLine = new File(ds, originalFlowLine.getName());
-        assertEquals(true, flowLine.isFile());
-        assertEquals(FileUtilities.loadToString(originalFlowLine), FileUtilities
-                .loadToString(flowLine));
-        assertHardLinkOnSameFile(originalFlowLine, flowLine);
+        File flowLane = new File(ds, originalFlowLane.getName());
+        assertEquals(true, flowLane.isFile());
+        assertEquals(FileUtilities.loadToString(originalFlowLane), FileUtilities
+                .loadToString(flowLane));
+        assertHardLinkOnSameFile(originalFlowLane, flowLane);
         String metaDataFileName =
-                flowLineSampleCode + (flowLineNumber.equals("2") ? "_" + EXTERNAL_SAMPLE_NAME : "")
-                        + FlowLineFeeder.META_DATA_FILE_TYPE;
+                flowLaneSampleCode + (flowLaneNumber.equals("2") ? "_" + EXTERNAL_SAMPLE_NAME : "")
+                        + FlowLaneFeeder.META_DATA_FILE_TYPE;
         assertEquals(true, new File(ds, metaDataFileName).exists());
         assertEquals(true, new File(dropBox, Constants.IS_FINISHED_PREFIX + fileName).exists());
     }
@@ -337,21 +379,21 @@ public class FlowLineFeederTest extends AbstractFileSystemTestCase
         assertEquals(4711000, file2.lastModified());
     }
     
-    private Sample createFlowLineSample(int flowLineNumber)
+    private Sample createFlowLaneSample(int flowLaneNumber)
     {
         Sample sample = new Sample();
         sample.setCode(SAMPLE_CODE + SampleIdentifier.CONTAINED_SAMPLE_CODE_SEPARARTOR_STRING
-                + flowLineNumber);
+                + flowLaneNumber);
         Group group = new Group();
-        group.setCode("G" + flowLineNumber);
+        group.setCode("G" + flowLaneNumber);
         sample.setGroup(group);
-        sample.setSubCode(Integer.toString(flowLineNumber));
+        sample.setSubCode(Integer.toString(flowLaneNumber));
         sample.setGeneratedFrom(EXAMPLE_FLOW_CELL_SAMPLE);
         Person registrator = new Person();
         registrator.setEmail("ab@c.de");
         sample.setRegistrator(registrator);
         sample.setIdentifier(SAMPLE_CODE + SampleIdentifier.CONTAINED_SAMPLE_CODE_SEPARARTOR_STRING
-                + flowLineNumber);
+                + flowLaneNumber);
         return sample;
     }
     
-- 
GitLab