*
* @throws Exception
*/
public void testAeErrorRateThresholdTerminateModified1() throws Exception {
int documentCount = 500; // number of documents to process
TestStatusCallbackListener listener = new TestStatusCallbackListener();
int exceptionSequence = 5;
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("terminate");
integratedProcessor.setMaxErrorCount(5);
CollectionProcessingEngine cpe = UIMAFramework.produceCollectionProcessingEngine(cpeDesc, null,
null);
// Create and register a Status Callback Listener
// listener = new CollectionReaderStatusCallbackListener(cpe);
cpe.addStatusCallbackListener(listener);
cpeProcessNoMsg(cpe, listener);
ManageOutputDevice.setAllSystemOutputToDefault();
// check the results, if everything worked as expected
assertEquals(
"The cpm called the listener, that the cpm has finished - which normally could not be.",
false, listener.isFinished());
assertEquals("The aborted-method of the listener wasn't called.", true, listener.isAborted());
assertEquals("There are not as much exceptions as expected! ", (5 + 1), FunctionErrorStore
.getCount());
}