@Test public void prefixLeaderPrioritizer() { Node a = createNode("http: Node c = createNode("http: Node d = createNode("http: List<Node> cliqueNode = Arrays.asList(a, createNode("http: assertThat(clique.electCliqueLeader(cliqueNode, new ArrayList<String>()).getId(), is(a.getId())); assertThat(clique.electCliqueLeader(cliqueNode, Arrays.asList("http: assertThat(clique.electCliqueLeader(cliqueNode, Arrays.asList("fake", "fake", "fake")).getId(), is(a.getId())); assertThat(clique.electCliqueLeader(cliqueNode, Arrays.asList("http: assertThat(clique.electCliqueLeader(cliqueNode, Arrays.asList("http: }
public Node electCliqueLeader(List<Node> clique, List<String> prefixLeaderPriority) { List<Node> designatedLeaders = designatedLeader(clique); if (designatedLeaders.size() > 1) { logger.severe( "More than one node in a clique designated as leader. Using failover strategy to elect a leader."); for (Node n : designatedLeaders) { logger.severe(n.getProperty(NodeProperties.IRI).toString()); } return filterByPrefix(designatedLeaders, prefixLeaderPriority); } else if (designatedLeaders.size() == 1) { return designatedLeaders.get(0); } else { return filterByPrefix(clique, prefixLeaderPriority); } }
Clique implements Postprocessor { public Node electCliqueLeader(List<Node> clique, List<String> prefixLeaderPriority) { List<Node> designatedLeaders = designatedLeader(clique); if (designatedLeaders.size() > 1) { logger.severe( "More than one node in a clique designated as leader. Using failover strategy to elect a leader."); for (Node n : designatedLeaders) { logger.severe(n.getProperty(NodeProperties.IRI).toString()); } return filterByPrefix(designatedLeaders, prefixLeaderPriority); } else if (designatedLeaders.size() == 1) { return designatedLeaders.get(0); } else { return filterByPrefix(clique, prefixLeaderPriority); } } }
Clique implements Postprocessor { public Node electCliqueLeader(List<Node> clique, List<String> prefixLeaderPriority) { List<Node> designatedLeaders = designatedLeader(clique); if (designatedLeaders.size() > 1) { logger.severe( "More than one node in a clique designated as leader. Using failover strategy to elect a leader."); for (Node n : designatedLeaders) { logger.severe(n.getProperty(NodeProperties.IRI).toString()); } return filterByPrefix(designatedLeaders, prefixLeaderPriority); } else if (designatedLeaders.size() == 1) { return designatedLeaders.get(0); } else { return filterByPrefix(clique, prefixLeaderPriority); } } @Inject  Clique(GraphDatabaseService graphDb, CliqueConfiguration cliqueConfiguration); }
Clique implements Postprocessor { public Node electCliqueLeader(List<Node> clique, List<String> prefixLeaderPriority) { List<Node> designatedLeaders = designatedLeader(clique); if (designatedLeaders.size() > 1) { logger.severe( "More than one node in a clique designated as leader. Using failover strategy to elect a leader."); for (Node n : designatedLeaders) { logger.severe(n.getProperty(NodeProperties.IRI).toString()); } return filterByPrefix(designatedLeaders, prefixLeaderPriority); } else if (designatedLeaders.size() == 1) { return designatedLeaders.get(0); } else { return filterByPrefix(clique, prefixLeaderPriority); } } @Inject  Clique(GraphDatabaseService graphDb, CliqueConfiguration cliqueConfiguration); @Override void run(); Node electCliqueLeader(List<Node> clique, List<String> prefixLeaderPriority); }
Clique implements Postprocessor { public Node electCliqueLeader(List<Node> clique, List<String> prefixLeaderPriority) { List<Node> designatedLeaders = designatedLeader(clique); if (designatedLeaders.size() > 1) { logger.severe( "More than one node in a clique designated as leader. Using failover strategy to elect a leader."); for (Node n : designatedLeaders) { logger.severe(n.getProperty(NodeProperties.IRI).toString()); } return filterByPrefix(designatedLeaders, prefixLeaderPriority); } else if (designatedLeaders.size() == 1) { return designatedLeaders.get(0); } else { return filterByPrefix(clique, prefixLeaderPriority); } } @Inject  Clique(GraphDatabaseService graphDb, CliqueConfiguration cliqueConfiguration); @Override void run(); Node electCliqueLeader(List<Node> clique, List<String> prefixLeaderPriority);  }