Revert "Checkstyle enforcer"
[controller.git] / opendaylight / sal / api / src / test / java / org / opendaylight / controller / sal / reader / FlowOnNodeTest.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 java.util.ArrayList;
13 import org.junit.Assert;
14 import org.junit.Test;
15 import org.opendaylight.controller.sal.action.Action;
16 import org.opendaylight.controller.sal.action.Output;
17 import org.opendaylight.controller.sal.core.NodeConnector;
18 import org.opendaylight.controller.sal.flowprogrammer.Flow;
19 import org.opendaylight.controller.sal.match.Match;
20 import org.opendaylight.controller.sal.match.MatchType;
21 import org.opendaylight.controller.sal.reader.FlowOnNode;
22 import org.opendaylight.controller.sal.utils.EtherTypes;
23 import org.opendaylight.controller.sal.utils.NodeConnectorCreator;
24 import org.opendaylight.controller.sal.utils.NodeCreator;
25         
26 public class FlowOnNodeTest {
27
28                 @Test
29                 public void testFlowOnNodeMethods () {
30                 Match match = new Match();
31                 NodeConnector inNC = NodeConnectorCreator.createNodeConnector((short)10, NodeCreator.createOFNode((long)10));
32                 NodeConnector outNC = NodeConnectorCreator.createNodeConnector((short)20, NodeCreator.createOFNode((long)20));
33                         
34                 match.setField(MatchType.DL_TYPE, EtherTypes.IPv4.shortValue());
35                 match.setField(MatchType.IN_PORT, inNC);
36                         
37                 Output output = new Output(outNC);
38                 ArrayList<Action> action = new ArrayList<Action>();
39                 action.add(output);
40                         
41                 Flow flow = new Flow (match, action);
42                 
43                 FlowOnNode flowOnNode = new FlowOnNode (flow);
44         
45                 Assert.assertTrue(flowOnNode.getFlow().equals(flow));
46                 
47                 flowOnNode.setPacketCount((long)100);
48                 flowOnNode.setByteCount((long)800);
49                 flowOnNode.setTableId((byte)0x55);
50                 flowOnNode.setDurationNanoseconds(40);
51                 flowOnNode.setDurationSeconds(45);
52                         
53                 Assert.assertTrue(flowOnNode.getPacketCount() == 100);
54                 Assert.assertTrue(flowOnNode.getByteCount() == 800);
55                 Assert.assertTrue(flowOnNode.getDurationNanoseconds() == 40);
56                 Assert.assertTrue(flowOnNode.getDurationSeconds() == 45);
57                 Assert.assertTrue(flowOnNode.getTableId() == (byte)0x55);               
58         }
59 }