Further test migration 00/94600/1
authorRobert Varga <robert.varga@pantheon.tech>
Mon, 11 Jan 2021 17:57:55 +0000 (18:57 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Mon, 11 Jan 2021 17:57:55 +0000 (18:57 +0100)
Use BindingMap instead of lists for easy migration.

Change-Id: Ifb721a363009475717222b71ec4982e10a777618
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/protocol/serialization/messages/GroupMessageSerializerTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/protocol/serialization/multipart/tablefeatures/WriteActionsMissTablePropertySerializerTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/protocol/serialization/multipart/tablefeatures/WriteActionsTablePropertySerializerTest.java

index bcf44e38de1b5af30f26ef3d8a17f10598f3fa71..7e6b402f84a759af040d1c806c3646d0824163ec 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.serialization.messages;
 
 import static org.junit.Assert.assertArrayEquals;
@@ -13,8 +12,6 @@ import static org.junit.Assert.assertEquals;
 
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.UnpooledByteBufAllocator;
-import java.util.Collections;
-import java.util.List;
 import org.junit.Test;
 import org.opendaylight.openflowjava.protocol.api.keys.MessageTypeKey;
 import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
@@ -23,7 +20,6 @@ import org.opendaylight.openflowplugin.impl.protocol.serialization.AbstractSeria
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwSrcActionCaseBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.nw.src.action._case.SetNwSrcActionBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.address.Ipv4Builder;
@@ -32,7 +28,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.Group
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupMessage;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupMessageBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupTypes;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.Buckets;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.BucketsBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.buckets.BucketBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.buckets.BucketKey;
@@ -64,42 +59,38 @@ public class GroupMessageSerializerTest extends AbstractSerializerTest {
     private static final ActionKey ACTION_KEY = new ActionKey(ACTION_ORDER);
     private static final Ipv4Prefix IPV4_PREFIX = new Ipv4Prefix("192.168.76.0/32");
 
-    private static final List<Action> ACTIONS = Collections.singletonList(
-            new ActionBuilder()
+    private static final GroupMessage MESSAGE = new GroupMessageBuilder()
+        .setBarrier(BARRIER)
+        .setBuckets(new BucketsBuilder()
+            .setBucket(BindingMap.of(new BucketBuilder()
+                .setBucketId(BUCKET_ID)
+                .withKey(BUCKET_KEY)
+                .setWatchGroup(BUCKET_WATCH_GROUP)
+                .setWatchPort(BUCKET_WATCH_PORT)
+                .setWeight(BUCKET_WEIGHT)
+                .setAction(BindingMap.of(
+                    new ActionBuilder()
                     .setAction(new SetNwSrcActionCaseBuilder()
-                            .setSetNwSrcAction(new SetNwSrcActionBuilder()
-                                    .setAddress(new Ipv4Builder()
-                                            .setIpv4Address(new Ipv4Prefix(IPV4_PREFIX))
-                                            .build())
-                                    .build())
+                        .setSetNwSrcAction(new SetNwSrcActionBuilder()
+                            .setAddress(new Ipv4Builder()
+                                .setIpv4Address(new Ipv4Prefix(IPV4_PREFIX))
+                                .build())
                             .build())
+                        .build())
                     .setOrder(ACTION_ORDER)
                     .withKey(ACTION_KEY)
                     .build()
-    );
-
-    private static final Buckets BUCKETS = new BucketsBuilder()
-            .setBucket(BindingMap.of(new BucketBuilder()
-                    .setBucketId(BUCKET_ID)
-                    .withKey(BUCKET_KEY)
-                    .setWatchGroup(BUCKET_WATCH_GROUP)
-                    .setWatchPort(BUCKET_WATCH_PORT)
-                    .setWeight(BUCKET_WEIGHT)
-                    .setAction(ACTIONS)
-                    .build()))
-            .build();
-
-    private static final GroupMessage MESSAGE = new GroupMessageBuilder()
-            .setBarrier(BARRIER)
-            .setBuckets(BUCKETS)
-            .setCommand(COMMAND)
-            .setContainerName(CONTAINER_NAME)
-            .setGroupId(GROUP_ID)
-            .setGroupName(GROUP_NAME)
-            .setGroupType(GROUP_TYPE)
-            .setVersion(VERSION)
-            .setXid(XID)
-            .build();
+                    ))
+                .build()))
+            .build())
+        .setCommand(COMMAND)
+        .setContainerName(CONTAINER_NAME)
+        .setGroupId(GROUP_ID)
+        .setGroupName(GROUP_NAME)
+        .setGroupType(GROUP_TYPE)
+        .setVersion(VERSION)
+        .setXid(XID)
+        .build();
 
     private GroupMessageSerializer serializer;
 
index 9cb398e161703d6f6ea9daa946ededba73b771d3..863fc0a66fa206647af18920e4f1346065364451 100644 (file)
@@ -9,7 +9,6 @@ package org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.ta
 
 import static org.junit.Assert.assertEquals;
 
-import java.util.Collections;
 import org.junit.Test;
 import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwSrcActionCaseBuilder;
@@ -18,6 +17,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev13
 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.TableFeaturePropType;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.WriteActionsMiss;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.WriteActionsMissBuilder;
+import org.opendaylight.yangtools.yang.binding.util.BindingMap;
 
 public class WriteActionsMissTablePropertySerializerTest extends AbstractTablePropertySerializerTest {
     @Test
@@ -26,10 +26,9 @@ public class WriteActionsMissTablePropertySerializerTest extends AbstractTablePr
                 .setWriteActionsMiss(new org.opendaylight.yang.gen.v1.urn.opendaylight
                         .table.types.rev131026.table.feature.prop.type.table.feature.prop.type.write.actions.miss
                         .WriteActionsMissBuilder()
-                        .setAction(Collections.singletonList(new ActionBuilder()
+                        .setAction(BindingMap.of(new ActionBuilder()
                                 .setOrder(0)
-                                .setAction(new SetNwSrcActionCaseBuilder()
-                                        .build())
+                                .setAction(new SetNwSrcActionCaseBuilder().build())
                                 .build()))
                         .build())
                 .build();
index 850d9e21cdb5054a89f0990025d0245a763e9b8c..f47ba265afc6d4ea6e9b6fcb98fdaa309a64d186 100644 (file)
@@ -9,7 +9,6 @@ package org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.ta
 
 import static org.junit.Assert.assertEquals;
 
-import java.util.Collections;
 import org.junit.Test;
 import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwSrcActionCaseBuilder;
@@ -18,6 +17,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev13
 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.TableFeaturePropType;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.WriteActions;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.WriteActionsBuilder;
+import org.opendaylight.yangtools.yang.binding.util.BindingMap;
 
 public class WriteActionsTablePropertySerializerTest extends AbstractTablePropertySerializerTest {
     @Test
@@ -26,10 +26,9 @@ public class WriteActionsTablePropertySerializerTest extends AbstractTableProper
                 .setWriteActions(new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature
                         .prop.type.table.feature.prop.type.write.actions
                         .WriteActionsBuilder()
-                        .setAction(Collections.singletonList(new ActionBuilder()
+                        .setAction(BindingMap.of(new ActionBuilder()
                                 .setOrder(0)
-                                .setAction(new SetNwSrcActionCaseBuilder()
-                                        .build())
+                                .setAction(new SetNwSrcActionCaseBuilder().build())
                                 .build()))
                         .build())
                 .build();