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();
}
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();
}
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);
}
Aggregations