use of com.mercedesbenz.sechub.sharedkernel.messaging.ClusterMemberMessage in project sechub by mercedes-benz.
the class SchedulerStartHandlerTest method schedulerHasBeenStarted.
@Test
public void schedulerHasBeenStarted() throws Exception {
/* prepare */
List<ScheduleSecHubJob> jobsRunningButStartedBefore = new ArrayList<>();
ScheduleSecHubJob job1 = mock(ScheduleSecHubJob.class);
UUID uuid1 = UUID.randomUUID();
when(job1.getUUID()).thenReturn(uuid1);
jobsRunningButStartedBefore.add(job1);
when(repository.findAllRunningJobsStartedBefore(any())).thenReturn(jobsRunningButStartedBefore);
/* execute */
handlerToTest.schedulerHasBeenStarted().run();
/* test */
ArgumentCaptor<DomainMessage> argument = ArgumentCaptor.forClass(DomainMessage.class);
verify(eventBus).sendAsynchron(argument.capture());
DomainMessage domainMessage = argument.getValue();
assertEquals(BASE_URL1, domainMessage.get(MessageDataKeys.ENVIRONMENT_BASE_URL));
ClusterMemberMessage status = domainMessage.get(MessageDataKeys.ENVIRONMENT_CLUSTER_MEMBER_STATUS);
assertNotNull(status);
assertEquals(HOSTNAME_1, status.getHostName());
}
Aggregations