protected static void log(Path path, Runnable closure) {
LogUtil.log(path, LOGGER, closure);
}
public void execute() {
final Progress progress = new Progress(testSuite.getProcessesCount());
MDC.put("progress", progress.toString());
// prepare test suite
// MUST BE OUTSITE OF LOG -> as it deletes whole file tree
FileTasks.deleteDirectory(testSuite.getPath());
FileTasks.mkdirs(testSuite.getPath());
log(testSuite.getPath(), () -> {
// fail fast
for (AbstractBPMNEngine engine : testSuite.getEngines()) {
if (engine.isRunning()) {
throw new IllegalStateException("Engine " + engine.getName() + " is running");
}
}
for (AbstractBPMNEngine engine : testSuite.getEngines()) {
FileTasks.mkdirs(engine.getPath());
log(engine.getPath(), () -> {
for (BPMNProcess process : engine.getProcesses()) {
progress.next();
MDC.put("progress", progress.toString());
executeProcess(process);
}
});
}