Merge "BUG-2329 Add test for anyxmls inside rpc resonse for netcfon-connector"
[controller.git] / opendaylight / adsal / sal / api / src / test / java / org / opendaylight / controller / sal / reader / NodeConnectorStatisticsTest.java
1
2 /*
3  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
4  *
5  * This program and the accompanying materials are made available under the
6  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
7  * and is available at http://www.eclipse.org/legal/epl-v10.html
8  */
9
10 package org.opendaylight.controller.sal.reader;
11
12 import org.junit.Test;
13 import org.opendaylight.controller.sal.core.NodeConnector;
14 import org.opendaylight.controller.sal.utils.NodeConnectorCreator;
15 import org.opendaylight.controller.sal.utils.NodeCreator;
16 import org.junit.Assert;
17
18 public class NodeConnectorStatisticsTest {
19
20         @Test
21         public void testNodeConnectorStatisticsMethods() {
22                 NodeConnector nc = NodeConnectorCreator.createNodeConnector((short)20, NodeCreator.createOFNode((long)20));
23                 NodeConnectorStatistics ncStats = new NodeConnectorStatistics();
24                 ncStats.setNodeConnector(nc);
25                 ncStats.setReceiveByteCount(800);
26                 ncStats.setReceiveCRCErrorCount(10);
27                 ncStats.setReceiveDropCount(5);
28                 ncStats.setReceiveErrorCount(20);
29                 ncStats.setReceiveFrameErrorCount(25);
30                 ncStats.setReceiveOverRunErrorCount(30);
31                 ncStats.setReceivePacketCount(100);
32                 ncStats.setTransmitByteCount(400);
33                 ncStats.setTransmitDropCount(15);
34                 ncStats.setTransmitErrorCount(18);
35                 ncStats.setTransmitPacketCount(50);
36                 ncStats.setCollisionCount(2);
37
38                 Assert.assertTrue(ncStats.getCollisionCount() == 2);
39                 Assert.assertTrue(ncStats.getTransmitPacketCount() == 50);
40                 Assert.assertTrue(ncStats.getTransmitErrorCount() == 18);
41                 Assert.assertTrue(ncStats.getTransmitDropCount() == 15);
42                 Assert.assertTrue(ncStats.getReceivePacketCount() == 100);
43                 Assert.assertTrue(ncStats.getReceiveOverRunErrorCount() == 30);
44                 Assert.assertTrue(ncStats.getReceiveFrameErrorCount() == 25);
45                 Assert.assertTrue(ncStats.getReceiveDropCount() == 5);
46                 Assert.assertTrue(ncStats.getReceiveCRCErrorCount() == 10);
47                 Assert.assertTrue(ncStats.getReceiveByteCount() == 800);
48                 Assert.assertTrue(ncStats.getNodeConnector().equals(nc));
49         }
50 }