use of com.synopsys.integration.alert.common.persistence.model.ConfigurationFieldModel in project hub-alert by blackducksoftware.
the class MockConfigurationModelFactory method createBlackDuckDistributionFields.
public static List<ConfigurationFieldModel> createBlackDuckDistributionFields() {
List<ConfigurationFieldModel> fields = new ArrayList<>();
ConfigurationFieldModel notificationTypes = createFieldModel(ProviderDescriptor.KEY_NOTIFICATION_TYPES, List.of(NotificationType.VULNERABILITY.toString(), NotificationType.RULE_VIOLATION.toString()));
ConfigurationFieldModel formatType = createFieldModel(ProviderDescriptor.KEY_PROCESSING_TYPE, ProcessingType.DEFAULT.toString());
ConfigurationFieldModel filterByProject = createFieldModel(ProviderDescriptor.KEY_FILTER_BY_PROJECT, "true");
ConfigurationFieldModel projectNamePattern = createFieldModel(ProviderDescriptor.KEY_PROJECT_NAME_PATTERN, ".*UnitTest.*");
ConfigurationFieldModel configuredProject = createFieldModel(ProviderDescriptor.KEY_CONFIGURED_PROJECT, List.of("TestProject1", "TestProject2"));
fields.add(notificationTypes);
fields.add(formatType);
fields.add(filterByProject);
fields.add(projectNamePattern);
fields.add(configuredProject);
return fields;
}
use of com.synopsys.integration.alert.common.persistence.model.ConfigurationFieldModel in project hub-alert by blackducksoftware.
the class MockConfigurationModelFactory method mockField.
private static void mockField(List<ConfigurationFieldModel> fieldList, ConfigurationModel configurationModel, String key, Collection<String> values) {
ConfigurationFieldModel field = ConfigurationFieldModel.create(key);
field.setFieldValues(values);
Mockito.when(configurationModel.getField(key)).thenReturn(Optional.of(field));
fieldList.add(field);
}
use of com.synopsys.integration.alert.common.persistence.model.ConfigurationFieldModel in project hub-alert by blackducksoftware.
the class NotificationRemovalTest method createBlackDuckConfiguration.
private ConfigurationModel createBlackDuckConfiguration() {
ConfigurationFieldModel blackDuckURLField = ConfigurationFieldModel.create(BlackDuckDescriptor.KEY_BLACKDUCK_URL);
blackDuckURLField.setFieldValue(BLACKDUCK_PROVIDER_URL);
ConfigurationFieldModel blackDuckAPITokenField = ConfigurationFieldModel.createSensitive(BlackDuckDescriptor.KEY_BLACKDUCK_API_KEY);
blackDuckAPITokenField.setFieldValue("");
ConfigurationFieldModel blackDuckTimeoutField = ConfigurationFieldModel.create(BlackDuckDescriptor.KEY_BLACKDUCK_TIMEOUT);
blackDuckTimeoutField.setFieldValue("300");
BlackDuckProviderKey blackDuckProviderKey = new BlackDuckProviderKey();
return configurationModelConfigurationAccessor.createConfiguration(blackDuckProviderKey, ConfigContextEnum.GLOBAL, List.of(blackDuckURLField, blackDuckAPITokenField, blackDuckTimeoutField));
}
use of com.synopsys.integration.alert.common.persistence.model.ConfigurationFieldModel in project hub-alert by blackducksoftware.
the class MockConfigurationModelFactory method createEmailDistributionFields.
public static List<ConfigurationFieldModel> createEmailDistributionFields() {
List<ConfigurationFieldModel> fields = new ArrayList<>();
ConfigurationFieldModel emailAddresses = createFieldModel(EmailDescriptor.KEY_EMAIL_ADDRESSES, List.of("noreply@blackducksoftware.com"));
ConfigurationFieldModel projectOwnerOnly = createFieldModel(EmailDescriptor.KEY_PROJECT_OWNER_ONLY, "false");
ConfigurationFieldModel subjectLine = createFieldModel(EmailDescriptor.KEY_SUBJECT_LINE, "Alert unit test subject line");
fields.add(emailAddresses);
fields.add(projectOwnerOnly);
fields.add(subjectLine);
Collection<ConfigurationFieldModel> commonFields = createCommonDistributionFields("Email Test Job", ChannelKeys.EMAIL.getUniversalKey());
fields.addAll(commonFields);
return fields;
}
use of com.synopsys.integration.alert.common.persistence.model.ConfigurationFieldModel in project hub-alert by blackducksoftware.
the class MockConfigurationModelFactory method createFieldModel.
public static ConfigurationFieldModel createFieldModel(String fieldKey, Collection<String> fieldValues) {
ConfigurationFieldModel configurationFieldModel = ConfigurationFieldModel.create(fieldKey);
configurationFieldModel.setFieldValues(fieldValues);
return configurationFieldModel;
}
Aggregations