use of com.synopsys.integration.alert.common.rest.proxy.ProxyTestService in project hub-alert by blackducksoftware.
the class SettingsProxyTestActionTest method blankTestUrlTest.
@Test
void blankTestUrlTest() {
ProxyTestService proxyTestService = Mockito.mock(ProxyTestService.class);
SettingsProxyTestAction settingsProxyTestAction = new SettingsProxyTestAction(authorizationManager, settingsProxyValidator, settingsDescriptorKey, proxyTestService, settingsProxyConfigAccessor);
ConfigurationTestResult testResult = settingsProxyTestAction.testConfigModelContent("", defaultSettingsProxyModel);
assertFalse(testResult.isSuccess());
}
use of com.synopsys.integration.alert.common.rest.proxy.ProxyTestService in project hub-alert by blackducksoftware.
the class SettingsProxyTestActionTest method testConfigModelContentTest.
@Test
void testConfigModelContentTest() {
ConfigurationTestResult configurationTestResult = ConfigurationTestResult.success();
ProxyTestService proxyTestService = Mockito.mock(ProxyTestService.class);
Mockito.when(proxyTestService.pingHost(Mockito.eq(TEST_URL), Mockito.any())).thenReturn(configurationTestResult);
SettingsProxyTestAction settingsProxyTestAction = new SettingsProxyTestAction(authorizationManager, settingsProxyValidator, settingsDescriptorKey, proxyTestService, settingsProxyConfigAccessor);
ConfigurationTestResult testResult = settingsProxyTestAction.testConfigModelContent(TEST_URL, defaultSettingsProxyModel);
assertEquals(configurationTestResult, testResult);
}
use of com.synopsys.integration.alert.common.rest.proxy.ProxyTestService in project hub-alert by blackducksoftware.
the class SettingsProxyTestActionTest method testWithPermissionCheckTest.
@Test
void testWithPermissionCheckTest() {
ConfigurationTestResult configurationTestResult = ConfigurationTestResult.success();
ProxyTestService proxyTestService = Mockito.mock(ProxyTestService.class);
Mockito.when(proxyTestService.pingHost(Mockito.eq(TEST_URL), Mockito.any())).thenReturn(configurationTestResult);
SettingsProxyTestAction settingsProxyTestAction = new SettingsProxyTestAction(authorizationManager, settingsProxyValidator, settingsDescriptorKey, proxyTestService, settingsProxyConfigAccessor);
ActionResponse<ValidationResponseModel> actionResponse = settingsProxyTestAction.testWithPermissionCheck(TEST_URL, defaultSettingsProxyModel);
assertTrue(actionResponse.isSuccessful());
assertTrue(actionResponse.hasContent());
Optional<ValidationResponseModel> validationResponseModel = actionResponse.getContent();
assertTrue(validationResponseModel.isPresent());
assertFalse(validationResponseModel.get().hasErrors());
}
use of com.synopsys.integration.alert.common.rest.proxy.ProxyTestService in project hub-alert by blackducksoftware.
the class SettingsProxyTestActionTest method passwordAlreadySavedTest.
@Test
void passwordAlreadySavedTest() {
ConfigurationTestResult configurationTestResult = ConfigurationTestResult.success();
ProxyTestService proxyTestService = Mockito.mock(ProxyTestService.class);
Mockito.when(proxyTestService.pingHost(Mockito.eq(TEST_URL), Mockito.any())).thenReturn(configurationTestResult);
SettingsProxyModel settingsProxyModel = createDefaultSettingsProxyModel();
settingsProxyModel.setProxyPassword(null);
settingsProxyModel.setIsProxyPasswordSet(true);
SettingsProxyTestAction settingsProxyTestAction = new SettingsProxyTestAction(authorizationManager, settingsProxyValidator, settingsDescriptorKey, proxyTestService, settingsProxyConfigAccessor);
ConfigurationTestResult testResult = settingsProxyTestAction.testConfigModelContent(TEST_URL, settingsProxyModel);
assertEquals(configurationTestResult, testResult);
}
use of com.synopsys.integration.alert.common.rest.proxy.ProxyTestService in project hub-alert by blackducksoftware.
the class SettingsProxyTestActionTest method testWithPermissionCheckFailureTest.
@Test
void testWithPermissionCheckFailureTest() {
ConfigurationTestResult configurationTestResult = ConfigurationTestResult.failure("Failure");
ProxyTestService proxyTestService = Mockito.mock(ProxyTestService.class);
Mockito.when(proxyTestService.pingHost(Mockito.eq(TEST_URL), Mockito.any())).thenReturn(configurationTestResult);
SettingsProxyTestAction settingsProxyTestAction = new SettingsProxyTestAction(authorizationManager, settingsProxyValidator, settingsDescriptorKey, proxyTestService, settingsProxyConfigAccessor);
ActionResponse<ValidationResponseModel> actionResponse = settingsProxyTestAction.testWithPermissionCheck(TEST_URL, defaultSettingsProxyModel);
assertTrue(actionResponse.isSuccessful());
assertTrue(actionResponse.hasContent());
Optional<ValidationResponseModel> validationResponseModel = actionResponse.getContent();
assertTrue(validationResponseModel.isPresent());
assertTrue(validationResponseModel.get().hasErrors());
}
Aggregations