use of ch.ivyteam.ivy.maven.log.LogCollector.LogEntry in project project-build-plugin by axonivy.
the class TestFileLogForwarder method fileToMavenLog.
@Test
public void fileToMavenLog() throws Exception {
File fakeEngineLog = Files.createTempFile("myProject.iar", ".deploymentLog").toFile();
LogCollector mavenLog = new LogCollector();
FileLogForwarder logForwarder = new FileLogForwarder(fakeEngineLog, mavenLog, new EngineLogLineHandler(mavenLog));
try {
logForwarder.activate();
logAndWait(fakeEngineLog, "WARNING: starting");
assertThat(mavenLog.getWarnings()).hasSize(1);
LogEntry firstEntry = mavenLog.getWarnings().get(mavenLog.getWarnings().size() - 1);
assertThat(firstEntry.toString()).isEqualTo(" ENGINE: starting");
logAndWait(fakeEngineLog, "WARNING: finished");
assertThat(mavenLog.getWarnings()).hasSize(2);
LogEntry lastEntry = mavenLog.getWarnings().get(mavenLog.getWarnings().size() - 1);
assertThat(lastEntry.toString()).isEqualTo(" ENGINE: finished");
logAndWait(fakeEngineLog, "INFO: hi");
assertThat(mavenLog.getDebug()).hasSize(1);
LogEntry debugEntry = mavenLog.getDebug().get(mavenLog.getDebug().size() - 1);
assertThat(debugEntry.toString()).isEqualTo(" ENGINE: hi");
} finally {
logForwarder.deactivate();
}
logAndWait(fakeEngineLog, "WARNING: illegal");
assertThat(mavenLog.getWarnings()).hasSize(2);
}
use of ch.ivyteam.ivy.maven.log.LogCollector.LogEntry in project project-build-plugin by axonivy.
the class TestFileLogForwarder method fileToMavenLog.
@Test
public void fileToMavenLog() throws Exception {
File fakeEngineLog = Files.createTempFile("myProject.iar", ".deploymentLog").toFile();
LogCollector mavenLog = new LogCollector();
FileLogForwarder logForwarder = new FileLogForwarder(fakeEngineLog, mavenLog, new EngineLogLineHandler(mavenLog));
try {
logForwarder.activate();
logAndWait(fakeEngineLog, "WARNING: starting");
assertThat(mavenLog.getWarnings()).hasSize(1);
LogEntry firstEntry = mavenLog.getWarnings().get(mavenLog.getWarnings().size() - 1);
assertThat(firstEntry.toString()).isEqualTo(" ENGINE: starting");
logAndWait(fakeEngineLog, "WARNING: finished");
assertThat(mavenLog.getWarnings()).hasSize(2);
LogEntry lastEntry = mavenLog.getWarnings().get(mavenLog.getWarnings().size() - 1);
assertThat(lastEntry.toString()).isEqualTo(" ENGINE: finished");
logAndWait(fakeEngineLog, "INFO: hi");
assertThat(mavenLog.getDebug()).hasSize(1);
LogEntry debugEntry = mavenLog.getDebug().get(mavenLog.getDebug().size() - 1);
assertThat(debugEntry.toString()).isEqualTo(" ENGINE: hi");
} finally {
logForwarder.deactivate();
}
logAndWait(fakeEngineLog, "WARNING: illegal");
assertThat(mavenLog.getWarnings()).hasSize(2);
}
Aggregations