* @return Object[] with the cpe-Descriptor at index 0 and the integratedProcessor at index 1
*/
private Object[] setupConfigurableCpm(int documentCount, String exceptionName,
int exceptionSequence, String functionName) {
CpeDescription cpeDesc = null;
CpeIntegratedCasProcessor integratedProcessor = null;
try {
String colReaderBase = JUnitExtension.getFile(
"CpmTests" + FS + "ErrorTestCollectionReader.xml").getAbsolutePath();
String taeBase = JUnitExtension.getFile("CpmTests" + FS + "ErrorTestAnnotator.xml")
.getAbsolutePath();
String casConsumerBase = JUnitExtension.getFile("CpmTests" + FS + "ErrorTestCasConsumer.xml")
.getAbsolutePath();
// first, prepare all descriptors as needed
String colReaderDesc = DescriptorMakeUtil.makeCollectionReader(colReaderBase, documentCount);
String taeDesc = null;
if (exceptionName == null || exceptionSequence <= 0 || functionName == null) {
taeDesc = DescriptorMakeUtil.makeAnalysisEngine(taeBase);
} else {
taeDesc = DescriptorMakeUtil.makeAnalysisEngine(taeBase, true, functionName,
exceptionSequence, exceptionName);
}
String casConsumerDesc = DescriptorMakeUtil.makeCasConsumer(casConsumerBase);
// secondly, create the cpm based on the descriptors
cpeDesc = CpeDescriptorFactory.produceDescriptor();
// managing the default behaviour of this client
integratedProcessor = CpeDescriptorFactory.produceCasProcessor("ErrorTestAnnotator");
integratedProcessor.setDescriptor(taeDesc);
CpeIntegratedCasProcessor casConsumer = CpeDescriptorFactory
.produceCasProcessor("ErrorTest CasConsumer");
casConsumer.setDescriptor(casConsumerDesc);
// - add all descriptors
cpeDesc.addCollectionReader(colReaderDesc);
cpeDesc.addCasProcessor(integratedProcessor);
cpeDesc.addCasProcessor(casConsumer);