Search in sources :

Example 1 with IssueTrackerException

use of com.synopsys.integration.alert.common.channel.issuetracker.exception.IssueTrackerException in project hub-alert by blackducksoftware.

the class JiraCloudProperties method createJiraServerConfig.

public JiraCloudRestConfig createJiraServerConfig() throws IssueTrackerException {
    JiraCloudRestConfigBuilder jiraServerConfigBuilder = new JiraCloudRestConfigBuilder();
    jiraServerConfigBuilder.setUrl(url);
    jiraServerConfigBuilder.setApiToken(accessToken);
    jiraServerConfigBuilder.setAuthUserEmail(username);
    jiraServerConfigBuilder.setProxyInfo(proxyInfo);
    try {
        return jiraServerConfigBuilder.build();
    } catch (IllegalArgumentException e) {
        throw new IssueTrackerException("There was an issue building the configuration: " + e.getMessage());
    }
}
Also used : IssueTrackerException(com.synopsys.integration.alert.common.channel.issuetracker.exception.IssueTrackerException) JiraCloudRestConfigBuilder(com.synopsys.integration.jira.common.cloud.configuration.JiraCloudRestConfigBuilder)

Example 2 with IssueTrackerException

use of com.synopsys.integration.alert.common.channel.issuetracker.exception.IssueTrackerException in project hub-alert by blackducksoftware.

the class JiraServerProperties method createJiraServerConfig.

public JiraServerRestConfig createJiraServerConfig() throws IssueTrackerException {
    JiraServerRestConfigBuilder jiraServerConfigBuilder = new JiraServerRestConfigBuilder();
    jiraServerConfigBuilder.setUrl(url);
    jiraServerConfigBuilder.setAuthPassword(password);
    jiraServerConfigBuilder.setAuthUsername(username);
    jiraServerConfigBuilder.setProxyInfo(proxyInfo);
    try {
        return jiraServerConfigBuilder.build();
    } catch (IllegalArgumentException e) {
        throw new IssueTrackerException("There was an issue building the configuration: " + e.getMessage());
    }
}
Also used : IssueTrackerException(com.synopsys.integration.alert.common.channel.issuetracker.exception.IssueTrackerException) JiraServerRestConfigBuilder(com.synopsys.integration.jira.common.server.configuration.JiraServerRestConfigBuilder)

Example 3 with IssueTrackerException

use of com.synopsys.integration.alert.common.channel.issuetracker.exception.IssueTrackerException 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());
}
Also used : JiraServerGlobalConfigurationValidator(com.synopsys.integration.alert.channel.jira.server.validator.JiraServerGlobalConfigurationValidator) IssueTrackerException(com.synopsys.integration.alert.common.channel.issuetracker.exception.IssueTrackerException) JiraServerGlobalConfigModel(com.synopsys.integration.alert.channel.jira.server.model.JiraServerGlobalConfigModel) AuthorizationManager(com.synopsys.integration.alert.common.security.authorization.AuthorizationManager) ConfigurationTestResult(com.synopsys.integration.alert.common.message.model.ConfigurationTestResult) Test(org.junit.jupiter.api.Test)

Example 4 with IssueTrackerException

use of com.synopsys.integration.alert.common.channel.issuetracker.exception.IssueTrackerException in project hub-alert by blackducksoftware.

the class JiraServerPropertiesTest method testBuildConfig.

@Test
public void testBuildConfig() {
    try {
        String url = "http://localhost:2990";
        String password = "password";
        String user = "user";
        boolean pluginCheckDisabled = true;
        JiraServerProperties properties = new JiraServerProperties(url, password, user, pluginCheckDisabled, ProxyInfo.NO_PROXY_INFO);
        assertEquals(url, properties.getUrl());
        assertEquals(password, properties.getPassword());
        assertEquals(user, properties.getUsername());
        assertEquals(pluginCheckDisabled, properties.isPluginCheckDisabled());
        JiraServerRestConfig config = properties.createJiraServerConfig();
        assertNotNull(config);
    } catch (IssueTrackerException ex) {
        ex.printStackTrace();
        fail();
    }
}
Also used : JiraServerRestConfig(com.synopsys.integration.jira.common.server.configuration.JiraServerRestConfig) IssueTrackerException(com.synopsys.integration.alert.common.channel.issuetracker.exception.IssueTrackerException) Test(org.junit.jupiter.api.Test)

Example 5 with IssueTrackerException

use of com.synopsys.integration.alert.common.channel.issuetracker.exception.IssueTrackerException in project hub-alert by blackducksoftware.

the class JiraServerPropertiesTest method testServerServiceFactory.

@Test
public void testServerServiceFactory() {
    try {
        JiraServerProperties properties = new JiraServerProperties("http://localhost:2990", "password", "user", false, ProxyInfo.NO_PROXY_INFO);
        JiraServerServiceFactory serviceFactory = properties.createJiraServicesServerFactory(LoggerFactory.getLogger(getClass()), new Gson());
        assertNotNull(serviceFactory);
    } catch (IssueTrackerException ex) {
        ex.printStackTrace();
        fail();
    }
}
Also used : JiraServerServiceFactory(com.synopsys.integration.jira.common.server.service.JiraServerServiceFactory) IssueTrackerException(com.synopsys.integration.alert.common.channel.issuetracker.exception.IssueTrackerException) Gson(com.google.gson.Gson) Test(org.junit.jupiter.api.Test)

Aggregations

IssueTrackerException (com.synopsys.integration.alert.common.channel.issuetracker.exception.IssueTrackerException)7 Test (org.junit.jupiter.api.Test)5 Gson (com.google.gson.Gson)2 JiraServerGlobalConfigModel (com.synopsys.integration.alert.channel.jira.server.model.JiraServerGlobalConfigModel)1 JiraServerGlobalConfigurationValidator (com.synopsys.integration.alert.channel.jira.server.validator.JiraServerGlobalConfigurationValidator)1 ConfigurationTestResult (com.synopsys.integration.alert.common.message.model.ConfigurationTestResult)1 AuthorizationManager (com.synopsys.integration.alert.common.security.authorization.AuthorizationManager)1 JiraCloudRestConfig (com.synopsys.integration.jira.common.cloud.configuration.JiraCloudRestConfig)1 JiraCloudRestConfigBuilder (com.synopsys.integration.jira.common.cloud.configuration.JiraCloudRestConfigBuilder)1 JiraCloudServiceFactory (com.synopsys.integration.jira.common.cloud.service.JiraCloudServiceFactory)1 JiraServerRestConfig (com.synopsys.integration.jira.common.server.configuration.JiraServerRestConfig)1 JiraServerRestConfigBuilder (com.synopsys.integration.jira.common.server.configuration.JiraServerRestConfigBuilder)1 JiraServerServiceFactory (com.synopsys.integration.jira.common.server.service.JiraServerServiceFactory)1