@Test public void testSelectionFunction() { Broker broker = generateBroker(NUM_REPLICAS); new SortedReplicasHelper().addSelectionFunc(SELECTION_FUNC) .addPriorityFunc(PRIORITY_FUNC) .setScoreFunc(SCORE_FUNC) .trackSortedReplicasFor(SORT_NAME, broker); SortedReplicas sr = broker.trackedSortedReplicas(SORT_NAME); assertEquals(broker.leaderReplicas().size(), sr.sortedReplicas(false).size()); verifySortedReplicas(sr); }
SortedReplicas(Broker broker, Set<Function<Replica, Boolean>> selectionFuncs, List<Function<Replica, Integer>> priorityFuncs, Function<Replica, Double> scoreFunction) { this(broker, null, selectionFuncs, priorityFuncs, scoreFunction, true); }
SortedReplicas { SortedReplicas(Broker broker, Set<Function<Replica, Boolean>> selectionFuncs, List<Function<Replica, Integer>> priorityFuncs, Function<Replica, Double> scoreFunction) { this(broker, null, selectionFuncs, priorityFuncs, scoreFunction, true); } }
SortedReplicas { SortedReplicas(Broker broker, Set<Function<Replica, Boolean>> selectionFuncs, List<Function<Replica, Integer>> priorityFuncs, Function<Replica, Double> scoreFunction) { this(broker, null, selectionFuncs, priorityFuncs, scoreFunction, true); } SortedReplicas(Broker broker,
                 Set<Function<Replica, Boolean>> selectionFuncs,
                 List<Function<Replica, Integer>> priorityFuncs,
                 Function<Replica, Double> scoreFunction);   SortedReplicas(Broker broker,
                 Disk disk,
                 Set<Function<Replica, Boolean>> selectionFuncs,
                 List<Function<Replica, Integer>> priorityFuncs,
                 Function<Replica, Double> scoreFunc,
                 boolean initialize); }
SortedReplicas { SortedReplicas(Broker broker, Set<Function<Replica, Boolean>> selectionFuncs, List<Function<Replica, Integer>> priorityFuncs, Function<Replica, Double> scoreFunction) { this(broker, null, selectionFuncs, priorityFuncs, scoreFunction, true); } SortedReplicas(Broker broker,
                 Set<Function<Replica, Boolean>> selectionFuncs,
                 List<Function<Replica, Integer>> priorityFuncs,
                 Function<Replica, Double> scoreFunction);   SortedReplicas(Broker broker,
                 Disk disk,
                 Set<Function<Replica, Boolean>> selectionFuncs,
                 List<Function<Replica, Integer>> priorityFuncs,
                 Function<Replica, Double> scoreFunc,
                 boolean initialize); SortedSet<Replica> sortedReplicas(boolean clone); Set<Function<Replica, Boolean>> selectionFunctions(); List<Function<Replica, Integer>> priorityFunctions(); Function<Replica, Double> scoreFunction(); void add(Replica replica); }
SortedReplicas { SortedReplicas(Broker broker, Set<Function<Replica, Boolean>> selectionFuncs, List<Function<Replica, Integer>> priorityFuncs, Function<Replica, Double> scoreFunction) { this(broker, null, selectionFuncs, priorityFuncs, scoreFunction, true); } SortedReplicas(Broker broker,
                 Set<Function<Replica, Boolean>> selectionFuncs,
                 List<Function<Replica, Integer>> priorityFuncs,
                 Function<Replica, Double> scoreFunction);   SortedReplicas(Broker broker,
                 Disk disk,
                 Set<Function<Replica, Boolean>> selectionFuncs,
                 List<Function<Replica, Integer>> priorityFuncs,
                 Function<Replica, Double> scoreFunc,
                 boolean initialize); SortedSet<Replica> sortedReplicas(boolean clone); Set<Function<Replica, Boolean>> selectionFunctions(); List<Function<Replica, Integer>> priorityFunctions(); Function<Replica, Double> scoreFunction(); void add(Replica replica);  }