Update MRI upstreams for Phosphorus
[openflowplugin.git] / openflowplugin-impl / src / test / java / org / opendaylight / openflowplugin / impl / protocol / deserialization / multipart / MultipartReplyMessageDeserializerTest.java
index b20632245a0815c53b3cfc90693563b929d66799..8cf63386f90a85a47360da7954bfab328ca3cfb3 100644 (file)
@@ -5,7 +5,6 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.openflowplugin.impl.protocol.deserialization.multipart;
 
 import static org.junit.Assert.assertEquals;
@@ -61,10 +60,11 @@ public class MultipartReplyMessageDeserializerTest extends AbstractDeserializerT
 
     @Override
     protected void init() {
+        // No-op
     }
 
     @Test
-    public void deserialize() throws Exception {
+    public void deserialize() {
         ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();
         buffer.writeByte(TYPE);
         buffer.writeShort(EncodeConstants.EMPTY_LENGTH);
@@ -82,11 +82,11 @@ public class MultipartReplyMessageDeserializerTest extends AbstractDeserializerT
         buffer.writeShort(IDLE_TIMEOUT);
         buffer.writeShort(HARD_TIMEOUT);
         buffer.writeShort(ByteBufUtils.fillBitMask(0,
-                FLAGS.isSENDFLOWREM(),
-                FLAGS.isCHECKOVERLAP(),
-                FLAGS.isRESETCOUNTS(),
-                FLAGS.isNOPKTCOUNTS(),
-                FLAGS.isNOBYTCOUNTS()));
+                FLAGS.getSENDFLOWREM(),
+                FLAGS.getCHECKOVERLAP(),
+                FLAGS.getRESETCOUNTS(),
+                FLAGS.getNOPKTCOUNTS(),
+                FLAGS.getNOBYTCOUNTS()));
         buffer.writeZero(PADDING_IN_FLOW_STATS_HEADER_02);
         buffer.writeLong(COOKIE);
         buffer.writeLong(PACKET_COUNT);
@@ -101,7 +101,7 @@ public class MultipartReplyMessageDeserializerTest extends AbstractDeserializerT
         // MplsLabel match
         buffer.writeShort(OxmMatchConstants.OPENFLOW_BASIC_CLASS);
         buffer.writeByte(OxmMatchConstants.MPLS_LABEL << 1);
-        buffer.writeByte(EncodeConstants.SIZE_OF_INT_IN_BYTES);
+        buffer.writeByte(Integer.BYTES);
         buffer.writeInt(MPLS_LABEL);
 
         // Match footer
@@ -129,12 +129,13 @@ public class MultipartReplyMessageDeserializerTest extends AbstractDeserializerT
 
         // Deserialize and check everything
         final MultipartReply message = (MultipartReply) getFactory()
-                .deserialize(buffer, EncodeConstants.OF13_VERSION_ID);
+                .deserialize(buffer, EncodeConstants.OF_VERSION_1_3);
 
         final MultipartReplyFlowStats reply = (MultipartReplyFlowStats) message.getMultipartReplyBody();
 
         assertEquals(XID, message.getXid().intValue());
-        final FlowAndStatisticsMapList flowAndStatisticsMapList = reply.getFlowAndStatisticsMapList().get(0);
+        final FlowAndStatisticsMapList flowAndStatisticsMapList =
+                reply.nonnullFlowAndStatisticsMapList().iterator().next();
         assertEquals(TABLE_ID, flowAndStatisticsMapList.getTableId().shortValue());
         assertEquals(SECOND, flowAndStatisticsMapList.getDuration().getSecond().getValue().intValue());
         assertEquals(NANOSECOND, flowAndStatisticsMapList.getDuration().getNanosecond().getValue().intValue());
@@ -149,12 +150,13 @@ public class MultipartReplyMessageDeserializerTest extends AbstractDeserializerT
         assertEquals(1, flowAndStatisticsMapList.getInstructions().getInstruction().size());
 
         final Instruction instruction =
-                flowAndStatisticsMapList.getInstructions().getInstruction().get(0).getInstruction();
-        assertEquals(ApplyActionsCase.class, instruction.getImplementedInterface());
+                flowAndStatisticsMapList.getInstructions().nonnullInstruction().values().iterator().next()
+                        .getInstruction();
+        assertEquals(ApplyActionsCase.class, instruction.implementedInterface());
 
         final ApplyActionsCase applyActions = (ApplyActionsCase) instruction;
         assertEquals(1, applyActions.getApplyActions().getAction().size());
-        assertEquals(PopPbbActionCase.class, applyActions.getApplyActions().getAction().get(0)
-                .getAction().getImplementedInterface());
+        assertEquals(PopPbbActionCase.class, applyActions.getApplyActions().nonnullAction().values().iterator().next()
+                .getAction().implementedInterface());
     }
 }