Search in sources :

Example 6 with GlobalConfigurationModelToConcreteSaveActions

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

the class GlobalConfigurationModelToConcreteConversionServiceTest method deletedDescriptorFoundNotGlobalTest.

@Test
void deletedDescriptorFoundNotGlobalTest() {
    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.DISTRIBUTION, Map.of());
    GlobalConfigurationModelToConcreteConversionService conversionService = new GlobalConfigurationModelToConcreteConversionService(fieldModelSaveActions, descriptorMap);
    conversionService.deleteDefaultConcreteModel(TEST_DESCRIPTOR_KEY, configurationModel);
    assertFalse(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 7 with GlobalConfigurationModelToConcreteSaveActions

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

the class GlobalConfigurationModelToConcreteConversionServiceTest method createdDescriptorFoundNotGlobalTest.

@Test
void createdDescriptorFoundNotGlobalTest() {
    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.DISTRIBUTION, Map.of());
    GlobalConfigurationModelToConcreteConversionService conversionService = new GlobalConfigurationModelToConcreteConversionService(fieldModelSaveActions, descriptorMap);
    conversionService.createDefaultConcreteModel(TEST_DESCRIPTOR_KEY, configurationModel);
    assertFalse(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 8 with GlobalConfigurationModelToConcreteSaveActions

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

the class GlobalConfigurationModelToConcreteConversionServiceTest method createdDescriptorMissingTest.

@Test
void createdDescriptorMissingTest() {
    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.createDefaultConcreteModel(TEST_DESCRIPTOR_KEY, configurationModel);
    assertFalse(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 9 with GlobalConfigurationModelToConcreteSaveActions

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

the class GlobalConfigurationModelToConcreteConversionServiceTest method updateDescriptorFoundNotGlobalTest.

@Test
void updateDescriptorFoundNotGlobalTest() {
    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.DISTRIBUTION, 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)

Example 10 with GlobalConfigurationModelToConcreteSaveActions

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

the class GlobalConfigurationModelToConcreteConversionServiceTest method deletedDescriptorMissingTest.

@Test
void deletedDescriptorMissingTest() {
    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.deleteDefaultConcreteModel(TEST_DESCRIPTOR_KEY, configurationModel);
    assertFalse(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)

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