*
* @return CollectionProcessingEngine - initialized cpe
*/
private CollectionProcessingEngine setupCpm(int documentCount, int threadCount, int poolSize,
ResourceManager resourceManager) throws Exception {
CpeDescription cpeDesc = null;
CollectionProcessingEngine cpe = null;
try {
String colReaderBase = JUnitExtension.getFile("CpmTests" + separator
+ "ErrorTestCollectionReader.xml").getAbsolutePath();
String taeBase = JUnitExtension.getFile("CpmTests" + separator + "aggrContainingPearSpecifier.xml").getAbsolutePath();
String casConsumerBase = JUnitExtension.getFile("CpmTests" + separator
+ "ErrorTestCasConsumer.xml").getAbsolutePath();
// created needed descriptors
String colReaderDesc = DescriptorMakeUtil.makeCollectionReader(colReaderBase, documentCount);
// String taeDesc = DescriptorMakeUtil.makeAnalysisEngine(taeBase);
String taeDesc = taeBase;
String casConsumerDesc = DescriptorMakeUtil.makeCasConsumer(casConsumerBase);
// create cpm descriptor
cpeDesc = CpeDescriptorFactory.produceDescriptor();
cpeDesc.setInputQueueSize(threadCount);
cpeDesc.setOutputQueueSize(threadCount);
cpeDesc.setProcessingUnitThreadCount(threadCount);
cpeDesc.getCpeCasProcessors().setPoolSize(poolSize);
// add tae
CpeIntegratedCasProcessor integratedProcessor = CpeDescriptorFactory
.produceCasProcessor("ErrorTestAnnotator");
integratedProcessor.setDescriptor(taeDesc);
cpeDesc.addCasProcessor(integratedProcessor);
// add casConsumer
CpeIntegratedCasProcessor casConsumer = CpeDescriptorFactory
.produceCasProcessor("ErrorTest CasConsumer");
casConsumer.setDescriptor(casConsumerDesc);
cpeDesc.addCasProcessor(casConsumer);
// add collectionReader
cpeDesc.addCollectionReader(colReaderDesc);
// produce cpe
cpe = UIMAFramework.produceCollectionProcessingEngine(cpeDesc, resourceManager, null);
} catch (Exception e) {
e.printStackTrace();