Bump MRI upstreams
[openflowplugin.git] / openflowjava / openflow-protocol-impl / src / test / java / org / opendaylight / openflowjava / protocol / impl / serialization / factories / SetAsyncInputMessageFactoryTest.java
index eb5f94d72c0764be12327c1139ce59b1141cb5c0..2504a38949e3da65cce0f68fc23666edd6919921 100644 (file)
@@ -5,13 +5,12 @@
  * 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.openflowjava.protocol.impl.serialization.factories;
 
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.UnpooledByteBufAllocator;
-import java.util.ArrayList;
 import java.util.List;
+import java.util.Set;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
@@ -52,7 +51,7 @@ public class SetAsyncInputMessageFactoryTest {
         registry = new SerializerRegistryImpl();
         registry.init();
         setAsyncFactory = registry.getSerializer(
-                new MessageTypeKey<>(EncodeConstants.OF13_VERSION_ID, SetAsyncInput.class));
+                new MessageTypeKey<>(EncodeConstants.OF_VERSION_1_3, SetAsyncInput.class));
     }
 
     /**
@@ -81,61 +80,37 @@ public class SetAsyncInputMessageFactoryTest {
     }
 
     private static List<PacketInMask> createPacketInMask() {
-        final List<PacketInMask> masks = new ArrayList<>();
-        PacketInMaskBuilder builder;
-        // OFPCR_ROLE_EQUAL or OFPCR_ROLE_MASTER
-        builder = new PacketInMaskBuilder();
-        List<PacketInReason> packetInReasonList = new ArrayList<>();
-        packetInReasonList.add(PacketInReason.OFPRNOMATCH);
-        packetInReasonList.add(PacketInReason.OFPRACTION);
-        packetInReasonList.add(PacketInReason.OFPRINVALIDTTL);
-        builder.setMask(packetInReasonList);
-        masks.add(builder.build());
-        // OFPCR_ROLE_SLAVE
-        builder = new PacketInMaskBuilder();
-        packetInReasonList = new ArrayList<>();
-        builder.setMask(packetInReasonList);
-        masks.add(builder.build());
-        return masks;
+        return List.of(
+            // OFPCR_ROLE_EQUAL or OFPCR_ROLE_MASTER
+            new PacketInMaskBuilder()
+                .setMask(Set.of(PacketInReason.OFPRNOMATCH, PacketInReason.OFPRACTION, PacketInReason.OFPRINVALIDTTL))
+                .build(),
+            // OFPCR_ROLE_SLAVE
+            new PacketInMaskBuilder().setMask(Set.of()).build());
     }
 
     private static List<PortStatusMask> createPortStatusMask() {
-        final List<PortStatusMask> masks = new ArrayList<>();
-        PortStatusMaskBuilder builder;
-        builder = new PortStatusMaskBuilder();
-        // OFPCR_ROLE_EQUAL or OFPCR_ROLE_MASTER
-        List<PortReason> portReasonList = new ArrayList<>();
-        portReasonList.add(PortReason.OFPPRADD);
-        portReasonList.add(PortReason.OFPPRDELETE);
-        portReasonList.add(PortReason.OFPPRMODIFY);
-        builder.setMask(portReasonList);
-        masks.add(builder.build());
-        // OFPCR_ROLE_SLAVE
-        builder = new PortStatusMaskBuilder();
-        portReasonList = new ArrayList<>();
-        builder.setMask(portReasonList);
-        masks.add(builder.build());
-        return masks;
+        return List.of(
+            // OFPCR_ROLE_EQUAL or OFPCR_ROLE_MASTER
+            new PortStatusMaskBuilder()
+                .setMask(Set.of(PortReason.OFPPRADD, PortReason.OFPPRDELETE, PortReason.OFPPRMODIFY))
+                .build(),
+            // OFPCR_ROLE_SLAVE
+            new PortStatusMaskBuilder().setMask(Set.of()).build());
     }
 
     private static List<FlowRemovedMask> createFlowRemowedMask() {
-        final List<FlowRemovedMask> masks = new ArrayList<>();
-        FlowRemovedMaskBuilder builder;
-        // OFPCR_ROLE_EQUAL or OFPCR_ROLE_MASTER
-        builder = new FlowRemovedMaskBuilder();
-        List<FlowRemovedReason> flowRemovedReasonList = new ArrayList<>();
-        flowRemovedReasonList.add(FlowRemovedReason.OFPRRIDLETIMEOUT);
-        flowRemovedReasonList.add(FlowRemovedReason.OFPRRHARDTIMEOUT);
-        flowRemovedReasonList.add(FlowRemovedReason.OFPRRDELETE);
-        flowRemovedReasonList.add(FlowRemovedReason.OFPRRGROUPDELETE);
-        builder.setMask(flowRemovedReasonList);
-        masks.add(builder.build());
-        // OFPCR_ROLE_SLAVE
-        builder = new FlowRemovedMaskBuilder();
-        flowRemovedReasonList = new ArrayList<>();
-        builder.setMask(flowRemovedReasonList);
-        masks.add(builder.build());
-        return masks;
+        return List.of(
+            // OFPCR_ROLE_EQUAL or OFPCR_ROLE_MASTER
+            new FlowRemovedMaskBuilder()
+                .setMask(Set.of(
+                    FlowRemovedReason.OFPRRIDLETIMEOUT,
+                    FlowRemovedReason.OFPRRHARDTIMEOUT,
+                    FlowRemovedReason.OFPRRDELETE,
+                    FlowRemovedReason.OFPRRGROUPDELETE))
+                .build(),
+            // OFPCR_ROLE_SLAVE
+            new FlowRemovedMaskBuilder().setMask(Set.of()).build());
     }
 
     /**