@Test
public void testDedupNodesPerStage() throws Exception {
List<Set<ClusterTask>> tasks = ImmutableList.of(
createSortedSet(createClusterTask("INSTALL", "1-1-1", "host1"),
createClusterTask("CONFIGURE", "1-1-2", "host1"),
createClusterTask("INSTALL", "1-1-3", "host3")),
createSortedSet(createClusterTask("INSTALL", "1-1-12", "host1"),
createClusterTask("INSTALL", "1-1-22", "host2"),
createClusterTask("INSTALL", "1-1-32", "host3")),
createSortedSet(createClusterTask("INSTALL", "1-1-13", "host1"),
createClusterTask("CONFIGURE", "1-1-22", "host1"),
createClusterTask("INSTALL", "1-1-32", "host3"))
);
List<Set<ClusterTask>> actual = JobPlanner.deDupNodePerStage(tasks);
List<Set<ClusterTask>> expected = ImmutableList.of(
createSortedSet(createClusterTask("INSTALL", "1-1-1", "host1"),
createClusterTask("INSTALL", "1-1-3", "host3")),
createSortedSet(createClusterTask("CONFIGURE", "1-1-2", "host1")),
createSortedSet(createClusterTask("INSTALL", "1-1-12", "host1"),
createClusterTask("INSTALL", "1-1-22", "host2"),
createClusterTask("INSTALL", "1-1-32", "host3")),
createSortedSet(createClusterTask("INSTALL", "1-1-13", "host1"),
createClusterTask("INSTALL", "1-1-32", "host3")),
createSortedSet(createClusterTask("CONFIGURE", "1-1-22", "host1"))
);
Assert.assertEquals(expected, actual);
}