@Test public void resolveReportCounters() { ReportPigCounterMapping counterMapping1 = new ReportPigCounterMapping("MAP_INPUT_RECORDS", "jobAlias1_2", "destination.report.param1"); ReportPigCounterMapping counterMapping2 = new ReportPigCounterMapping("REDUCE_OUTPUT_RECORDS", "jobAlias1", "destination.report.param2"); ReportPigCounterMapping counterMapping3 = new ReportPigCounterMapping("MAP_INPUT_RECORDS", "jobAlias2", "destination.report.param3"); ReportPigCounterMapping counterMapping4 = new ReportPigCounterMapping("RECORD_WRITTEN", null, "destination.report.record_written"); ReportPigCounterMapping counterMapping5 = new ReportPigCounterMapping("SOME_STRANGE_COUNTER", null, "destination.report.some_strange"); List<ReportEntry> reportCounters = reportPigCountersResolver.resolveReportCounters(pigCounters, Lists.newArrayList(counterMapping1, counterMapping2, counterMapping3, counterMapping4, counterMapping5)); assertThat(reportCounters, containsInAnyOrder( new ReportEntry("destination.report.param1", ReportEntryType.COUNTER, "10"), new ReportEntry("destination.report.param2", ReportEntryType.COUNTER, "2"), new ReportEntry("destination.report.param3", ReportEntryType.COUNTER, "3"), new ReportEntry("destination.report.record_written", ReportEntryType.COUNTER, "3"), new ReportEntry("destination.report.some_strange", ReportEntryType.COUNTER, "500"))); }
public List<ReportEntry> resolveReportCounters(PigCounters pigCounters, List<ReportPigCounterMapping> reportPigCountersMappings) { List<ReportEntry> reportCounters = Lists.newArrayList(); for (ReportPigCounterMapping counterMapping : reportPigCountersMappings) { String counterValue = extractCounterValue(pigCounters, counterMapping); ReportEntry reportEntry = ReportEntryFactory.createCounterReportEntry(counterMapping.getDestReportCounterName(), Long.valueOf(counterValue)); reportCounters.add(reportEntry); } return reportCounters; }
ReportPigCountersResolver { public List<ReportEntry> resolveReportCounters(PigCounters pigCounters, List<ReportPigCounterMapping> reportPigCountersMappings) { List<ReportEntry> reportCounters = Lists.newArrayList(); for (ReportPigCounterMapping counterMapping : reportPigCountersMappings) { String counterValue = extractCounterValue(pigCounters, counterMapping); ReportEntry reportEntry = ReportEntryFactory.createCounterReportEntry(counterMapping.getDestReportCounterName(), Long.valueOf(counterValue)); reportCounters.add(reportEntry); } return reportCounters; } }
ReportPigCountersResolver { public List<ReportEntry> resolveReportCounters(PigCounters pigCounters, List<ReportPigCounterMapping> reportPigCountersMappings) { List<ReportEntry> reportCounters = Lists.newArrayList(); for (ReportPigCounterMapping counterMapping : reportPigCountersMappings) { String counterValue = extractCounterValue(pigCounters, counterMapping); ReportEntry reportEntry = ReportEntryFactory.createCounterReportEntry(counterMapping.getDestReportCounterName(), Long.valueOf(counterValue)); reportCounters.add(reportEntry); } return reportCounters; }  }
ReportPigCountersResolver { public List<ReportEntry> resolveReportCounters(PigCounters pigCounters, List<ReportPigCounterMapping> reportPigCountersMappings) { List<ReportEntry> reportCounters = Lists.newArrayList(); for (ReportPigCounterMapping counterMapping : reportPigCountersMappings) { String counterValue = extractCounterValue(pigCounters, counterMapping); ReportEntry reportEntry = ReportEntryFactory.createCounterReportEntry(counterMapping.getDestReportCounterName(), Long.valueOf(counterValue)); reportCounters.add(reportEntry); } return reportCounters; }  List<ReportEntry> resolveReportCounters(PigCounters pigCounters, List<ReportPigCounterMapping> reportPigCountersMappings); }
ReportPigCountersResolver { public List<ReportEntry> resolveReportCounters(PigCounters pigCounters, List<ReportPigCounterMapping> reportPigCountersMappings) { List<ReportEntry> reportCounters = Lists.newArrayList(); for (ReportPigCounterMapping counterMapping : reportPigCountersMappings) { String counterValue = extractCounterValue(pigCounters, counterMapping); ReportEntry reportEntry = ReportEntryFactory.createCounterReportEntry(counterMapping.getDestReportCounterName(), Long.valueOf(counterValue)); reportCounters.add(reportEntry); } return reportCounters; }  List<ReportEntry> resolveReportCounters(PigCounters pigCounters, List<ReportPigCounterMapping> reportPigCountersMappings);  }