Added more (de)serialization factories + ByteBufUtils methods
[openflowjava.git] / openflow-protocol-impl / src / test / java / org / opendaylight / openflowjava / protocol / impl / serialization / factories / EchoReplyInputMessageFactoryTest.java
1 /* Copyright (C)2013 Pantheon Technologies, s.r.o. All rights reserved. */\r
2 package org.opendaylight.openflowjava.protocol.impl.serialization.factories;\r
3 \r
4 import io.netty.buffer.ByteBuf;\r
5 import io.netty.buffer.UnpooledByteBufAllocator;\r
6 \r
7 import org.junit.Test;\r
8 import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.HelloMessageFactoryTest;\r
9 import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;\r
10 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoReplyInput;\r
11 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoReplyInputBuilder;\r
12 \r
13 /**\r
14  * @author michal.polkorab\r
15  *\r
16  */\r
17 public class EchoReplyInputMessageFactoryTest {\r
18 \r
19     private static final byte ECHO_REPLY_MESSAGE_CODE_TYPE = 3;\r
20     \r
21     /**\r
22      * Testing of {@link EchoReplyInputMessageFactory} for correct translation from POJO\r
23      * @throws Exception \r
24      */\r
25     @Test\r
26     public void test() throws Exception {\r
27         EchoReplyInputBuilder erib = new EchoReplyInputBuilder();\r
28         BufferHelper.setupHeader(erib);\r
29         EchoReplyInput eri = erib.build();\r
30         \r
31         ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();\r
32         EchoReplyInputMessageFactory eimf = EchoReplyInputMessageFactory.getInstance();\r
33         eimf.messageToBuffer(HelloMessageFactoryTest.VERSION_YET_SUPPORTED, out, eri);\r
34         \r
35         BufferHelper.checkHeaderV13(out, ECHO_REPLY_MESSAGE_CODE_TYPE, 8);\r
36     }\r
37 \r
38 }\r