Search in sources :

Example 6 with ContainerListEntry

use of org.eclipse.che.plugin.docker.client.json.ContainerListEntry in project che by eclipse.

the class DockerConnectorTest method shouldCallListContainersWithParametersObject.

@Test
public void shouldCallListContainersWithParametersObject() throws IOException {
    ListContainersParams listContainersParams = ListContainersParams.create().withAll(true);
    ContainerListEntry containerListEntry = mock(ContainerListEntry.class);
    List<ContainerListEntry> expectedListContainers = singletonList(containerListEntry);
    doReturn(expectedListContainers).when(dockerConnector).listContainers(listContainersParams);
    List<ContainerListEntry> result = dockerConnector.listContainers();
    ArgumentCaptor<ListContainersParams> listContainersParamsArgumentCaptor = ArgumentCaptor.forClass(ListContainersParams.class);
    verify(dockerConnector).listContainers(listContainersParamsArgumentCaptor.capture());
    assertEquals(result, expectedListContainers);
    assertEquals(listContainersParamsArgumentCaptor.getValue(), listContainersParams);
}
Also used : ContainerListEntry(org.eclipse.che.plugin.docker.client.json.ContainerListEntry) ListContainersParams(org.eclipse.che.plugin.docker.client.params.ListContainersParams) Test(org.testng.annotations.Test)

Aggregations

ContainerListEntry (org.eclipse.che.plugin.docker.client.json.ContainerListEntry)6 ArrayList (java.util.ArrayList)5 Test (org.testng.annotations.Test)5 Collections.singletonList (java.util.Collections.singletonList)4 List (java.util.List)4 ListContainersParams (org.eclipse.che.plugin.docker.client.params.ListContainersParams)3 ByteArrayInputStream (java.io.ByteArrayInputStream)2 Matchers.anyString (org.mockito.Matchers.anyString)2 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 IOException (java.io.IOException)1 URI (java.net.URI)1 NotFoundException (org.eclipse.che.api.core.NotFoundException)1 Filters (org.eclipse.che.plugin.docker.client.json.Filters)1 ContainerNameInfo (org.eclipse.che.plugin.docker.machine.DockerContainerNameGenerator.ContainerNameInfo)1