Removed deprecated classes/interfaces

IntentBatchLeaderEvent
IntentBatchListener
IntentBatchService

Change-Id: I712f0eb0b26d9bfaa820a14022c1dd30943fab27
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/ObjectiveTracker.java b/core/net/src/main/java/org/onosproject/net/intent/impl/ObjectiveTracker.java
index 0a36d1c..aabcc28 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/ObjectiveTracker.java
+++ b/core/net/src/main/java/org/onosproject/net/intent/impl/ObjectiveTracker.java
@@ -29,9 +29,6 @@
 import org.onosproject.net.Link;
 import org.onosproject.net.LinkKey;
 import org.onosproject.net.NetworkResource;
-import org.onosproject.net.intent.IntentBatchLeaderEvent;
-import org.onosproject.net.intent.IntentBatchListener;
-import org.onosproject.net.intent.IntentBatchService;
 import org.onosproject.net.intent.IntentId;
 import org.onosproject.net.intent.IntentService;
 import org.onosproject.net.link.LinkEvent;
@@ -80,23 +77,18 @@
     @Reference(cardinality = ReferenceCardinality.OPTIONAL_UNARY)
     protected IntentService intentService;
 
-    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
-    protected IntentBatchService batchService;
-
     private ExecutorService executorService =
             newSingleThreadExecutor(namedThreads("onos-flowtracker"));
 
     private TopologyListener listener = new InternalTopologyListener();
     private LinkResourceListener linkResourceListener =
             new InternalLinkResourceListener();
-    private final LeadershipListener leaderListener = new LeadershipListener();
     private TopologyChangeDelegate delegate;
 
     @Activate
     public void activate() {
         topologyService.addListener(listener);
         resourceManager.addListener(linkResourceListener);
-        batchService.addListener(leaderListener);
         log.info("Started");
     }
 
@@ -104,7 +96,6 @@
     public void deactivate() {
         topologyService.removeListener(listener);
         resourceManager.removeListener(linkResourceListener);
-        batchService.removeListener(leaderListener);
         log.info("Stopped");
     }
 
@@ -265,22 +256,4 @@
             }
         });
     }
-
-    private class LeadershipListener implements IntentBatchListener {
-        @Override
-        public void event(IntentBatchLeaderEvent event) {
-            log.debug("leadership event: {}", event);
-            ApplicationId appId = event.subject();
-            switch (event.type()) {
-                case ELECTED:
-                    updateTrackedResources(appId, true);
-                    break;
-                case BOOTED:
-                    updateTrackedResources(appId, false);
-                    break;
-                default:
-                    break;
-            }
-        }
-    }
 }
diff --git a/core/net/src/test/java/org/onosproject/net/intent/impl/ObjectiveTrackerTest.java b/core/net/src/test/java/org/onosproject/net/intent/impl/ObjectiveTrackerTest.java
index cf89098..02d206a 100644
--- a/core/net/src/test/java/org/onosproject/net/intent/impl/ObjectiveTrackerTest.java
+++ b/core/net/src/test/java/org/onosproject/net/intent/impl/ObjectiveTrackerTest.java
@@ -26,17 +26,13 @@
 import org.junit.Before;
 import org.junit.Test;
 import org.onlab.junit.TestUtils;
+import org.onlab.junit.TestUtils.TestUtilsException;
 import org.onosproject.core.IdGenerator;
 import org.onosproject.event.Event;
 import org.onosproject.net.Link;
-import org.onosproject.net.LinkKey;
-import org.onosproject.net.NetTestTools;
 import org.onosproject.net.NetworkResource;
 import org.onosproject.net.intent.Intent;
-import org.onosproject.net.intent.IntentBatchLeaderEvent;
-import org.onosproject.net.intent.IntentBatchListener;
 import org.onosproject.net.intent.IntentId;
-import org.onosproject.net.intent.IntentService;
 import org.onosproject.net.intent.MockIdGenerator;
 import org.onosproject.net.link.LinkEvent;
 import org.onosproject.net.resource.LinkResourceEvent;
@@ -45,20 +41,15 @@
 import org.onosproject.net.topology.TopologyEvent;
 import org.onosproject.net.topology.TopologyListener;
 
-import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableSet;
 import com.google.common.collect.Lists;
-import com.google.common.collect.SetMultimap;
 
 import static org.easymock.EasyMock.createMock;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.replay;
 import static org.hamcrest.MatcherAssert.assertThat;
 import static org.hamcrest.Matchers.equalTo;
 import static org.hamcrest.Matchers.hasSize;
 import static org.hamcrest.Matchers.is;
 import static org.onosproject.net.NetTestTools.link;
-import org.onlab.junit.TestUtils.TestUtilsException;
 
 /**
  * Tests for the objective tracker.
@@ -71,7 +62,6 @@
     private List<Event> reasons;
     private TopologyListener listener;
     private LinkResourceListener linkResourceListener;
-    private IntentBatchListener leaderListener;
     private IdGenerator mockGenerator;
 
     /**
@@ -88,7 +78,6 @@
         reasons = new LinkedList<>();
         listener = TestUtils.getField(tracker, "listener");
         linkResourceListener = TestUtils.getField(tracker, "linkResourceListener");
-        leaderListener = TestUtils.getField(tracker, "leaderListener");
         mockGenerator = new MockIdGenerator();
         Intent.bindIdGenerator(mockGenerator);
     }
@@ -123,32 +112,6 @@
     }
 
     /**
-     * Mock compilable intent class.
-     */
-    private static class MockIntent extends Intent {
-
-        public MockIntent(Collection<NetworkResource> resources) {
-            super(NetTestTools.APP_ID, resources);
-        }
-
-    }
-
-    /**
-     * Mock installable intent class.
-     */
-    private static class MockInstallableIntent extends Intent {
-        public MockInstallableIntent(Collection<NetworkResource> resources) {
-            super(NetTestTools.APP_ID, resources);
-        }
-
-        @Override
-        public boolean isInstallable() {
-            return true;
-        }
-
-    }
-
-    /**
      * Tests an event with no associated reasons.
      *
      * @throws InterruptedException if the latch wait fails.
@@ -271,52 +234,4 @@
         assertThat(delegate.compileAllFailedFromEvent, is(true));
     }
 
-    /**
-     * Tests leadership events.
-     *
-     * @throws InterruptedException if the latch wait fails.
-     */
-    @Test
-    public void testLeaderEvents() throws Exception {
-
-        final Link link = link("src", 1, "dst", 2);
-        final List<NetworkResource> resources = ImmutableList.of(link);
-
-        final List<Intent> intents = new LinkedList<>();
-        final List<Intent> installableIntents = new LinkedList<>();
-        installableIntents.add(new MockInstallableIntent(resources));
-        intents.add(new MockIntent(resources));
-
-        final SetMultimap<LinkKey, IntentId> intentsByLink =
-                TestUtils.getField(tracker, "intentsByLink");
-        assertThat(intentsByLink.size(), is(0));
-
-        final IntentService mockIntentManager = createMock(IntentService.class);
-        expect(mockIntentManager
-                .getIntents())
-                .andReturn(intents)
-                .anyTimes();
-        expect(mockIntentManager
-                .getIntent(IntentId.valueOf(0x0)))
-                .andReturn(intents.get(0))
-                .anyTimes();
-        expect(mockIntentManager
-                .getInstallableIntents(IntentId.valueOf(0x1)))
-                .andReturn(installableIntents)
-                .anyTimes();
-        replay(mockIntentManager);
-        tracker.bindIntentService(mockIntentManager);
-
-        final IntentBatchLeaderEvent electedEvent = new IntentBatchLeaderEvent(
-                IntentBatchLeaderEvent.Type.ELECTED, NetTestTools.APP_ID);
-        leaderListener.event(electedEvent);
-        assertThat(intentsByLink.size(), is(1));
-
-        final IntentBatchLeaderEvent bootedEvent = new IntentBatchLeaderEvent(
-                IntentBatchLeaderEvent.Type.BOOTED, NetTestTools.APP_ID);
-        leaderListener.event(bootedEvent);
-        assertThat(intentsByLink.size(), is(0));
-
-        tracker.unbindIntentService(mockIntentManager);
-    }
 }