Merge changes I50218f21,I6bc2631b
[controller.git] / opendaylight / hosttracker / implementation / src / test / java / org / opendaylight / controller / hosttracker / internal / HostTrackerTest.java
index 25de544f52e8d0dd79da9afff83e2eda1e28a145..d7c60e67a91dfa85213343e41e3f495bacf83e55 100644 (file)
@@ -10,13 +10,13 @@ package org.opendaylight.controller.hosttracker.internal;
 \r
 import java.net.InetAddress;\r
 import java.net.UnknownHostException;\r
-import java.util.concurrent.Future;\r
 \r
 import junit.framework.TestCase;\r
 \r
 import org.junit.Assert;\r
 import org.junit.Test;\r
-import org.opendaylight.controller.hosttracker.hostAware.HostNodeConnector;\r
+import org.opendaylight.controller.hosttracker.IHostId;\r
+import org.opendaylight.controller.hosttracker.IPHostId;\r
 \r
 public class HostTrackerTest extends TestCase {\r
 \r
@@ -28,15 +28,16 @@ public class HostTrackerTest extends TestCase {
         Assert.assertFalse(hostTracker == null);\r
 \r
         InetAddress hostIP = InetAddress.getByName("192.168.0.8");\r
+        IHostId id  = IPHostId.fromIP(hostIP);\r
 \r
         HostTrackerCallable htCallable = new HostTrackerCallable(hostTracker,\r
-                hostIP);\r
-        Assert.assertTrue(htCallable.trackedHost.equals(hostIP));\r
+                id);\r
+        Assert.assertTrue(htCallable.trackedHost.equals(id));\r
         Assert.assertTrue(htCallable.hostTracker.equals(hostTracker));\r
 \r
         long count = htCallable.latch.getCount();\r
         htCallable.wakeup();\r
-        Assert.assertTrue(htCallable.latch.getCount() == --count);\r
+        Assert.assertTrue(htCallable.latch.getCount() == (count - 1));\r
     }\r
 \r
     @Test\r
@@ -46,9 +47,11 @@ public class HostTrackerTest extends TestCase {
         Assert.assertFalse(hostTracker == null);\r
 \r
         InetAddress hostIP_1 = InetAddress.getByName("192.168.0.8");\r
+        IHostId id1 = IPHostId.fromIP(hostIP_1);\r
         InetAddress hostIP_2 = InetAddress.getByName("192.168.0.18");\r
-        Future<HostNodeConnector> dschost = hostTracker.discoverHost(hostIP_1);\r
-        dschost = hostTracker.discoverHost(hostIP_2);\r
+        IHostId id2 = IPHostId.fromIP(hostIP_2);\r
+        hostTracker.discoverHost(id1);\r
+        hostTracker.discoverHost(id2);\r
         hostTracker.nonClusterObjectCreate();\r
     }\r
 \r