X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fadsal%2Fnorthbound%2Fstatistics%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fstatistics%2Fnorthbound%2FStatisticsNorthboundTest.java;fp=opendaylight%2Fadsal%2Fnorthbound%2Fstatistics%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fstatistics%2Fnorthbound%2FStatisticsNorthboundTest.java;h=d09ff04574095a9d771ff08c655f993ded13a0b5;hp=0000000000000000000000000000000000000000;hb=42c32160bfd41de57189bb246fec5ffb48ed8e9e;hpb=edf5bfcee83c750853253ccfd991ba7000f5f65b diff --git a/opendaylight/adsal/northbound/statistics/src/test/java/org/opendaylight/controller/statistics/northbound/StatisticsNorthboundTest.java b/opendaylight/adsal/northbound/statistics/src/test/java/org/opendaylight/controller/statistics/northbound/StatisticsNorthboundTest.java new file mode 100644 index 0000000000..d09ff04574 --- /dev/null +++ b/opendaylight/adsal/northbound/statistics/src/test/java/org/opendaylight/controller/statistics/northbound/StatisticsNorthboundTest.java @@ -0,0 +1,99 @@ + +/* + * 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 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; + +public class StatisticsNorthboundTest { + + @Test + public void testFlowStatistics() { + List fon = new ArrayList(); + Node node = NodeCreator.createOFNode(1L); + FlowStatistics fs = new FlowStatistics(node, fon); + Assert.assertTrue(fs.getNode().equals(node)); + Assert.assertTrue(fs.getFlowStats().equals(fon)); + + Node node2 = NodeCreator.createOFNode(2L); + fs.setNode(node2); + Assert.assertTrue(fs.getNode().equals(node2)); + fs.setNode(node2); + Assert.assertTrue(fs.getNode().equals(node2)); + fs.setFlowStats(null); + Assert.assertTrue(fs.getFlowStats() == null); + } + + @Test + public void testAllFlowStatistics() { + List fs = new ArrayList(); + AllFlowStatistics afs = new AllFlowStatistics(fs); + Assert.assertTrue(afs.getFlowStatistics().equals(fs)); + afs.setFlowStatistics(null); + Assert.assertTrue(afs.getFlowStatistics() == null); + } + + @Test + public void testPortStatistics() { + List ncs = new ArrayList(); + Node node = NodeCreator.createOFNode(1L); + PortStatistics ps = new PortStatistics(node, ncs); + + Assert.assertTrue(ps.getNode().equals(node)); + Assert.assertTrue(ps.getPortStats().equals(ncs)); + Node node2 = NodeCreator.createOFNode(2L); + ps.setNode(node2); + Assert.assertTrue(ps.getNode().equals(node2)); + ps.setFlowStats(null); + Assert.assertTrue(ps.getPortStats() == null); + } + + @Test + public void testAllPortStatistics() { + List ps = new ArrayList(); + AllPortStatistics aps = new AllPortStatistics(ps); + Assert.assertTrue(aps.getPortStatistics().equals(ps)); + aps.setPortStatistics(null); + Assert.assertTrue(aps.getPortStatistics() == null); + } + + @Test + public void testTableStatistics() { + List nts = new ArrayList(); + 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 ts = new ArrayList(); + AllTableStatistics ats = new AllTableStatistics(ts); + Assert.assertTrue(ats.getTableStatistics().equals(ts)); + ats.setTableStatistics(null); + Assert.assertTrue(ats.getTableStatistics() == null); + } + +}