Ported ZookeeperRegistry to new Curator version using their notifications

Change-Id: Ie2319d0f11a1ebd2c34ceb7c9e0fb9c5aa085708

Implemented asynchronous leadership change notification.
This is needed to prevent deadlock in original switch registry code
(this used to be provided by my Curator modifications, but the official
Curator leader latch implementation gives notifications on the calling thread).

Change-Id: Ic3db816c98e4fc2b7a85d0007740b28afc4566a6

Remove local (modified) curator libraries and clean up the pom.xml
Amended to fix tests that broke due to an API change.

Change-Id: I09de15de2dd448b06712e93724c1b75160768db3
diff --git a/src/test/java/net/onrc/onos/registry/controller/ZookeeperRegistryTest.java b/src/test/java/net/onrc/onos/registry/controller/ZookeeperRegistryTest.java
index 3314ad2..774a9d4 100644
--- a/src/test/java/net/onrc/onos/registry/controller/ZookeeperRegistryTest.java
+++ b/src/test/java/net/onrc/onos/registry/controller/ZookeeperRegistryTest.java
@@ -10,6 +10,23 @@
 import net.onrc.onos.registry.controller.StandaloneRegistryTest.LoggingCallback;
 import net.onrc.onos.registry.controller.ZookeeperRegistry.SwitchLeaderListener;
 
+import org.apache.curator.RetryPolicy;
+import org.apache.curator.framework.CuratorFramework;
+import org.apache.curator.framework.CuratorFrameworkFactory;
+import org.apache.curator.framework.listen.ListenerContainer;
+import org.apache.curator.framework.recipes.atomic.AtomicValue;
+import org.apache.curator.framework.recipes.atomic.DistributedAtomicLong;
+import org.apache.curator.framework.recipes.cache.ChildData;
+import org.apache.curator.framework.recipes.cache.PathChildrenCache;
+import org.apache.curator.framework.recipes.cache.PathChildrenCache.StartMode;
+import org.apache.curator.framework.recipes.cache.PathChildrenCacheEvent;
+import org.apache.curator.framework.recipes.cache.PathChildrenCacheListener;
+import org.apache.curator.framework.recipes.leader.LeaderLatch;
+import org.apache.curator.x.discovery.ServiceCache;
+import org.apache.curator.x.discovery.ServiceCacheBuilder;
+import org.apache.curator.x.discovery.ServiceDiscovery;
+import org.apache.curator.x.discovery.ServiceDiscoveryBuilder;
+import org.apache.curator.x.discovery.ServiceInstance;
 import org.easymock.EasyMock;
 import org.easymock.IAnswer;
 import org.junit.After;
@@ -22,24 +39,6 @@
 import org.powermock.core.classloader.annotations.PrepareForTest;
 import org.powermock.modules.junit4.PowerMockRunner;
 
-import com.netflix.curator.RetryPolicy;
-import com.netflix.curator.framework.CuratorFramework;
-import com.netflix.curator.framework.CuratorFrameworkFactory;
-import com.netflix.curator.framework.listen.ListenerContainer;
-import com.netflix.curator.framework.recipes.atomic.AtomicValue;
-import com.netflix.curator.framework.recipes.atomic.DistributedAtomicLong;
-import com.netflix.curator.framework.recipes.cache.ChildData;
-import com.netflix.curator.framework.recipes.cache.PathChildrenCache;
-import com.netflix.curator.framework.recipes.cache.PathChildrenCacheEvent;
-import com.netflix.curator.framework.recipes.cache.PathChildrenCacheListener;
-import com.netflix.curator.framework.recipes.cache.PathChildrenCache.StartMode;
-import com.netflix.curator.framework.recipes.leader.LeaderLatch;
-import com.netflix.curator.x.discovery.ServiceCache;
-import com.netflix.curator.x.discovery.ServiceCacheBuilder;
-import com.netflix.curator.x.discovery.ServiceDiscovery;
-import com.netflix.curator.x.discovery.ServiceDiscoveryBuilder;
-import com.netflix.curator.x.discovery.ServiceInstance;
-
 /**
  * Unit test for {@link ZookeeperRegistry}.
  * NOTE: {@link FloodlightTestCase} conflicts with PowerMock. If FloodLight-related methods need to be tested,
@@ -205,7 +204,7 @@
 		EasyMock.expectLastCall().once();
 		latch.start();
 		EasyMock.expectLastCall().once();
-		latch.removeAllListeners();
+		latch.removeListener(EasyMock.anyObject(SwitchLeaderListener.class));
 		EasyMock.expectLastCall().once();
 		latch.close();
 		EasyMock.expectLastCall().once();
@@ -241,7 +240,7 @@
 		latch.start();
 		EasyMock.expectLastCall().once();
 		EasyMock.expect(latch.hasLeadership()).andReturn(true).anyTimes();
-		latch.removeAllListeners();
+		latch.removeListener(EasyMock.anyObject(SwitchLeaderListener.class));
 		EasyMock.expectLastCall().once();
 		latch.close();
 		EasyMock.expectLastCall().once();