use of com.synopsys.integration.alert.common.message.model.ConfigurationTestResult in project hub-alert by blackducksoftware.
the class EmailGlobalTestActionTest method testConfigInvalidDestinationTest.
@Test
public void testConfigInvalidDestinationTest() {
AuthorizationManager authorizationManager = createAuthorizationManager(AuthenticationTestUtils.FULL_PERMISSIONS);
EmailGlobalConfigurationValidator validator = new EmailGlobalConfigurationValidator();
EmailGlobalTestAction emailGlobalTestAction = new EmailGlobalTestAction(authorizationManager, validator, null, null, null);
ConfigurationTestResult testResult = emailGlobalTestAction.testConfigModelContent("not a valid email address", new EmailGlobalConfigModel());
assertFalse(testResult.isSuccess());
}
use of com.synopsys.integration.alert.common.message.model.ConfigurationTestResult in project hub-alert by blackducksoftware.
the class EmailGlobalTestActionTest method testConfigValidTest.
@Test
public void testConfigValidTest() throws AlertException {
AuthorizationManager authorizationManager = createAuthorizationManager(255);
EmailGlobalConfigurationValidator validator = new EmailGlobalConfigurationValidator();
EmailChannelMessagingService emailChannelMessagingService = Mockito.mock(EmailChannelMessagingService.class);
Mockito.when(emailChannelMessagingService.sendMessage(Mockito.any(), Mockito.any())).thenReturn(new MessageResult("PASS"));
JavamailPropertiesFactory javamailPropertiesFactory = new JavamailPropertiesFactory();
EmailGlobalTestAction emailGlobalTestAction = new EmailGlobalTestAction(authorizationManager, validator, emailChannelMessagingService, javamailPropertiesFactory, configurationAccessor);
ConfigurationTestResult testResult = emailGlobalTestAction.testConfigModelContent("noreply@synopsys.com", new EmailGlobalConfigModel());
assertTrue(testResult.isSuccess(), "Expected the message result to not have errors");
}
use of com.synopsys.integration.alert.common.message.model.ConfigurationTestResult 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.message.model.ConfigurationTestResult 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.message.model.ConfigurationTestResult 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());
}
Aggregations