Search in sources :

Example 1 with AdministrationConfigMessage

use of com.mercedesbenz.sechub.sharedkernel.messaging.AdministrationConfigMessage 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 AdministrationConfigMessage

use of com.mercedesbenz.sechub.sharedkernel.messaging.AdministrationConfigMessage 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)

Example 3 with AdministrationConfigMessage

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

the class ScheduleMessageHandlerTest method handler_receiving_auto_cleanup_calls_config_serice_with_message_data.

@Test
void handler_receiving_auto_cleanup_calls_config_serice_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 */
    scheduleHandlerToTest.receiveAsyncMessage(message);
    /* test */
    verify(scheduleHandlerToTest.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 4 with AdministrationConfigMessage

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

the class ScheduleMessageHandler method ReceivedhandleAutoCleanUpConfigurationChanged.

@IsReceivingAsyncMessage(MessageID.AUTO_CLEANUP_CONFIGURATION_CHANGED)
private void ReceivedhandleAutoCleanUpConfigurationChanged(DomainMessage request) {
    AdministrationConfigMessage message = request.get(MessageDataKeys.AUTO_CLEANUP_CONFIG_CHANGE_DATA);
    configService.updateAutoCleanupInDays(message.getAutoCleanupInDays());
}
Also used : AdministrationConfigMessage(com.mercedesbenz.sechub.sharedkernel.messaging.AdministrationConfigMessage) IsReceivingAsyncMessage(com.mercedesbenz.sechub.sharedkernel.messaging.IsReceivingAsyncMessage)

Example 5 with AdministrationConfigMessage

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

the class ScanMessageHandlerTest method handler_receiving_auto_cleanup_calls_config_sevice_with_message_data.

@Test
void handler_receiving_auto_cleanup_calls_config_sevice_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 */
    messageHandlerToTest.receiveAsyncMessage(message);
    /* test */
    verify(messageHandlerToTest.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)

Aggregations

AdministrationConfigMessage (com.mercedesbenz.sechub.sharedkernel.messaging.AdministrationConfigMessage)8 DomainMessage (com.mercedesbenz.sechub.sharedkernel.messaging.DomainMessage)5 Test (org.junit.jupiter.api.Test)4 IsReceivingAsyncMessage (com.mercedesbenz.sechub.sharedkernel.messaging.IsReceivingAsyncMessage)3 AdministrationAutoCleanupConfig (com.mercedesbenz.sechub.domain.administration.autocleanup.AdministrationAutoCleanupConfig)1 IsSendingAsyncMessage (com.mercedesbenz.sechub.sharedkernel.messaging.IsSendingAsyncMessage)1 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)1