* @throws Exception
*/
public void testAeErrorRateThresholdContinue() throws Exception {
int exceptionSequence = 4;
int documentCount = 20; // number of documents processed
TestStatusCallbackListener listener = new TestStatusCallbackListener();
String functionName = "process";
String exceptionName = "AnnotatorProcessException";
ManageOutputDevice.setAllSystemOutputToNirvana();
Object[] objs = setupConfigurableCpm(documentCount, exceptionName, exceptionSequence,
functionName);
CpeDescription cpeDesc = (CpeDescription) objs[0];
cpeDesc.setProcessingUnitThreadCount(1);
CpeIntegratedCasProcessor integratedProcessor = (CpeIntegratedCasProcessor) objs[1];
integratedProcessor.setActionOnMaxError("continue");
integratedProcessor.setMaxErrorCount(5);
integratedProcessor.setMaxErrorSampleSize(15);
CollectionProcessingEngine cpe = UIMAFramework.produceCollectionProcessingEngine(cpeDesc, null,
null);
// Create and register a Status Callback Listener
// listener = new CollectionReaderStatusCallbackListener(cpe);
cpe.addStatusCallbackListener(listener);
cpe.process();
// wait until cpm has finished
while (!listener.isFinished() && !listener.isAborted()) {
Thread.sleep(5);
}
ManageOutputDevice.setAllSystemOutputToDefault();
// check the results, if everything worked as expected
assertEquals(
"The cpm propably didn't finish correctly! The aborted method of the listener was called.",
false, listener.isAborted());
assertEquals("The cpm didn't finish by calling the Listener.", true, listener.isFinished());
// TODO: write a function which calculates the expected number of occuring errors
// assertEquals("There are not as much exceptions as expected! ", 44,
// FunctionErrorStore.getCount());
}