use of com.synopsys.integration.alert.channel.jira.server.validator.JiraServerGlobalConfigurationValidator in project hub-alert by blackducksoftware.
the class JiraServerGlobalTestActionTest method testUserAdminMissing.
@Test
void testUserAdminMissing() throws IntegrationException {
AuthorizationManager authorizationManager = createAuthorizationManager(255);
JiraServerGlobalConfigurationValidator validator = new JiraServerGlobalConfigurationValidator();
JiraServerTestActionFactory jiraServerTestActionFactory = Mockito.mock(JiraServerTestActionFactory.class);
JiraServerGlobalTestActionWrapper testActionWrapper = Mockito.mock(JiraServerGlobalTestActionWrapper.class);
Mockito.when(jiraServerTestActionFactory.createTestActionWrapper(Mockito.any())).thenReturn(testActionWrapper);
Mockito.when(testActionWrapper.canUserGetIssues()).thenReturn(true);
Mockito.when(testActionWrapper.isAppCheckEnabled()).thenReturn(true);
Mockito.when(testActionWrapper.isUserAdmin()).thenReturn(false);
JiraServerGlobalTestAction jiraServerGlobalTestAction = new JiraServerGlobalTestAction(authorizationManager, validator, jiraServerTestActionFactory);
ConfigurationTestResult testResult = jiraServerGlobalTestAction.testConfigModelContent(jiraServerGlobalConfigModel);
assertFalse(testResult.isSuccess());
}
use of com.synopsys.integration.alert.channel.jira.server.validator.JiraServerGlobalConfigurationValidator in project hub-alert by blackducksoftware.
the class JiraServerGlobalTestActionTest method testConfigIssueTrackerException.
@Test
void testConfigIssueTrackerException() throws IntegrationException {
AuthorizationManager authorizationManager = createAuthorizationManager(255);
JiraServerGlobalConfigurationValidator validator = new JiraServerGlobalConfigurationValidator();
JiraServerTestActionFactory jiraServerTestActionFactory = Mockito.mock(JiraServerTestActionFactory.class);
Mockito.when(jiraServerTestActionFactory.createTestActionWrapper(Mockito.any())).thenThrow(new IssueTrackerException("Test Exception message"));
JiraServerGlobalConfigModel jiraServerGlobalConfigModel = createValidJiraServerGlobalConfigModel();
JiraServerGlobalTestAction jiraServerGlobalTestAction = new JiraServerGlobalTestAction(authorizationManager, validator, jiraServerTestActionFactory);
ConfigurationTestResult testResult = jiraServerGlobalTestAction.testConfigModelContent(jiraServerGlobalConfigModel);
assertFalse(testResult.isSuccess());
}
use of com.synopsys.integration.alert.channel.jira.server.validator.JiraServerGlobalConfigurationValidator in project hub-alert by blackducksoftware.
the class JiraServerGlobalTestActionTest method testAppCheckDisabled.
@Test
void testAppCheckDisabled() throws IntegrationException {
AuthorizationManager authorizationManager = createAuthorizationManager(255);
JiraServerGlobalConfigurationValidator validator = new JiraServerGlobalConfigurationValidator();
JiraServerTestActionFactory jiraServerTestActionFactory = Mockito.mock(JiraServerTestActionFactory.class);
JiraServerGlobalTestActionWrapper testActionWrapper = Mockito.mock(JiraServerGlobalTestActionWrapper.class);
Mockito.when(jiraServerTestActionFactory.createTestActionWrapper(Mockito.any())).thenReturn(testActionWrapper);
Mockito.when(testActionWrapper.canUserGetIssues()).thenReturn(true);
Mockito.when(testActionWrapper.isAppCheckEnabled()).thenReturn(false);
Mockito.when(testActionWrapper.isUserAdmin()).thenThrow(new IntegrationException("Test failure: This exception should not be thrown!"));
JiraServerGlobalTestAction jiraServerGlobalTestAction = new JiraServerGlobalTestAction(authorizationManager, validator, jiraServerTestActionFactory);
ConfigurationTestResult testResult = jiraServerGlobalTestAction.testConfigModelContent(jiraServerGlobalConfigModel);
assertTrue(testResult.isSuccess());
}
Aggregations