+++ /dev/null
-/*\r
- * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.controller.hosttracker.internal;\r
-\r
-import java.net.InetAddress;\r
-import java.net.UnknownHostException;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.controller.hosttracker.IHostId;\r
-import org.opendaylight.controller.hosttracker.IPHostId;\r
-\r
-public class HostTrackerTest {\r
-\r
- @Test\r
- public void testHostTrackerCallable() throws UnknownHostException {\r
-\r
- HostTracker hostTracker = null;\r
- hostTracker = new HostTracker();\r
-\r
- InetAddress hostIP = InetAddress.getByName("192.168.0.8");\r
- IHostId id = IPHostId.fromIP(hostIP);\r
-\r
- HostTrackerCallable htCallable = new HostTrackerCallable(hostTracker,\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 - 1));\r
- }\r
-\r
- @Test\r
- public void testHostTracker() throws UnknownHostException {\r
- HostTracker hostTracker = null;\r
- hostTracker = new HostTracker();\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
- IHostId id2 = IPHostId.fromIP(hostIP_2);\r
- hostTracker.discoverHost(id1);\r
- hostTracker.discoverHost(id2);\r
- hostTracker.nonClusterObjectCreate();\r
- }\r
-\r
-}\r