Skip to content
Snippets Groups Projects
Commit 06bbe861 authored by cramakri's avatar cramakri
Browse files

LMS-1947 Keep the lines in the order they were provided.

SVN: 19215
parent 41f0d020
No related branches found
No related tags found
No related merge requests found
...@@ -52,12 +52,18 @@ class SampleAndDataSetControlFileProcessor extends AbstractSampleAndDataSetProce ...@@ -52,12 +52,18 @@ class SampleAndDataSetControlFileProcessor extends AbstractSampleAndDataSetProce
private final File controlFile; private final File controlFile;
// Keep the errors as a map and array list for fast access and correct ordering
private final HashMap<SampleDataSetPair, IRegistrationStatus> errorMap = private final HashMap<SampleDataSetPair, IRegistrationStatus> errorMap =
new HashMap<SampleDataSetPair, IRegistrationStatus>(); new HashMap<SampleDataSetPair, IRegistrationStatus>();
private final ArrayList<SampleDataSetPair> errorPairs = new ArrayList<SampleDataSetPair>();
// Keep the successes as a map and array list for fast access and correct ordering
private final HashMap<SampleDataSetPair, IRegistrationStatus> successMap = private final HashMap<SampleDataSetPair, IRegistrationStatus> successMap =
new HashMap<SampleDataSetPair, IRegistrationStatus>(); new HashMap<SampleDataSetPair, IRegistrationStatus>();
private final ArrayList<SampleDataSetPair> successPairs = new ArrayList<SampleDataSetPair>();
private final HashSet<File> processedDataSetFiles = new HashSet<File>(); private final HashSet<File> processedDataSetFiles = new HashSet<File>();
// State that is filled out as a result of processing // State that is filled out as a result of processing
...@@ -293,9 +299,11 @@ class SampleAndDataSetControlFileProcessor extends AbstractSampleAndDataSetProce ...@@ -293,9 +299,11 @@ class SampleAndDataSetControlFileProcessor extends AbstractSampleAndDataSetProce
if (result.isError()) if (result.isError())
{ {
errorMap.put(sampleDataSet, result); errorMap.put(sampleDataSet, result);
errorPairs.add(sampleDataSet);
} else } else
{ {
successMap.put(sampleDataSet, result); successMap.put(sampleDataSet, result);
successPairs.add(sampleDataSet);
} }
} }
...@@ -348,7 +356,7 @@ class SampleAndDataSetControlFileProcessor extends AbstractSampleAndDataSetProce ...@@ -348,7 +356,7 @@ class SampleAndDataSetControlFileProcessor extends AbstractSampleAndDataSetProce
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append("Encountered errors in the following lines:\n"); sb.append("Encountered errors in the following lines:\n");
for (SampleDataSetPair pair : errorMap.keySet()) for (SampleDataSetPair pair : errorPairs)
{ {
IRegistrationStatus error = errorMap.get(pair); IRegistrationStatus error = errorMap.get(pair);
sb.append("# "); sb.append("# ");
...@@ -410,7 +418,7 @@ class SampleAndDataSetControlFileProcessor extends AbstractSampleAndDataSetProce ...@@ -410,7 +418,7 @@ class SampleAndDataSetControlFileProcessor extends AbstractSampleAndDataSetProce
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append("The following lines were successfully registered:\n"); sb.append("The following lines were successfully registered:\n");
for (SampleDataSetPair pair : successMap.keySet()) for (SampleDataSetPair pair : successPairs)
{ {
sb.append("# "); sb.append("# ");
String[] tokens = pair.getTokens(); String[] tokens = pair.getTokens();
......
...@@ -127,8 +127,8 @@ public class SampleAndDatasetRegistrationHandlerTest extends AbstractFileSystemT ...@@ -127,8 +127,8 @@ public class SampleAndDatasetRegistrationHandlerTest extends AbstractFileSystemT
+ "# Illegal empty identifier\n" + "# Illegal empty identifier\n"
+ "\t/MYSPACE/MYPROJ/EXP2\tVAL11\tVAL21\tVAL31\tFILE_TYPE\tVAL41\tVAL51\tds2/\n\n" + "\t/MYSPACE/MYPROJ/EXP2\tVAL11\tVAL21\tVAL31\tFILE_TYPE\tVAL41\tVAL51\tds2/\n\n"
+ "The following lines were successfully registered:\n" + "The following lines were successfully registered:\n"
+ "# /MYSPACE/S3\t/MYSPACE/MYPROJ/EXP3\tVAL12\tVAL22\tVAL32\tFILE_TYPE\tVAL42\tVAL52\tds3/\n" + "# /MYSPACE/S1\t/MYSPACE/MYPROJ/EXP1\tVAL10\tVAL20\tVAL30\tFILE_TYPE\tVAL40\tVAL50\tds1/\n"
+ "# /MYSPACE/S1\t/MYSPACE/MYPROJ/EXP1\tVAL10\tVAL20\tVAL30\tFILE_TYPE\tVAL40\tVAL50\tds1/\n"; + "# /MYSPACE/S3\t/MYSPACE/MYPROJ/EXP3\tVAL12\tVAL22\tVAL32\tFILE_TYPE\tVAL42\tVAL52\tds3/\n";
checkAppenderContent(logText, folderName); checkAppenderContent(logText, folderName);
context.assertIsSatisfied(); context.assertIsSatisfied();
......
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