use of com.epam.pipeline.controller.vo.IssueVO in project cloud-pipeline by epam.
the class ToolDaoTest method testLoadToolsWithIssuesCount.
@Test
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
public void testLoadToolsWithIssuesCount() {
// create tool
Tool tool = generateTool();
tool.setRegistryId(firstRegistry.getId());
tool.setToolGroupId(library1.getId());
toolDao.createTool(tool);
// create issues
when(authManager.getAuthorizedUser()).thenReturn(AUTHOR);
EntityVO entityVO = new EntityVO(tool.getId(), AclClass.TOOL);
IssueVO issueVO = getIssueVO(ISSUE_NAME, ISSUE_TEXT, entityVO);
issueManager.createIssue(issueVO);
verify(notificationManager).notifyIssue(any(), any(), any());
issueVO.setName(ISSUE_NAME2);
issueManager.createIssue(issueVO);
List<ToolWithIssuesCount> loaded = toolDao.loadToolsWithIssuesCountByGroup(library1.getId());
Assert.assertEquals(1, loaded.size());
Assert.assertEquals(2, loaded.get(0).getIssuesCount());
}
use of com.epam.pipeline.controller.vo.IssueVO in project cloud-pipeline by epam.
the class IssueManagerTest method registerIssue.
private Issue registerIssue() {
when(authManager.getAuthorizedUser()).thenReturn(AUTHOR);
IssueVO issueVO = getIssueVO(ISSUE_NAME, ISSUE_TEXT, entityVO);
return issueManager.createIssue(issueVO);
}
use of com.epam.pipeline.controller.vo.IssueVO in project cloud-pipeline by epam.
the class IssueManagerTest method testLoadAndDeleteIssuesForEntity.
@Test
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
public void testLoadAndDeleteIssuesForEntity() {
when(authManager.getAuthorizedUser()).thenReturn(AUTHOR);
IssueVO issueVO = getIssueVO(ISSUE_NAME, ISSUE_TEXT, entityVO);
issueVO.setAttachments(Collections.singletonList(testAttachment));
Issue issue = issueManager.createIssue(issueVO);
Issue issue2 = issueManager.createIssue(getIssueVO(ISSUE_NAME2, ISSUE_TEXT, entityVO));
// load
List<Issue> actualIssues = issueManager.loadIssuesForEntity(entityVO);
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 -> compareIssues(expectedMap.get(i.getId()), i));
// delete
issueManager.deleteIssuesForEntity(entityVO);
actualIssues = issueManager.loadIssuesForEntity(entityVO);
assertEquals(0, actualIssues.size());
}
use of com.epam.pipeline.controller.vo.IssueVO in project cloud-pipeline by epam.
the class IssueManagerTest method testDeleteIssuesWhenEntityWasDeleted.
@Test
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
public void testDeleteIssuesWhenEntityWasDeleted() {
when(authManager.getAuthorizedUser()).thenReturn(AUTHOR);
Folder folder = new Folder();
folder.setName(FOLDER_NAME_2);
folder.setOwner(AUTHOR);
folderDao.createFolder(folder);
EntityVO entityVO = new EntityVO(folder.getId(), AclClass.FOLDER);
IssueVO issueVO = getIssueVO(ISSUE_NAME, ISSUE_TEXT, entityVO);
issueManager.createIssue(issueVO);
folderManager.delete(folder.getId());
List<Issue> issues = issueManager.loadIssuesForEntity(entityVO);
assertTrue(CollectionUtils.isEmpty(issues));
}
use of com.epam.pipeline.controller.vo.IssueVO in project cloud-pipeline by epam.
the class IssueManagerTest method creatingIssueWithEmptyNameShouldThrowException.
@Test(expected = IllegalArgumentException.class)
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
public void creatingIssueWithEmptyNameShouldThrowException() {
when(authManager.getAuthorizedUser()).thenReturn(AUTHOR);
IssueVO issueVO = getIssueVO("", ISSUE_TEXT, entityVO);
issueManager.createIssue(issueVO);
}
Aggregations