Search in sources :

Example 1 with ToolGroup

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

the class ToolGroupManager method loadToolsWithIssuesCount.

public ToolGroupWithIssues loadToolsWithIssuesCount(Long id) {
    ToolGroup group = toolGroupDao.loadToolGroup(id).orElseThrow(() -> new IllegalArgumentException(messageHelper.getMessage(MessageConstants.ERROR_TOOL_GROUP_NOT_FOUND, id)));
    group.setPrivateGroup(group.getName().equalsIgnoreCase(makePrivateGroupName()));
    ToolGroupWithIssues groupWithIssues = toolGroupWithIssuesMapper.toToolGroupWithIssues(group);
    groupWithIssues.setToolsWithIssues(toolManager.loadToolsWithIssuesCountByGroup(id));
    return groupWithIssues;
}
Also used : ToolGroup(com.epam.pipeline.entity.pipeline.ToolGroup) ToolGroupWithIssues(com.epam.pipeline.entity.pipeline.ToolGroupWithIssues)

Example 2 with ToolGroup

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

the class ToolGroupManager method load.

/**
 * Loads a ToolGroup with nested Tools
 * @param id ID of the group
 * @return a ToolGroup with nested Tools
 */
@Override
public ToolGroup load(Long id) {
    ToolGroup group = toolGroupDao.loadToolGroup(id).orElseThrow(() -> new IllegalArgumentException(messageHelper.getMessage(MessageConstants.ERROR_TOOL_GROUP_NOT_FOUND, id)));
    group.setTools(toolManager.loadToolsByGroup(group.getId()));
    group.setPrivateGroup(group.getName().equalsIgnoreCase(makePrivateGroupName()));
    return group;
}
Also used : ToolGroup(com.epam.pipeline.entity.pipeline.ToolGroup)

Example 3 with ToolGroup

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

the class ToolGroupManager method changeOwner.

@Override
@Transactional(propagation = Propagation.REQUIRED)
public ToolGroup changeOwner(Long id, String owner) {
    ToolGroup group = load(id);
    group.setOwner(owner);
    toolGroupDao.updateToolGroup(group);
    return group;
}
Also used : ToolGroup(com.epam.pipeline.entity.pipeline.ToolGroup) Transactional(org.springframework.transaction.annotation.Transactional)

Example 4 with ToolGroup

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

the class DockerRegistryDaoTest method createToolGroup.

private ToolGroup createToolGroup(DockerRegistry created) {
    ToolGroup group = new ToolGroup();
    group.setRegistryId(created.getId());
    group.setParent(created);
    group.setOwner(TEST_USER);
    group.setName(TOOL_GROUP_NAME);
    group.setDescription(TOOL_GROUP_DESCRIPTION);
    return group;
}
Also used : ToolGroup(com.epam.pipeline.entity.pipeline.ToolGroup)

Example 5 with ToolGroup

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

the class DockerRegistryDaoTest method initTestHierarchy.

private List<DockerRegistry> initTestHierarchy() {
    DockerRegistry createdRegistry = new DockerRegistry();
    createdRegistry.setPath(REGISTRY_PATH);
    createdRegistry.setOwner(TEST_USER);
    registryDao.createDockerRegistry(createdRegistry);
    DockerRegistry createdRegistry2 = new DockerRegistry();
    createdRegistry2.setPath(ANOTHER_REGISTRY_PATH);
    createdRegistry2.setOwner(TEST_USER);
    registryDao.createDockerRegistry(createdRegistry2);
    ToolGroup library = createToolGroup(createdRegistry);
    ToolGroup library2 = createToolGroup(createdRegistry2);
    toolGroupDao.createToolGroup(library);
    toolGroupDao.createToolGroup(library2);
    createdRegistry.setGroups(Collections.singletonList(library));
    createdRegistry2.setGroups(Collections.singletonList(library2));
    Tool tool = createTool(TOOL_IMAGE, createdRegistry.getId(), library);
    toolDao.createTool(tool);
    library.setTools(Collections.singletonList(tool));
    createdRegistry.setTools(Collections.singletonList(tool));
    Tool tool2 = createTool(ANOTHER_TOOL_IMAGE, createdRegistry2.getId(), library2);
    toolDao.createTool(tool2);
    library2.setTools(Collections.singletonList(tool2));
    return Arrays.asList(createdRegistry, createdRegistry2);
}
Also used : DockerRegistry(com.epam.pipeline.entity.pipeline.DockerRegistry) ToolGroup(com.epam.pipeline.entity.pipeline.ToolGroup) Tool(com.epam.pipeline.entity.pipeline.Tool)

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