Added more (de)serialization factories + ByteBufUtils methods
[openflowjava.git] / openflow-protocol-impl / src / test / java / org / opendaylight / openflowjava / protocol / impl / deserialization / factories / HelloMessageFactoryTest.java
index de3ce14c154ebaf7f72f35be3c61280e23d9898d..04af39d409260065eb7fab6fa9c8a8a529534f71 100644 (file)
@@ -3,32 +3,28 @@ package org.opendaylight.openflowjava.protocol.impl.deserialization.factories;
 \r
 import io.netty.buffer.ByteBuf;\r
 \r
-import org.junit.Assert;\r
 import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.HelloMessageFactory;\r
 import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloMessage;\r
 \r
 /**\r
  * @author michal.polkorab\r
- *\r
+ * \r
  */\r
 public class HelloMessageFactoryTest {\r
-    \r
+\r
     /** Number of currently supported version / codec */\r
-    public static final short VERSION_YET_SUPPORTED = 0x04;\r
-    /** Index of Xid in OpenFlow 1.3 header */\r
-    public static final byte INDEX_OF_XID_IN_HEADER = 4;\r
+    public static final Short VERSION_YET_SUPPORTED = 0x04;\r
 \r
     /**\r
      * Testing {@link HelloMessageFactory} for correct translation into POJO\r
      */\r
     @Test\r
     public void test() {\r
-        ByteBuf bb = BufferHelper.buildBuffer(new byte[0]);\r
-        HelloMessage builtByFactory = HelloMessageFactory.getInstance().bufferToMessage(bb, VERSION_YET_SUPPORTED);\r
+        ByteBuf bb = BufferHelper.buildBuffer();\r
+        HelloMessage builtByFactory = BufferHelper.decodeV13(\r
+                HelloMessageFactory.getInstance(), bb);\r
 \r
-        Assert.assertTrue(builtByFactory.getVersion() == VERSION_YET_SUPPORTED);\r
-        Assert.assertEquals(builtByFactory.getXid().longValue(), 16909060L);\r
+        BufferHelper.checkHeaderV13(builtByFactory);\r
     }\r
 }\r