Search in sources :

Example 1 with JiraServerChannelKey

use of com.synopsys.integration.alert.descriptor.api.JiraServerChannelKey in project hub-alert by blackducksoftware.

the class StaticJobAccessorTestIT method verifyJiraCloudSavesTest.

@Test
public void verifyJiraCloudSavesTest() {
    JiraCloudJobDetailsModel jiraCloudJobDetailsModel = new JiraCloudJobDetailsModel(UUID.randomUUID(), true, "issueCreatorEmail", "projectNameOrKey", "issueType", "resolveTransition", "reopenTransition", List.of(), "issueSummary");
    DistributionJobRequestModel jobRequestModel = createJobRequestModel(jiraCloudJobDetailsModel, new JiraServerChannelKey());
    createAndAssertJob(jobRequestModel);
}
Also used : JiraServerChannelKey(com.synopsys.integration.alert.descriptor.api.JiraServerChannelKey) JiraCloudJobDetailsModel(com.synopsys.integration.alert.common.persistence.model.job.details.JiraCloudJobDetailsModel) DistributionJobRequestModel(com.synopsys.integration.alert.common.persistence.model.job.DistributionJobRequestModel) AlertIntegrationTest(com.synopsys.integration.alert.util.AlertIntegrationTest) Test(org.junit.jupiter.api.Test)

Example 2 with JiraServerChannelKey

use of com.synopsys.integration.alert.descriptor.api.JiraServerChannelKey in project hub-alert by blackducksoftware.

the class StaticJobAccessorTestIT method verifyJiraServerSavesTest.

@Test
public void verifyJiraServerSavesTest() {
    JiraServerJobDetailsModel jiraServerJobDetailsModel = new JiraServerJobDetailsModel(UUID.randomUUID(), true, "issueCreatorUsername", "projectNameOrKey", "issueType", "resolveTransition", "reopenTransition", List.of(), "issueSummary");
    DistributionJobRequestModel jobRequestModel = createJobRequestModel(jiraServerJobDetailsModel, new JiraServerChannelKey());
    createAndAssertJob(jobRequestModel);
}
Also used : JiraServerChannelKey(com.synopsys.integration.alert.descriptor.api.JiraServerChannelKey) DistributionJobRequestModel(com.synopsys.integration.alert.common.persistence.model.job.DistributionJobRequestModel) JiraServerJobDetailsModel(com.synopsys.integration.alert.common.persistence.model.job.details.JiraServerJobDetailsModel) AlertIntegrationTest(com.synopsys.integration.alert.util.AlertIntegrationTest) Test(org.junit.jupiter.api.Test)

Example 3 with JiraServerChannelKey

use of com.synopsys.integration.alert.descriptor.api.JiraServerChannelKey in project hub-alert by blackducksoftware.

the class JiraServerExternalConnectionTest method sendJiraServerMessageTest.

// This test is @Disabled since it requires a running Jira Server instance. In order to run this test, you must deploy a Jira Server and
// add the Jira Server environment values into test.properties
@Test
@Disabled
public void sendJiraServerMessageTest() throws AlertException {
    Gson gson = new Gson();
    JiraMessageFormatter jiraMessageFormatter = new JiraMessageFormatter();
    JiraServerChannelKey jiraServerChannelKey = new JiraServerChannelKey();
    JiraServerGlobalConfigAccessor jiraServerGlobalConfigAccessor = Mockito.mock(JiraServerGlobalConfigAccessor.class);
    Mockito.when(jiraServerGlobalConfigAccessor.getConfigurationByName(Mockito.anyString())).thenReturn(Optional.of(createJiraServerConfigModel()));
    ProxyManager proxyManager = Mockito.mock(ProxyManager.class);
    Mockito.when(proxyManager.createProxyInfoForHost(Mockito.anyString())).thenReturn(null);
    JobAccessor jobAccessor = Mockito.mock(JobAccessor.class);
    Mockito.when(jobAccessor.getJobById(Mockito.any())).thenReturn(Optional.of(createDistributionJobModel()));
    JiraServerPropertiesFactory jiraServerPropertiesFactory = new JiraServerPropertiesFactory(proxyManager, jiraServerGlobalConfigAccessor, jobAccessor);
    IssueTrackerCallbackInfoCreator issueTrackerCallbackInfoCreator = new IssueTrackerCallbackInfoCreator();
    IssueCategoryRetriever issueCategoryRetriever = new IssueCategoryRetriever();
    JiraServerMessageSenderFactory jiraServerMessageSenderFactory = new JiraServerMessageSenderFactory(gson, jiraServerChannelKey, jiraServerPropertiesFactory, issueTrackerCallbackInfoCreator, issueCategoryRetriever);
    ProjectMessageToIssueModelTransformer modelTransformer = new ProjectMessageToIssueModelTransformer();
    JiraServerProcessorFactory jiraServerProcessorFactory = new JiraServerProcessorFactory(gson, jiraMessageFormatter, jiraServerPropertiesFactory, jiraServerMessageSenderFactory, modelTransformer, issueCategoryRetriever);
    IssueTrackerProcessor<String> processor = jiraServerProcessorFactory.createProcessor(createDistributionDetails());
    IssueTrackerResponse<String> response = processor.processMessages(createMessage(), "jobName");
    assertEquals("Success", response.getStatusMessage());
}
Also used : JiraServerChannelKey(com.synopsys.integration.alert.descriptor.api.JiraServerChannelKey) IssueTrackerCallbackInfoCreator(com.synopsys.integration.alert.api.channel.issue.callback.IssueTrackerCallbackInfoCreator) ProxyManager(com.synopsys.integration.alert.common.rest.proxy.ProxyManager) Gson(com.google.gson.Gson) JiraServerGlobalConfigAccessor(com.synopsys.integration.alert.channel.jira.server.database.accessor.JiraServerGlobalConfigAccessor) JiraServerProcessorFactory(com.synopsys.integration.alert.channel.jira.server.distribution.JiraServerProcessorFactory) JobAccessor(com.synopsys.integration.alert.common.persistence.accessor.JobAccessor) JiraMessageFormatter(com.synopsys.integration.alert.api.channel.jira.distribution.JiraMessageFormatter) JiraServerMessageSenderFactory(com.synopsys.integration.alert.channel.jira.server.distribution.JiraServerMessageSenderFactory) ProjectMessageToIssueModelTransformer(com.synopsys.integration.alert.api.channel.issue.convert.ProjectMessageToIssueModelTransformer) IssueCategoryRetriever(com.synopsys.integration.alert.api.channel.issue.search.IssueCategoryRetriever) Test(org.junit.jupiter.api.Test) Disabled(org.junit.jupiter.api.Disabled)

Aggregations

JiraServerChannelKey (com.synopsys.integration.alert.descriptor.api.JiraServerChannelKey)3 Test (org.junit.jupiter.api.Test)3 DistributionJobRequestModel (com.synopsys.integration.alert.common.persistence.model.job.DistributionJobRequestModel)2 AlertIntegrationTest (com.synopsys.integration.alert.util.AlertIntegrationTest)2 Gson (com.google.gson.Gson)1 IssueTrackerCallbackInfoCreator (com.synopsys.integration.alert.api.channel.issue.callback.IssueTrackerCallbackInfoCreator)1 ProjectMessageToIssueModelTransformer (com.synopsys.integration.alert.api.channel.issue.convert.ProjectMessageToIssueModelTransformer)1 IssueCategoryRetriever (com.synopsys.integration.alert.api.channel.issue.search.IssueCategoryRetriever)1 JiraMessageFormatter (com.synopsys.integration.alert.api.channel.jira.distribution.JiraMessageFormatter)1 JiraServerGlobalConfigAccessor (com.synopsys.integration.alert.channel.jira.server.database.accessor.JiraServerGlobalConfigAccessor)1 JiraServerMessageSenderFactory (com.synopsys.integration.alert.channel.jira.server.distribution.JiraServerMessageSenderFactory)1 JiraServerProcessorFactory (com.synopsys.integration.alert.channel.jira.server.distribution.JiraServerProcessorFactory)1 JobAccessor (com.synopsys.integration.alert.common.persistence.accessor.JobAccessor)1 JiraCloudJobDetailsModel (com.synopsys.integration.alert.common.persistence.model.job.details.JiraCloudJobDetailsModel)1 JiraServerJobDetailsModel (com.synopsys.integration.alert.common.persistence.model.job.details.JiraServerJobDetailsModel)1 ProxyManager (com.synopsys.integration.alert.common.rest.proxy.ProxyManager)1 Disabled (org.junit.jupiter.api.Disabled)1