Search in sources :

Example 46 with ToolGroup

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

the class ToolGroupManagerTest method createToolGroup.

private ToolGroup createToolGroup() {
    ToolGroup group = new ToolGroup();
    group.setName("test");
    group.setRegistryId(registry.getId());
    group.setDescription(TEST_DESCRIPTION);
    toolGroupManager.create(group);
    return group;
}
Also used : ToolGroup(com.epam.pipeline.entity.pipeline.ToolGroup)

Example 47 with ToolGroup

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

the class ToolGroupManagerTest method testUpdateToolGroup.

@Test
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
public void testUpdateToolGroup() {
    ToolGroup group = createToolGroup();
    ToolGroup original = toolGroupManager.load(group.getId());
    group.setDescription(TEST_OTHER_DESCRIPTION);
    group.setName("foo");
    group.setOwner("bar");
    group.setRegistryId(0L);
    toolGroupManager.updateToolGroup(group);
    ToolGroup updated = toolGroupManager.load(group.getId());
    Assert.assertEquals(TEST_OTHER_DESCRIPTION, updated.getDescription());
    Assert.assertEquals(original.getName(), updated.getName());
    Assert.assertEquals(original.getOwner(), updated.getOwner());
    Assert.assertEquals(original.getRegistryId(), updated.getRegistryId());
}
Also used : ToolGroup(com.epam.pipeline.entity.pipeline.ToolGroup) AbstractManagerTest(com.epam.pipeline.manager.AbstractManagerTest) Test(org.junit.Test) Transactional(org.springframework.transaction.annotation.Transactional)

Example 48 with ToolGroup

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

the class ToolGroupManagerTest method testLoadByNameWIthRegistry.

@Test
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
public void testLoadByNameWIthRegistry() {
    ToolGroup group = createToolGroup();
    ToolGroup loadedGroup = toolGroupManager.loadByNameOrId(registry.getPath() + "/" + group.getName());
    Assert.assertEquals(group.getId(), loadedGroup.getId());
    Assert.assertEquals(group.getName(), loadedGroup.getName());
}
Also used : ToolGroup(com.epam.pipeline.entity.pipeline.ToolGroup) AbstractManagerTest(com.epam.pipeline.manager.AbstractManagerTest) Test(org.junit.Test) Transactional(org.springframework.transaction.annotation.Transactional)

Example 49 with ToolGroup

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

the class ToolGroupApiServiceTest method testCreateToolGroup.

@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
@WithMockUser(username = TEST_USER2, roles = TOOL_GROUP_MANAGER_ROLE)
@Test()
public void testCreateToolGroup() {
    ToolGroup group = createToolGroup();
    ToolGroup loaded = toolGroupApiService.load(group.getId());
    Assert.assertEquals(group.getName(), loaded.getName());
    Assert.assertEquals(group.getRegistryId(), loaded.getRegistryId());
    Assert.assertEquals(TEST_USER2, loaded.getOwner());
}
Also used : ToolGroup(com.epam.pipeline.entity.pipeline.ToolGroup) 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 50 with ToolGroup

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

the class ToolGroupApiServiceTest method createToolGroup.

private ToolGroup createToolGroup() {
    ToolGroup group = new ToolGroup();
    group.setName("dev");
    group.setRegistryId(registry.getId());
    group = toolGroupApiService.create(group);
    return group;
}
Also used : ToolGroup(com.epam.pipeline.entity.pipeline.ToolGroup)

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