Search in sources :

Example 1 with DistributionJobRequestModel

use of com.synopsys.integration.alert.common.persistence.model.job.DistributionJobRequestModel in project hub-alert by blackducksoftware.

the class DefaultDistributionAccessorTestIT method createAndSave6JobAndAudit.

private Map<UUID, Pair<DistributionJobModel, List<AuditEntryEntity>>> createAndSave6JobAndAudit() {
    DistributionJobRequestModel firstJob = createSlackJob(true);
    DistributionJobRequestModel secondJob = createSlackJob(false);
    DistributionJobRequestModel thirdJob = createSlackJob(true);
    DistributionJobRequestModel fourthJob = createSlackJob(false);
    DistributionJobRequestModel fifthJob = createMSTeamsJob(true);
    DistributionJobRequestModel sixthJob = createMSTeamsJob(false);
    DistributionJobModel firstJobSaved = jobAccessor.createJob(firstJob);
    DistributionJobModel secondJobSaved = jobAccessor.createJob(secondJob);
    DistributionJobModel thirdJobSaved = jobAccessor.createJob(thirdJob);
    DistributionJobModel fourthJobSaved = jobAccessor.createJob(fourthJob);
    DistributionJobModel fifthJobSaved = jobAccessor.createJob(fifthJob);
    DistributionJobModel sixthJobSaved = jobAccessor.createJob(sixthJob);
    createdJobs.add(firstJobSaved.getJobId());
    createdJobs.add(secondJobSaved.getJobId());
    createdJobs.add(thirdJobSaved.getJobId());
    createdJobs.add(fourthJobSaved.getJobId());
    createdJobs.add(fifthJobSaved.getJobId());
    createdJobs.add(sixthJobSaved.getJobId());
    AuditEntryEntity firstAudit = createAuditEntryEntity(firstJobSaved.getJobId(), OffsetDateTime.now(), AuditEntryStatus.SUCCESS);
    AuditEntryEntity secondAudit = createAuditEntryEntity(firstJobSaved.getJobId(), OffsetDateTime.now().minusDays(1), AuditEntryStatus.PENDING);
    AuditEntryEntity thirdAudit = createAuditEntryEntity(secondJobSaved.getJobId(), OffsetDateTime.now().minusMinutes(1), AuditEntryStatus.FAILURE);
    AuditEntryEntity fourthAudit = createAuditEntryEntity(fourthJobSaved.getJobId(), OffsetDateTime.now().minusHours(1), AuditEntryStatus.SUCCESS);
    AuditEntryEntity fifthAudit = createAuditEntryEntity(fifthJobSaved.getJobId(), OffsetDateTime.now().minusHours(2), AuditEntryStatus.SUCCESS);
    AuditEntryEntity sixthAudit = createAuditEntryEntity(fifthJobSaved.getJobId(), OffsetDateTime.now().minusMinutes(2), AuditEntryStatus.FAILURE);
    AuditEntryEntity seventhAudit = createAuditEntryEntity(sixthJobSaved.getJobId(), null, AuditEntryStatus.SUCCESS);
    AuditEntryEntity eighthAudit = createAuditEntryEntity(sixthJobSaved.getJobId(), OffsetDateTime.now(), AuditEntryStatus.FAILURE);
    AuditEntryEntity ninthAudit = createAuditEntryEntity(sixthJobSaved.getJobId(), null, AuditEntryStatus.PENDING);
    saveAllAudits(List.of(firstAudit, secondAudit, thirdAudit, fourthAudit, fifthAudit, sixthAudit, seventhAudit, eighthAudit, ninthAudit));
    return Map.of(firstJobSaved.getJobId(), Pair.of(firstJobSaved, List.of(firstAudit, secondAudit)), secondJobSaved.getJobId(), Pair.of(secondJobSaved, List.of(thirdAudit)), thirdJobSaved.getJobId(), Pair.of(thirdJobSaved, List.of()), fourthJobSaved.getJobId(), Pair.of(fourthJobSaved, List.of(fourthAudit)), fifthJobSaved.getJobId(), Pair.of(fifthJobSaved, List.of(fifthAudit, sixthAudit)), sixthJobSaved.getJobId(), Pair.of(sixthJobSaved, List.of(seventhAudit, eighthAudit, ninthAudit)));
}
Also used : AuditEntryEntity(com.synopsys.integration.alert.database.audit.AuditEntryEntity) DistributionJobRequestModel(com.synopsys.integration.alert.common.persistence.model.job.DistributionJobRequestModel) DistributionJobModel(com.synopsys.integration.alert.common.persistence.model.job.DistributionJobModel)

Example 2 with DistributionJobRequestModel

use of com.synopsys.integration.alert.common.persistence.model.job.DistributionJobRequestModel 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 3 with DistributionJobRequestModel

use of com.synopsys.integration.alert.common.persistence.model.job.DistributionJobRequestModel in project hub-alert by blackducksoftware.

the class StaticJobAccessorTestIT method verifySlackSavesTest.

@Test
public void verifySlackSavesTest() {
    SlackJobDetailsModel slackJobDetailsModel = new SlackJobDetailsModel(UUID.randomUUID(), "webhook", "channelName", "channelUsername");
    DistributionJobRequestModel jobRequestModel = createJobRequestModel(slackJobDetailsModel, new SlackChannelKey());
    createAndAssertJob(jobRequestModel);
}
Also used : SlackChannelKey(com.synopsys.integration.alert.descriptor.api.SlackChannelKey) SlackJobDetailsModel(com.synopsys.integration.alert.common.persistence.model.job.details.SlackJobDetailsModel) DistributionJobRequestModel(com.synopsys.integration.alert.common.persistence.model.job.DistributionJobRequestModel) AlertIntegrationTest(com.synopsys.integration.alert.util.AlertIntegrationTest) Test(org.junit.jupiter.api.Test)

Example 4 with DistributionJobRequestModel

use of com.synopsys.integration.alert.common.persistence.model.job.DistributionJobRequestModel in project hub-alert by blackducksoftware.

the class StaticJobAccessorTestIT method verifyAzureSavesTest.

@Test
@Transactional
public void verifyAzureSavesTest() {
    AzureBoardsJobDetailsModel azureBoardsJobDetailsModel = new AzureBoardsJobDetailsModel(UUID.randomUUID(), true, "projectNameOrId", "workItemType", "workItemCompletedState", "workItemReopenState");
    DistributionJobRequestModel jobRequestModel = createJobRequestModel(azureBoardsJobDetailsModel, new AzureBoardsChannelKey());
    createAndAssertJob(jobRequestModel);
}
Also used : AzureBoardsChannelKey(com.synopsys.integration.alert.descriptor.api.AzureBoardsChannelKey) AzureBoardsJobDetailsModel(com.synopsys.integration.alert.common.persistence.model.job.details.AzureBoardsJobDetailsModel) DistributionJobRequestModel(com.synopsys.integration.alert.common.persistence.model.job.DistributionJobRequestModel) AlertIntegrationTest(com.synopsys.integration.alert.util.AlertIntegrationTest) Test(org.junit.jupiter.api.Test) Transactional(org.springframework.transaction.annotation.Transactional)

Example 5 with DistributionJobRequestModel

use of com.synopsys.integration.alert.common.persistence.model.job.DistributionJobRequestModel 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)

Aggregations

DistributionJobRequestModel (com.synopsys.integration.alert.common.persistence.model.job.DistributionJobRequestModel)34 Test (org.junit.jupiter.api.Test)25 DistributionJobModel (com.synopsys.integration.alert.common.persistence.model.job.DistributionJobModel)18 AlertIntegrationTest (com.synopsys.integration.alert.util.AlertIntegrationTest)16 UUID (java.util.UUID)10 DistributionJobEntity (com.synopsys.integration.alert.database.job.DistributionJobEntity)7 BlackDuckJobDetailsEntity (com.synopsys.integration.alert.database.job.blackduck.BlackDuckJobDetailsEntity)7 ConfigurationFieldModel (com.synopsys.integration.alert.common.persistence.model.ConfigurationFieldModel)6 SlackJobDetailsModel (com.synopsys.integration.alert.common.persistence.model.job.details.SlackJobDetailsModel)6 AuditEntryEntity (com.synopsys.integration.alert.database.audit.AuditEntryEntity)6 ArrayList (java.util.ArrayList)6 AuthorizationManager (com.synopsys.integration.alert.common.security.authorization.AuthorizationManager)4 AuditNotificationRelation (com.synopsys.integration.alert.database.audit.AuditNotificationRelation)4 NotificationEntity (com.synopsys.integration.alert.database.notification.NotificationEntity)4 AlertException (com.synopsys.integration.alert.api.common.model.exception.AlertException)3 ActionResponse (com.synopsys.integration.alert.common.action.ActionResponse)3 ValidationActionResponse (com.synopsys.integration.alert.common.action.ValidationActionResponse)3 ConfigurationModel (com.synopsys.integration.alert.common.persistence.model.ConfigurationModel)3 FieldModel (com.synopsys.integration.alert.common.rest.model.FieldModel)3 JobFieldModel (com.synopsys.integration.alert.common.rest.model.JobFieldModel)3