@Test public void cdhVersionParsing() { String versionStr = "Hadoop 2.6.0-cdh5.16.2\n" + "Subversion http: + "4f94d60caa4cbb9af0709a2fd96dc3861af9cf20\n" + "Compiled by jenkins on 2019-06-03T10:41Z\n" + "Compiled with protoc 2.5.0\n" + "From source with checksum 79b9b24a29c6358b53597c3b49575e37\n" + "This command was run using /usr/lib/hadoop/hadoop-common-2.6.0-cdh5.16.2.jar"; HdfsVersionValidationTask task = new HdfsVersionValidationTask(sConf); String version = task.parseVersion(versionStr); assertEquals("cdh5.16.2", version); }
protected String parseVersion(String output) { Matcher cdhMatcher = CDH_PATTERN.matcher(output); if (cdhMatcher.find()) { String cdhVersion = cdhMatcher.group("cdhVersion"); return "cdh" + cdhVersion; } String version = ""; Matcher matcher = HADOOP_PATTERN.matcher(output); if (matcher.find()) { version = matcher.group("version"); } return version; }
HdfsVersionValidationTask extends AbstractValidationTask { protected String parseVersion(String output) { Matcher cdhMatcher = CDH_PATTERN.matcher(output); if (cdhMatcher.find()) { String cdhVersion = cdhMatcher.group("cdhVersion"); return "cdh" + cdhVersion; } String version = ""; Matcher matcher = HADOOP_PATTERN.matcher(output); if (matcher.find()) { version = matcher.group("version"); } return version; } }
HdfsVersionValidationTask extends AbstractValidationTask { protected String parseVersion(String output) { Matcher cdhMatcher = CDH_PATTERN.matcher(output); if (cdhMatcher.find()) { String cdhVersion = cdhMatcher.group("cdhVersion"); return "cdh" + cdhVersion; } String version = ""; Matcher matcher = HADOOP_PATTERN.matcher(output); if (matcher.find()) { version = matcher.group("version"); } return version; } HdfsVersionValidationTask(AlluxioConfiguration conf); }
HdfsVersionValidationTask extends AbstractValidationTask { protected String parseVersion(String output) { Matcher cdhMatcher = CDH_PATTERN.matcher(output); if (cdhMatcher.find()) { String cdhVersion = cdhMatcher.group("cdhVersion"); return "cdh" + cdhVersion; } String version = ""; Matcher matcher = HADOOP_PATTERN.matcher(output); if (matcher.find()) { version = matcher.group("version"); } return version; } HdfsVersionValidationTask(AlluxioConfiguration conf); @Override String getName(); @Override ValidationTaskResult validateImpl(Map<String, String> optionMap); }
HdfsVersionValidationTask extends AbstractValidationTask { protected String parseVersion(String output) { Matcher cdhMatcher = CDH_PATTERN.matcher(output); if (cdhMatcher.find()) { String cdhVersion = cdhMatcher.group("cdhVersion"); return "cdh" + cdhVersion; } String version = ""; Matcher matcher = HADOOP_PATTERN.matcher(output); if (matcher.find()) { version = matcher.group("version"); } return version; } HdfsVersionValidationTask(AlluxioConfiguration conf); @Override String getName(); @Override ValidationTaskResult validateImpl(Map<String, String> optionMap);  }