use of org.eclipse.che.plugin.docker.client.json.ContainerCommitted in project che by eclipse.
the class DockerConnectorTest method shouldBeAbleToCommitImage.
@Test
public void shouldBeAbleToCommitImage() throws IOException, JsonParseException {
CommitParams commitParams = CommitParams.create(CONTAINER).withRepository(REPOSITORY);
ContainerCommitted containerCommitted = mock(ContainerCommitted.class);
when(dockerResponse.getStatus()).thenReturn(RESPONSE_CREATED_CODE);
when(containerCommitted.getId()).thenReturn(IMAGE);
doReturn(containerCommitted).when(dockerConnector).parseResponseStreamAndClose(inputStream, ContainerCommitted.class);
String returnedImage = dockerConnector.commit(commitParams);
verify(dockerConnectionFactory).openConnection(any(URI.class));
verify(dockerConnection).method(REQUEST_METHOD_POST);
verify(dockerConnection).path("/commit");
verify(dockerConnection).query("container", commitParams.getContainer());
verify(dockerConnection).query("repo", commitParams.getRepository());
verify(dockerConnection).request();
verify(dockerResponse).getStatus();
verify(dockerResponse).getInputStream();
assertEquals(returnedImage, IMAGE);
}
Aggregations