OF1.0 fixes
[openflowjava.git] / openflow-protocol-impl / src / test / java / org / opendaylight / openflowjava / protocol / impl / serialization / factories / FlowModInputMessageFactoryTest.java
index 7fcd9b889957470550b67d5baa2d45d534cd8fe6..83cb7d285787453091debb94000be810e4004b49 100644 (file)
@@ -12,6 +12,7 @@ import org.junit.Assert;
 import org.junit.Test;\r
 import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.HelloMessageFactoryTest;\r
 import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;\r
+import org.opendaylight.openflowjava.protocol.impl.util.EncodeConstants;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EcnMatchEntry;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EcnMatchEntryBuilder;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MetadataInstruction;\r
@@ -45,6 +46,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731
  */\r
 public class FlowModInputMessageFactoryTest {\r
     private static final byte PADDING_IN_FLOW_MOD_MESSAGE = 2;\r
+    \r
     /**\r
      * @throws Exception \r
      * Testing of {@link FlowModInputMessageFactory} for correct translation from POJO\r
@@ -52,7 +54,7 @@ public class FlowModInputMessageFactoryTest {
     @Test\r
     public void testFlowModInputMessageFactory() throws Exception {\r
         FlowModInputBuilder builder = new FlowModInputBuilder();\r
-        BufferHelper.setupHeader(builder);\r
+        BufferHelper.setupHeader(builder, EncodeConstants.OF13_VERSION_ID);\r
         byte[] cookie = new byte[]{0x00, 0x01, 0x04, 0x01, 0x06, 0x00, 0x07, 0x01};\r
         builder.setCookie(new BigInteger(cookie));\r
         byte[] cookieMask = new byte[]{0x01, 0x05, 0x00, 0x00, 0x09, 0x30, 0x00, 0x30};\r
@@ -120,30 +122,30 @@ public class FlowModInputMessageFactoryTest {
         Assert.assertEquals("Wrong flags", message.getFlags(), createFlowModFlagsFromBitmap(out.readUnsignedShort()));\r
         out.skipBytes(PADDING_IN_FLOW_MOD_MESSAGE);\r
         Assert.assertEquals("Wrong match type", 1, out.readUnsignedShort());\r
-        out.skipBytes(Short.SIZE / Byte.SIZE);\r
+        out.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
         Assert.assertEquals("Wrong oxm class", 0x8000, out.readUnsignedShort());\r
         short fieldAndMask = out.readUnsignedByte();\r
         Assert.assertEquals("Wrong oxm hasMask", 0, fieldAndMask & 1);\r
         Assert.assertEquals("Wrong oxm field", 1, fieldAndMask >> 1);\r
-        out.skipBytes(Byte.SIZE / Byte.SIZE);\r
+        out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);\r
         Assert.assertEquals("Wrong oxm value", 42, out.readUnsignedInt());\r
         Assert.assertEquals("Wrong oxm class", 0, out.readUnsignedShort());\r
         fieldAndMask = out.readUnsignedByte();\r
         Assert.assertEquals("Wrong oxm hasMask", 0, fieldAndMask & 1);\r
         Assert.assertEquals("Wrong oxm field", 9, fieldAndMask >> 1);\r
-        out.skipBytes(Byte.SIZE / Byte.SIZE);\r
+        out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);\r
         Assert.assertEquals("Wrong oxm value", 4, out.readUnsignedByte());\r
         out.skipBytes(7);\r
         Assert.assertEquals("Wrong instruction type", 1, out.readUnsignedShort());\r
-        out.skipBytes(Short.SIZE / Byte.SIZE);\r
+        out.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
         Assert.assertEquals("Wrong instruction value", 43, out.readUnsignedByte());\r
         out.skipBytes(3);\r
         Assert.assertEquals("Wrong instruction type", 2, out.readUnsignedShort());\r
-        out.skipBytes(Short.SIZE / Byte.SIZE);\r
-        out.skipBytes(Integer.SIZE / Byte.SIZE);\r
-        byte[] cookieRead = new byte[Long.SIZE / Byte.SIZE];\r
+        out.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
+        out.skipBytes(EncodeConstants.SIZE_OF_INT_IN_BYTES);\r
+        byte[] cookieRead = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];\r
         out.readBytes(cookieRead);\r
-        byte[] cookieMaskRead = new byte[Long.SIZE / Byte.SIZE];\r
+        byte[] cookieMaskRead = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];\r
         out.readBytes(cookieMaskRead);\r
         Assert.assertArrayEquals("Wrong metadata", cookie, cookieRead);\r
         Assert.assertArrayEquals("Wrong metadata mask", cookieMask, cookieMaskRead); \r