@Test @SuppressWarnings("unchecked") public void parseFingerprintGCP() throws IOException { Set<String> expected = new HashSet<>(); expected.add("db:01:97:98:81:2a:25:a0:05:62:39:0b:3c:65:49:ac"); expected.add("1b:42:16:09:65:e0:e4:39:31:5d:7d:29:6a:76:2b:87"); String consoleLog = FileReaderUtils.readFileFromClasspath("com/sequenceiq/cloudbreak/service/stack/flow/gcp-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);  }