use of com.epam.pipeline.controller.vo.IssueVO in project cloud-pipeline by epam.
the class IssueManagerTest method getIssueVO.
private IssueVO getIssueVO(String name, String text, EntityVO entity) {
IssueVO issueVO = new IssueVO();
issueVO.setName(name);
issueVO.setEntity(entity);
issueVO.setText(text);
issueVO.setLabels(Arrays.asList(LABEL1, LABEL2));
return issueVO;
}
use of com.epam.pipeline.controller.vo.IssueVO in project cloud-pipeline by epam.
the class IssueManagerTest method updateIssueWithAttachments.
@Test
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Throwable.class)
public void updateIssueWithAttachments() {
when(authManager.getAuthorizedUser()).thenReturn(AUTHOR);
IssueVO issueVO = getIssueVO(ISSUE_NAME, ISSUE_TEXT, entityVO);
issueVO.setStatus(IssueStatus.OPEN);
issueVO.setAttachments(Collections.singletonList(testAttachment));
Issue saved = issueManager.createIssue(issueVO);
Attachment newAttachment = new Attachment();
newAttachment.setPath("///");
newAttachment.setName("newTestAttachment");
newAttachment.setCreatedDate(new Date());
newAttachment.setOwner(AUTHOR);
attachmentDao.createAttachment(newAttachment);
issueVO.setAttachments(Collections.singletonList(newAttachment));
issueManager.updateIssue(saved.getId(), issueVO);
Issue loaded = issueManager.loadIssue(saved.getId());
assertEquals(1, loaded.getAttachments().size());
assertTrue(loaded.getAttachments().stream().allMatch(a -> a.getName().equals(newAttachment.getName())));
}
use of com.epam.pipeline.controller.vo.IssueVO in project cloud-pipeline by epam.
the class IssueManagerTest method getClosedIssue.
private Issue getClosedIssue() {
when(authManager.getAuthorizedUser()).thenReturn(AUTHOR);
IssueVO issueVO = getIssueVO(ISSUE_NAME, ISSUE_TEXT, entityVO);
Issue issue = issueManager.createIssue(issueVO);
issueVO.setStatus(IssueStatus.CLOSED);
return issueManager.updateIssue(issue.getId(), issueVO);
}
use of com.epam.pipeline.controller.vo.IssueVO in project cloud-pipeline by epam.
the class IssueManagerTest method testUpdateIssue.
@Test
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
public void testUpdateIssue() {
when(authManager.getAuthorizedUser()).thenReturn(AUTHOR);
IssueVO issueVO = getIssueVO(ISSUE_NAME, ISSUE_TEXT, entityVO);
Issue saved = issueManager.createIssue(issueVO);
issueVO.setName(ISSUE_NAME2);
issueVO.setText(ISSUE_TEXT2);
issueVO.setStatus(IssueStatus.OPEN);
issueVO.setLabels(Arrays.asList(LABEL1, LABEL2, LABEL3));
Long issueId = saved.getId();
issueManager.updateIssue(issueId, issueVO);
Issue updated = issueMapper.toIssue(issueVO);
updated.setAuthor(AUTHOR);
compareIssues(issueManager.loadIssue(issueId), updated);
}
use of com.epam.pipeline.controller.vo.IssueVO in project cloud-pipeline by epam.
the class IssueManagerTest method updatingClosedIssueShouldThrowException.
@Test(expected = IllegalArgumentException.class)
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
public void updatingClosedIssueShouldThrowException() {
when(authManager.getAuthorizedUser()).thenReturn(AUTHOR);
Issue closedIssue = getClosedIssue();
IssueVO issueVO = getIssueVO(ISSUE_NAME, ISSUE_TEXT, entityVO);
issueVO.setLabels(Collections.singletonList(LABEL1));
issueManager.updateIssue(closedIssue.getId(), issueVO);
}
Aggregations