Search in sources :

Example 6 with ToolGroup

use of com.epam.pipeline.entity.pipeline.ToolGroup in project cloud-pipeline by epam.

the class ToolGroupDaoTest method deleteToolGroup.

@Test
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
public void deleteToolGroup() {
    ToolGroup group = saveToolGroup(TEST_GROUP_NAME, registry);
    toolGroupDao.deleteToolGroup(group.getId());
    Assert.assertTrue(toolGroupDao.loadToolGroups().stream().noneMatch(g -> g.getId().equals(group.getId())));
}
Also used : DockerRegistry(com.epam.pipeline.entity.pipeline.DockerRegistry) List(java.util.List) ToolGroup(com.epam.pipeline.entity.pipeline.ToolGroup) Propagation(org.springframework.transaction.annotation.Propagation) Optional(java.util.Optional) Autowired(org.springframework.beans.factory.annotation.Autowired) Test(org.junit.Test) AbstractSpringTest(com.epam.pipeline.AbstractSpringTest) DockerRegistryDao(com.epam.pipeline.dao.docker.DockerRegistryDao) Assert(org.junit.Assert) Before(org.junit.Before) Transactional(org.springframework.transaction.annotation.Transactional) ToolGroup(com.epam.pipeline.entity.pipeline.ToolGroup) Test(org.junit.Test) AbstractSpringTest(com.epam.pipeline.AbstractSpringTest) Transactional(org.springframework.transaction.annotation.Transactional)

Example 7 with ToolGroup

use of com.epam.pipeline.entity.pipeline.ToolGroup in project cloud-pipeline by epam.

the class ToolGroupDaoTest method saveToolGroup.

private ToolGroup saveToolGroup(String name, DockerRegistry dockerRegistry) {
    ToolGroup group = getToolGroup(name, dockerRegistry);
    toolGroupDao.createToolGroup(group);
    return group;
}
Also used : ToolGroup(com.epam.pipeline.entity.pipeline.ToolGroup)

Example 8 with ToolGroup

use of com.epam.pipeline.entity.pipeline.ToolGroup in project cloud-pipeline by epam.

the class ToolGroupDaoTest method checkFields.

private void checkFields(ToolGroup group, Optional<ToolGroup> loaded) {
    Assert.assertTrue(loaded.isPresent());
    ToolGroup loadedGroup = loaded.get();
    Assert.assertEquals(group.getId(), loadedGroup.getId());
    Assert.assertEquals(group.getName(), loadedGroup.getName());
    Assert.assertEquals(group.getRegistryId(), loadedGroup.getRegistryId());
    Assert.assertEquals(group.getOwner(), loadedGroup.getOwner());
    Assert.assertEquals(group.getDescription(), loadedGroup.getDescription());
}
Also used : ToolGroup(com.epam.pipeline.entity.pipeline.ToolGroup)

Example 9 with ToolGroup

use of com.epam.pipeline.entity.pipeline.ToolGroup in project cloud-pipeline by epam.

the class ToolGroupDaoTest method createToolGroup.

@Test
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
public void createToolGroup() {
    ToolGroup group = saveToolGroup(TEST_GROUP_NAME, registry);
    Assert.assertNotNull(group.getId());
}
Also used : ToolGroup(com.epam.pipeline.entity.pipeline.ToolGroup) Test(org.junit.Test) AbstractSpringTest(com.epam.pipeline.AbstractSpringTest) Transactional(org.springframework.transaction.annotation.Transactional)

Example 10 with ToolGroup

use of com.epam.pipeline.entity.pipeline.ToolGroup in project cloud-pipeline by epam.

the class ToolVulnerabilityDaoTest method setUp.

@Before
public void setUp() throws Exception {
    DockerRegistry registry = DockerRegistryDaoTest.getDockerRegistry();
    dockerRegistryDao.createDockerRegistry(registry);
    ToolGroup group = ToolGroupDaoTest.getToolGroup("test", registry);
    toolGroupDao.createToolGroup(group);
    tool = generateTool();
    tool.setToolGroupId(group.getId());
    tool.setRegistryId(registry.getId());
    toolDao.createTool(tool);
}
Also used : DockerRegistry(com.epam.pipeline.entity.pipeline.DockerRegistry) ToolGroup(com.epam.pipeline.entity.pipeline.ToolGroup) Before(org.junit.Before)

Aggregations

ToolGroup (com.epam.pipeline.entity.pipeline.ToolGroup)53 Transactional (org.springframework.transaction.annotation.Transactional)27 DockerRegistry (com.epam.pipeline.entity.pipeline.DockerRegistry)25 Test (org.junit.Test)20 Tool (com.epam.pipeline.entity.pipeline.Tool)14 AbstractSpringTest (com.epam.pipeline.AbstractSpringTest)10 AbstractManagerTest (com.epam.pipeline.manager.AbstractManagerTest)10 Before (org.junit.Before)10 AclPermission (com.epam.pipeline.security.acl.AclPermission)6 List (java.util.List)6 Autowired (org.springframework.beans.factory.annotation.Autowired)6 Propagation (org.springframework.transaction.annotation.Propagation)6 DockerRegistryDao (com.epam.pipeline.dao.docker.DockerRegistryDao)4 AclTestDao (com.epam.pipeline.dao.util.AclTestDao)4 AclClass (com.epam.pipeline.entity.security.acl.AclClass)4 Optional (java.util.Optional)4 Assert (org.junit.Assert)4 WithMockUser (org.springframework.security.test.context.support.WithMockUser)4 PermissionGrantVO (com.epam.pipeline.controller.vo.PermissionGrantVO)3 ToolGroupDao (com.epam.pipeline.dao.tool.ToolGroupDao)3