Bulk-add copyright headers to java files
[controller.git] / opendaylight / northbound / hosttracker / src / test / java / org / opendaylight / controller / hosttracker / northbound / HostTrackerNorthboundTest.java
1 /*
2  * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.controller.hosttracker.northbound;
9
10 import java.net.InetAddress;
11 import java.net.UnknownHostException;
12 import java.util.HashSet;
13 import java.util.Set;
14
15 import org.junit.Assert;
16 import org.junit.Test;
17 import org.opendaylight.controller.hosttracker.hostAware.HostNodeConnector;
18 import org.opendaylight.controller.sal.core.ConstructionException;
19
20 public class HostTrackerNorthboundTest {
21
22     @Test
23     public void testHosts() throws UnknownHostException, ConstructionException {
24         Hosts h1 = new Hosts();
25         Assert.assertNull(h1.getHostConfig());
26
27         Hosts h2 = new Hosts(null);
28         Assert.assertNull(h2.getHostConfig());
29
30         Set<HostConfig> conn = new HashSet<HostConfig>();
31         InetAddress addr = InetAddress.getByName("10.1.1.1");
32         HostNodeConnector c1 = new HostNodeConnector(addr);
33         conn.add(HostConfig.convert(c1));
34         h1.setHostConfig(conn);
35         Assert.assertTrue(h1.getHostConfig().equals(conn));
36
37         Hosts h3 = new Hosts(conn);
38         Assert.assertTrue(h3.getHostConfig().equals(conn));
39         h3.setHostConfig(null);
40         Assert.assertNull(h3.getHostConfig());
41
42     }
43 }