@Test(expected = NullPointerException.class) public void reportShouldThrowExceptionWhenSparkContextIsNull() { JavaRDD<DocumentToPatentWithIdsToExport> documentToPatentsToExportWithIds = sc.emptyRDD(); reporter.report(null, documentToPatentsToExportWithIds, outputReportPath); }
public void report(JavaSparkContext sc, JavaRDD<DocumentToPatentWithIdsToExport> documentToPatentsToExportWithIds, String outputReportPath) { Preconditions.checkNotNull(sc, "sparkContext has not been set"); Preconditions.checkNotNull(outputReportPath, "reportPath has not been set"); ReportEntry totalRelationsCounter = ReportEntryFactory.createCounterReportEntry(PATENT_REFERENCES_COUNTER, totalRelationsCount(documentToPatentsToExportWithIds)); ReportEntry totalEntitiesCounter = ReportEntryFactory.createCounterReportEntry(EXPORTED_PATENT_ENTITIES_COUNTER, totalEntitiesCount(documentToPatentsToExportWithIds)); ReportEntry distinctPublicationsCounter = ReportEntryFactory.createCounterReportEntry(DISTINCT_PUBLICATIONS_WITH_PATENT_REFERENCES_COUNTER, distinctPublicationsCount(documentToPatentsToExportWithIds)); JavaRDD<ReportEntry> report = sc.parallelize(Arrays.asList( totalRelationsCounter, totalEntitiesCounter, distinctPublicationsCounter), 1); avroSaver.saveJavaRDD(report, ReportEntry.SCHEMA$, outputReportPath); }
PatentExportCounterReporter { public void report(JavaSparkContext sc, JavaRDD<DocumentToPatentWithIdsToExport> documentToPatentsToExportWithIds, String outputReportPath) { Preconditions.checkNotNull(sc, "sparkContext has not been set"); Preconditions.checkNotNull(outputReportPath, "reportPath has not been set"); ReportEntry totalRelationsCounter = ReportEntryFactory.createCounterReportEntry(PATENT_REFERENCES_COUNTER, totalRelationsCount(documentToPatentsToExportWithIds)); ReportEntry totalEntitiesCounter = ReportEntryFactory.createCounterReportEntry(EXPORTED_PATENT_ENTITIES_COUNTER, totalEntitiesCount(documentToPatentsToExportWithIds)); ReportEntry distinctPublicationsCounter = ReportEntryFactory.createCounterReportEntry(DISTINCT_PUBLICATIONS_WITH_PATENT_REFERENCES_COUNTER, distinctPublicationsCount(documentToPatentsToExportWithIds)); JavaRDD<ReportEntry> report = sc.parallelize(Arrays.asList( totalRelationsCounter, totalEntitiesCounter, distinctPublicationsCounter), 1); avroSaver.saveJavaRDD(report, ReportEntry.SCHEMA$, outputReportPath); } }
PatentExportCounterReporter { public void report(JavaSparkContext sc, JavaRDD<DocumentToPatentWithIdsToExport> documentToPatentsToExportWithIds, String outputReportPath) { Preconditions.checkNotNull(sc, "sparkContext has not been set"); Preconditions.checkNotNull(outputReportPath, "reportPath has not been set"); ReportEntry totalRelationsCounter = ReportEntryFactory.createCounterReportEntry(PATENT_REFERENCES_COUNTER, totalRelationsCount(documentToPatentsToExportWithIds)); ReportEntry totalEntitiesCounter = ReportEntryFactory.createCounterReportEntry(EXPORTED_PATENT_ENTITIES_COUNTER, totalEntitiesCount(documentToPatentsToExportWithIds)); ReportEntry distinctPublicationsCounter = ReportEntryFactory.createCounterReportEntry(DISTINCT_PUBLICATIONS_WITH_PATENT_REFERENCES_COUNTER, distinctPublicationsCount(documentToPatentsToExportWithIds)); JavaRDD<ReportEntry> report = sc.parallelize(Arrays.asList( totalRelationsCounter, totalEntitiesCounter, distinctPublicationsCounter), 1); avroSaver.saveJavaRDD(report, ReportEntry.SCHEMA$, outputReportPath); }  }
PatentExportCounterReporter { public void report(JavaSparkContext sc, JavaRDD<DocumentToPatentWithIdsToExport> documentToPatentsToExportWithIds, String outputReportPath) { Preconditions.checkNotNull(sc, "sparkContext has not been set"); Preconditions.checkNotNull(outputReportPath, "reportPath has not been set"); ReportEntry totalRelationsCounter = ReportEntryFactory.createCounterReportEntry(PATENT_REFERENCES_COUNTER, totalRelationsCount(documentToPatentsToExportWithIds)); ReportEntry totalEntitiesCounter = ReportEntryFactory.createCounterReportEntry(EXPORTED_PATENT_ENTITIES_COUNTER, totalEntitiesCount(documentToPatentsToExportWithIds)); ReportEntry distinctPublicationsCounter = ReportEntryFactory.createCounterReportEntry(DISTINCT_PUBLICATIONS_WITH_PATENT_REFERENCES_COUNTER, distinctPublicationsCount(documentToPatentsToExportWithIds)); JavaRDD<ReportEntry> report = sc.parallelize(Arrays.asList( totalRelationsCounter, totalEntitiesCounter, distinctPublicationsCounter), 1); avroSaver.saveJavaRDD(report, ReportEntry.SCHEMA$, outputReportPath); }  void report(JavaSparkContext sc,
                       JavaRDD<DocumentToPatentWithIdsToExport> documentToPatentsToExportWithIds,
                       String outputReportPath); }
PatentExportCounterReporter { public void report(JavaSparkContext sc, JavaRDD<DocumentToPatentWithIdsToExport> documentToPatentsToExportWithIds, String outputReportPath) { Preconditions.checkNotNull(sc, "sparkContext has not been set"); Preconditions.checkNotNull(outputReportPath, "reportPath has not been set"); ReportEntry totalRelationsCounter = ReportEntryFactory.createCounterReportEntry(PATENT_REFERENCES_COUNTER, totalRelationsCount(documentToPatentsToExportWithIds)); ReportEntry totalEntitiesCounter = ReportEntryFactory.createCounterReportEntry(EXPORTED_PATENT_ENTITIES_COUNTER, totalEntitiesCount(documentToPatentsToExportWithIds)); ReportEntry distinctPublicationsCounter = ReportEntryFactory.createCounterReportEntry(DISTINCT_PUBLICATIONS_WITH_PATENT_REFERENCES_COUNTER, distinctPublicationsCount(documentToPatentsToExportWithIds)); JavaRDD<ReportEntry> report = sc.parallelize(Arrays.asList( totalRelationsCounter, totalEntitiesCounter, distinctPublicationsCounter), 1); avroSaver.saveJavaRDD(report, ReportEntry.SCHEMA$, outputReportPath); }  void report(JavaSparkContext sc,
                       JavaRDD<DocumentToPatentWithIdsToExport> documentToPatentsToExportWithIds,
                       String outputReportPath); static final String PATENT_REFERENCES_COUNTER; static final String EXPORTED_PATENT_ENTITIES_COUNTER; static final String DISTINCT_PUBLICATIONS_WITH_PATENT_REFERENCES_COUNTER; }