Added support for OF 1.0
[openflowjava.git] / openflow-protocol-impl / src / test / java / org / opendaylight / openflowjava / protocol / impl / deserialization / factories / QueueGetConfigReplyMessageFactoryTest.java
1 /* Copyright (C)2013 Pantheon Technologies, s.r.o. All rights reserved. */\r
2 package org.opendaylight.openflowjava.protocol.impl.deserialization.factories;\r
3 \r
4 import io.netty.buffer.ByteBuf;\r
5 \r
6 import java.util.ArrayList;\r
7 import java.util.List;\r
8 \r
9 import org.junit.Assert;\r
10 import org.junit.Test;\r
11 import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;\r
12 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber;\r
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.QueueId;\r
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.QueueProperties;\r
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetQueueConfigOutput;\r
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.queue.get.config.reply.Queues;\r
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.queue.get.config.reply.QueuesBuilder;\r
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.queue.property.header.QueueProperty;\r
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.queue.property.header.QueuePropertyBuilder;\r
20 \r
21 /**\r
22  * @author timotej.kubas\r
23  * @author michal.polkorab\r
24  */\r
25 public class QueueGetConfigReplyMessageFactoryTest {\r
26 \r
27     /**\r
28      * Testing {@link QueueGetConfigReplyMessageFactory} for correct translation into POJO\r
29      */\r
30     //@Test\r
31  // TODO - fix test\r
32     public void test(){\r
33         ByteBuf bb = BufferHelper.buildBuffer("00 01 02 03 00 00 00 00 00 00 00 01 00 00 00 01 00 00 00 00 00 00 00 00 00 02 00 00 00 00 00 00");\r
34         GetQueueConfigOutput builtByFactory = BufferHelper.decodeV13(QueueGetConfigReplyMessageFactory.getInstance(), bb);\r
35         BufferHelper.checkHeaderV13(builtByFactory);\r
36         Assert.assertEquals("Wrong port", 66051L, builtByFactory.getPort().getValue().longValue());\r
37         Assert.assertEquals("Wrong queues", builtByFactory.getQueues(), createQueuesList());\r
38     }\r
39     \r
40     private static List<Queues> createQueuesList(){\r
41         List<Queues> queuesList = new ArrayList<>();\r
42         QueuesBuilder qb = new QueuesBuilder();\r
43         qb.setQueueId(new QueueId(1L));\r
44         qb.setPort(new PortNumber(1L));\r
45         qb.setQueueProperty(createPropertiesList());\r
46         queuesList.add(qb.build());\r
47         \r
48         return queuesList;\r
49     }\r
50     \r
51     private static List<QueueProperty> createPropertiesList(){\r
52         List<QueueProperty> propertiesList = new ArrayList<>();\r
53         QueuePropertyBuilder pb = new QueuePropertyBuilder();\r
54         pb.setProperty(QueueProperties.forValue(2));\r
55         propertiesList.add(pb.build());\r
56         \r
57         return propertiesList;\r
58     }\r
59 }\r