Updates for SDN-IP:

 * Use the new Leadership Service instead of Distributed Lock to
   elect the SDN-IP Leader
 * Reimplement the SDN-IP Intent Synchronizer. In the new implementation
   the Point-to-Point Peer intents are also synchronized by and pushed
   only by the Leader (same as the Multipoint-to-SinglePoint Route intents)
 * Minor cleanups

Change-Id: I8e142781211a1d0f2d362875bc28fd05d843cd4b
diff --git a/apps/sdnip/src/test/java/org/onlab/onos/sdnip/PeerConnectivityManagerTest.java b/apps/sdnip/src/test/java/org/onlab/onos/sdnip/PeerConnectivityManagerTest.java
index d21bb2e..b7cdbc0 100644
--- a/apps/sdnip/src/test/java/org/onlab/onos/sdnip/PeerConnectivityManagerTest.java
+++ b/apps/sdnip/src/test/java/org/onlab/onos/sdnip/PeerConnectivityManagerTest.java
@@ -20,6 +20,8 @@
 import org.junit.Before;
 import org.junit.Ignore;
 import org.junit.Test;
+import org.onlab.junit.TestUtils;
+import org.onlab.junit.TestUtils.TestUtilsException;
 import org.onlab.onos.core.ApplicationId;
 import org.onlab.onos.net.ConnectPoint;
 import org.onlab.onos.net.DeviceId;
@@ -70,9 +72,10 @@
     };
 
     private PeerConnectivityManager peerConnectivityManager;
-    private IntentService intentService;
+    private IntentSynchronizer intentSynchronizer;
     private SdnIpConfigService configInfoService;
     private InterfaceService interfaceService;
+    private IntentService intentService;
 
     private Map<String, BgpSpeaker> bgpSpeakers;
     private Map<String, Interface> interfaces;
@@ -525,8 +528,10 @@
 
     /**
      * Initializes peer connectivity testing environment.
+     *
+     * @throws TestUtilsException if exceptions when using TestUtils
      */
-    private void initPeerConnectivity() {
+    private void initPeerConnectivity() throws TestUtilsException {
 
         configInfoService = createMock(SdnIpConfigService.class);
         expect(configInfoService.getBgpPeers()).andReturn(peers).anyTimes();
@@ -536,8 +541,13 @@
         intentService = createMock(IntentService.class);
         replay(intentService);
 
-        peerConnectivityManager = new PeerConnectivityManager(APPID, configInfoService,
-                interfaceService, intentService);
+        intentSynchronizer = new IntentSynchronizer(APPID, intentService);
+        intentSynchronizer.leaderChanged(true);
+        TestUtils.setField(intentSynchronizer, "isActivatedLeader", true);
+
+        peerConnectivityManager =
+            new PeerConnectivityManager(APPID, intentSynchronizer,
+                                        configInfoService, interfaceService);
     }
 
     /*