use of org.jboss.pnc.client.BuildConfigurationClient in project pnc by project-ncl.
the class WebSocketClientTest method testNotificationCatcher.
@Test
public void testNotificationCatcher() throws Exception {
// with
WebSocketClient wsClient = new VertxWebSocketClient();
wsClient.connect(PNC_SOCKET_URL).get();
BuildConfigurationClient buildConfigurationClient = new BuildConfigurationClient(RestClientConfiguration.asUser());
BuildConfiguration bc = buildConfigurationClient.getAll().iterator().next();
// when
CompletableFuture<BuildChangedNotification> future = wsClient.catchBuildChangedNotification(withBuildConfiguration(bc.getId()), withBuildCompleted());
buildConfigurationClient.trigger(bc.getId(), new BuildParameters());
// then
assertThat(future).succeedsWithin(500, TimeUnit.MILLISECONDS);
BuildChangedNotification bcn = future.get();
assertThat(bcn).isNotNull();
assertThat(bcn.getBuild()).isNotNull();
assertThat(bcn.getBuild().getBuildConfigRevision().getId()).isEqualTo(bc.getId());
assertThat(bcn.getBuild().getStatus().isFinal()).isTrue();
wsClient.disconnect();
}
Aggregations