Search in sources :

Example 66 with DomainMessage

use of com.mercedesbenz.sechub.sharedkernel.messaging.DomainMessage in project sechub by mercedes-benz.

the class NotificationMessageHandlerTest method an_event_about_email_updatedeleted_user_triggers_UserEmailAddressChangedNotificationService.

@Test
public void an_event_about_email_updatedeleted_user_triggers_UserEmailAddressChangedNotificationService() {
    /* prepare */
    UserMessage userMessage = mock(UserMessage.class);
    DomainMessage request = mock(DomainMessage.class);
    when(request.getMessageId()).thenReturn(MessageID.USER_EMAIL_ADDRESS_CHANGED);
    when(request.get(MessageDataKeys.USER_EMAIL_ADDRESS_CHANGE_DATA)).thenReturn(userMessage);
    /* execute */
    handlerToTest.receiveAsyncMessage(request);
    /* test */
    verify(mockedUserEmailAddressChangedNotificationService).notify(userMessage);
}
Also used : UserMessage(com.mercedesbenz.sechub.sharedkernel.messaging.UserMessage) DomainMessage(com.mercedesbenz.sechub.sharedkernel.messaging.DomainMessage) Test(org.junit.Test)

Example 67 with DomainMessage

use of com.mercedesbenz.sechub.sharedkernel.messaging.DomainMessage in project sechub by mercedes-benz.

the class NotificationMessageHandlerTest method an_event_about_requested_new_api_token_triggers_newApiTokenRequestedUserNotificationService.

@Test
public void an_event_about_requested_new_api_token_triggers_newApiTokenRequestedUserNotificationService() {
    /* prepare */
    UserMessage userMessage = mock(UserMessage.class);
    DomainMessage request = mock(DomainMessage.class);
    when(request.getMessageId()).thenReturn(MessageID.USER_NEW_API_TOKEN_REQUESTED);
    when(request.get(MessageDataKeys.USER_ONE_TIME_TOKEN_INFO)).thenReturn(userMessage);
    /* execute */
    handlerToTest.receiveAsyncMessage(request);
    /* test */
    verify(mockedNewApiTokenRequestedUserNotificationService).notify(userMessage);
}
Also used : UserMessage(com.mercedesbenz.sechub.sharedkernel.messaging.UserMessage) DomainMessage(com.mercedesbenz.sechub.sharedkernel.messaging.DomainMessage) Test(org.junit.Test)

Example 68 with DomainMessage

use of com.mercedesbenz.sechub.sharedkernel.messaging.DomainMessage in project sechub by mercedes-benz.

the class NotificationMessageHandlerTest method an_event_about_deleted_project_triggers_3_snotification_ervices.

@Test
public void an_event_about_deleted_project_triggers_3_snotification_ervices() {
    /* prepare */
    ProjectMessage projectMessage = mock(ProjectMessage.class);
    DomainMessage request = mock(DomainMessage.class);
    when(request.getMessageId()).thenReturn(MessageID.PROJECT_DELETED);
    when(request.get(MessageDataKeys.PROJECT_DELETE_DATA)).thenReturn(projectMessage);
    when(request.get(MessageDataKeys.ENVIRONMENT_BASE_URL)).thenReturn("base1");
    /* execute */
    handlerToTest.receiveAsyncMessage(request);
    /* test */
    verify(mockedInformAdminsThatProjectHasBeenDeletedNotificationService).notify(projectMessage, "base1");
    verify(mockedInformOwnerThatProjectHasBeenDeletedNotificationService).notify(projectMessage, "base1");
    verify(mockedInformUsersThatProjectHasBeenDeletedNotificationService).notify(projectMessage, "base1");
}
Also used : ProjectMessage(com.mercedesbenz.sechub.sharedkernel.messaging.ProjectMessage) DomainMessage(com.mercedesbenz.sechub.sharedkernel.messaging.DomainMessage) Test(org.junit.Test)

Example 69 with DomainMessage

use of com.mercedesbenz.sechub.sharedkernel.messaging.DomainMessage in project sechub by mercedes-benz.

the class ScanProgressMonitor method sendRequestBatchJobStatusRequestSynchron.

@IsSendingSyncMessage(MessageID.REQUEST_BATCH_JOB_STATUS)
protected BatchJobMessage sendRequestBatchJobStatusRequestSynchron() {
    DomainMessage request = new DomainMessage(MessageID.REQUEST_BATCH_JOB_STATUS);
    BatchJobMessage statusRequestMessage = new BatchJobMessage();
    statusRequestMessage.setBatchJobId(batchJobId);
    request.set(MessageDataKeys.BATCH_JOB_STATUS, statusRequestMessage);
    /* ask for status */
    DomainMessageSynchronousResult response = eventBus.sendSynchron(request);
    BatchJobMessage jobStatusRepsonse = response.get(MessageDataKeys.BATCH_JOB_STATUS);
    return jobStatusRepsonse;
}
Also used : DomainMessageSynchronousResult(com.mercedesbenz.sechub.sharedkernel.messaging.DomainMessageSynchronousResult) BatchJobMessage(com.mercedesbenz.sechub.sharedkernel.messaging.BatchJobMessage) DomainMessage(com.mercedesbenz.sechub.sharedkernel.messaging.DomainMessage) IsSendingSyncMessage(com.mercedesbenz.sechub.sharedkernel.messaging.IsSendingSyncMessage)

Aggregations

DomainMessage (com.mercedesbenz.sechub.sharedkernel.messaging.DomainMessage)69 IsSendingAsyncMessage (com.mercedesbenz.sechub.sharedkernel.messaging.IsSendingAsyncMessage)31 UserMessage (com.mercedesbenz.sechub.sharedkernel.messaging.UserMessage)21 Test (org.junit.Test)18 Test (org.junit.jupiter.api.Test)13 ProjectMessage (com.mercedesbenz.sechub.sharedkernel.messaging.ProjectMessage)10 DomainMessageSynchronousResult (com.mercedesbenz.sechub.sharedkernel.messaging.DomainMessageSynchronousResult)8 JobMessage (com.mercedesbenz.sechub.sharedkernel.messaging.JobMessage)6 AdministrationConfigMessage (com.mercedesbenz.sechub.sharedkernel.messaging.AdministrationConfigMessage)5 BatchJobMessage (com.mercedesbenz.sechub.sharedkernel.messaging.BatchJobMessage)4 SecHubConfiguration (com.mercedesbenz.sechub.sharedkernel.configuration.SecHubConfiguration)3 IsSendingSyncMessage (com.mercedesbenz.sechub.sharedkernel.messaging.IsSendingSyncMessage)3 UUID (java.util.UUID)3 ScheduleSecHubJob (com.mercedesbenz.sechub.domain.schedule.job.ScheduleSecHubJob)2 SecHubExecutionException (com.mercedesbenz.sechub.sharedkernel.execution.SecHubExecutionException)2 SecHubRuntimeException (com.mercedesbenz.sechub.commons.model.SecHubRuntimeException)1 AdministrationAutoCleanupConfig (com.mercedesbenz.sechub.domain.administration.autocleanup.AdministrationAutoCleanupConfig)1 User (com.mercedesbenz.sechub.domain.administration.user.User)1 ScanMockData (com.mercedesbenz.sechub.domain.scan.project.ScanMockData)1 ScanProjectConfig (com.mercedesbenz.sechub.domain.scan.project.ScanProjectConfig)1