Remove deprecated getLeaderBoard() API from LeadershipService

Change-Id: I009e1ae26faef3950a7a5e997376783895f575f2
diff --git a/cli/src/main/java/org/onosproject/cli/net/LeaderCommand.java b/cli/src/main/java/org/onosproject/cli/net/LeaderCommand.java
index a848519..51601d2 100644
--- a/cli/src/main/java/org/onosproject/cli/net/LeaderCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/LeaderCommand.java
@@ -15,23 +15,22 @@
  */
 package org.onosproject.cli.net;
 
-import java.util.Comparator;
-import java.util.List;
-import java.util.Map;
-import java.util.regex.Pattern;
-
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ArrayNode;
 import org.apache.karaf.shell.commands.Argument;
 import org.apache.karaf.shell.commands.Command;
 import org.apache.karaf.shell.commands.Option;
 import org.onlab.util.Tools;
 import org.onosproject.cli.AbstractShellCommand;
 import org.onosproject.cluster.Leadership;
-import org.onosproject.cluster.LeadershipService;
+import org.onosproject.cluster.LeadershipAdminService;
 import org.onosproject.cluster.NodeId;
 
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.node.ArrayNode;
+import java.util.Comparator;
+import java.util.List;
+import java.util.Map;
+import java.util.regex.Pattern;
 
 /**
  * Prints the leader for every topic.
@@ -136,7 +135,7 @@
 
     @Override
     protected void execute() {
-        LeadershipService leaderService = get(LeadershipService.class);
+        LeadershipAdminService leaderService = get(LeadershipAdminService.class);
         Map<String, Leadership> leaderBoard = leaderService.getLeaderBoard();
         if (topicPattern == null) {
             allTopics = true;
diff --git a/core/api/src/main/java/org/onosproject/cluster/LeadershipAdminService.java b/core/api/src/main/java/org/onosproject/cluster/LeadershipAdminService.java
index 45a8fa4..fe9868a 100644
--- a/core/api/src/main/java/org/onosproject/cluster/LeadershipAdminService.java
+++ b/core/api/src/main/java/org/onosproject/cluster/LeadershipAdminService.java
@@ -15,6 +15,8 @@
  */
 package org.onosproject.cluster;
 
+import java.util.Map;
+
 /**
  * Interface for administratively manipulating leadership assignments.
  */
@@ -45,4 +47,11 @@
      * @param nodeId node identifier
      */
     void unregister(NodeId nodeId);
+
+    /**
+     * Returns the current leader board.
+     *
+     * @return mapping from topic to leadership info.
+     */
+    Map<String, Leadership> getLeaderBoard();
 }
diff --git a/core/api/src/main/java/org/onosproject/cluster/LeadershipService.java b/core/api/src/main/java/org/onosproject/cluster/LeadershipService.java
index d95d1be..27268fb 100644
--- a/core/api/src/main/java/org/onosproject/cluster/LeadershipService.java
+++ b/core/api/src/main/java/org/onosproject/cluster/LeadershipService.java
@@ -15,15 +15,10 @@
  */
 package org.onosproject.cluster;
 
+import com.google.common.collect.ImmutableList;
 import org.onosproject.event.ListenerService;
 
-import com.google.common.base.Objects;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Maps;
-
 import java.util.List;
-import java.util.Map;
 import java.util.Set;
 
 /**
@@ -66,9 +61,7 @@
      * @param nodeId node identifier.
      * @return set of topics for which this node is the current leader.
      */
-    default Set<String> ownedTopics(NodeId nodeId) {
-        return Maps.filterValues(getLeaderBoard(), v -> Objects.equal(nodeId, v.leaderNodeId())).keySet();
-    }
+    Set<String> ownedTopics(NodeId nodeId);
 
     /**
      * Enters a leadership contest.
@@ -86,26 +79,6 @@
     void withdraw(String topic);
 
     /**
-     * Returns the current leader board.
-     *
-     * @return mapping from topic to leadership info.
-     * @deprecated 1.6.0 Goldeneye release. Replace usages with {@link #getLeadership(String)}
-     */
-    @Deprecated
-    Map<String, Leadership> getLeaderBoard();
-
-    /**
-     * Returns the candidate nodes for each topic.
-     *
-     * @return A mapping from topics to corresponding list of candidates.
-     * @deprecated 1.6.0 Goldeneye release. Replace usages with {@link #getLeadership(String)}
-     */
-    @Deprecated
-    default Map<String, List<NodeId>> getCandidates() {
-        return ImmutableMap.copyOf(Maps.transformValues(getLeaderBoard(), v -> ImmutableList.copyOf(v.candidates())));
-    }
-
-    /**
      * Returns the candidate nodes for a given topic.
      *
      * @param topic leadership topic
diff --git a/core/api/src/test/java/org/onosproject/cluster/LeadershipServiceAdapter.java b/core/api/src/test/java/org/onosproject/cluster/LeadershipServiceAdapter.java
index dc671d6..b3b0bf5 100644
--- a/core/api/src/test/java/org/onosproject/cluster/LeadershipServiceAdapter.java
+++ b/core/api/src/test/java/org/onosproject/cluster/LeadershipServiceAdapter.java
@@ -16,7 +16,6 @@
 package org.onosproject.cluster;
 
 import java.util.List;
-import java.util.Map;
 import java.util.Set;
 
 /**
@@ -49,11 +48,6 @@
     }
 
     @Override
-    public Map<String, Leadership> getLeaderBoard() {
-        return null;
-    }
-
-    @Override
     public void addListener(LeadershipEventListener listener) {
 
     }
@@ -64,11 +58,6 @@
     }
 
     @Override
-    public Map<String, List<NodeId>> getCandidates() {
-        return null;
-    }
-
-    @Override
     public List<NodeId> getCandidates(String path) {
         return null;
     }
diff --git a/core/common/src/test/java/org/onosproject/store/trivial/SimpleLeadershipManager.java b/core/common/src/test/java/org/onosproject/store/trivial/SimpleLeadershipManager.java
index a618f16..035ac9c 100644
--- a/core/common/src/test/java/org/onosproject/store/trivial/SimpleLeadershipManager.java
+++ b/core/common/src/test/java/org/onosproject/store/trivial/SimpleLeadershipManager.java
@@ -106,13 +106,6 @@
     }
 
     @Override
-    public Map<String, Leadership> getLeaderBoard() {
-        //FIXME
-        throw new UnsupportedOperationException("I don't know what to do." +
-                                                        " I wish you luck.");
-    }
-
-    @Override
     public void addListener(LeadershipEventListener listener) {
         listeners.add(listener);
     }
@@ -123,11 +116,6 @@
     }
 
     @Override
-    public Map<String, List<NodeId>> getCandidates() {
-        return null;
-    }
-
-    @Override
     public List<NodeId> getCandidates(String path) {
         return null;
     }
diff --git a/core/net/src/main/java/org/onosproject/cluster/impl/LeadershipManager.java b/core/net/src/main/java/org/onosproject/cluster/impl/LeadershipManager.java
index 19e85bf..07d8419 100644
--- a/core/net/src/main/java/org/onosproject/cluster/impl/LeadershipManager.java
+++ b/core/net/src/main/java/org/onosproject/cluster/impl/LeadershipManager.java
@@ -18,7 +18,9 @@
 import static org.slf4j.LoggerFactory.getLogger;
 
 import java.util.Map;
+import java.util.Set;
 
+import com.google.common.base.Objects;
 import org.apache.felix.scr.annotations.Activate;
 import org.apache.felix.scr.annotations.Component;
 import org.apache.felix.scr.annotations.Deactivate;
@@ -84,6 +86,11 @@
     }
 
     @Override
+    public Set<String> ownedTopics(NodeId nodeId) {
+        return Maps.filterValues(store.getLeaderships(), v -> Objects.equal(nodeId, v.leaderNodeId())).keySet();
+    }
+
+    @Override
     public Leadership runForLeadership(String topic) {
         return store.addRegistration(topic);
     }