Skip to content

Commit 535969d

Browse files
committed
fix: multithreading fifo test
1 parent 9c363e1 commit 535969d

File tree

1 file changed

+8
-13
lines changed

1 file changed

+8
-13
lines changed

arc-core/src/test/java/fr/insee/arc/core/service/global/thread/MultiThreadingTest.java

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -44,28 +44,23 @@ public void dispatchFilesByNod_2ExecutorNods_allAllocatedTest()
4444
/**
4545
* files must be allocate to a target nod with consistency according to their name
4646
*/
47-
public void dispatchFilesByNod_2ExecutorNods_consistencyTest()
47+
public void dispatchFilesByNod_2ExecutorNods_fifoTest()
4848
{
49-
List<String> listIdSource1 = Arrays.asList("file1", "file2", "file3", "file4", "file5");
50-
List<String> listIdSource2 = Arrays.asList("file2", "file4", "file3", "file5", "file1");
49+
List<String> listIdSource = Arrays.asList("file1", "file2", "file3", "file4", "file5");
5150

5251
int startIndexOfExecutorNods=1;
5352
int numberOfExecutorNods=2;
5453

55-
Map<Integer, List<Integer>> filesByNods1 = MultiThreading.dispatchFilesByNodId(listIdSource1, startIndexOfExecutorNods,
56-
numberOfExecutorNods);
57-
Map<Integer, List<Integer>> filesByNods2 = MultiThreading.dispatchFilesByNodId(listIdSource2, startIndexOfExecutorNods,
54+
Map<Integer, List<Integer>> filesByNods1 = MultiThreading.dispatchFilesByNodId(listIdSource, startIndexOfExecutorNods,
5855
numberOfExecutorNods);
5956

6057
// test if both of file list has been allocated to same executor nod when the number of total executor nods is the same
6158

62-
List<String> filesInNods1OrderedByName = filesByNods1.get(1).stream().map(x->listIdSource1.get(x)).collect(Collectors.toList());
63-
List<String> filesInNods2OrderedByName= filesByNods2.get(1).stream().map(x->listIdSource2.get(x)).collect(Collectors.toList());
64-
65-
Collections.sort(filesInNods1OrderedByName);
66-
Collections.sort(filesInNods2OrderedByName);
67-
68-
assertEquals(filesInNods1OrderedByName,filesInNods2OrderedByName);
59+
List<String> filesInNods1OrderedByName = filesByNods1.get(1).stream().map(x->listIdSource.get(x)).collect(Collectors.toList());
60+
List<String> filesInNods2OrderedByName= filesByNods1.get(2).stream().map(x->listIdSource.get(x)).collect(Collectors.toList());
61+
62+
assertEquals(filesInNods1OrderedByName,Arrays.asList("file1","file3","file5"));
63+
assertEquals(filesInNods2OrderedByName,Arrays.asList("file2","file4"));
6964
}
7065

7166
}

0 commit comments

Comments
 (0)