Merge "Quickfix - Vlan-vid match entry"
[openflowjava.git] / openflow-protocol-impl / src / test / java / org / opendaylight / openflowjava / protocol / impl / serialization / factories / OF10QueueGetConfigInputMessageFactoryTest.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 import junit.framework.Assert;\r
7 \r
8 import org.junit.Test;\r
9 import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;\r
10 import org.opendaylight.openflowjava.protocol.impl.util.EncodeConstants;\r
11 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber;\r
12 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetQueueConfigInput;\r
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetQueueConfigInputBuilder;\r
14 \r
15 /**\r
16  * @author michal.polkorab\r
17  *\r
18  */\r
19 public class OF10QueueGetConfigInputMessageFactoryTest {\r
20 \r
21     /**\r
22      * Testing of {@link OF10QueueGetConfigInputMessageFactory} for correct translation from POJO\r
23      * @throws Exception \r
24      */\r
25     @Test\r
26     public void test() throws Exception {\r
27         GetQueueConfigInputBuilder builder = new GetQueueConfigInputBuilder();\r
28         BufferHelper.setupHeader(builder, EncodeConstants.OF10_VERSION_ID);\r
29         builder.setPort(new PortNumber(6653L));\r
30         GetQueueConfigInput message = builder.build();\r
31         \r
32         ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();\r
33         OF10QueueGetConfigInputMessageFactory factory = OF10QueueGetConfigInputMessageFactory.getInstance();\r
34         factory.messageToBuffer(EncodeConstants.OF10_VERSION_ID, out, message);\r
35         \r
36         BufferHelper.checkHeaderV10(out, (byte) 20, 12);\r
37         Assert.assertEquals("Wrong port", 6653L, out.readUnsignedShort());\r
38         out.skipBytes(2);\r
39     }\r
40 \r
41 }\r