use of com.synopsys.integration.alert.common.rest.model.SettingsProxyModel in project hub-alert by blackducksoftware.
the class ProxyConfigurationModelConverterTest method validConversionTest.
@Test
void validConversionTest() {
ConfigurationModel configurationModel = createDefaultConfigurationModel();
ProxyConfigurationModelConverter converter = new ProxyConfigurationModelConverter();
Optional<SettingsProxyModel> model = converter.convert(configurationModel);
assertTrue(model.isPresent());
SettingsProxyModel proxyModel = model.get();
assertEquals(TEST_AUTH_USER, proxyModel.getProxyUsername().orElse(null));
assertEquals(TEST_AUTH_PASSWORD, proxyModel.getProxyPassword().orElse(null));
assertEquals(TEST_SMTP_HOST, proxyModel.getProxyHost().orElse(null));
assertEquals(Integer.valueOf(TEST_SMTP_PORT), proxyModel.getProxyPort().orElse(null));
assertEquals(TEST_NON_PROXY_HOSTS, proxyModel.getNonProxyHosts().orElse(null));
}
use of com.synopsys.integration.alert.common.rest.model.SettingsProxyModel in project hub-alert by blackducksoftware.
the class SettingsProxyTestActionTestIT method testValidationFailureTest.
@Test
void testValidationFailureTest() {
SettingsProxyModel settingsProxyModel = new SettingsProxyModel();
AuthorizationManager authorizationManager = createAuthorizationManager(AuthenticationTestUtils.FULL_PERMISSIONS);
settingsProxyTestAction = new SettingsProxyTestAction(authorizationManager, settingsProxyValidator, settingsDescriptorKey, proxyTestService, settingsProxyConfigAccessor);
ActionResponse<ValidationResponseModel> testResult = settingsProxyTestAction.testWithPermissionCheck(validTargetUrl, settingsProxyModel);
assertTrue(testResult.isSuccessful());
assertTrue(testResult.getContent().isPresent());
ValidationResponseModel validationResponseModel = testResult.getContent().get();
assertTrue(validationResponseModel.hasErrors());
}
use of com.synopsys.integration.alert.common.rest.model.SettingsProxyModel in project hub-alert by blackducksoftware.
the class SettingsProxyTestActionTestIT method testConfigurationWithPasswordSaved.
@Test
void testConfigurationWithPasswordSaved() throws AlertConfigurationException {
SettingsProxyModel settingsProxyModel = createSettingsProxyModel(testProperties);
settingsProxyConfigAccessor.createConfiguration(createSettingsProxyModel(testProperties));
settingsProxyModel.setProxyPassword(null);
settingsProxyModel.setIsProxyPasswordSet(true);
AuthorizationManager authorizationManager = createAuthorizationManager(AuthenticationTestUtils.FULL_PERMISSIONS);
settingsProxyTestAction = new SettingsProxyTestAction(authorizationManager, settingsProxyValidator, settingsDescriptorKey, proxyTestService, settingsProxyConfigAccessor);
ActionResponse<ValidationResponseModel> testResult = settingsProxyTestAction.testWithPermissionCheck(validTargetUrl, settingsProxyModel);
assertTrue(testResult.isSuccessful());
assertTrue(testResult.getContent().isPresent());
ValidationResponseModel validationResponseModel = testResult.getContent().get();
assertFalse(validationResponseModel.hasErrors());
}
use of com.synopsys.integration.alert.common.rest.model.SettingsProxyModel in project hub-alert by blackducksoftware.
the class SettingsProxyTestActionTestIT method testWithoutPermissionsCheckTest.
@Test
void testWithoutPermissionsCheckTest() {
SettingsProxyModel settingsProxyModel = createSettingsProxyModel(testProperties);
AuthorizationManager authorizationManager = createAuthorizationManager(AuthenticationTestUtils.NO_PERMISSIONS);
settingsProxyTestAction = new SettingsProxyTestAction(authorizationManager, settingsProxyValidator, settingsDescriptorKey, proxyTestService, settingsProxyConfigAccessor);
ActionResponse<ValidationResponseModel> testResult = settingsProxyTestAction.testWithPermissionCheck(validTargetUrl, settingsProxyModel);
assertTrue(testResult.isError());
assertTrue(testResult.getContent().isPresent());
ValidationResponseModel validationResponseModel = testResult.getContent().get();
assertTrue(validationResponseModel.hasErrors());
}
use of com.synopsys.integration.alert.common.rest.model.SettingsProxyModel in project hub-alert by blackducksoftware.
the class SettingsProxyTestActionTestIT method missingTargetUrlTest.
@Test
void missingTargetUrlTest() {
SettingsProxyModel settingsProxyModel = createSettingsProxyModel(testProperties);
AuthorizationManager authorizationManager = createAuthorizationManager(AuthenticationTestUtils.FULL_PERMISSIONS);
settingsProxyTestAction = new SettingsProxyTestAction(authorizationManager, settingsProxyValidator, settingsDescriptorKey, proxyTestService, settingsProxyConfigAccessor);
ActionResponse<ValidationResponseModel> testResult = settingsProxyTestAction.testWithPermissionCheck("", settingsProxyModel);
assertTrue(testResult.isSuccessful());
assertTrue(testResult.getContent().isPresent());
ValidationResponseModel validationResponseModel = testResult.getContent().get();
assertTrue(validationResponseModel.hasErrors());
}
Aggregations