diff options
author | Harald Musum <musum@yahooinc.com> | 2022-08-15 09:37:01 +0200 |
---|---|---|
committer | Harald Musum <musum@yahooinc.com> | 2022-08-15 12:40:31 +0200 |
commit | 4fe51e8e0401543532483eaf6e2f619055388a2e (patch) | |
tree | 57eeea837ee5094988be55ae9e3ff6a9f6ac1069 /clustercontroller-core | |
parent | 7b4a447a035234db7f6e655b138fc8fdf4547724 (diff) |
Remove unused method and class
Diffstat (limited to 'clustercontroller-core')
2 files changed, 1 insertions, 112 deletions
diff --git a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/FleetControllerTest.java b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/FleetControllerTest.java index 01720644fa8..c39a5c52836 100644 --- a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/FleetControllerTest.java +++ b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/FleetControllerTest.java @@ -41,7 +41,6 @@ import java.util.TreeMap; import java.util.TreeSet; import java.util.logging.Level; import java.util.logging.Logger; -import java.util.regex.Pattern; import java.util.stream.Collectors; import java.util.stream.IntStream; @@ -325,116 +324,6 @@ public abstract class FleetControllerTest implements Waiter { fleetController.waitForCompleteCycle(timeout); } - private static class ExpectLine { - final Pattern regex; - int matchedCount = 0; - int minCount = 1; - int maxCount = 1; - boolean repeatable() { return (maxCount == 0 || maxCount > matchedCount); } - boolean optional() { return (matchedCount >= minCount); } - - boolean matches(String event) { - if (event == null) return false; - boolean m = regex.matcher(event).matches(); - if (m) ++matchedCount; - return m; - } - - ExpectLine(String pattern) { - if (pattern.charAt(0) == '?') { - pattern = pattern.substring(1); - minCount = 0; - } else if (pattern.charAt(0) == '*') { - pattern = pattern.substring(1); - minCount = 0; - maxCount = 0; - } else if (pattern.charAt(0) == '+') { - pattern = pattern.substring(1); - maxCount = 0; - } - regex = Pattern.compile(pattern); - } - - public String toString() { - return "{"+minCount+","+maxCount+"}("+matchedCount+") " + regex; - } - } - - /** - * Verifies that node event list is equal to some expected value. - * The format of the expected values is as follows: - * <ul> - * <li>Each line in the exp string specifies a pattern to match one or more events. - * <li>A line starting with ? * or + means that the line can match 0 or 1, 0 or more or 1 or more respectively. - * <li>The rest of the line is a regular expression. - * </ul> - */ - protected void verifyNodeEvents(Node n, String exp) { - List<NodeEvent> events = fleetController.getNodeEvents(n); - String[] expectLines = exp.split("\n"); - List<ExpectLine> expected = new ArrayList<>(); - for (String line : expectLines) { - expected.add(new ExpectLine(line)); - } - - boolean mismatch = false; - StringBuilder errors = new StringBuilder(); - - int gotno = 0; - int expno = 0; - - while (gotno < events.size() || expno < expected.size()) { - String eventLine = null; - if (gotno < events.size()) { - NodeEvent e = events.get(gotno); - eventLine = e.toString(); - } - - ExpectLine pattern = null; - if (expno < expected.size()) { - pattern = expected.get(expno); - } - - if (pattern == null) { - errors.append("Exhausted expected list before matching event " + gotno - + ": '" + eventLine + "'."); - mismatch = true; - break; - } - - if (pattern.matches(eventLine)) { - if (! pattern.repeatable()) { - ++expno; - } - ++gotno; - } else { - if (pattern.optional()) { - ++expno; - } else { - errors.append("Event " + gotno + ": '" + eventLine - + "' did not match regex " + expno + ": " + pattern); - mismatch = true; - break; - } - } - } - if (!mismatch && expno < expected.size()) { - errors.append("Too few entries in event log (only matched " - + expno + " of " + expected.size() + ")"); - mismatch = true; - } - if (mismatch) { - StringBuilder eventsGotten = new StringBuilder(); - for (Event e : events) { - String eventLine = e.toString(); - eventsGotten.append(eventLine).append("\n"); - } - errors.append("\nExpected events matching:\n" + exp + "\n"); - errors.append("but got the following events:\n" + eventsGotten); - fail(errors.toString()); - } - } - public static Set<ConfiguredNode> toNodes(Integer ... indexes) { return Arrays.stream(indexes) .map(i -> new ConfiguredNode(i, false)) diff --git a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/StateChangeTest.java b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/StateChangeTest.java index 6ad0430b5c3..426ac42fe9e 100644 --- a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/StateChangeTest.java +++ b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/StateChangeTest.java @@ -82,7 +82,7 @@ public class StateChangeTest extends FleetControllerTest { super.tearDown(); } - public void verifyNodeEvents(Node n, String correct) { + private void verifyNodeEvents(Node n, String correct) { String actual = ""; for (NodeEvent e : eventLog.getNodeEvents(n)) { actual += e.toString() + "\n"; |