Search in sources :

Example 1 with ToolWithIssuesCount

use of com.epam.pipeline.entity.pipeline.ToolWithIssuesCount 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());
}
Also used : EntityVO(com.epam.pipeline.controller.vo.EntityVO) ToolWithIssuesCount(com.epam.pipeline.entity.pipeline.ToolWithIssuesCount) IssueVO(com.epam.pipeline.controller.vo.IssueVO) Tool(com.epam.pipeline.entity.pipeline.Tool) AbstractSpringTest(com.epam.pipeline.AbstractSpringTest) Test(org.junit.Test) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

AbstractSpringTest (com.epam.pipeline.AbstractSpringTest)1 EntityVO (com.epam.pipeline.controller.vo.EntityVO)1 IssueVO (com.epam.pipeline.controller.vo.IssueVO)1 Tool (com.epam.pipeline.entity.pipeline.Tool)1 ToolWithIssuesCount (com.epam.pipeline.entity.pipeline.ToolWithIssuesCount)1 Test (org.junit.Test)1 Transactional (org.springframework.transaction.annotation.Transactional)1