use of org.jboss.pnc.dto.response.Vertex in project pnc by project-ncl.
the class BuildProviderImplTest method shouldGetGraphWithDependencies.
@Test
public void shouldGetGraphWithDependencies() {
// With
Integer buildSetTaskId = 1;
BuildSetTask buildSetTask = mock(BuildSetTask.class);
when(buildSetTask.getId()).thenReturn(buildSetTaskId);
BuildTask task = mockBuildTaskWithSet(buildSetTask);
BuildTask taskDep = mockBuildTaskWithSet(buildSetTask);
BuildTask taskDepDep = mockBuildTaskWithSet(buildSetTask);
when(task.getDependencies()).thenReturn(asSet(taskDep));
when(taskDep.getDependencies()).thenReturn(asSet(taskDepDep));
// When
Graph<Build> graph = provider.getBuildGraphForGroupBuild(Integer.toString(buildSetTaskId));
// Then
assertThat(graph.getVertices()).hasSize(3);
List<String> buildTaskIDsOrderedByBCName = Stream.of(task, taskDep, taskDepDep).sorted(Comparator.comparing(t -> t.getBuildConfigurationAudited().getName())).map(t -> t.getId()).collect(Collectors.toList());
assertThat(graph.getVertices().values().stream().map(Vertex::getName)).containsExactlyElementsOf(buildTaskIDsOrderedByBCName);
}
Aggregations