Revert "Checkstyle enforcer"
[controller.git] / opendaylight / 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.reader.NodeConnectorStatistics;
15 import org.opendaylight.controller.sal.utils.NodeConnectorCreator;
16 import org.opendaylight.controller.sal.utils.NodeCreator;
17 import org.junit.Assert;
18
19 public class NodeConnectorStatisticsTest {
20
21         @Test
22         public void testNodeConnectorStatisticsMethods() {
23                 NodeConnector nc = NodeConnectorCreator.createNodeConnector((short)20, NodeCreator.createOFNode((long)20));
24                 NodeConnectorStatistics ncStats = new NodeConnectorStatistics();
25                 ncStats.setNodeConnector(nc);
26                 ncStats.setReceiveByteCount(800);
27                 ncStats.setReceiveCRCErrorCount(10);
28                 ncStats.setReceiveDropCount(5);
29                 ncStats.setReceiveErrorCount(20);
30                 ncStats.setReceiveFrameErrorCount(25);
31                 ncStats.setReceiveOverRunErrorCount(30);
32                 ncStats.setReceivePacketCount(100);
33                 ncStats.setTransmitByteCount(400);
34                 ncStats.setTransmitDropCount(15);
35                 ncStats.setTransmitErrorCount(18);
36                 ncStats.setTransmitPacketCount(50);
37                 ncStats.setCollisionCount(2);
38                 
39                 Assert.assertTrue(ncStats.getCollisionCount() == 2);
40                 Assert.assertTrue(ncStats.getTransmitPacketCount() == 50);
41                 Assert.assertTrue(ncStats.getTransmitErrorCount() == 18);
42                 Assert.assertTrue(ncStats.getTransmitDropCount() == 15);
43                 Assert.assertTrue(ncStats.getReceivePacketCount() == 100);
44                 Assert.assertTrue(ncStats.getReceiveOverRunErrorCount() == 30);
45                 Assert.assertTrue(ncStats.getReceiveFrameErrorCount() == 25);
46                 Assert.assertTrue(ncStats.getReceiveDropCount() == 5);
47                 Assert.assertTrue(ncStats.getReceiveCRCErrorCount() == 10);
48                 Assert.assertTrue(ncStats.getReceiveByteCount() == 800);
49                 Assert.assertTrue(ncStats.getNodeConnector().equals(nc));
50         }
51 }
52