use of com.synopsys.integration.alert.common.rest.model.ValidationResponseModel in project hub-alert by blackducksoftware.
the class SettingsEncryptionValidatorTest method validateNotInitializedTest.
@Test
public void validateNotInitializedTest() {
MockAlertProperties alertPropertiesNoEncryption = new MockAlertProperties();
alertPropertiesNoEncryption.setEncryptionPassword("");
alertPropertiesNoEncryption.setEncryptionSalt("");
FilePersistenceUtil filePersistenceUtilWithoutProperties = new FilePersistenceUtil(alertPropertiesNoEncryption, gson);
EncryptionUtility encryptionUtilityWithoutProperties = new EncryptionUtility(alertPropertiesNoEncryption, filePersistenceUtilWithoutProperties);
SettingsEncryptionModel settingsEncryptionModel = new SettingsEncryptionModel();
settingsEncryptionModel.setEncryptionPassword("password");
settingsEncryptionModel.setEncryptionGlobalSalt("globalSalt");
SettingsEncryptionValidator validator = new SettingsEncryptionValidator(encryptionUtilityWithoutProperties, systemMessageAccessor);
ValidationResponseModel validationResponseModel = validator.validate(settingsEncryptionModel);
assertFalse(validationResponseModel.hasErrors());
}
use of com.synopsys.integration.alert.common.rest.model.ValidationResponseModel in project hub-alert by blackducksoftware.
the class SettingsEncryptionValidatorTest method fieldNameTooShortTest.
@Test
public void fieldNameTooShortTest() {
SettingsEncryptionValidator validator = new SettingsEncryptionValidator(encryptionUtility, systemMessageAccessor);
SettingsEncryptionModel settingsEncryptionModel = new SettingsEncryptionModel();
settingsEncryptionModel.setEncryptionPassword("too");
settingsEncryptionModel.setEncryptionGlobalSalt("short");
ValidationResponseModel validationResponseModel = validator.validate(settingsEncryptionModel);
assertTrue(validationResponseModel.hasErrors());
assertEquals(2, validationResponseModel.getErrors().size());
}
use of com.synopsys.integration.alert.common.rest.model.ValidationResponseModel in project hub-alert by blackducksoftware.
the class SettingsProxyValidatorTest method validateHostWithoutPortTest.
@Test
void validateHostWithoutPortTest() {
SettingsProxyModel settingsProxyModel = new SettingsProxyModel();
settingsProxyModel.setName(AlertRestConstants.DEFAULT_CONFIGURATION_NAME);
settingsProxyModel.setProxyHost(HOST);
ValidationResponseModel validationResponseModel = settingsProxyValidator.validate(settingsProxyModel);
assertTrue(validationResponseModel.hasErrors());
assertEquals(1, validationResponseModel.getErrors().size());
assertTrue(validationResponseModel.getErrors().containsKey(SettingsProxyValidator.PROXY_PORT_FIELD_NAME));
}
use of com.synopsys.integration.alert.common.rest.model.ValidationResponseModel in project hub-alert by blackducksoftware.
the class SettingsProxyValidatorTest method validatePortWithoutHostTest.
@Test
void validatePortWithoutHostTest() {
SettingsProxyModel settingsProxyModel = new SettingsProxyModel();
settingsProxyModel.setName(AlertRestConstants.DEFAULT_CONFIGURATION_NAME);
settingsProxyModel.setProxyPort(PORT);
ValidationResponseModel validationResponseModel = settingsProxyValidator.validate(settingsProxyModel);
assertTrue(validationResponseModel.hasErrors());
assertEquals(1, validationResponseModel.getErrors().size());
assertTrue(validationResponseModel.getErrors().containsKey(SettingsProxyValidator.PROXY_HOST_FIELD_NAME));
}
use of com.synopsys.integration.alert.common.rest.model.ValidationResponseModel in project hub-alert by blackducksoftware.
the class SettingsProxyValidatorTest method validateUsernameWithoutPasswordTest.
@Test
void validateUsernameWithoutPasswordTest() {
SettingsProxyModel settingsProxyModel = new SettingsProxyModel();
settingsProxyModel.setName(AlertRestConstants.DEFAULT_CONFIGURATION_NAME);
settingsProxyModel.setProxyHost(HOST);
settingsProxyModel.setProxyPort(PORT);
settingsProxyModel.setProxyUsername(USERNAME);
ValidationResponseModel validationResponseModel = settingsProxyValidator.validate(settingsProxyModel);
assertTrue(validationResponseModel.hasErrors());
assertEquals(1, validationResponseModel.getErrors().size());
assertTrue(validationResponseModel.getErrors().containsKey(SettingsProxyValidator.PROXY_PASSWORD_FIELD_NAME));
}
Aggregations