Search in sources :

Example 1 with GetEventsParams

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

the class DockerConnectorTest method shouldBeAbleToGetEvents.

@Test
public void shouldBeAbleToGetEvents() throws IOException {
    GetEventsParams getEventsParams = GetEventsParams.create();
    doReturn(new ByteArrayInputStream(STREAM_DATA_BYTES)).when(dockerResponse).getInputStream();
    dockerConnector.getEvents(getEventsParams, eventMessageProcessor);
    verify(dockerConnectionFactory).openConnection(any(URI.class));
    verify(dockerConnection).method(REQUEST_METHOD_GET);
    verify(dockerConnection).path("/events");
    verify(dockerConnection).request();
    verify(dockerResponse).getStatus();
    verify(dockerResponse).getInputStream();
}
Also used : ByteArrayInputStream(java.io.ByteArrayInputStream) GetEventsParams(org.eclipse.che.plugin.docker.client.params.GetEventsParams) URI(java.net.URI) Test(org.testng.annotations.Test)

Example 2 with GetEventsParams

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

the class DockerConnectorTest method shouldThrowDockerExceptionWhileGettingEventsIfResponseCodeIsNotSuccess.

@Test(expectedExceptions = DockerException.class, expectedExceptionsMessageRegExp = EXCEPTION_ERROR_MESSAGE)
public void shouldThrowDockerExceptionWhileGettingEventsIfResponseCodeIsNotSuccess() throws IOException {
    GetEventsParams getExecInfoParams = GetEventsParams.create();
    when(dockerResponse.getStatus()).thenReturn(RESPONSE_ERROR_CODE);
    dockerConnector.getEvents(getExecInfoParams, eventMessageProcessor);
    verify(dockerResponse).getStatus();
}
Also used : GetEventsParams(org.eclipse.che.plugin.docker.client.params.GetEventsParams) Test(org.testng.annotations.Test)

Aggregations

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