use of com.epam.pipeline.entity.pipeline.Tool in project cloud-pipeline by epam.
the class ToolManager method loadToolDescription.
public ImageDescription loadToolDescription(Long id, String tag) {
Tool tool = load(id);
Assert.notNull(tool, messageHelper.getMessage(MessageConstants.ERROR_TOOL_NOT_FOUND, id));
return dockerRegistryManager.getImageDescription(dockerRegistryManager.load(tool.getRegistryId()), tool.getImage(), tag);
}
use of com.epam.pipeline.entity.pipeline.Tool in project cloud-pipeline by epam.
the class GraphReader method parseTool.
private void parseTool(TaskNode currentTask, String line) {
String value = line.substring(TOOL_START.length());
if (!StringUtils.isEmpty(value)) {
String[] toolDescription = value.trim().split("\\s+");
String image = toolDescription[0];
if (!image.isEmpty()) {
Tool tool = new Tool(image);
currentTask.setTool(tool);
for (int j = 1; j < toolDescription.length; j++) {
if (toolDescription[j].startsWith(CPU_PREFIX)) {
tool.setCpu(toolDescription[j].substring(CPU_PREFIX.length()));
} else if (toolDescription[j].startsWith(RAM_PREFIX)) {
tool.setRam(toolDescription[j].substring(RAM_PREFIX.length()));
} else if (toolDescription[j].startsWith(REGISTRY_PREFIX)) {
tool.setRam(toolDescription[j].substring(REGISTRY_PREFIX.length()));
}
}
}
}
}
use of com.epam.pipeline.entity.pipeline.Tool in project cloud-pipeline by epam.
the class ToolDaoTest method sameToolsInDifferentRegistryShouldBeWorksCorrectly.
@Test
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
public void sameToolsInDifferentRegistryShouldBeWorksCorrectly() {
Tool tool = generateTool();
tool.setRegistryId(firstRegistry.getId());
tool.setToolGroupId(library1.getId());
toolDao.createTool(tool);
tool.setRegistryId(secondRegistry.getId());
tool.setToolGroupId(library2.getId());
toolDao.createTool(tool);
List<Tool> tools = toolDao.loadAllTools();
Assert.assertEquals(2, tools.size());
Tool first = toolDao.loadTool(firstRegistry.getId(), tool.getImage());
checkLoadedTool(first, firstRegistry.getId(), TEST_REPO);
Tool second = toolDao.loadTool(secondRegistry.getId(), tool.getImage());
checkLoadedTool(second, secondRegistry.getId(), TEST_REPO_2);
toolDao.deleteTool(second.getId());
Assert.assertEquals(1, toolDao.loadAllTools().size());
toolDao.deleteTool(first.getId());
Assert.assertTrue(toolDao.loadAllTools().isEmpty());
}
use of com.epam.pipeline.entity.pipeline.Tool in project cloud-pipeline by epam.
the class ToolDaoTest method generateTool.
public static Tool generateTool() {
Tool tool = new Tool();
tool.setImage(TEST_IMAGE);
tool.setRam(TEST_RAM);
tool.setCpu(TEST_CPU);
tool.setOwner(TEST_USER);
return tool;
}
use of com.epam.pipeline.entity.pipeline.Tool 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);
}
Aggregations