Factory tests back to stable
[openflowjava.git] / openflow-protocol-impl / src / test / java / org / opendaylight / openflowjava / protocol / impl / deserialization / factories / QueueGetConfigReplyMessageFactoryMultiTest.java
index b0ea6cb66f30554f83e23c62bf06dd087718b0e4..eb2cdc7c7c42c3c209490b5ca49d11032516a221 100644 (file)
@@ -9,6 +9,8 @@ import java.util.List;
 import org.junit.Assert;\r
 import org.junit.Test;\r
 import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.RateQueueProperty;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.RateQueuePropertyBuilder;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.QueueId;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.QueueProperties;\r
@@ -28,26 +30,28 @@ public class QueueGetConfigReplyMessageFactoryMultiTest {
      * Testing of {@link QueueGetConfigReplyMessageFactory} for correct\r
      * translation into POJO\r
      */\r
-    //@Test\r
- // TODO - fix test\r
+    @Test\r
     public void test() {\r
         ByteBuf bb = BufferHelper.buildBuffer("00 01 02 03 " + // port\r
                 "00 00 00 00 " + // padding\r
                 "00 00 00 01 " + // queueId\r
                 "00 00 00 01 " + // port\r
-                "00 00 00 00 00 00 00 00 " + // pad\r
-                "00 01 " + // property\r
+                "00 20 " + // length\r
+                "00 00 00 00 00 00 " + // pad\r
+                "00 02 " + // property\r
+                "00 10 " + // length\r
+                "00 00 00 00 " + // pad\r
+                "00 05 " + // rate\r
                 "00 00 00 00 00 00 " + // pad\r
                 "00 00 00 02 " + // queueId\r
                 "00 00 00 02 " + // port\r
-                "00 00 00 00 00 00 00 00 " + // pad\r
-                "00 01 " + // property\r
+                "00 20 " + // length\r
                 "00 00 00 00 00 00 " + // pad\r
-                "00 00 00 03 " + // queueId\r
-                "00 00 00 03 " + // port\r
-                "00 00 00 00 00 00 00 00 " + // pad\r
-                "00 01 " + // property\r
-                "00 00 00 00 00 00" // pad\r
+                "00 02 " + // property\r
+                "00 10 " + // length\r
+                "00 00 00 00 " + // pad\r
+                "00 05 " + // rate\r
+                "00 00 00 00 00 00 " // pad\r
         );\r
 \r
         GetQueueConfigOutput builtByFactory = BufferHelper.decodeV13(\r
@@ -55,14 +59,13 @@ public class QueueGetConfigReplyMessageFactoryMultiTest {
 \r
         BufferHelper.checkHeaderV13(builtByFactory);\r
         Assert.assertEquals("Wrong port", 66051L, builtByFactory.getPort().getValue().longValue());\r
-        Assert.assertEquals("Wrong queues", builtByFactory.getQueues(),\r
-                createQueuesList());\r
+        Assert.assertEquals("Wrong queues", createQueuesList(), builtByFactory.getQueues());\r
     }\r
 \r
     private static List<Queues> createQueuesList() {\r
         List<Queues> queuesList = new ArrayList<>();\r
-        QueuesBuilder qb = new QueuesBuilder();\r
-        for (int i = 1; i <= 3; i++) {\r
+        for (int i = 1; i < 3; i++) {\r
+            QueuesBuilder qb = new QueuesBuilder();\r
             qb.setQueueId(new QueueId((long) i));\r
             qb.setPort(new PortNumber((long) i));\r
             qb.setQueueProperty(createPropertiesList());\r
@@ -74,7 +77,10 @@ public class QueueGetConfigReplyMessageFactoryMultiTest {
     private static List<QueueProperty> createPropertiesList() {\r
         List<QueueProperty> propertiesList = new ArrayList<>();\r
         QueuePropertyBuilder pb = new QueuePropertyBuilder();\r
-        pb.setProperty(QueueProperties.forValue(1));\r
+        pb.setProperty(QueueProperties.forValue(2));\r
+        RateQueuePropertyBuilder rateBuilder = new RateQueuePropertyBuilder();\r
+        rateBuilder.setRate(5);\r
+        pb.addAugmentation(RateQueueProperty.class, rateBuilder.build());\r
         propertiesList.add(pb.build());\r
         return propertiesList;\r
     }\r