use of com.epam.pipeline.controller.vo.IssueCommentVO in project cloud-pipeline by epam.
the class IssueManagerTest method creatingCommentForClosedIssueShouldThrowException.
@Test(expected = IllegalArgumentException.class)
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
public void creatingCommentForClosedIssueShouldThrowException() {
Issue issue = getClosedIssue();
IssueCommentVO commentVO = getCommentVO(COMMENT_TEXT);
issueManager.createComment(issue.getId(), commentVO);
}
use of com.epam.pipeline.controller.vo.IssueCommentVO in project cloud-pipeline by epam.
the class IssueManagerTest method testUpdateComment.
@Test
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
public void testUpdateComment() {
Issue issue = registerIssue();
Long issueId = issue.getId();
IssueCommentVO commentVO = getCommentVO(COMMENT_TEXT);
IssueComment comment = issueManager.createComment(issueId, commentVO);
IssueCommentVO updated = new IssueCommentVO();
updated.setText(COMMENT_TEXT2);
Long commentId = comment.getId();
issueManager.updateComment(issueId, comment.getId(), updated);
assertEquals(COMMENT_TEXT2, issueManager.loadComment(issueId, commentId).getText());
}
use of com.epam.pipeline.controller.vo.IssueCommentVO in project cloud-pipeline by epam.
the class IssueManagerTest method registerComment.
private IssueComment registerComment() {
Issue issue = registerIssue();
Long issueId = issue.getId();
IssueCommentVO commentVO = getCommentVO(COMMENT_TEXT);
return issueManager.createComment(issueId, commentVO);
}
use of com.epam.pipeline.controller.vo.IssueCommentVO in project cloud-pipeline by epam.
the class IssueApiServiceTest method testCreateCommentAccessDenied.
@WithMockUser(username = NO_PERMISSION_USER)
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
@Test(expected = AccessDeniedException.class)
public void testCreateCommentAccessDenied() {
IssueCommentVO issueCommentVO = new IssueCommentVO();
issueCommentVO.setText(COMMENT_TEXT);
issueApiService.createComment(createdIssue.getId(), issueCommentVO);
}
use of com.epam.pipeline.controller.vo.IssueCommentVO in project cloud-pipeline by epam.
the class IssueApiServiceTest method testIssueOwnerCRUD.
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
@WithMockUser(username = USER_OWNER)
@Test
public void testIssueOwnerCRUD() {
Issue issue = issueApiService.createIssue(getIssueVO(ISSUE_NAME, ISSUE_TEXT, entityVO));
Issue loaded = issueApiService.loadIssue(issue.getId());
Assert.assertNotNull(loaded);
List<Issue> loadedIssues = issueApiService.loadIssuesForEntity(entityVO);
Assert.assertNotNull(loadedIssues);
issueApiService.updateIssue(issue.getId(), getIssueVO(ISSUE_NAME, ISSUE_TEXT + "!", entityVO));
IssueCommentVO issueCommentVO = new IssueCommentVO();
issueCommentVO.setText(COMMENT_TEXT);
IssueComment comment = issueApiService.createComment(issue.getId(), issueCommentVO);
IssueComment loadedComment = issueApiService.loadComment(issue.getId(), comment.getId());
Assert.assertNotNull(loadedComment);
issueCommentVO.setText(COMMENT_TEXT + "!");
issueApiService.updateComment(issue.getId(), comment.getId(), issueCommentVO);
issueApiService.deleteComment(issue.getId(), comment.getId());
issueApiService.deleteIssue(issue.getId());
}
Aggregations