Search in sources :

Example 1 with StopContainerParams

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

the class DockerConnectorTest method shouldBeAbleToStopContainer.

@Test
public void shouldBeAbleToStopContainer() throws IOException {
    StopContainerParams stopContainerParams = StopContainerParams.create(CONTAINER);
    dockerConnector.stopContainer(stopContainerParams);
    verify(dockerConnectionFactory).openConnection(any(URI.class));
    verify(dockerConnection).method(REQUEST_METHOD_POST);
    verify(dockerConnection).path("/containers/" + stopContainerParams.getContainer() + "/stop");
    verify(dockerConnection).request();
    verify(dockerResponse).getStatus();
}
Also used : StopContainerParams(org.eclipse.che.plugin.docker.client.params.StopContainerParams) URI(java.net.URI) Test(org.testng.annotations.Test)

Example 2 with StopContainerParams

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

the class DockerConnectorTest method shouldThrowDockerExceptionWhileStoppingContainerIfResponseCodeIsNotSuccess.

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

Aggregations

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