use of com.epam.pipeline.entity.pipeline.DockerRegistry 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);
}
use of com.epam.pipeline.entity.pipeline.DockerRegistry in project cloud-pipeline by epam.
the class DockerRegistryDaoTest method updateDockerRegistry.
@Test
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
public void updateDockerRegistry() throws Exception {
DockerRegistry created = getDockerRegistry();
registryDao.createDockerRegistry(created);
created.setDescription(EMPTY);
registryDao.updateDockerRegistry(created);
DockerRegistry loaded = registryDao.loadDockerRegistry(created.getId());
Assert.assertEquals(EMPTY, loaded.getDescription());
}
use of com.epam.pipeline.entity.pipeline.DockerRegistry in project cloud-pipeline by epam.
the class DockerRegistryDaoTest method testLoadAllRegistriesContent.
@Test
@Ignore
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Throwable.class)
public void testLoadAllRegistriesContent() {
List<DockerRegistry> created = initTestHierarchy();
Set<Long> createdRegistryIds = created.stream().map(BaseEntity::getId).collect(Collectors.toSet());
List<DockerRegistry> dockerRegistries = registryDao.loadAllRegistriesContent();
Assert.assertFalse(dockerRegistries.isEmpty());
for (int i = 0; i < dockerRegistries.size(); i++) {
DockerRegistry loadedRegistry = dockerRegistries.get(i);
if (createdRegistryIds.contains(loadedRegistry.getId())) {
Assert.assertFalse(loadedRegistry.getGroups().isEmpty());
Assert.assertEquals(loadedRegistry.getGroups().get(0).getName(), created.get(i).getGroups().get(0).getName());
Assert.assertEquals(loadedRegistry.getGroups().get(0).getDescription(), created.get(i).getGroups().get(0).getDescription());
for (int j = 0; j < created.get(i).getGroups().get(0).getTools().size(); j++) {
Tool tool = created.get(i).getGroups().get(0).getTools().get(j);
Tool loadedTool = loadedRegistry.getGroups().get(0).getTools().get(j);
Assert.assertEquals(tool.getId(), loadedTool.getId());
Assert.assertEquals(tool.getImage(), loadedTool.getImage());
Assert.assertEquals(tool.getCpu(), loadedTool.getCpu());
}
}
}
}
use of com.epam.pipeline.entity.pipeline.DockerRegistry in project cloud-pipeline by epam.
the class ToolGroupDaoTest method setUp.
@Before
public void setUp() throws Exception {
registry = new DockerRegistry();
registry.setPath(TEST_REPO);
registry.setOwner(TEST_USER);
registryDao.createDockerRegistry(registry);
registry2 = new DockerRegistry();
registry2.setPath(TEST_REPO2);
registry2.setOwner(TEST_USER);
registryDao.createDockerRegistry(registry2);
}
use of com.epam.pipeline.entity.pipeline.DockerRegistry 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);
}
Aggregations