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.MessageTypeKey;\r
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;\r
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;\r
+import org.opendaylight.openflowjava.protocol.impl.serialization.SerializerRegistryImpl;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ActionsInstruction;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ActionsInstructionBuilder;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EthertypeAction;\r
* @author michal.polkorab\r
*\r
*/\r
-public class InstructionsSerializerTest {\r
+public class OF13InstructionsSerializerTest {\r
+\r
+ private SerializerRegistry registry;\r
+ private OFSerializer<Instruction> instructionSerializer;\r
+\r
+ /**\r
+ * Initializes serializer table and stores correct factory in field\r
+ */\r
+ @Before\r
+ public void startUp() {\r
+ registry = new SerializerRegistryImpl();\r
+ registry.init();\r
+ instructionSerializer = registry.getSerializer(\r
+ new MessageTypeKey<>(EncodeConstants.OF13_VERSION_ID, Instruction.class));\r
+ }\r
\r
/**\r
* Testing instructions translation\r
instructions.add(builder.build());\r
\r
ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();\r
- InstructionsSerializer.encodeInstructions(instructions, out);\r
+ CodingUtils.serializeList(instructions, instructionSerializer, out);\r
\r
Assert.assertEquals("Wrong instruction type", 1, out.readUnsignedShort());\r
Assert.assertEquals("Wrong instruction length", 8, out.readUnsignedShort());\r