Search in sources :

Example 1 with LogEntry

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);
}
Also used : LogCollector(ch.ivyteam.ivy.maven.log.LogCollector) File(java.io.File) LogEntry(ch.ivyteam.ivy.maven.log.LogCollector.LogEntry) Test(org.junit.Test)

Example 2 with LogEntry

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);
}
Also used : LogCollector(ch.ivyteam.ivy.maven.log.LogCollector) File(java.io.File) LogEntry(ch.ivyteam.ivy.maven.log.LogCollector.LogEntry) Test(org.junit.Test)

Aggregations

LogCollector (ch.ivyteam.ivy.maven.log.LogCollector)2 LogEntry (ch.ivyteam.ivy.maven.log.LogCollector.LogEntry)2 File (java.io.File)2 Test (org.junit.Test)2