use of org.eclipse.che.plugin.docker.client.params.GetContainerLogsParams in project che by eclipse.
the class DockerConnectorTest method shouldBeAbleToGetContainerLogs.
@Test
public void shouldBeAbleToGetContainerLogs() throws IOException {
GetContainerLogsParams getContainerLogsParams = GetContainerLogsParams.create(CONTAINER);
when(dockerResponse.getInputStream()).thenReturn(new ByteArrayInputStream(DOCKER_RESPONSE_BYTES));
dockerConnector.getContainerLogs(getContainerLogsParams, logMessageProcessor);
verify(dockerConnectionFactory).openConnection(any(URI.class));
verify(dockerConnection).method(REQUEST_METHOD_GET);
verify(dockerConnection).path("/containers/" + getContainerLogsParams.getContainer() + "/logs");
verify(dockerConnection).query("stdout", 1);
verify(dockerConnection).query("stderr", 1);
verify(dockerConnection).request();
verify(dockerResponse).getStatus();
verify(dockerResponse).getInputStream();
}
use of org.eclipse.che.plugin.docker.client.params.GetContainerLogsParams in project che by eclipse.
the class DockerConnectorTest method shouldThrowContainerNotFoundExceptionWhileGettingContainerLogsIfResponseCodeIs404.
@Test(expectedExceptions = ContainerNotFoundException.class)
public void shouldThrowContainerNotFoundExceptionWhileGettingContainerLogsIfResponseCodeIs404() throws IOException {
GetContainerLogsParams getContainerLogsParams = GetContainerLogsParams.create(CONTAINER);
when(dockerResponse.getInputStream()).thenReturn(new ByteArrayInputStream("container not found".getBytes()));
when(dockerResponse.getStatus()).thenReturn(RESPONSE_NOT_FOUND_CODE);
dockerConnector.getContainerLogs(getContainerLogsParams, logMessageProcessor);
verify(dockerResponse).getStatus();
}
use of org.eclipse.che.plugin.docker.client.params.GetContainerLogsParams in project che by eclipse.
the class DockerConnectorTest method shouldThrowDockerExceptionWhileGettingContainerLogsIfResponseCodeIs5xx.
@Test(expectedExceptions = DockerException.class, expectedExceptionsMessageRegExp = EXCEPTION_ERROR_MESSAGE)
public void shouldThrowDockerExceptionWhileGettingContainerLogsIfResponseCodeIs5xx() throws IOException {
GetContainerLogsParams getContainerLogsParams = GetContainerLogsParams.create(CONTAINER);
when(dockerResponse.getStatus()).thenReturn(RESPONSE_ERROR_CODE);
dockerConnector.getContainerLogs(getContainerLogsParams, logMessageProcessor);
verify(dockerResponse).getStatus();
}
Aggregations