Search in sources :

Example 16 with DomainMessage

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

the class TriggerSchedulerStatusRefreshService method sendUpdateSchedulerStatusEvent.

@IsSendingAsyncMessage(MessageID.REQUEST_SCHEDULER_STATUS_UPDATE)
private void sendUpdateSchedulerStatusEvent() {
    DomainMessage request = DomainMessageFactory.createEmptyRequest(MessageID.REQUEST_SCHEDULER_STATUS_UPDATE);
    eventBusService.sendAsynchron(request);
}
Also used : DomainMessage(com.mercedesbenz.sechub.sharedkernel.messaging.DomainMessage) IsSendingAsyncMessage(com.mercedesbenz.sechub.sharedkernel.messaging.IsSendingAsyncMessage)

Example 17 with DomainMessage

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

the class AnonymousSignupCreateService method informAboutSignupRequest.

@IsSendingAsyncMessage(MessageID.USER_SIGNUP_REQUESTED)
private void informAboutSignupRequest(Signup signup) {
    DomainMessage infoRequest = new DomainMessage(MessageID.USER_SIGNUP_REQUESTED);
    UserMessage userMessage = new UserMessage();
    userMessage.setEmailAdress(signup.getEmailAdress());
    userMessage.setUserId(signup.getUserId());
    infoRequest.set(MessageDataKeys.USER_SIGNUP_DATA, userMessage);
    eventBusService.sendAsynchron(infoRequest);
}
Also used : UserMessage(com.mercedesbenz.sechub.sharedkernel.messaging.UserMessage) DomainMessage(com.mercedesbenz.sechub.sharedkernel.messaging.DomainMessage) IsSendingAsyncMessage(com.mercedesbenz.sechub.sharedkernel.messaging.IsSendingAsyncMessage)

Example 18 with DomainMessage

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

the class AnonymousUserGetAPITokenByOneTimeTokenService method sendUserAPITokenChanged.

@IsSendingAsyncMessage(MessageID.USER_API_TOKEN_CHANGED)
private void sendUserAPITokenChanged(User user) {
    DomainMessage request = new DomainMessage(MessageID.USER_API_TOKEN_CHANGED);
    UserMessage message = new UserMessage();
    message.setEmailAdress(user.getEmailAdress());
    message.setUserId(user.getName());
    message.setHashedApiToken(user.getHashedApiToken());
    request.set(MessageDataKeys.USER_API_TOKEN_DATA, message);
    eventBusService.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 19 with DomainMessage

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

the class ScheduleJobLauncherServiceTest method executeJob__sends_domain_message_about_JOB_STARTED.

@Test
public void executeJob__sends_domain_message_about_JOB_STARTED() throws Exception {
    /* prepare */
    UUID jobUUID = UUID.randomUUID();
    ScheduleSecHubJob secHubJob = mock(ScheduleSecHubJob.class);
    when(secHubJob.getJsonConfiguration()).thenReturn("jsonConfig");
    when(secHubJob.getUUID()).thenReturn(jobUUID);
    when(jobRepository.findNextJobToExecute()).thenReturn(Optional.of(secHubJob));
    /* execute */
    serviceToTest.executeJob(secHubJob);
    /* test */
    ArgumentCaptor<DomainMessage> message = ArgumentCaptor.forClass(DomainMessage.class);
    verify(eventBus).sendAsynchron(message.capture());
    assertEquals(MessageID.JOB_STARTED, message.getValue().getMessageId());
}
Also used : UUID(java.util.UUID) ScheduleSecHubJob(com.mercedesbenz.sechub.domain.schedule.job.ScheduleSecHubJob) DomainMessage(com.mercedesbenz.sechub.sharedkernel.messaging.DomainMessage) Test(org.junit.Test)

Example 20 with DomainMessage

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

the class AdministrationConfigService method sendEvent.

@IsSendingAsyncMessage(MessageID.AUTO_CLEANUP_CONFIGURATION_CHANGED)
private void sendEvent(long calculateCleanupTimeInDays) {
    AdministrationConfigMessage adminConfigMessage = new AdministrationConfigMessage();
    adminConfigMessage.setAutoCleanupInDays(calculateCleanupTimeInDays);
    DomainMessage domainMessage = DomainMessageFactory.createEmptyRequest(MessageID.AUTO_CLEANUP_CONFIGURATION_CHANGED);
    domainMessage.set(MessageDataKeys.AUTO_CLEANUP_CONFIG_CHANGE_DATA, adminConfigMessage);
    domainMessageService.sendAsynchron(domainMessage);
}
Also used : AdministrationConfigMessage(com.mercedesbenz.sechub.sharedkernel.messaging.AdministrationConfigMessage) 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