use of com.synopsys.integration.alert.common.persistence.model.job.details.JiraServerJobDetailsModel in project hub-alert by blackducksoftware.
the class JiraServerExternalConnectionTest method createDistributionDetails.
private JiraServerJobDetailsModel createDistributionDetails() {
UUID uuid = UUID.randomUUID();
List<JiraJobCustomFieldModel> customFields = new ArrayList<>();
// This test requires that the JIRA server has 2 components associated with the project: "component1" and "component2"
customFields.add(new JiraJobCustomFieldModel("Component/s", "component1 component2"));
return new JiraServerJobDetailsModel(uuid, Boolean.parseBoolean(testProperties.getProperty(TestPropertyKey.TEST_JIRA_SERVER_ADD_COMMENTS)), testProperties.getOptionalProperty(TestPropertyKey.TEST_JIRA_SERVER_ISSUE_CREATOR).orElse(null), testProperties.getProperty(TestPropertyKey.TEST_JIRA_SERVER_PROJECT_NAME), testProperties.getProperty(TestPropertyKey.TEST_JIRA_SERVER_ISSUE_TYPE), testProperties.getProperty(TestPropertyKey.TEST_JIRA_SERVER_RESOLVE_TRANSITION), testProperties.getProperty(TestPropertyKey.TEST_JIRA_SERVER_REOPEN_TRANSITION), customFields, "");
}
use of com.synopsys.integration.alert.common.persistence.model.job.details.JiraServerJobDetailsModel in project hub-alert by blackducksoftware.
the class JiraServerJobDetailsAccessorTest method retrieveDetailsUnknownIdTest.
@Test
void retrieveDetailsUnknownIdTest() {
UUID jobId = UUID.randomUUID();
Mockito.when(jobDetailsRepository.findById(Mockito.any())).thenReturn(Optional.empty());
Optional<JiraServerJobDetailsModel> foundJobDetailsModel = jobDetailsAccessor.retrieveDetails(jobId);
assertTrue(foundJobDetailsModel.isEmpty());
}
use of com.synopsys.integration.alert.common.persistence.model.job.details.JiraServerJobDetailsModel in project hub-alert by blackducksoftware.
the class JiraServerJobDetailsAccessorTest method saveJobDetailsTest.
@Test
void saveJobDetailsTest() {
UUID jobId = UUID.randomUUID();
List<JiraServerJobCustomFieldEntity> customFields = createCustomFieldEntities(jobId);
JiraServerJobDetailsEntity jiraJobDetailsEntity = createDetailsEntity(jobId);
jiraJobDetailsEntity.setJobCustomFields(customFields);
JiraServerJobDetailsModel jiraJobDetailsModel = createDetailsModel(jiraJobDetailsEntity);
Mockito.when(jiraServerJobCustomFieldRepository.saveAll(Mockito.any())).thenReturn(customFields);
Mockito.when(jiraServerJobCustomFieldRepository.findByJobId(jobId)).thenReturn(customFields);
Mockito.when(jobDetailsRepository.findById(jobId)).thenReturn(Optional.of(jiraJobDetailsEntity));
Mockito.when(jobDetailsRepository.save(Mockito.any())).thenReturn(jiraJobDetailsEntity);
JiraServerJobDetailsModel newJiraJobDetails = jobDetailsAccessor.saveJobDetails(jobId, jiraJobDetailsModel);
assertEquals(jobId, newJiraJobDetails.getJobId());
assertNotNull(newJiraJobDetails.getCustomFields());
assertEquals(1, newJiraJobDetails.getCustomFields().size());
}
Aggregations