Search in sources :

Example 16 with DescriptorMap

use of com.synopsys.integration.alert.common.descriptor.DescriptorMap 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 17 with DescriptorMap

use of com.synopsys.integration.alert.common.descriptor.DescriptorMap 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 18 with DescriptorMap

use of com.synopsys.integration.alert.common.descriptor.DescriptorMap 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 19 with DescriptorMap

use of com.synopsys.integration.alert.common.descriptor.DescriptorMap 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 20 with DescriptorMap

use of com.synopsys.integration.alert.common.descriptor.DescriptorMap 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

DescriptorMap (com.synopsys.integration.alert.common.descriptor.DescriptorMap)21 Test (org.junit.jupiter.api.Test)20 GlobalConfigurationModelToConcreteSaveActions (com.synopsys.integration.alert.common.action.api.GlobalConfigurationModelToConcreteSaveActions)12 DescriptorKey (com.synopsys.integration.alert.descriptor.api.model.DescriptorKey)12 DescriptorProcessor (com.synopsys.integration.alert.common.descriptor.DescriptorProcessor)11 ConfigContextEnum (com.synopsys.integration.alert.common.enumeration.ConfigContextEnum)11 ConfigurationModelConfigurationAccessor (com.synopsys.integration.alert.common.persistence.accessor.ConfigurationModelConfigurationAccessor)11 DescriptorAccessor (com.synopsys.integration.alert.common.persistence.accessor.DescriptorAccessor)11 ConfigurationModel (com.synopsys.integration.alert.common.persistence.model.ConfigurationModel)11 ConfigurationFieldModelConverter (com.synopsys.integration.alert.common.persistence.util.ConfigurationFieldModelConverter)11 FieldModelProcessor (com.synopsys.integration.alert.common.rest.FieldModelProcessor)11 Descriptor (com.synopsys.integration.alert.common.descriptor.Descriptor)7 EncryptionUtility (com.synopsys.integration.alert.common.security.EncryptionUtility)7 AuthorizationManager (com.synopsys.integration.alert.common.security.authorization.AuthorizationManager)7 PKIXErrorResponseFactory (com.synopsys.integration.alert.component.certificates.web.PKIXErrorResponseFactory)7 SettingsDescriptorKey (com.synopsys.integration.alert.component.settings.descriptor.SettingsDescriptorKey)7 BeforeEach (org.junit.jupiter.api.BeforeEach)7 AlertConfigurationException (com.synopsys.integration.alert.api.common.model.exception.AlertConfigurationException)6 ChannelDescriptor (com.synopsys.integration.alert.common.descriptor.ChannelDescriptor)6 FieldModel (com.synopsys.integration.alert.common.rest.model.FieldModel)6