@Test @SuppressWarnings("unchecked") public void parseFingerprintOpenstack() throws IOException { Set<String> expected = new HashSet<>(); expected.add("0d:0f:d8:85:33:f5:e0:73:25:8f:d4:b3:52:ed:89:94"); expected.add("19:ff:09:ba:e1:72:7c:39:6f:82:0d:f5:21:01:4a:b4"); String consoleLog = FileReaderUtils.readFileFromClasspath("com/sequenceiq/cloudbreak/service/stack/flow/openstack-console.txt"); Set<String> fingerprints = FingerprintParserUtil.parseFingerprints(consoleLog); assertEquals(expected, fingerprints); }
public static Set<String> parseFingerprints(String consoleLog) { LOGGER.debug("Received console log: {}", consoleLog); Set<String> matchedFingerprints = new HashSet<>(); String[] lines = consoleLog.split("\n"); for (String line : lines) { for (Pattern pattern : FINGERPRINT_PATTERNS) { Matcher m = pattern.matcher(line); if (m.find()) { matchedFingerprints.add(m.group("fingerprint")); } } } return matchedFingerprints; }
FingerprintParserUtil { public static Set<String> parseFingerprints(String consoleLog) { LOGGER.debug("Received console log: {}", consoleLog); Set<String> matchedFingerprints = new HashSet<>(); String[] lines = consoleLog.split("\n"); for (String line : lines) { for (Pattern pattern : FINGERPRINT_PATTERNS) { Matcher m = pattern.matcher(line); if (m.find()) { matchedFingerprints.add(m.group("fingerprint")); } } } return matchedFingerprints; } }
FingerprintParserUtil { public static Set<String> parseFingerprints(String consoleLog) { LOGGER.debug("Received console log: {}", consoleLog); Set<String> matchedFingerprints = new HashSet<>(); String[] lines = consoleLog.split("\n"); for (String line : lines) { for (Pattern pattern : FINGERPRINT_PATTERNS) { Matcher m = pattern.matcher(line); if (m.find()) { matchedFingerprints.add(m.group("fingerprint")); } } } return matchedFingerprints; } private  FingerprintParserUtil(); }
FingerprintParserUtil { public static Set<String> parseFingerprints(String consoleLog) { LOGGER.debug("Received console log: {}", consoleLog); Set<String> matchedFingerprints = new HashSet<>(); String[] lines = consoleLog.split("\n"); for (String line : lines) { for (Pattern pattern : FINGERPRINT_PATTERNS) { Matcher m = pattern.matcher(line); if (m.find()) { matchedFingerprints.add(m.group("fingerprint")); } } } return matchedFingerprints; } private  FingerprintParserUtil(); static Set<String> parseFingerprints(String consoleLog); }
FingerprintParserUtil { public static Set<String> parseFingerprints(String consoleLog) { LOGGER.debug("Received console log: {}", consoleLog); Set<String> matchedFingerprints = new HashSet<>(); String[] lines = consoleLog.split("\n"); for (String line : lines) { for (Pattern pattern : FINGERPRINT_PATTERNS) { Matcher m = pattern.matcher(line); if (m.find()) { matchedFingerprints.add(m.group("fingerprint")); } } } return matchedFingerprints; } private  FingerprintParserUtil(); static Set<String> parseFingerprints(String consoleLog);  }