@Test public void testCollapseTextOnly() throws Exception { collapser.setup(context); List<Citation> source = new ArrayList<>(); String citation1Text = "citation text"; String citation1OtherText = "citation new text"; String citation2Text = "some other text"; source.add(buildCitationWithText(1, citation1Text)); source.add(buildCitationWithText(1, citation1OtherText)); source.add(buildCitationWithText(2, citation2Text)); List<Citation> result = collapser.collapse(source); assertNotNull(result); assertEquals(2, result.size()); assertEquals(1, result.get(0).getEntry().getPosition().intValue()); assertEquals(citation1OtherText, result.get(0).getEntry().getRawText()); assertEquals(2, result.get(1).getEntry().getPosition().intValue()); assertEquals(citation2Text, result.get(1).getEntry().getRawText()); verify(totalTextCounter, times(1)).increment(2); verify(docsWithAtLeastOneCitationTextCounter, times(1)).increment(1); verify(totalMatchedCounter, never()).increment(1); verify(docsWithAtLeastOneMatchedCitationCounter, never()).increment(1); }
@Override public void setup(TaskAttemptContext context) { totalTextCounter = context.getCounter(CitationTextCounters.TOTAL); totalTextCounter.setValue(0); docsWithAtLeastOneCitationTextCounter = context.getCounter(CitationTextCounters.DOCS_WITH_AT_LEAST_ONE_CITATION); docsWithAtLeastOneCitationTextCounter.setValue(0); totalMatchedCounter = context.getCounter(MatchedCitationCounters.TOTAL); totalMatchedCounter.setValue(0); docsWithAtLeastOneMatchedCitationCounter = context.getCounter(MatchedCitationCounters.DOCS_WITH_AT_LEAST_ONE_CITATION); docsWithAtLeastOneMatchedCitationCounter.setValue(0); }
GenericCitationCollapser extends AbstractSimpleCollapser<Citation> { @Override public void setup(TaskAttemptContext context) { totalTextCounter = context.getCounter(CitationTextCounters.TOTAL); totalTextCounter.setValue(0); docsWithAtLeastOneCitationTextCounter = context.getCounter(CitationTextCounters.DOCS_WITH_AT_LEAST_ONE_CITATION); docsWithAtLeastOneCitationTextCounter.setValue(0); totalMatchedCounter = context.getCounter(MatchedCitationCounters.TOTAL); totalMatchedCounter.setValue(0); docsWithAtLeastOneMatchedCitationCounter = context.getCounter(MatchedCitationCounters.DOCS_WITH_AT_LEAST_ONE_CITATION); docsWithAtLeastOneMatchedCitationCounter.setValue(0); } }
GenericCitationCollapser extends AbstractSimpleCollapser<Citation> { @Override public void setup(TaskAttemptContext context) { totalTextCounter = context.getCounter(CitationTextCounters.TOTAL); totalTextCounter.setValue(0); docsWithAtLeastOneCitationTextCounter = context.getCounter(CitationTextCounters.DOCS_WITH_AT_LEAST_ONE_CITATION); docsWithAtLeastOneCitationTextCounter.setValue(0); totalMatchedCounter = context.getCounter(MatchedCitationCounters.TOTAL); totalMatchedCounter.setValue(0); docsWithAtLeastOneMatchedCitationCounter = context.getCounter(MatchedCitationCounters.DOCS_WITH_AT_LEAST_ONE_CITATION); docsWithAtLeastOneMatchedCitationCounter.setValue(0); }  }
GenericCitationCollapser extends AbstractSimpleCollapser<Citation> { @Override public void setup(TaskAttemptContext context) { totalTextCounter = context.getCounter(CitationTextCounters.TOTAL); totalTextCounter.setValue(0); docsWithAtLeastOneCitationTextCounter = context.getCounter(CitationTextCounters.DOCS_WITH_AT_LEAST_ONE_CITATION); docsWithAtLeastOneCitationTextCounter.setValue(0); totalMatchedCounter = context.getCounter(MatchedCitationCounters.TOTAL); totalMatchedCounter.setValue(0); docsWithAtLeastOneMatchedCitationCounter = context.getCounter(MatchedCitationCounters.DOCS_WITH_AT_LEAST_ONE_CITATION); docsWithAtLeastOneMatchedCitationCounter.setValue(0); }  @Override void setup(TaskAttemptContext context); }
GenericCitationCollapser extends AbstractSimpleCollapser<Citation> { @Override public void setup(TaskAttemptContext context) { totalTextCounter = context.getCounter(CitationTextCounters.TOTAL); totalTextCounter.setValue(0); docsWithAtLeastOneCitationTextCounter = context.getCounter(CitationTextCounters.DOCS_WITH_AT_LEAST_ONE_CITATION); docsWithAtLeastOneCitationTextCounter.setValue(0); totalMatchedCounter = context.getCounter(MatchedCitationCounters.TOTAL); totalMatchedCounter.setValue(0); docsWithAtLeastOneMatchedCitationCounter = context.getCounter(MatchedCitationCounters.DOCS_WITH_AT_LEAST_ONE_CITATION); docsWithAtLeastOneMatchedCitationCounter.setValue(0); }  @Override void setup(TaskAttemptContext context);  }