use of org.jboss.pnc.spi.coordinator.events.DefaultBuildSetStatusChangedEvent in project pnc by project-ncl.
the class DefaultBuildCoordinator method sendSetStatusChangeEvent.
private void sendSetStatusChangeEvent(BuildSetTask buildSetTask, BuildSetStatus status, BuildSetStatus oldStatus, BuildConfigSetRecord record, String description) {
BuildSetStatusChangedEvent event = new DefaultBuildSetStatusChangedEvent(oldStatus, status, groupBuildMapper.toDTO(record), description);
log.debug("Notifying build set status update {}.", event);
buildSetStatusChangedEventNotifier.fire(event);
}
use of org.jboss.pnc.spi.coordinator.events.DefaultBuildSetStatusChangedEvent in project pnc by project-ncl.
the class WebSocketsNotificationTest method shouldReceiveBuildSetStatusChangeNotification.
@Test
@InSequence(3)
public void shouldReceiveBuildSetStatusChangeNotification() throws Exception {
// given
GroupBuild groupBuild = GroupBuild.builder().id("1").groupConfig(GroupConfigurationRef.refBuilder().id("1").name("BuildSet1").build()).startTime(Instant.ofEpochMilli(1453118400000L)).endTime(Instant.ofEpochMilli(1453122000000L)).user(User.builder().id("1").username("user1").build()).status(BuildStatus.SUCCESS).build();
BuildSetStatusChangedEvent buildStatusChangedEvent = new DefaultBuildSetStatusChangedEvent(BuildSetStatus.NEW, BuildSetStatus.DONE, groupBuild, "description");
String groupBuildString = mapperProvider.getMapper().writeValueAsString(groupBuild);
String expectedJsonResponse = "{\"groupBuild\":" + groupBuildString + ",\"job\":\"GROUP_BUILD\",\"notificationType\":\"GROUP_BUILD_STATUS_CHANGED\",\"progress\":\"FINISHED\",\"oldProgress\":\"IN_PROGRESS\",\"message\":null}";
// when
buildSetStatusNotificationEvent.fire(buildStatusChangedEvent);
// then
Wait.forCondition(() -> isReceived(expectedJsonResponse), 15, ChronoUnit.SECONDS);
}
Aggregations