Search in sources :

Example 1 with DomainMessage

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

the class JobAdministrationMessageHandlerTest method handler_receiving_auto_cleanup_calls_config_service_with_message_data.

@Test
void handler_receiving_auto_cleanup_calls_config_service_with_message_data() {
    /* prepare */
    long days = System.nanoTime();
    AdministrationConfigMessage configMessage = new AdministrationConfigMessage();
    configMessage.setAutoCleanupInDays(days);
    DomainMessage message = new DomainMessage(MessageID.AUTO_CLEANUP_CONFIGURATION_CHANGED);
    message.set(MessageDataKeys.AUTO_CLEANUP_CONFIG_CHANGE_DATA, configMessage);
    /* execute */
    handlerToTest.receiveAsyncMessage(message);
    /* test */
    verify(configService).updateAutoCleanupInDays(days);
}
Also used : AdministrationConfigMessage(com.mercedesbenz.sechub.sharedkernel.messaging.AdministrationConfigMessage) DomainMessage(com.mercedesbenz.sechub.sharedkernel.messaging.DomainMessage) Test(org.junit.jupiter.api.Test)

Example 2 with DomainMessage

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

the class ProjectAssignUserService method sendUserAddedToProjectEvent.

@IsSendingAsyncMessage(MessageID.USER_ADDED_TO_PROJECT)
private void sendUserAddedToProjectEvent(String projectId, User user) {
    DomainMessage request = new DomainMessage(MessageID.USER_ADDED_TO_PROJECT);
    UserMessage projectToUserData = new UserMessage();
    projectToUserData.setUserId(user.getName());
    projectToUserData.setProjectIds(Arrays.asList(projectId));
    request.set(MessageDataKeys.PROJECT_TO_USER_DATA, projectToUserData);
    eventBus.sendAsynchron(request);
}
Also used : UserMessage(com.mercedesbenz.sechub.sharedkernel.messaging.UserMessage) DomainMessage(com.mercedesbenz.sechub.sharedkernel.messaging.DomainMessage) IsSendingAsyncMessage(com.mercedesbenz.sechub.sharedkernel.messaging.IsSendingAsyncMessage)

Example 3 with DomainMessage

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

the class ProjectChangeAccessLevelService method sendProjectAccessLevelChangedEvent.

@IsSendingAsyncMessage(MessageID.PROJECT_ACCESS_LEVEL_CHANGED)
private void sendProjectAccessLevelChangedEvent(Project project, ProjectAccessLevel formerAccessLevel) {
    DomainMessage request = new DomainMessage(MessageID.PROJECT_ACCESS_LEVEL_CHANGED);
    ProjectMessage projectData = new ProjectMessage();
    projectData.setProjectId(project.id);
    projectData.setFormerAccessLevel(formerAccessLevel);
    projectData.setNewAccessLevel(project.getAccessLevel());
    request.set(MessageDataKeys.PROJECT_ACCESS_LEVEL_CHANGE_DATA, projectData);
    eventBus.sendAsynchron(request);
}
Also used : ProjectMessage(com.mercedesbenz.sechub.sharedkernel.messaging.ProjectMessage) DomainMessage(com.mercedesbenz.sechub.sharedkernel.messaging.DomainMessage) IsSendingAsyncMessage(com.mercedesbenz.sechub.sharedkernel.messaging.IsSendingAsyncMessage)

Example 4 with DomainMessage

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

the class ProjectChangeOwnerService method sendOwnerChangedForProjectEvent.

@IsSendingAsyncMessage(MessageID.PROJECT_OWNER_CHANGED)
private void sendOwnerChangedForProjectEvent(Project project, User previousOwner, User newOwner) {
    DomainMessage request = new DomainMessage(MessageID.PROJECT_OWNER_CHANGED);
    ProjectMessage projectData = new ProjectMessage();
    projectData.setProjectId(project.id);
    projectData.setPreviousProjectOwnerEmailAddress(previousOwner.getEmailAdress());
    projectData.setProjectOwnerEmailAddress(newOwner.getEmailAdress());
    project.users.forEach(user -> {
        projectData.addUserEmailAddress(user.getEmailAdress());
    });
    request.set(MessageDataKeys.PROJECT_OWNER_CHANGE_DATA, projectData);
    eventBus.sendAsynchron(request);
}
Also used : ProjectMessage(com.mercedesbenz.sechub.sharedkernel.messaging.ProjectMessage) DomainMessage(com.mercedesbenz.sechub.sharedkernel.messaging.DomainMessage) IsSendingAsyncMessage(com.mercedesbenz.sechub.sharedkernel.messaging.IsSendingAsyncMessage)

Example 5 with DomainMessage

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

the class UserEmailAddressUpdateService method informUserEmailAddressUpdated.

@IsSendingAsyncMessage(MessageID.USER_EMAIL_ADDRESS_CHANGED)
private void informUserEmailAddressUpdated(UserMessage message) {
    DomainMessage infoRequest = new DomainMessage(MessageID.USER_EMAIL_ADDRESS_CHANGED);
    infoRequest.set(MessageDataKeys.USER_EMAIL_ADDRESS_CHANGE_DATA, message);
    eventBusService.sendAsynchron(infoRequest);
}
Also used : DomainMessage(com.mercedesbenz.sechub.sharedkernel.messaging.DomainMessage) IsSendingAsyncMessage(com.mercedesbenz.sechub.sharedkernel.messaging.IsSendingAsyncMessage)

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