JUnit tests for flowprogrammer.northbound, 87/87/1
authorKalvin Hom <kahom@cisco.com>
Thu, 28 Mar 2013 20:59:05 +0000 (13:59 -0700)
committerKalvin Hom <kahom@cisco.com>
Thu, 28 Mar 2013 20:59:05 +0000 (13:59 -0700)
hosttracker.northbound, and subnets.northbound

Change-Id: I10644b8c08448492ff30e1d9f2773b95bd9916cc
Signed-off-by: Kalvin Hom <kahom@cisco.com>
opendaylight/northbound/flowprogrammer/src/test/java/org/opendaylight/controller/flowprogrammer/northbound/FlowProgrammerNorthboundTest.java [new file with mode: 0644]
opendaylight/northbound/hosttracker/src/test/java/org/opendaylight/controller/hosttracker/northbound/HostTrackerNorthboundTest.java [new file with mode: 0644]
opendaylight/northbound/subnets/src/test/java/org/opendaylight/controller/subnets/northbound/SubnetsNorthboundTest.java [new file with mode: 0644]

diff --git a/opendaylight/northbound/flowprogrammer/src/test/java/org/opendaylight/controller/flowprogrammer/northbound/FlowProgrammerNorthboundTest.java b/opendaylight/northbound/flowprogrammer/src/test/java/org/opendaylight/controller/flowprogrammer/northbound/FlowProgrammerNorthboundTest.java
new file mode 100644 (file)
index 0000000..493168c
--- /dev/null
@@ -0,0 +1,33 @@
+package org.opendaylight.controller.flowprogrammer.northbound;
+
+import java.util.ArrayList;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.controller.forwardingrulesmanager.FlowConfig;
+
+public class FlowProgrammerNorthboundTest {
+
+    @Test
+    public void testFlowConfigs() {
+        FlowConfigs fc = new FlowConfigs(null);
+        Assert.assertNull(fc.getFlowConfig());
+
+        FlowConfig conf = new FlowConfig();
+        FlowConfig conf2 = new FlowConfig();
+        ArrayList<FlowConfig> list = new ArrayList<FlowConfig>();
+
+        list.add(conf);
+        list.add(conf2);
+        FlowConfigs fc2 = new FlowConfigs(list);
+        Assert.assertTrue(fc2.getFlowConfig().equals(list));
+
+        fc.setFlowConfig(list);
+        Assert.assertTrue(fc.getFlowConfig().equals(fc2.getFlowConfig()));
+
+        fc.setFlowConfig(null);
+        Assert.assertNull(fc.getFlowConfig());
+
+    }
+
+}
diff --git a/opendaylight/northbound/hosttracker/src/test/java/org/opendaylight/controller/hosttracker/northbound/HostTrackerNorthboundTest.java b/opendaylight/northbound/hosttracker/src/test/java/org/opendaylight/controller/hosttracker/northbound/HostTrackerNorthboundTest.java
new file mode 100644 (file)
index 0000000..cd5e5a9
--- /dev/null
@@ -0,0 +1,36 @@
+package org.opendaylight.controller.hosttracker.northbound;
+
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.controller.hosttracker.hostAware.HostNodeConnector;
+import org.opendaylight.controller.sal.core.ConstructionException;
+
+public class HostTrackerNorthboundTest {
+
+    @Test
+    public void testHosts() throws UnknownHostException, ConstructionException {
+        Hosts h1 = new Hosts();
+        Assert.assertNull(h1.getHostNodeConnector());
+
+        Hosts h2 = new Hosts(null);
+        Assert.assertNull(h2.getHostNodeConnector());
+
+        Set<HostNodeConnector> conn = new HashSet<HostNodeConnector>();
+        InetAddress addr = InetAddress.getByName("10.1.1.1");
+        HostNodeConnector c1 = new HostNodeConnector(addr);
+        conn.add(c1);
+        h1.setHostNodeConnector(conn);
+        Assert.assertTrue(h1.getHostNodeConnector().equals(conn));
+
+        Hosts h3 = new Hosts(conn);
+        Assert.assertTrue(h3.getHostNodeConnector().equals(conn));
+        h3.setHostNodeConnector(null);
+        Assert.assertNull(h3.getHostNodeConnector());
+
+    }
+}
diff --git a/opendaylight/northbound/subnets/src/test/java/org/opendaylight/controller/subnets/northbound/SubnetsNorthboundTest.java b/opendaylight/northbound/subnets/src/test/java/org/opendaylight/controller/subnets/northbound/SubnetsNorthboundTest.java
new file mode 100644 (file)
index 0000000..66b71e7
--- /dev/null
@@ -0,0 +1,26 @@
+package org.opendaylight.controller.subnets.northbound;
+
+import java.util.ArrayList;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.controller.switchmanager.SubnetConfig;
+
+public class SubnetsNorthboundTest {
+
+    @Test
+    public void testSubnetConfigs() {
+        SubnetConfigs sc1 = new SubnetConfigs(null);
+        Assert.assertNull(sc1.getSubnetConfig());
+
+        ArrayList<SubnetConfig> list = new ArrayList<SubnetConfig>();
+        SubnetConfig s1 = new SubnetConfig();
+        list.add(s1);
+        sc1.setSubnetConfig(list);
+        Assert.assertTrue(sc1.getSubnetConfig().equals(list));
+
+        sc1.setSubnetConfig(null);
+        Assert.assertNull(sc1.getSubnetConfig());
+    }
+
+}