use of com.synopsys.integration.alert.common.rest.model.FieldValueModel in project hub-alert by blackducksoftware.
the class SettingsGlobalConfigurationFieldModelValidatorTest method missingProxyPassword.
@Test
public void missingProxyPassword() {
Map<String, FieldValueModel> keyToValues = createProxyKeyToValues();
FieldValueModel username = new FieldValueModel(List.of("username"), true);
keyToValues.put(ProxyManager.KEY_PROXY_USERNAME, username);
GlobalConfigurationValidatorAsserter validatorAsserter = createValidatorAsserter(keyToValues);
validatorAsserter.assertMissingValue(ProxyManager.KEY_PROXY_PWD);
}
use of com.synopsys.integration.alert.common.rest.model.FieldValueModel in project hub-alert by blackducksoftware.
the class AuthenticationConfigurationValidatorTest method missingLdapFields.
@Test
public void missingLdapFields() {
Map<String, FieldValueModel> keyToValues = Map.of(AuthenticationDescriptor.KEY_LDAP_ENABLED, new FieldValueModel(List.of("true"), true));
GlobalConfigurationValidatorAsserter validatorAsserter = createValidatorAsserter(keyToValues);
validatorAsserter.assertCustom(alertFieldStatuses -> assertEquals(3, alertFieldStatuses.size(), alertFieldStatuses.toString()));
}
use of com.synopsys.integration.alert.common.rest.model.FieldValueModel in project hub-alert by blackducksoftware.
the class AuthenticationConfigurationValidatorTest method hasSamlMetadataFile.
@Test
public void hasSamlMetadataFile() {
Map<String, FieldValueModel> keyToValues = createValidSamlValues();
keyToValues.remove(AuthenticationDescriptor.KEY_SAML_METADATA_URL);
keyToValues.remove(AuthenticationDescriptor.KEY_SAML_ENTITY_BASE_URL);
FilePersistenceUtil filePersistenceUtil = Mockito.mock(FilePersistenceUtil.class);
Mockito.when(filePersistenceUtil.uploadFileExists(Mockito.anyString())).thenReturn(true);
AuthenticationConfigurationFieldModelValidator authenticationConfigurationValidator = new AuthenticationConfigurationFieldModelValidator(filePersistenceUtil);
Set<AlertFieldStatus> alertFieldStatuses = authenticationConfigurationValidator.validate(new FieldModel(new AuthenticationDescriptorKey().getUniversalKey(), ConfigContextEnum.GLOBAL.name(), keyToValues));
assertEquals(1, alertFieldStatuses.size());
}
use of com.synopsys.integration.alert.common.rest.model.FieldValueModel in project hub-alert by blackducksoftware.
the class AuthenticationConfigurationValidatorTest method verifyInvalidLdapAndSamlEnabled.
@Test
public void verifyInvalidLdapAndSamlEnabled() {
Map<String, FieldValueModel> keyToValues = Map.of(AuthenticationDescriptor.KEY_LDAP_ENABLED, new FieldValueModel(List.of("true"), true), AuthenticationDescriptor.KEY_SAML_ENABLED, new FieldValueModel(List.of("true"), true));
GlobalConfigurationValidatorAsserter validatorAsserter = createValidatorAsserter(keyToValues);
validatorAsserter.assertCustom(alertFieldStatuses -> assertTrue(alertFieldStatuses.size() >= 2, alertFieldStatuses.toString()));
}
use of com.synopsys.integration.alert.common.rest.model.FieldValueModel in project hub-alert by blackducksoftware.
the class SchedulingConfigurationValidatorTest method createValidConfig.
private Map<String, FieldValueModel> createValidConfig() {
Map<String, FieldValueModel> keyToValues = new HashMap<>();
FieldValueModel processingHour = new FieldValueModel(List.of("1"), true);
FieldValueModel purgeFrequency = new FieldValueModel(List.of("3"), true);
keyToValues.put(SchedulingDescriptor.KEY_DAILY_PROCESSOR_HOUR_OF_DAY, processingHour);
keyToValues.put(SchedulingDescriptor.KEY_PURGE_DATA_FREQUENCY_DAYS, purgeFrequency);
return keyToValues;
}
Aggregations