Search in sources :

Example 1 with StartContainerParams

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

the class DockerConnectorTest method shouldThrowDockerExceptionWhileStartingContainerIfResponseCodeIsNotSuccess.

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

Example 2 with StartContainerParams

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

the class DockerConnectorTest method shouldBeAbleToStartContainer.

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

Aggregations

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