Search in sources :

Example 1 with GlobalConfigurationModelToConcreteSaveActions

use of com.synopsys.integration.alert.common.action.api.GlobalConfigurationModelToConcreteSaveActions in project hub-alert by blackducksoftware.

the class GlobalConfigurationModelToConcreteConversionServiceTest method deleteDescriptorFoundTest.

@Test
void deleteDescriptorFoundTest() {
    TestSaveActions saveActions = new TestSaveActions(testDescriptorKey);
    DescriptorMap descriptorMap = new DescriptorMap(List.of(testDescriptorKey), List.of());
    List<GlobalConfigurationModelToConcreteSaveActions> fieldModelSaveActions = List.of(saveActions);
    String timestamp = DateUtils.createCurrentDateString(DateUtils.UTC_DATE_FORMAT_TO_MINUTE);
    ConfigurationModel configurationModel = new ConfigurationModel(1L, 1L, timestamp, timestamp, ConfigContextEnum.GLOBAL, Map.of());
    GlobalConfigurationModelToConcreteConversionService conversionService = new GlobalConfigurationModelToConcreteConversionService(fieldModelSaveActions, descriptorMap);
    conversionService.deleteDefaultConcreteModel(TEST_DESCRIPTOR_KEY, configurationModel);
    assertTrue(saveActions.wasDeleteCalled());
}
Also used : ConfigurationModel(com.synopsys.integration.alert.common.persistence.model.ConfigurationModel) DescriptorMap(com.synopsys.integration.alert.common.descriptor.DescriptorMap) GlobalConfigurationModelToConcreteSaveActions(com.synopsys.integration.alert.common.action.api.GlobalConfigurationModelToConcreteSaveActions) Test(org.junit.jupiter.api.Test)

Example 2 with GlobalConfigurationModelToConcreteSaveActions

use of com.synopsys.integration.alert.common.action.api.GlobalConfigurationModelToConcreteSaveActions in project hub-alert by blackducksoftware.

the class GlobalConfigurationModelToConcreteConversionServiceTest method createdDescriptorFoundTest.

@Test
void createdDescriptorFoundTest() {
    TestSaveActions saveActions = new TestSaveActions(testDescriptorKey);
    DescriptorMap descriptorMap = new DescriptorMap(List.of(testDescriptorKey), List.of());
    List<GlobalConfigurationModelToConcreteSaveActions> fieldModelSaveActions = List.of(saveActions);
    String timestamp = DateUtils.createCurrentDateString(DateUtils.UTC_DATE_FORMAT_TO_MINUTE);
    ConfigurationModel configurationModel = new ConfigurationModel(1L, 1L, timestamp, timestamp, ConfigContextEnum.GLOBAL, Map.of());
    GlobalConfigurationModelToConcreteConversionService conversionService = new GlobalConfigurationModelToConcreteConversionService(fieldModelSaveActions, descriptorMap);
    conversionService.createDefaultConcreteModel(TEST_DESCRIPTOR_KEY, configurationModel);
    assertTrue(saveActions.wasCreatedCalled());
}
Also used : ConfigurationModel(com.synopsys.integration.alert.common.persistence.model.ConfigurationModel) DescriptorMap(com.synopsys.integration.alert.common.descriptor.DescriptorMap) GlobalConfigurationModelToConcreteSaveActions(com.synopsys.integration.alert.common.action.api.GlobalConfigurationModelToConcreteSaveActions) Test(org.junit.jupiter.api.Test)

Example 3 with GlobalConfigurationModelToConcreteSaveActions

use of com.synopsys.integration.alert.common.action.api.GlobalConfigurationModelToConcreteSaveActions in project hub-alert by blackducksoftware.

the class EmailConfigActionTestIT method createConversionService.

private GlobalConfigurationModelToConcreteConversionService createConversionService(EmailGlobalCrudActions emailGlobalCrudActions) {
    EmailGlobalConfigurationModelConverter modelConverter = new EmailGlobalConfigurationModelConverter();
    EmailGlobalConfigurationModelSaveActions emailGlobalConfigurationModelSaveActions = new EmailGlobalConfigurationModelSaveActions(modelConverter, emailGlobalCrudActions, emailGlobalConfigAccessor);
    List<GlobalConfigurationModelToConcreteSaveActions> conversionActions = List.of(emailGlobalConfigurationModelSaveActions);
    return new GlobalConfigurationModelToConcreteConversionService(conversionActions, descriptorMap);
}
Also used : GlobalConfigurationModelToConcreteConversionService(com.synopsys.integration.alert.web.api.config.GlobalConfigurationModelToConcreteConversionService) EmailGlobalConfigurationModelSaveActions(com.synopsys.integration.alert.channel.email.convert.EmailGlobalConfigurationModelSaveActions) EmailGlobalConfigurationModelConverter(com.synopsys.integration.alert.channel.email.convert.EmailGlobalConfigurationModelConverter) GlobalConfigurationModelToConcreteSaveActions(com.synopsys.integration.alert.common.action.api.GlobalConfigurationModelToConcreteSaveActions)

Example 4 with GlobalConfigurationModelToConcreteSaveActions

use of com.synopsys.integration.alert.common.action.api.GlobalConfigurationModelToConcreteSaveActions in project hub-alert by blackducksoftware.

the class GlobalConfigurationModelToConcreteConversionServiceTest method updatedDescriptorFoundTest.

@Test
void updatedDescriptorFoundTest() {
    TestSaveActions saveActions = new TestSaveActions(testDescriptorKey);
    DescriptorMap descriptorMap = new DescriptorMap(List.of(testDescriptorKey), List.of());
    List<GlobalConfigurationModelToConcreteSaveActions> fieldModelSaveActions = List.of(saveActions);
    String timestamp = DateUtils.createCurrentDateString(DateUtils.UTC_DATE_FORMAT_TO_MINUTE);
    ConfigurationModel configurationModel = new ConfigurationModel(1L, 1L, timestamp, timestamp, ConfigContextEnum.GLOBAL, Map.of());
    GlobalConfigurationModelToConcreteConversionService conversionService = new GlobalConfigurationModelToConcreteConversionService(fieldModelSaveActions, descriptorMap);
    conversionService.updateDefaultConcreteModel(TEST_DESCRIPTOR_KEY, configurationModel);
    assertTrue(saveActions.wasUpdateCalled());
}
Also used : ConfigurationModel(com.synopsys.integration.alert.common.persistence.model.ConfigurationModel) DescriptorMap(com.synopsys.integration.alert.common.descriptor.DescriptorMap) GlobalConfigurationModelToConcreteSaveActions(com.synopsys.integration.alert.common.action.api.GlobalConfigurationModelToConcreteSaveActions) Test(org.junit.jupiter.api.Test)

Example 5 with GlobalConfigurationModelToConcreteSaveActions

use of com.synopsys.integration.alert.common.action.api.GlobalConfigurationModelToConcreteSaveActions in project hub-alert by blackducksoftware.

the class GlobalConfigurationModelToConcreteConversionServiceTest method updatedDescriptorMissingTest.

@Test
void updatedDescriptorMissingTest() {
    TestSaveActions saveActions = new TestSaveActions(testDescriptorKey);
    DescriptorMap descriptorMap = new DescriptorMap(List.of(), List.of());
    List<GlobalConfigurationModelToConcreteSaveActions> fieldModelSaveActions = List.of(saveActions);
    String timestamp = DateUtils.createCurrentDateString(DateUtils.UTC_DATE_FORMAT_TO_MINUTE);
    ConfigurationModel configurationModel = new ConfigurationModel(1L, 1L, timestamp, timestamp, ConfigContextEnum.GLOBAL, Map.of());
    GlobalConfigurationModelToConcreteConversionService conversionService = new GlobalConfigurationModelToConcreteConversionService(fieldModelSaveActions, descriptorMap);
    conversionService.updateDefaultConcreteModel(TEST_DESCRIPTOR_KEY, configurationModel);
    assertFalse(saveActions.wasUpdateCalled());
}
Also used : ConfigurationModel(com.synopsys.integration.alert.common.persistence.model.ConfigurationModel) DescriptorMap(com.synopsys.integration.alert.common.descriptor.DescriptorMap) GlobalConfigurationModelToConcreteSaveActions(com.synopsys.integration.alert.common.action.api.GlobalConfigurationModelToConcreteSaveActions) Test(org.junit.jupiter.api.Test)

Aggregations

GlobalConfigurationModelToConcreteSaveActions (com.synopsys.integration.alert.common.action.api.GlobalConfigurationModelToConcreteSaveActions)10 DescriptorMap (com.synopsys.integration.alert.common.descriptor.DescriptorMap)9 ConfigurationModel (com.synopsys.integration.alert.common.persistence.model.ConfigurationModel)9 Test (org.junit.jupiter.api.Test)9 EmailGlobalConfigurationModelConverter (com.synopsys.integration.alert.channel.email.convert.EmailGlobalConfigurationModelConverter)1 EmailGlobalConfigurationModelSaveActions (com.synopsys.integration.alert.channel.email.convert.EmailGlobalConfigurationModelSaveActions)1 GlobalConfigurationModelToConcreteConversionService (com.synopsys.integration.alert.web.api.config.GlobalConfigurationModelToConcreteConversionService)1