use of ch.ivyteam.ivy.maven.log.LogCollector 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 in project project-build-plugin by axonivy.
the class TestCompileProjectMojo method compilerSettingsFile_notFoundWarnings.
@Test
public void compilerSettingsFile_notFoundWarnings() throws Exception {
LogCollector log = new LogCollector();
CompileProjectMojo mojo = compile.getMojo();
mojo.setLog(log);
mojo.compilerWarnings = false;
mojo.compilerSettings = new File("path/to/oblivion");
mojo.execute();
assertThat(log.getWarnings().toString()).doesNotContain("Could not locate compiler settings file");
mojo.compilerWarnings = true;
mojo.execute();
assertThat(log.getWarnings().toString()).contains("Could not locate compiler settings file");
}
use of ch.ivyteam.ivy.maven.log.LogCollector 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 in project project-build-plugin by axonivy.
the class TestStartEngine method startEngine_targetDirectoryNotClean.
@Test
public void startEngine_targetDirectoryNotClean() throws Exception {
LogCollector log = new LogCollector();
StartTestEngineMojo mojo = rule.getMojo();
mojo.setLog(log);
Executor startedProcess = null;
try {
File engineDirTarget = mojo.getEngineDir(mojo.project);
assertThat(engineDirTarget.toString()).contains("/target/ivyEngine");
assertThat(engineDirTarget).doesNotExist();
assertThat(log.getWarnings().toString()).doesNotContain("Skipping copy");
startedProcess = mojo.startEngine();
assertThat(engineDirTarget).exists();
assertThat(log.getWarnings().toString()).doesNotContain("Skipping copy");
kill(startedProcess);
startedProcess = mojo.startEngine();
assertThat(engineDirTarget).exists();
assertThat(log.getWarnings().toString()).contains("Skipping copy");
} finally {
kill(startedProcess);
}
}
use of ch.ivyteam.ivy.maven.log.LogCollector in project project-build-plugin by axonivy.
the class TestEngineControl method startAndStop.
@Test
public void startAndStop() throws Exception {
LogCollector log = new LogCollector();
rule.getMojo().setLog(log);
EngineControl controller = rule.getMojo().createEngineController();
assertThat(controller.state()).isEqualTo(EngineState.STOPPED);
controller.start();
assertThat(controller.state()).isEqualTo(EngineState.RUNNING);
controller.stop();
assertThat(controller.state()).isEqualTo(EngineState.STOPPED);
assertThat(log.getErrors()).isEmpty();
}
Aggregations