use of org.eclipse.che.plugin.docker.client.params.InspectImageParams in project che by eclipse.
the class DockerConnectorTest method shouldBeAbleToInspectImage.
@Test
public void shouldBeAbleToInspectImage() throws IOException, JsonParseException {
InspectImageParams inspectImageParams = InspectImageParams.create(IMAGE);
ImageInfo imageInfo = mock(ImageInfo.class);
doReturn(imageInfo).when(dockerConnector).parseResponseStreamAndClose(inputStream, ImageInfo.class);
ImageInfo returnedImageInfo = dockerConnector.inspectImage(inspectImageParams);
verify(dockerConnectionFactory).openConnection(any(URI.class));
verify(dockerConnection).method(REQUEST_METHOD_GET);
verify(dockerConnection).path("/images/" + inspectImageParams.getImage() + "/json");
verify(dockerConnection).request();
verify(dockerResponse).getStatus();
verify(dockerResponse).getInputStream();
assertEquals(returnedImageInfo, imageInfo);
}
use of org.eclipse.che.plugin.docker.client.params.InspectImageParams in project che by eclipse.
the class DockerConnectorTest method shouldThrowDockerExceptionWhileGettingImageInfoIfResponseCodeIsNotSuccess.
@Test(expectedExceptions = DockerException.class, expectedExceptionsMessageRegExp = EXCEPTION_ERROR_MESSAGE)
public void shouldThrowDockerExceptionWhileGettingImageInfoIfResponseCodeIsNotSuccess() throws IOException {
InspectImageParams inspectImageParams = InspectImageParams.create(IMAGE);
when(dockerResponse.getStatus()).thenReturn(RESPONSE_ERROR_CODE);
dockerConnector.inspectImage(inspectImageParams);
verify(dockerResponse).getStatus();
}
use of org.eclipse.che.plugin.docker.client.params.InspectImageParams in project che by eclipse.
the class DockerConnectorTest method shouldCallInspectImageWithParametersObject.
@Test
public void shouldCallInspectImageWithParametersObject() throws IOException {
InspectImageParams inspectImageParams = InspectImageParams.create(IMAGE);
ImageInfo imageInfo = mock(ImageInfo.class);
doReturn(imageInfo).when(dockerConnector).inspectImage(any(InspectImageParams.class));
ImageInfo returnedImageInfo = dockerConnector.inspectImage(IMAGE);
verify(dockerConnector).inspectImage((InspectImageParams) captor.capture());
assertEquals(captor.getValue(), inspectImageParams);
assertEquals(returnedImageInfo, imageInfo);
}
Aggregations