use of com.synopsys.integration.alert.descriptor.api.model.DescriptorKey in project hub-alert by blackducksoftware.
the class ConfigurationFieldModelTest method convertFromFieldModelEmptyFieldsTest.
@Test
public void convertFromFieldModelEmptyFieldsTest() throws Exception {
FieldModel fieldModel = createFieldModel();
EncryptionUtility encryptionUtility = Mockito.mock(EncryptionUtility.class);
DescriptorAccessor descriptorAccessor = new MockDescriptorAccessor(List.of());
List<DescriptorKey> descriptorKeys = createDescriptorKeyList();
ConfigurationFieldModelConverter modelConverter = new ConfigurationFieldModelConverter(encryptionUtility, descriptorAccessor, descriptorKeys);
Map<String, ConfigurationFieldModel> actualModelMap = modelConverter.convertToConfigurationFieldModelMap(fieldModel);
assertTrue(actualModelMap.isEmpty());
}
use of com.synopsys.integration.alert.descriptor.api.model.DescriptorKey in project hub-alert by blackducksoftware.
the class ConfigurationModelConfigurationAccessorTestIT method getConfigurationByIdTest.
@Test
public void getConfigurationByIdTest() {
ConfigurationFieldModel configField1 = ConfigurationFieldModel.create(FIELD_KEY_INSENSITIVE);
ConfigurationFieldModel configField2 = ConfigurationFieldModel.createSensitive(FIELD_KEY_SENSITIVE);
DescriptorKey descriptorKey = createDescriptorKey(DESCRIPTOR_NAME);
ConfigurationModel configurationModel1 = configurationModelConfigurationAccessor.createConfiguration(descriptorKey, ConfigContextEnum.DISTRIBUTION, Arrays.asList(configField1));
ConfigurationModel configurationModel2 = configurationModelConfigurationAccessor.createConfiguration(descriptorKey, ConfigContextEnum.DISTRIBUTION, Arrays.asList(configField2));
Optional<ConfigurationModel> optionalFoundConfig1 = configurationModelConfigurationAccessor.getConfigurationById(configurationModel1.getConfigurationId());
assertTrue(optionalFoundConfig1.isPresent());
ConfigurationModel foundConfig1 = optionalFoundConfig1.get();
assertEquals(configurationModel1.getDescriptorId(), foundConfig1.getDescriptorId());
assertEquals(configurationModel1.getConfigurationId(), foundConfig1.getConfigurationId());
Optional<ConfigurationModel> optionalFoundConfig2 = configurationModelConfigurationAccessor.getConfigurationById(configurationModel2.getConfigurationId());
assertTrue(optionalFoundConfig2.isPresent());
ConfigurationModel foundConfig2 = optionalFoundConfig2.get();
assertEquals(configurationModel2.getDescriptorId(), foundConfig2.getDescriptorId());
assertEquals(configurationModel2.getConfigurationId(), foundConfig2.getConfigurationId());
}
use of com.synopsys.integration.alert.descriptor.api.model.DescriptorKey in project hub-alert by blackducksoftware.
the class ConfigurationModelConfigurationAccessorTestIT method configurationModelTest.
@Test
public void configurationModelTest() {
DescriptorKey descriptorKey = createDescriptorKey(DESCRIPTOR_NAME);
ConfigurationModel configurationModel = configurationModelConfigurationAccessor.createConfiguration(descriptorKey, ConfigContextEnum.DISTRIBUTION, List.of());
assertNotNull(configurationModel.getConfigurationId());
assertNotNull(configurationModel.getDescriptorId());
assertNotNull(configurationModel.getCopyOfFieldList());
assertNotNull(configurationModel.getCopyOfKeyToFieldMap());
}
use of com.synopsys.integration.alert.descriptor.api.model.DescriptorKey in project hub-alert by blackducksoftware.
the class ConfigurationModelConfigurationAccessorTestIT method getConfigsByNameTest.
@Test
public void getConfigsByNameTest() {
ConfigurationFieldModel configField1 = ConfigurationFieldModel.create(FIELD_KEY_INSENSITIVE);
ConfigurationFieldModel configField2 = ConfigurationFieldModel.createSensitive(FIELD_KEY_SENSITIVE);
DescriptorKey descriptorKey = createDescriptorKey(DESCRIPTOR_NAME);
configurationModelConfigurationAccessor.createConfiguration(descriptorKey, ConfigContextEnum.DISTRIBUTION, Arrays.asList(configField1));
configurationModelConfigurationAccessor.createConfiguration(descriptorKey, ConfigContextEnum.DISTRIBUTION, Arrays.asList(configField2));
List<ConfigurationModel> configurationsForDescriptor = configurationModelConfigurationAccessor.getConfigurationsByDescriptorKey(descriptorKey);
assertEquals(2, configurationsForDescriptor.size());
}
use of com.synopsys.integration.alert.descriptor.api.model.DescriptorKey in project hub-alert by blackducksoftware.
the class ConfigurationModelConfigurationAccessorTestIT method getConfigurationsByDescriptorTypeTest.
@Test
public void getConfigurationsByDescriptorTypeTest() {
List<ConfigurationModel> configurationModels = configurationModelConfigurationAccessor.getConfigurationsByDescriptorType(DescriptorType.CHANNEL);
assertTrue(configurationModels.isEmpty());
ConfigurationFieldModel configField1 = ConfigurationFieldModel.create(FIELD_KEY_INSENSITIVE);
ConfigurationFieldModel configField2 = ConfigurationFieldModel.createSensitive(FIELD_KEY_SENSITIVE);
DescriptorKey descriptorKey = createDescriptorKey(DESCRIPTOR_NAME);
configurationModelConfigurationAccessor.createConfiguration(descriptorKey, ConfigContextEnum.DISTRIBUTION, Arrays.asList(configField1));
configurationModelConfigurationAccessor.createConfiguration(descriptorKey, ConfigContextEnum.DISTRIBUTION, Arrays.asList(configField2));
configurationModels = configurationModelConfigurationAccessor.getConfigurationsByDescriptorType(DescriptorType.PROVIDER);
assertFalse(configurationModels.isEmpty());
}
Aggregations