@Test public void report() throws Exception { when(uniqueEntities.count()).thenReturn(10L); when(uniqueRelations.count()).thenReturn(5L); doReturn(documentIds).when(uniqueRelations).map(any()); when(documentIds.distinct()).thenReturn(distinctDocumentIds); when(distinctDocumentIds.count()).thenReturn(3L); doReturn(reportCounters).when(sparkContext).parallelize(any(), eq(1)); counterReporter.report(sparkContext, uniqueEntities, uniqueRelations, outputReportPath); verify(uniqueRelations).map(extractDocIdFunction.capture()); assertExtractDocIdFunction(extractDocIdFunction.getValue()); verify(sparkContext).parallelize(reportEntriesCaptor.capture(), eq(1)); assertReportEntries(reportEntriesCaptor.getValue()); verify(avroSaver).saveJavaRDD(reportCounters, ReportEntry.SCHEMA$, outputReportPath); }
public void report(JavaSparkContext sparkContext, JavaRDD<?> uniqueEntities, JavaRDD<Tuple3<String, String, Float>> uniqueRelations, String outputReportPath) { Preconditions.checkNotNull(outputReportPath, "reportPath has not been set"); Preconditions.checkNotNull(sparkContext, "sparkContext has not been set"); ReportEntry totalEntitiesCounter = ReportEntryFactory.createCounterReportEntry(EXPORTED_SOFTWARE_ENTITIES_COUNTER, uniqueEntities.count()); ReportEntry totalRelationsCounter = ReportEntryFactory.createCounterReportEntry(SOFTWARE_REFERENCES_COUNTER, uniqueRelations.count()); ReportEntry distinctPubsCounter = generateDistinctPublicationsCounter(uniqueRelations); JavaRDD<ReportEntry> report = sparkContext.parallelize(Lists.newArrayList( totalEntitiesCounter, totalRelationsCounter, distinctPubsCounter), 1); avroSaver.saveJavaRDD(report, ReportEntry.SCHEMA$, outputReportPath); }
SoftwareExportCounterReporter { public void report(JavaSparkContext sparkContext, JavaRDD<?> uniqueEntities, JavaRDD<Tuple3<String, String, Float>> uniqueRelations, String outputReportPath) { Preconditions.checkNotNull(outputReportPath, "reportPath has not been set"); Preconditions.checkNotNull(sparkContext, "sparkContext has not been set"); ReportEntry totalEntitiesCounter = ReportEntryFactory.createCounterReportEntry(EXPORTED_SOFTWARE_ENTITIES_COUNTER, uniqueEntities.count()); ReportEntry totalRelationsCounter = ReportEntryFactory.createCounterReportEntry(SOFTWARE_REFERENCES_COUNTER, uniqueRelations.count()); ReportEntry distinctPubsCounter = generateDistinctPublicationsCounter(uniqueRelations); JavaRDD<ReportEntry> report = sparkContext.parallelize(Lists.newArrayList( totalEntitiesCounter, totalRelationsCounter, distinctPubsCounter), 1); avroSaver.saveJavaRDD(report, ReportEntry.SCHEMA$, outputReportPath); } }
SoftwareExportCounterReporter { public void report(JavaSparkContext sparkContext, JavaRDD<?> uniqueEntities, JavaRDD<Tuple3<String, String, Float>> uniqueRelations, String outputReportPath) { Preconditions.checkNotNull(outputReportPath, "reportPath has not been set"); Preconditions.checkNotNull(sparkContext, "sparkContext has not been set"); ReportEntry totalEntitiesCounter = ReportEntryFactory.createCounterReportEntry(EXPORTED_SOFTWARE_ENTITIES_COUNTER, uniqueEntities.count()); ReportEntry totalRelationsCounter = ReportEntryFactory.createCounterReportEntry(SOFTWARE_REFERENCES_COUNTER, uniqueRelations.count()); ReportEntry distinctPubsCounter = generateDistinctPublicationsCounter(uniqueRelations); JavaRDD<ReportEntry> report = sparkContext.parallelize(Lists.newArrayList( totalEntitiesCounter, totalRelationsCounter, distinctPubsCounter), 1); avroSaver.saveJavaRDD(report, ReportEntry.SCHEMA$, outputReportPath); }  }
SoftwareExportCounterReporter { public void report(JavaSparkContext sparkContext, JavaRDD<?> uniqueEntities, JavaRDD<Tuple3<String, String, Float>> uniqueRelations, String outputReportPath) { Preconditions.checkNotNull(outputReportPath, "reportPath has not been set"); Preconditions.checkNotNull(sparkContext, "sparkContext has not been set"); ReportEntry totalEntitiesCounter = ReportEntryFactory.createCounterReportEntry(EXPORTED_SOFTWARE_ENTITIES_COUNTER, uniqueEntities.count()); ReportEntry totalRelationsCounter = ReportEntryFactory.createCounterReportEntry(SOFTWARE_REFERENCES_COUNTER, uniqueRelations.count()); ReportEntry distinctPubsCounter = generateDistinctPublicationsCounter(uniqueRelations); JavaRDD<ReportEntry> report = sparkContext.parallelize(Lists.newArrayList( totalEntitiesCounter, totalRelationsCounter, distinctPubsCounter), 1); avroSaver.saveJavaRDD(report, ReportEntry.SCHEMA$, outputReportPath); }  void report(JavaSparkContext sparkContext, 
            JavaRDD<?> uniqueEntities, JavaRDD<Tuple3<String, String, Float>> uniqueRelations, String outputReportPath); }
SoftwareExportCounterReporter { public void report(JavaSparkContext sparkContext, JavaRDD<?> uniqueEntities, JavaRDD<Tuple3<String, String, Float>> uniqueRelations, String outputReportPath) { Preconditions.checkNotNull(outputReportPath, "reportPath has not been set"); Preconditions.checkNotNull(sparkContext, "sparkContext has not been set"); ReportEntry totalEntitiesCounter = ReportEntryFactory.createCounterReportEntry(EXPORTED_SOFTWARE_ENTITIES_COUNTER, uniqueEntities.count()); ReportEntry totalRelationsCounter = ReportEntryFactory.createCounterReportEntry(SOFTWARE_REFERENCES_COUNTER, uniqueRelations.count()); ReportEntry distinctPubsCounter = generateDistinctPublicationsCounter(uniqueRelations); JavaRDD<ReportEntry> report = sparkContext.parallelize(Lists.newArrayList( totalEntitiesCounter, totalRelationsCounter, distinctPubsCounter), 1); avroSaver.saveJavaRDD(report, ReportEntry.SCHEMA$, outputReportPath); }  void report(JavaSparkContext sparkContext, 
            JavaRDD<?> uniqueEntities, JavaRDD<Tuple3<String, String, Float>> uniqueRelations, String outputReportPath); static final String EXPORTED_SOFTWARE_ENTITIES_COUNTER; static final String SOFTWARE_REFERENCES_COUNTER; static final String DISTINCT_PUBLICATIONS_WITH_SOFTWARE_REFERENCES_COUNTER; }