use of com.epam.pipeline.entity.issue.Issue in project cloud-pipeline by epam.
the class IssueDaoTest method testLoadAndDeleteAllIssuesForEntity.
@Test
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Throwable.class)
public void testLoadAndDeleteAllIssuesForEntity() {
EntityVO entity = new EntityVO(ENTITY_ID, ENTITY_CLASS);
Issue issue = getIssue(NAME, entity);
issueDao.createIssue(issue);
Issue issue2 = getIssue(NAME2, entity);
issueDao.createIssue(issue2);
// load
List<Issue> actualIssues = issueDao.loadIssuesForEntity(entity);
assertEquals(2, actualIssues.size());
List<Issue> expectedIssues = Stream.of(issue, issue2).collect(Collectors.toList());
Map<Long, Issue> expectedMap = expectedIssues.stream().collect(Collectors.toMap(Issue::getId, Function.identity()));
actualIssues.forEach(i -> verifyIssue(expectedMap.get(i.getId()), i));
// delete
issueDao.deleteIssuesForEntity(entity);
actualIssues = issueDao.loadIssuesForEntity(entity);
assertEquals(0, actualIssues.size());
}
use of com.epam.pipeline.entity.issue.Issue in project cloud-pipeline by epam.
the class IssueCommentDaoTest method createIssueComment.
private Issue createIssueComment(String issueName) {
Issue issue = createIssue(issueName);
IssueComment comment = getComment(issue, COMMENT_TEXT);
commentDao.createComment(comment);
return issue;
}
use of com.epam.pipeline.entity.issue.Issue in project cloud-pipeline by epam.
the class IssueCommentDaoTest method createIssue.
private Issue createIssue(String name) {
EntityVO entityVO = new EntityVO(ENTITY_ID, ENTITY_CLASS);
Issue issue = new Issue();
issue.setName(name);
issue.setAuthor(ISSUE_AUTHOR);
issue.setEntity(entityVO);
issue.setText(ISSUE_TEXT);
issueDao.createIssue(issue);
return issue;
}
use of com.epam.pipeline.entity.issue.Issue in project cloud-pipeline by epam.
the class IssueCommentDaoTest method testDeleteCommentsForIssuesList.
@Test
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
public void testDeleteCommentsForIssuesList() {
Issue issue = createIssueComment(ISSUE_NAME);
Issue issue1 = createIssueComment(ISSUE_NAME1);
List<Long> issuesToDelete = Stream.of(issue.getId(), issue1.getId()).collect(Collectors.toList());
commentDao.deleteAllCommentsForIssuesList(issuesToDelete);
assertEquals(0, commentDao.loadCommentsForIssue(issue.getId()).size());
assertEquals(0, commentDao.loadCommentsForIssue(issue1.getId()).size());
}
use of com.epam.pipeline.entity.issue.Issue in project cloud-pipeline by epam.
the class IssueManagerTest method testLoadIssueWithComments.
@Test
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
public void testLoadIssueWithComments() {
Issue issue = registerIssue();
Long issueId = issue.getId();
IssueCommentVO commentVO1 = getCommentVO(COMMENT_TEXT);
IssueCommentVO commentVO2 = getCommentVO(COMMENT_TEXT2);
issueManager.createComment(issueId, commentVO1);
issueManager.createComment(issueId, commentVO2);
assertEquals(2, issueManager.loadIssue(issueId).getComments().size());
}
Aggregations