@Test
public void testAllKindsOfComponents() throws Exception {
final List<LogRecord> records = new ArrayList<LogRecord>();
// Tell the logger to log everything
ConsoleHandler handler = (ConsoleHandler) LogManager.getLogManager().getLogger("")
.getHandlers()[0];
java.util.logging.Level oldLevel = handler.getLevel();
handler.setLevel(Level.ALL);
handler.setFilter(new Filter() {
public boolean isLoggable(LogRecord record) {
records.add(record);
return true;
}
});
try {
JCas jcas = JCasFactory.createJCas();
createReader(LoggingCasCollectionReader.class).hasNext();
assertLogDone(records);
createReader(LoggingJCasCollectionReader.class).hasNext();
assertLogDone(records);
// createFlowControllerDescription(LoggingJCasFlowController.class).
// assertLogDone(records);
createEngine(LoggingCasAnnotator.class).process(jcas.getCas());
assertLogDone(records);
createEngine(LoggingJCasAnnotator.class).process(jcas);
assertLogDone(records);
createEngine(LoggingCasConsumer.class).process(jcas.getCas());
assertLogDone(records);
createEngine(LoggingJCasConsumer.class).process(jcas);
assertLogDone(records);
createEngine(LoggingCasMultiplier.class).process(jcas.getCas());
assertLogDone(records);
createEngine(LoggingJCasMultiplier.class).process(jcas);
assertLogDone(records);
} finally {
if (oldLevel != null) {
handler.setLevel(oldLevel);
handler.setFilter(null);
}
}
}