Search in sources :

Example 1 with DefaultBuildSetStatusChangedEvent

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);
}
Also used : BuildSetStatusChangedEvent(org.jboss.pnc.spi.events.BuildSetStatusChangedEvent) DefaultBuildSetStatusChangedEvent(org.jboss.pnc.spi.coordinator.events.DefaultBuildSetStatusChangedEvent) DefaultBuildSetStatusChangedEvent(org.jboss.pnc.spi.coordinator.events.DefaultBuildSetStatusChangedEvent)

Example 2 with DefaultBuildSetStatusChangedEvent

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);
}
Also used : GroupBuild(org.jboss.pnc.dto.GroupBuild) DefaultBuildSetStatusChangedEvent(org.jboss.pnc.spi.coordinator.events.DefaultBuildSetStatusChangedEvent) BuildSetStatusChangedEvent(org.jboss.pnc.spi.events.BuildSetStatusChangedEvent) DefaultBuildSetStatusChangedEvent(org.jboss.pnc.spi.coordinator.events.DefaultBuildSetStatusChangedEvent) ContainerTest(org.jboss.pnc.test.category.ContainerTest) Test(org.junit.Test) InSequence(org.jboss.arquillian.junit.InSequence)

Aggregations

DefaultBuildSetStatusChangedEvent (org.jboss.pnc.spi.coordinator.events.DefaultBuildSetStatusChangedEvent)2 BuildSetStatusChangedEvent (org.jboss.pnc.spi.events.BuildSetStatusChangedEvent)2 InSequence (org.jboss.arquillian.junit.InSequence)1 GroupBuild (org.jboss.pnc.dto.GroupBuild)1 ContainerTest (org.jboss.pnc.test.category.ContainerTest)1 Test (org.junit.Test)1