Search in sources :

Example 1 with RemoveContainerParams

use of org.eclipse.che.plugin.docker.client.params.RemoveContainerParams in project che by eclipse.

the class DockerConnectorTest method shouldBeAbleToRemoveContainer.

@Test
public void shouldBeAbleToRemoveContainer() throws IOException {
    RemoveContainerParams removeContainerParams = RemoveContainerParams.create(CONTAINER);
    when(dockerResponse.getStatus()).thenReturn(RESPONSE_NO_CONTENT_CODE);
    dockerConnector.removeContainer(removeContainerParams);
    verify(dockerConnectionFactory).openConnection(any(URI.class));
    verify(dockerConnection).method(REQUEST_METHOD_DELETE);
    verify(dockerConnection).path("/containers/" + removeContainerParams.getContainer());
    verify(dockerConnection).request();
    verify(dockerResponse).getStatus();
}
Also used : URI(java.net.URI) RemoveContainerParams(org.eclipse.che.plugin.docker.client.params.RemoveContainerParams) Test(org.testng.annotations.Test)

Example 2 with RemoveContainerParams

use of org.eclipse.che.plugin.docker.client.params.RemoveContainerParams in project che by eclipse.

the class DockerConnectorTest method shouldThrowDockerExceptionWhileRemovingContainerIfResponseCodeIsNotSuccess.

@Test(expectedExceptions = DockerException.class, expectedExceptionsMessageRegExp = EXCEPTION_ERROR_MESSAGE)
public void shouldThrowDockerExceptionWhileRemovingContainerIfResponseCodeIsNotSuccess() throws IOException {
    RemoveContainerParams removeContainerParams = RemoveContainerParams.create(CONTAINER);
    when(dockerResponse.getStatus()).thenReturn(RESPONSE_ERROR_CODE);
    dockerConnector.removeContainer(removeContainerParams);
    verify(dockerResponse).getStatus();
}
Also used : RemoveContainerParams(org.eclipse.che.plugin.docker.client.params.RemoveContainerParams) Test(org.testng.annotations.Test)

Aggregations

RemoveContainerParams (org.eclipse.che.plugin.docker.client.params.RemoveContainerParams)2 Test (org.testng.annotations.Test)2 URI (java.net.URI)1