Skip to content
Snippets Groups Projects
Commit 5b1560e7 authored by felmer's avatar felmer
Browse files

LMS-1404 improve error message in case of a flow lane occurs twice

SVN: 14989
parent b7913a32
No related branches found
No related tags found
No related merge requests found
......@@ -23,6 +23,7 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Properties;
......@@ -155,10 +156,15 @@ class FlowLaneFeeder extends AbstractPostRegistrationDataSetHandlerForFileBasedU
throw new EnvironmentFailureException("Only " + files.size()
+ " flow lane files found instead of " + flowLaneSampleMap.size() + ".");
}
Set<String> processedFlowLanes = new LinkedHashSet<String>();
for (File file : files)
{
List<String> srfInfo = getSRFInfo(file);
String flowLane = extractFlowLane(file);
if (processedFlowLanes.contains(flowLane))
{
throw new UserFailureException("Flow lane " + flowLane + " already registered.");
}
Sample flowLaneSample = flowLaneSampleMap.get(flowLane);
if (flowLaneSample == null)
{
......@@ -194,6 +200,7 @@ class FlowLaneFeeder extends AbstractPostRegistrationDataSetHandlerForFileBasedU
+ "' successfully dropped into drop box '" + dropBox + "' as '"
+ flowLaneDataSet.getName() + "'.");
}
processedFlowLanes.add(flowLane);
}
return Status.OK;
}
......
......@@ -235,6 +235,38 @@ public class FlowLaneFeederTest extends AbstractFileSystemTestCase
context.assertIsSatisfied();
}
@Test
public void testFlowLaneTwice()
{
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, "1.srf");
FileUtilities.writeToFile(originalFlowLane2, "hello second flow lane 1");
prepareLoadFlowCellSample(EXAMPLE_FLOW_CELL_SAMPLE);
Sample fl1 = createFlowLaneSample(1);
Sample fl2 = createFlowLaneSample(1);
prepareListFlowLanes(EXAMPLE_FLOW_CELL_SAMPLE, Arrays.asList(fl1, fl2));
prepareGetProperties(Arrays.asList(fl1));
try
{
flowLaneFeeder.handle(flowCell, EXAMPLE_DATA_SET_INFO);
fail("UserFailureException expected");
} catch (UserFailureException ex)
{
assertEquals("Flow lane 1 already registered.", ex.getMessage());
}
context.assertIsSatisfied();
}
@Test
public void testHappyCase()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment