@Test public void parse_JOB_LEVEL_PIG_COUNTER() { ReportPigCounterMapping mapping = reportPigCounterMappingParser.parse("destination.report.counter", "{jobAlias.COUNTER_NAME}"); assertEquals("destination.report.counter", mapping.getDestReportCounterName()); assertEquals("jobAlias", mapping.getSourcePigJobAlias()); assertEquals("COUNTER_NAME", mapping.getSourcePigCounterName()); }
public ReportPigCounterMapping parse(String destReportCounter, String sourcePigCounterName) { Preconditions.checkNotNull(destReportCounter); Preconditions.checkNotNull(sourcePigCounterName); Matcher placeholderMatcher = PIG_COUNTER_PLACEHOLDER_PATTERN.matcher(sourcePigCounterName); if (!placeholderMatcher.matches()) { throw new IllegalArgumentException("invalid pig counter placeholder:" + sourcePigCounterName); } String[] placeholderValues = StringUtils.split(placeholderMatcher.group(1), PLACEHOLDER_VALUES_SEPARATOR); if (placeholderValues.length == 1) { return new ReportPigCounterMapping(placeholderValues[0], null, destReportCounter); } if (placeholderValues.length == 2) { String alias = placeholderValues[0]; String counterName = placeholderValues[1]; return new ReportPigCounterMapping(counterName, alias, destReportCounter); } throw new IllegalArgumentException("Invalid placeholder, to many levels (dots): " + placeholderMatcher.group(1)); }
ReportPigCounterMappingParser { public ReportPigCounterMapping parse(String destReportCounter, String sourcePigCounterName) { Preconditions.checkNotNull(destReportCounter); Preconditions.checkNotNull(sourcePigCounterName); Matcher placeholderMatcher = PIG_COUNTER_PLACEHOLDER_PATTERN.matcher(sourcePigCounterName); if (!placeholderMatcher.matches()) { throw new IllegalArgumentException("invalid pig counter placeholder:" + sourcePigCounterName); } String[] placeholderValues = StringUtils.split(placeholderMatcher.group(1), PLACEHOLDER_VALUES_SEPARATOR); if (placeholderValues.length == 1) { return new ReportPigCounterMapping(placeholderValues[0], null, destReportCounter); } if (placeholderValues.length == 2) { String alias = placeholderValues[0]; String counterName = placeholderValues[1]; return new ReportPigCounterMapping(counterName, alias, destReportCounter); } throw new IllegalArgumentException("Invalid placeholder, to many levels (dots): " + placeholderMatcher.group(1)); } }
ReportPigCounterMappingParser { public ReportPigCounterMapping parse(String destReportCounter, String sourcePigCounterName) { Preconditions.checkNotNull(destReportCounter); Preconditions.checkNotNull(sourcePigCounterName); Matcher placeholderMatcher = PIG_COUNTER_PLACEHOLDER_PATTERN.matcher(sourcePigCounterName); if (!placeholderMatcher.matches()) { throw new IllegalArgumentException("invalid pig counter placeholder:" + sourcePigCounterName); } String[] placeholderValues = StringUtils.split(placeholderMatcher.group(1), PLACEHOLDER_VALUES_SEPARATOR); if (placeholderValues.length == 1) { return new ReportPigCounterMapping(placeholderValues[0], null, destReportCounter); } if (placeholderValues.length == 2) { String alias = placeholderValues[0]; String counterName = placeholderValues[1]; return new ReportPigCounterMapping(counterName, alias, destReportCounter); } throw new IllegalArgumentException("Invalid placeholder, to many levels (dots): " + placeholderMatcher.group(1)); }  }
ReportPigCounterMappingParser { public ReportPigCounterMapping parse(String destReportCounter, String sourcePigCounterName) { Preconditions.checkNotNull(destReportCounter); Preconditions.checkNotNull(sourcePigCounterName); Matcher placeholderMatcher = PIG_COUNTER_PLACEHOLDER_PATTERN.matcher(sourcePigCounterName); if (!placeholderMatcher.matches()) { throw new IllegalArgumentException("invalid pig counter placeholder:" + sourcePigCounterName); } String[] placeholderValues = StringUtils.split(placeholderMatcher.group(1), PLACEHOLDER_VALUES_SEPARATOR); if (placeholderValues.length == 1) { return new ReportPigCounterMapping(placeholderValues[0], null, destReportCounter); } if (placeholderValues.length == 2) { String alias = placeholderValues[0]; String counterName = placeholderValues[1]; return new ReportPigCounterMapping(counterName, alias, destReportCounter); } throw new IllegalArgumentException("Invalid placeholder, to many levels (dots): " + placeholderMatcher.group(1)); }  ReportPigCounterMapping parse(String destReportCounter, String sourcePigCounterName); }
ReportPigCounterMappingParser { public ReportPigCounterMapping parse(String destReportCounter, String sourcePigCounterName) { Preconditions.checkNotNull(destReportCounter); Preconditions.checkNotNull(sourcePigCounterName); Matcher placeholderMatcher = PIG_COUNTER_PLACEHOLDER_PATTERN.matcher(sourcePigCounterName); if (!placeholderMatcher.matches()) { throw new IllegalArgumentException("invalid pig counter placeholder:" + sourcePigCounterName); } String[] placeholderValues = StringUtils.split(placeholderMatcher.group(1), PLACEHOLDER_VALUES_SEPARATOR); if (placeholderValues.length == 1) { return new ReportPigCounterMapping(placeholderValues[0], null, destReportCounter); } if (placeholderValues.length == 2) { String alias = placeholderValues[0]; String counterName = placeholderValues[1]; return new ReportPigCounterMapping(counterName, alias, destReportCounter); } throw new IllegalArgumentException("Invalid placeholder, to many levels (dots): " + placeholderMatcher.group(1)); }  ReportPigCounterMapping parse(String destReportCounter, String sourcePigCounterName);  }