Search in sources :

Example 11 with IssueCommentVO

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);
}
Also used : IssueCommentVO(com.epam.pipeline.controller.vo.IssueCommentVO) Issue(com.epam.pipeline.entity.issue.Issue) AbstractSpringTest(com.epam.pipeline.AbstractSpringTest) Test(org.junit.Test) Transactional(org.springframework.transaction.annotation.Transactional)

Example 12 with IssueCommentVO

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());
}
Also used : IssueCommentVO(com.epam.pipeline.controller.vo.IssueCommentVO) Issue(com.epam.pipeline.entity.issue.Issue) IssueComment(com.epam.pipeline.entity.issue.IssueComment) AbstractSpringTest(com.epam.pipeline.AbstractSpringTest) Test(org.junit.Test) Transactional(org.springframework.transaction.annotation.Transactional)

Example 13 with IssueCommentVO

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);
}
Also used : IssueCommentVO(com.epam.pipeline.controller.vo.IssueCommentVO) Issue(com.epam.pipeline.entity.issue.Issue)

Example 14 with IssueCommentVO

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);
}
Also used : IssueCommentVO(com.epam.pipeline.controller.vo.IssueCommentVO) WithMockUser(org.springframework.security.test.context.support.WithMockUser) AbstractManagerTest(com.epam.pipeline.manager.AbstractManagerTest) Test(org.junit.Test) Transactional(org.springframework.transaction.annotation.Transactional)

Example 15 with 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());
}
Also used : IssueCommentVO(com.epam.pipeline.controller.vo.IssueCommentVO) Issue(com.epam.pipeline.entity.issue.Issue) IssueComment(com.epam.pipeline.entity.issue.IssueComment) WithMockUser(org.springframework.security.test.context.support.WithMockUser) AbstractManagerTest(com.epam.pipeline.manager.AbstractManagerTest) Test(org.junit.Test) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

IssueCommentVO (com.epam.pipeline.controller.vo.IssueCommentVO)16 Transactional (org.springframework.transaction.annotation.Transactional)14 Test (org.junit.Test)13 Issue (com.epam.pipeline.entity.issue.Issue)11 AbstractSpringTest (com.epam.pipeline.AbstractSpringTest)9 IssueComment (com.epam.pipeline.entity.issue.IssueComment)6 AbstractManagerTest (com.epam.pipeline.manager.AbstractManagerTest)4 WithMockUser (org.springframework.security.test.context.support.WithMockUser)4 EntityVO (com.epam.pipeline.controller.vo.EntityVO)2 IssueVO (com.epam.pipeline.controller.vo.IssueVO)2 AttachmentDao (com.epam.pipeline.dao.issue.AttachmentDao)2 Attachment (com.epam.pipeline.entity.issue.Attachment)2 IssueStatus (com.epam.pipeline.entity.issue.IssueStatus)2 AclClass (com.epam.pipeline.entity.security.acl.AclClass)2 NotificationManager (com.epam.pipeline.manager.notification.NotificationManager)2 AuthManager (com.epam.pipeline.manager.security.AuthManager)2 IssueMapper (com.epam.pipeline.mapper.IssueMapper)2 Collections (java.util.Collections)2 List (java.util.List)2 Map (java.util.Map)2