Search in sources :

Example 1 with KillContainerParams

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

the class DockerConnectorTest method shouldBeAbleToKillContainer.

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

Example 2 with KillContainerParams

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

the class DockerConnectorTest method shouldThrowDockerExceptionWhileKillingContainerIfResponseCodeIsNotSuccess.

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

Example 3 with KillContainerParams

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

the class DockerConnectorTest method shouldCallKillContainerWithParametersObject.

@Test
public void shouldCallKillContainerWithParametersObject() throws IOException {
    KillContainerParams killContainerParams = KillContainerParams.create(CONTAINER);
    doNothing().when(dockerConnector).killContainer(killContainerParams);
    dockerConnector.killContainer(CONTAINER);
    verify(dockerConnector).killContainer((KillContainerParams) captor.capture());
    assertEquals(captor.getValue(), killContainerParams);
}
Also used : KillContainerParams(org.eclipse.che.plugin.docker.client.params.KillContainerParams) Test(org.testng.annotations.Test)

Aggregations

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