1 package org.opendaylight.controller.hosttracker.northbound;
3 import java.net.InetAddress;
4 import java.net.UnknownHostException;
5 import java.util.HashSet;
8 import org.junit.Assert;
10 import org.opendaylight.controller.hosttracker.hostAware.HostNodeConnector;
11 import org.opendaylight.controller.sal.core.ConstructionException;
13 public class HostTrackerNorthboundTest {
16 public void testHosts() throws UnknownHostException, ConstructionException {
17 Hosts h1 = new Hosts();
18 Assert.assertNull(h1.getHostConfig());
20 Hosts h2 = new Hosts(null);
21 Assert.assertNull(h2.getHostConfig());
23 Set<HostConfig> conn = new HashSet<HostConfig>();
24 InetAddress addr = InetAddress.getByName("10.1.1.1");
25 HostNodeConnector c1 = new HostNodeConnector(addr);
26 conn.add(HostConfig.convert(c1));
27 h1.setHostConfig(conn);
28 Assert.assertTrue(h1.getHostConfig().equals(conn));
30 Hosts h3 = new Hosts(conn);
31 Assert.assertTrue(h3.getHostConfig().equals(conn));
32 h3.setHostConfig(null);
33 Assert.assertNull(h3.getHostConfig());