Removed license headers erroneously added to openflowJ
[controller.git] / third-party / openflowj / src / test / java / org / openflow / protocol / OFPortStatusTest.java
1 package org.openflow.protocol;
2
3 import java.nio.ByteBuffer;
4
5 import junit.framework.TestCase;
6
7 import org.openflow.protocol.OFPortStatus.OFPortReason;
8 import org.openflow.util.OFTestCase;
9
10 public class OFPortStatusTest extends OFTestCase {
11     public void testWriteRead() throws Exception {
12         OFPortStatus msg = (OFPortStatus) messageFactory
13                 .getMessage(OFType.PORT_STATUS);
14         msg.setDesc(new OFPhysicalPort());
15         msg.getDesc().setHardwareAddress(new byte[6]);
16         msg.getDesc().setName("eth0");
17         msg.setReason((byte) OFPortReason.OFPPR_ADD.ordinal());
18         ByteBuffer bb = ByteBuffer.allocate(1024);
19         bb.clear();
20         msg.writeTo(bb);
21         bb.flip();
22         msg.readFrom(bb);
23         TestCase.assertEquals(OFType.PORT_STATUS, msg.getType());
24         TestCase.assertEquals((byte) OFPortReason.OFPPR_ADD.ordinal(), msg
25                 .getReason());
26         TestCase.assertNotNull(msg.getDesc());
27     }
28 }