use of org.jboss.pnc.dto.notification.GroupBuildChangedNotification in project pnc by project-ncl.
the class DefaultNotifier method collectBuildSetStatusChangedEvent.
public void collectBuildSetStatusChangedEvent(@Observes BuildSetStatusChangedEvent buildSetStatusChangedEvent) {
logger.trace("Observed new set status changed event {}.", buildSetStatusChangedEvent);
sendMessage(new GroupBuildChangedNotification(buildSetStatusChangedEvent.getGroupBuild()));
logger.trace("Set status changed event processed {}.", buildSetStatusChangedEvent);
}
use of org.jboss.pnc.dto.notification.GroupBuildChangedNotification in project pnc by project-ncl.
the class WebSocketClientTest method testRestGroupBuildFallback.
@Test
public void testRestGroupBuildFallback() throws Exception {
// with
WebSocketSessionHandler handler = new WebSocketSessionHandler();
Undertow wsServer = withHandler(handler);
wsServer.start();
WebSocketClient wsClient = new VertxWebSocketClient();
wsClient.connect("ws://localhost:8082" + NOTIFICATION_PATH).join();
AdvancedGroupConfigurationClient groupConfigurationClient = new AdvancedGroupConfigurationClient(RestClientConfiguration.asUser());
GroupConfiguration gc = groupConfigurationClient.getAll().iterator().next();
// test the actual fallbackSupplier (it's private -> reflection unfortunately)
Method supplier = groupConfigurationClient.getClass().getDeclaredMethod("fallbackSupplier", String.class);
supplier.setAccessible(true);
// when
CompletableFuture<GroupBuildChangedNotification> future = wsClient.catchGroupBuildChangedNotification(() -> invokeMethod(supplier, GroupBuild.class, groupConfigurationClient, gc.getId()), withGConfigId(gc.getId()), withGBuildCompleted());
GroupBuild groupBuild = groupConfigurationClient.trigger(gc.getId(), new GroupBuildParameters(), GroupBuildRequest.builder().build());
// wait for GroupBuild to finish
ResponseUtils.waitSynchronouslyFor(() -> groupBuildToFinish(groupBuild.getId()), 15, TimeUnit.SECONDS);
// make client reconnect and use REST fallback
handler.closeSession();
// then
assertThat(future).succeedsWithin(500, TimeUnit.MILLISECONDS);
wsClient.close();
wsServer.stop();
}
Aggregations