DBMultiplier extends JCasMultiplier_ImplBase { @Override public boolean hasNext() { return documentDataIterator != null && documentDataIterator.hasNext(); }  @Override void initialize(UimaContext aContext); @Override void process(JCas aJCas); @Override boolean hasNext();  }
@Test public void testDBMultiplierReader() throws UIMAException, IOException, ConfigurationException { String costosysConfig = DBTestUtils.createTestCostosysConfig("medline_2017", 2, postgres); CollectionReader reader = CollectionReaderFactory.createReader(DBMultiplierReader.class, PARAM_BATCH_SIZE, 5, PARAM_TABLE, "testsubset", PARAM_COSTOSYS_CONFIG_NAME, costosysConfig); AnalysisEngine multiplier = AnalysisEngineFactory.createEngine(TestMultiplier.class, TableReaderConstants.PARAM_COSTOSYS_CONFIG_NAME, costosysConfig); assertTrue(reader.hasNext()); JCas jCas = JCasFactory.createJCas("de.julielab.jcore.types.casmultiplier.jcore-dbtable-multiplier-types", "de.julielab.jcore.types.extensions.jcore-document-meta-extension-types"); int numReadDocs = 0; while (reader.hasNext()) { reader.getNext(jCas.getCas()); RowBatch rowBatch = JCasUtil.selectSingle(jCas, RowBatch.class); assertTrue(rowBatch.getIdentifiers().size() > 0); JCasIterator jCasIterator = multiplier.processAndOutputNewCASes(jCas); while (jCasIterator.hasNext()) { JCas mJCas = jCasIterator.next(); assertNotNull(mJCas.getDocumentText()); assertTrue(JCoReTools.getDocId(mJCas) != null); assertTrue(JCoReTools.getDocId(mJCas).length() > 0); log.debug(StringUtils.abbreviate(mJCas.getDocumentText(), 200)); mJCas.release(); ++numReadDocs; } jCas.reset(); } assertEquals(20, numReadDocs); }