Add 'TableStatistics' to SAL and Northbound Statistics API.
[controller.git] / opendaylight / northbound / statistics / src / test / java / org / opendaylight / controller / statistics / northbound / StatisticsNorthboundTest.java
index 3790ae8ea925f9b92a7caefc6d1d9170e92a2520..0764c0b0077d25f9d33e2d173079a16e2bae9078 100644 (file)
@@ -1,17 +1,27 @@
+
+/*
+ * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
 package org.opendaylight.controller.statistics.northbound;
 
 import java.util.ArrayList;
 import java.util.List;
 
+import junit.framework.TestCase;
+
 import org.junit.Assert;
 import org.junit.Test;
 import org.opendaylight.controller.sal.core.Node;
 import org.opendaylight.controller.sal.reader.FlowOnNode;
 import org.opendaylight.controller.sal.reader.NodeConnectorStatistics;
+import org.opendaylight.controller.sal.reader.NodeTableStatistics;
 import org.opendaylight.controller.sal.utils.NodeCreator;
 
-import junit.framework.TestCase;
-
 public class StatisticsNorthboundTest extends TestCase {
 
     @Test
@@ -64,4 +74,28 @@ public class StatisticsNorthboundTest extends TestCase {
         Assert.assertTrue(aps.getPortStatistics() == null);
     }
 
+    @Test
+    public void testTableStatistics() {
+        List<NodeTableStatistics> nts = new ArrayList<NodeTableStatistics>();
+        Node node = NodeCreator.createOFNode(1L);
+        TableStatistics ts = new TableStatistics(node, nts);
+
+        Assert.assertTrue(ts.getNode().equals(node));
+        Assert.assertTrue(ts.getTableStats().equals(nts));
+        Node node2 = NodeCreator.createOFNode(2L);
+        ts.setNode(node2);
+        Assert.assertTrue(ts.getNode().equals(node2));
+        ts.setTableStats(null);
+        Assert.assertTrue(ts.getTableStats() == null);
+    }
+
+    @Test
+    public void testAllTableStatistics() {
+        List<TableStatistics> ts = new ArrayList<TableStatistics>();
+        AllTableStatistics ats = new AllTableStatistics(ts);
+        Assert.assertTrue(ats.getTableStatistics().equals(ts));
+        ats.setTableStatistics(null);
+        Assert.assertTrue(ats.getTableStatistics() == null);
+    }
+
 }