Search in sources :

Example 6 with AdministrationConfigMessage

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

the class AdministrationConfigServiceTest method auto_cleanup_configuration_change_does_result_in_auto_cleanup_change_event_with_correct_data.

@Test
void auto_cleanup_configuration_change_does_result_in_auto_cleanup_change_event_with_correct_data() {
    /* prepare */
    emulateExistingInitialAdministrationConfig();
    long days = 42;
    AdministrationAutoCleanupConfig autoCleanupConfiguration = new AdministrationAutoCleanupConfig();
    when(calculator.calculateCleanupTimeInDays(eq(autoCleanupConfiguration))).thenReturn(days);
    /* execute */
    serviceToTest.updateAutoCleanupConfiguration(autoCleanupConfiguration);
    /* test */
    ArgumentCaptor<DomainMessage> captor = ArgumentCaptor.forClass(DomainMessage.class);
    verify(domainMessageService).sendAsynchron(captor.capture());
    DomainMessage message = captor.getValue();
    AdministrationConfigMessage cleanupData = message.get(MessageDataKeys.AUTO_CLEANUP_CONFIG_CHANGE_DATA);
    assertNotNull(cleanupData);
    assertEquals(days, cleanupData.getAutoCleanupInDays());
}
Also used : AdministrationAutoCleanupConfig(com.mercedesbenz.sechub.domain.administration.autocleanup.AdministrationAutoCleanupConfig) AdministrationConfigMessage(com.mercedesbenz.sechub.sharedkernel.messaging.AdministrationConfigMessage) DomainMessage(com.mercedesbenz.sechub.sharedkernel.messaging.DomainMessage) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 7 with AdministrationConfigMessage

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

the class JobAdministrationMessageHandler method handleAutoCleanUpConfigurationChanged.

@IsReceivingAsyncMessage(MessageID.AUTO_CLEANUP_CONFIGURATION_CHANGED)
private void handleAutoCleanUpConfigurationChanged(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 8 with AdministrationConfigMessage

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

the class ScanMessageHandler 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)

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