@Test public void should_report_log_file() throws IOException { final TakeDockerEnvironment takeDockerEnvironment = new TakeDockerEnvironment(); takeDockerEnvironment.reportEvent = reportEvent; takeDockerEnvironment.reportContainerLogs(new BeforeStop(CUBE_ID), dockerClientExecutor, getReporterConfiguration()); verify(reportEvent).fire(reportEventArgumentCaptor.capture()); final SectionEvent sectionEvent = reportEventArgumentCaptor.getValue(); assertThatSection(sectionEvent) .hasSectionId(CUBE_ID) .hasReportOfTypeThatIsAssignableFrom(BasicReport.class); final Report report = sectionEvent.getReport(); assertThatReport(report) .hasNumberOfEntries(1) .hasEntriesContaining(new KeyValueEntry(LOG_PATH, new FileEntry("reports" + File.separatorChar + "logs" + File.separatorChar + "tomcat.log"))); }
public void reportContainerLogs(@Observes org.arquillian.cube.spi.event.lifecycle.BeforeStop beforeStop, DockerClientExecutor executor, ReporterConfiguration reporterConfiguration) throws IOException { final String cubeId = beforeStop.getCubeId(); if (cubeId != null) { final File logFile = new File(createContainerLogDirectory(new File(reporterConfiguration.getRootDirectory())), cubeId + ".log"); final Path rootDir = Paths.get(reporterConfiguration.getRootDirectory()); final Path relativePath = rootDir.relativize(logFile.toPath()); executor.copyLog(beforeStop.getCubeId(), false, true, true, true, -1, new FileOutputStream(logFile)); Reporter.createReport() .addKeyValueEntry(LOG_PATH, new FileEntry(relativePath)) .inSection(new DockerContainerSection(cubeId)) .fire(reportEvent); } }
TakeDockerEnvironment { public void reportContainerLogs(@Observes org.arquillian.cube.spi.event.lifecycle.BeforeStop beforeStop, DockerClientExecutor executor, ReporterConfiguration reporterConfiguration) throws IOException { final String cubeId = beforeStop.getCubeId(); if (cubeId != null) { final File logFile = new File(createContainerLogDirectory(new File(reporterConfiguration.getRootDirectory())), cubeId + ".log"); final Path rootDir = Paths.get(reporterConfiguration.getRootDirectory()); final Path relativePath = rootDir.relativize(logFile.toPath()); executor.copyLog(beforeStop.getCubeId(), false, true, true, true, -1, new FileOutputStream(logFile)); Reporter.createReport() .addKeyValueEntry(LOG_PATH, new FileEntry(relativePath)) .inSection(new DockerContainerSection(cubeId)) .fire(reportEvent); } } }
TakeDockerEnvironment { public void reportContainerLogs(@Observes org.arquillian.cube.spi.event.lifecycle.BeforeStop beforeStop, DockerClientExecutor executor, ReporterConfiguration reporterConfiguration) throws IOException { final String cubeId = beforeStop.getCubeId(); if (cubeId != null) { final File logFile = new File(createContainerLogDirectory(new File(reporterConfiguration.getRootDirectory())), cubeId + ".log"); final Path rootDir = Paths.get(reporterConfiguration.getRootDirectory()); final Path relativePath = rootDir.relativize(logFile.toPath()); executor.copyLog(beforeStop.getCubeId(), false, true, true, true, -1, new FileOutputStream(logFile)); Reporter.createReport() .addKeyValueEntry(LOG_PATH, new FileEntry(relativePath)) .inSection(new DockerContainerSection(cubeId)) .fire(reportEvent); } }  }
TakeDockerEnvironment { public void reportContainerLogs(@Observes org.arquillian.cube.spi.event.lifecycle.BeforeStop beforeStop, DockerClientExecutor executor, ReporterConfiguration reporterConfiguration) throws IOException { final String cubeId = beforeStop.getCubeId(); if (cubeId != null) { final File logFile = new File(createContainerLogDirectory(new File(reporterConfiguration.getRootDirectory())), cubeId + ".log"); final Path rootDir = Paths.get(reporterConfiguration.getRootDirectory()); final Path relativePath = rootDir.relativize(logFile.toPath()); executor.copyLog(beforeStop.getCubeId(), false, true, true, true, -1, new FileOutputStream(logFile)); Reporter.createReport() .addKeyValueEntry(LOG_PATH, new FileEntry(relativePath)) .inSection(new DockerContainerSection(cubeId)) .fire(reportEvent); } }  void reportDockerEnvironment(@Observes AfterAutoStart event, CubeDockerConfiguration cubeDockerConfiguration, DockerClientExecutor executor, ReporterConfiguration reporterConfiguration); void captureContainerStatsBeforeTest(@Observes Before before, DockerClientExecutor executor, CubeRegistry cubeRegistry); void reportContainerStatsAfterTest(@Observes After after, DockerClientExecutor executor, CubeRegistry cubeRegistry); void reportContainerLogs(@Observes org.arquillian.cube.spi.event.lifecycle.BeforeStop beforeStop, DockerClientExecutor executor, ReporterConfiguration reporterConfiguration); void captureStats(DockerClientExecutor executor, CubeRegistry cubeRegistry, String when, Boolean decimal); }
TakeDockerEnvironment { public void reportContainerLogs(@Observes org.arquillian.cube.spi.event.lifecycle.BeforeStop beforeStop, DockerClientExecutor executor, ReporterConfiguration reporterConfiguration) throws IOException { final String cubeId = beforeStop.getCubeId(); if (cubeId != null) { final File logFile = new File(createContainerLogDirectory(new File(reporterConfiguration.getRootDirectory())), cubeId + ".log"); final Path rootDir = Paths.get(reporterConfiguration.getRootDirectory()); final Path relativePath = rootDir.relativize(logFile.toPath()); executor.copyLog(beforeStop.getCubeId(), false, true, true, true, -1, new FileOutputStream(logFile)); Reporter.createReport() .addKeyValueEntry(LOG_PATH, new FileEntry(relativePath)) .inSection(new DockerContainerSection(cubeId)) .fire(reportEvent); } }  void reportDockerEnvironment(@Observes AfterAutoStart event, CubeDockerConfiguration cubeDockerConfiguration, DockerClientExecutor executor, ReporterConfiguration reporterConfiguration); void captureContainerStatsBeforeTest(@Observes Before before, DockerClientExecutor executor, CubeRegistry cubeRegistry); void reportContainerStatsAfterTest(@Observes After after, DockerClientExecutor executor, CubeRegistry cubeRegistry); void reportContainerLogs(@Observes org.arquillian.cube.spi.event.lifecycle.BeforeStop beforeStop, DockerClientExecutor executor, ReporterConfiguration reporterConfiguration); void captureStats(DockerClientExecutor executor, CubeRegistry cubeRegistry, String when, Boolean decimal);  }