use of org.eclipse.che.plugin.docker.client.params.InspectContainerParams in project che by eclipse.
the class DockerConnectorTest method shouldCallInspectContainerWithParametersObject.
@Test
public void shouldCallInspectContainerWithParametersObject() throws IOException {
InspectContainerParams inspectContainerParams = InspectContainerParams.create(CONTAINER);
ContainerInfo containerInfo = mock(ContainerInfo.class);
doReturn(containerInfo).when(dockerConnector).inspectContainer(inspectContainerParams);
ContainerInfo returnedContainerInfo = dockerConnector.inspectContainer(CONTAINER);
verify(dockerConnector).inspectContainer((InspectContainerParams) captor.capture());
assertEquals(captor.getValue(), inspectContainerParams);
assertEquals(returnedContainerInfo, containerInfo);
}
use of org.eclipse.che.plugin.docker.client.params.InspectContainerParams in project che by eclipse.
the class DockerConnectorTest method shouldBeAbleToInspectContainer.
@Test
public void shouldBeAbleToInspectContainer() throws IOException, JsonParseException {
InspectContainerParams inspectContainerParams = InspectContainerParams.create(CONTAINER);
ContainerInfo containerInfo = mock(ContainerInfo.class);
doReturn(containerInfo).when(dockerConnector).parseResponseStreamAndClose(inputStream, ContainerInfo.class);
ContainerInfo returnedContainerInfo = dockerConnector.inspectContainer(inspectContainerParams);
verify(dockerConnectionFactory).openConnection(any(URI.class));
verify(dockerConnection).method(REQUEST_METHOD_GET);
verify(dockerConnection).path("/containers/" + inspectContainerParams.getContainer() + "/json");
verify(dockerConnection).request();
verify(dockerResponse).getStatus();
verify(dockerResponse).getInputStream();
assertEquals(returnedContainerInfo, containerInfo);
}
use of org.eclipse.che.plugin.docker.client.params.InspectContainerParams in project che by eclipse.
the class DockerConnectorTest method shouldThrowDockerExceptionWhileInspectingContainerIfResponseCodeIsNotSuccess.
@Test(expectedExceptions = DockerException.class, expectedExceptionsMessageRegExp = EXCEPTION_ERROR_MESSAGE)
public void shouldThrowDockerExceptionWhileInspectingContainerIfResponseCodeIsNotSuccess() throws IOException {
InspectContainerParams inspectContainerParams = InspectContainerParams.create(CONTAINER);
when(dockerResponse.getStatus()).thenReturn(RESPONSE_ERROR_CODE);
dockerConnector.inspectContainer(inspectContainerParams);
verify(dockerResponse).getStatus();
}
Aggregations