Search in sources :

Example 1 with ImageDescription

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

the class DockerRegistryManagerTest method testLoadingImageDescription.

@Test
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
public void testLoadingImageDescription() {
    DockerRegistry registry = generateRegistry();
    Date date = new Date();
    registryDao.createDockerRegistry(registry);
    ToolGroup group = generateToolGroup(registry);
    toolGroupDao.createToolGroup(group);
    Tool tool = generateTool(group);
    toolManager.create(tool, true);
    DockerClient mockClient = Mockito.mock(DockerClient.class);
    when(dockerClientFactoryMock.getDockerClient(any(DockerRegistry.class), any())).thenReturn(mockClient);
    ImageDescription expected = new ImageDescription(1L, TEST_IMAGE, TEST_TAG, date);
    when(mockClient.getImageDescription(registry, tool.getName(), TEST_TAG)).thenReturn(expected);
    Assert.assertEquals(expected, dockerRegistryManager.getImageDescription(registry, tool.getName(), TEST_TAG));
}
Also used : DockerRegistry(com.epam.pipeline.entity.pipeline.DockerRegistry) ToolGroup(com.epam.pipeline.entity.pipeline.ToolGroup) ImageDescription(com.epam.pipeline.entity.docker.ImageDescription) Date(java.util.Date) Tool(com.epam.pipeline.entity.pipeline.Tool) AbstractManagerTest(com.epam.pipeline.manager.AbstractManagerTest) Test(org.junit.Test) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

ImageDescription (com.epam.pipeline.entity.docker.ImageDescription)1 DockerRegistry (com.epam.pipeline.entity.pipeline.DockerRegistry)1 Tool (com.epam.pipeline.entity.pipeline.Tool)1 ToolGroup (com.epam.pipeline.entity.pipeline.ToolGroup)1 AbstractManagerTest (com.epam.pipeline.manager.AbstractManagerTest)1 Date (java.util.Date)1 Test (org.junit.Test)1 Transactional (org.springframework.transaction.annotation.Transactional)1