@Test public void filesAreStreamedToTheExecutor() throws DockerException, InterruptedException, IOException { LogStream logStream = null; try { logStream = streamer .startStreaming(new DockerLogPath(SOME_CONTAINER_ID, "busybox", SOME_LOG_LOCATION)); testLogStream.outputStream.write("Hello\n".getBytes("UTF-8")); assertEquals(testLogStream, logStream); assertEquals("Hello\n", writer.getStdOutContent()); } finally { if (logStream != null) logStream.close(); } }
public LogStream startStreaming(DockerLogPath path) { LOGGER .info("Stream from " + path.getContainerLogPath() + " to " + path.getExecutorLogPath()); LogStream logStream = createContainerLogStream(path.getContainerId(), path.getContainerLogPath()); try { writer.write(path.getExecutorLogPath(), logStream); LOGGER.info(String.format("Logging file: %s", path.getExecutorLogPath())); return logStream; } catch (IOException e) { LOGGER.error("Failed", e); logStream.close(); return null; } }
DockerStreamer { public LogStream startStreaming(DockerLogPath path) { LOGGER .info("Stream from " + path.getContainerLogPath() + " to " + path.getExecutorLogPath()); LogStream logStream = createContainerLogStream(path.getContainerId(), path.getContainerLogPath()); try { writer.write(path.getExecutorLogPath(), logStream); LOGGER.info(String.format("Logging file: %s", path.getExecutorLogPath())); return logStream; } catch (IOException e) { LOGGER.error("Failed", e); logStream.close(); return null; } } }
DockerStreamer { public LogStream startStreaming(DockerLogPath path) { LOGGER .info("Stream from " + path.getContainerLogPath() + " to " + path.getExecutorLogPath()); LogStream logStream = createContainerLogStream(path.getContainerId(), path.getContainerLogPath()); try { writer.write(path.getExecutorLogPath(), logStream); LOGGER.info(String.format("Logging file: %s", path.getExecutorLogPath())); return logStream; } catch (IOException e) { LOGGER.error("Failed", e); logStream.close(); return null; } } DockerStreamer(LogStreamWriter writer, ContainerizerClient client); }
DockerStreamer { public LogStream startStreaming(DockerLogPath path) { LOGGER .info("Stream from " + path.getContainerLogPath() + " to " + path.getExecutorLogPath()); LogStream logStream = createContainerLogStream(path.getContainerId(), path.getContainerLogPath()); try { writer.write(path.getExecutorLogPath(), logStream); LOGGER.info(String.format("Logging file: %s", path.getExecutorLogPath())); return logStream; } catch (IOException e) { LOGGER.error("Failed", e); logStream.close(); return null; } } DockerStreamer(LogStreamWriter writer, ContainerizerClient client); LogStream startStreaming(DockerLogPath path); void stopStreaming(String containerId, LogStream logStream); }
DockerStreamer { public LogStream startStreaming(DockerLogPath path) { LOGGER .info("Stream from " + path.getContainerLogPath() + " to " + path.getExecutorLogPath()); LogStream logStream = createContainerLogStream(path.getContainerId(), path.getContainerLogPath()); try { writer.write(path.getExecutorLogPath(), logStream); LOGGER.info(String.format("Logging file: %s", path.getExecutorLogPath())); return logStream; } catch (IOException e) { LOGGER.error("Failed", e); logStream.close(); return null; } } DockerStreamer(LogStreamWriter writer, ContainerizerClient client); LogStream startStreaming(DockerLogPath path); void stopStreaming(String containerId, LogStream logStream);  }