Bug 1277 - Move ByteBuffUtils to separate bundle
[openflowjava.git] / openflow-protocol-impl / src / test / java / org / opendaylight / openflowjava / protocol / impl / util / ActionsDeserializerTest.java
index d7f79c8cb5be72e647e32cd1da1f66f4fb3dd6ff..06fbe466563b18ffcddeca3b7378a6ec1b1353d3 100644 (file)
@@ -12,7 +12,11 @@ import io.netty.buffer.ByteBuf;
 import java.util.List;\r
 \r
 import org.junit.Assert;\r
+import org.junit.Before;\r
 import org.junit.Test;\r
+import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;\r
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
+import org.opendaylight.openflowjava.protocol.impl.deserialization.DeserializerRegistryImpl;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EthertypeAction;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.GroupIdAction;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaxLengthAction;\r
@@ -35,6 +39,17 @@ public class ActionsDeserializerTest {
 \r
     private static final Logger LOGGER = LoggerFactory\r
             .getLogger(ActionsDeserializerTest.class);\r
+    private DeserializerRegistry registry;\r
+\r
+    /**\r
+     * Initializes deserializer registry and lookups correct deserializer\r
+     */\r
+    @Before\r
+    public void startUp() {\r
+        registry = new DeserializerRegistryImpl();\r
+        registry.init();\r
+    }\r
+\r
     /**\r
      * Testing actions deserialization\r
      */\r
@@ -59,7 +74,10 @@ public class ActionsDeserializerTest {
         \r
         message.skipBytes(4); // skip XID\r
         LOGGER.info("bytes: " + message.readableBytes());\r
-        List<Action> actions = ActionsDeserializer.createActions(message, message.readableBytes());\r
+        \r
+        CodeKeyMaker keyMaker = CodeKeyMakerFactory.createActionsKeyMaker(EncodeConstants.OF13_VERSION_ID);\r
+        List<Action> actions = ListDeserializer.deserializeList(EncodeConstants.OF13_VERSION_ID,\r
+                message.readableBytes(), message, keyMaker, registry);\r
         Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight."\r
                 + "openflow.common.action.rev130731.Output", actions.get(0).getType().getName());\r
         Assert.assertEquals("Wrong action port", 1,\r