use of com.mercedesbenz.sechub.sharedkernel.messaging.DomainMessage in project sechub by mercedes-benz.
the class SchedulerRestartJobService method sendJobRestartCanceled.
@IsSendingAsyncMessage(MessageID.JOB_RESTART_CANCELED)
private void sendJobRestartCanceled(JobDataContext context) {
DomainMessage request = DomainMessageFactory.createEmptyRequest(MessageID.JOB_RESTART_CANCELED);
JobMessage message = new JobMessage();
message.setJobUUID(context.sechubJobUUID);
message.setProjectId(context.projectId);
message.setOwner(context.owner);
message.setOwnerEmailAddress(context.ownerEmailAddress);
message.setInfo(context.info);
request.set(MessageDataKeys.JOB_RESTART_DATA, message);
request.set(MessageDataKeys.ENVIRONMENT_BASE_URL, sechubEnvironment.getServerBaseUrl());
eventBus.sendAsynchron(request);
}
use of com.mercedesbenz.sechub.sharedkernel.messaging.DomainMessage in project sechub by mercedes-benz.
the class SchedulerRestartJobService method sendJobRestartTriggered.
@IsSendingAsyncMessage(MessageID.JOB_RESTART_TRIGGERED)
private void sendJobRestartTriggered(ScheduleSecHubJob secHubJob, String ownerEmailAddress) {
DomainMessage request = DomainMessageFactory.createEmptyRequest(MessageID.JOB_RESTART_TRIGGERED);
JobMessage message = new JobMessage();
message.setJobUUID(secHubJob.getUUID());
message.setProjectId(secHubJob.getProjectId());
message.setOwner(secHubJob.getOwner());
message.setOwnerEmailAddress(ownerEmailAddress);
request.set(MessageDataKeys.JOB_RESTART_DATA, message);
request.set(MessageDataKeys.ENVIRONMENT_BASE_URL, sechubEnvironment.getServerBaseUrl());
eventBus.sendAsynchron(request);
}
use of com.mercedesbenz.sechub.sharedkernel.messaging.DomainMessage in project sechub by mercedes-benz.
the class SchedulerRestartJobService method sendPurgeJobResultsSynchronousRequest.
@IsSendingSyncMessage(MessageID.REQUEST_PURGE_JOB_RESULTS)
private void sendPurgeJobResultsSynchronousRequest(ScheduleSecHubJob secHubJob) {
DomainMessage request = DomainMessageFactory.createEmptyRequest(MessageID.REQUEST_PURGE_JOB_RESULTS);
request.set(MessageDataKeys.SECHUB_UUID, secHubJob.getUUID());
request.set(MessageDataKeys.ENVIRONMENT_BASE_URL, sechubEnvironment.getServerBaseUrl());
DomainMessageSynchronousResult result = eventBus.sendSynchron(request);
if (result.hasFailed()) {
throw new SecHubRuntimeException("Purge failed!");
}
}
use of com.mercedesbenz.sechub.sharedkernel.messaging.DomainMessage in project sechub by mercedes-benz.
the class UserEmailAddressUpdateServiceTest method sends_event_with_user_data_when_parameters_are_valid.
@Test
void sends_event_with_user_data_when_parameters_are_valid() {
/* prepare */
User knownUser1 = createKnownUser1();
when(userRepository.findOrFailUser(KNOWN_USER1)).thenReturn(knownUser1);
/* execute */
serviceToTest.updateUserEmailAddress(KNOWN_USER1, "new.user1@example.com");
/* test */
// check event is sent with expected data
ArgumentCaptor<DomainMessage> messageCaptor = ArgumentCaptor.forClass(DomainMessage.class);
verify(eventBusService).sendAsynchron(messageCaptor.capture());
UserMessage userMessage = messageCaptor.getValue().get(MessageDataKeys.USER_EMAIL_ADDRESS_CHANGE_DATA);
assertNotNull(userMessage);
assertEquals(KNOWN_USER1, userMessage.getUserId());
assertEquals("new.user1@example.com", userMessage.getEmailAdress());
assertEquals("former.user1@example.com", userMessage.getFormerEmailAddress());
}
use of com.mercedesbenz.sechub.sharedkernel.messaging.DomainMessage in project sechub by mercedes-benz.
the class NotificationMessageHandlerTest method an_event_about_deleted_user_triggers_UserDeletedNotificationService.
@Test
public void an_event_about_deleted_user_triggers_UserDeletedNotificationService() {
/* prepare */
UserMessage userMessage = mock(UserMessage.class);
DomainMessage request = mock(DomainMessage.class);
when(request.getMessageId()).thenReturn(MessageID.USER_DELETED);
when(request.get(MessageDataKeys.USER_DELETE_DATA)).thenReturn(userMessage);
/* execute */
handlerToTest.receiveAsyncMessage(request);
/* test */
verify(mockedUserDeletedNotificationService).notify(userMessage);
}
Aggregations