Update MRI upstreams for Phosphorus
[openflowplugin.git] / extension / openflowjava-extension-nicira / src / test / java / org / opendaylight / openflowjava / nx / codec / match / Reg4CodecTest.java
index dd7dac3b7c37a2fc660bce07ac9f44ec2296a477..1b1c2e42e7efa061b13d1ead796ee6934d63810b 100644 (file)
@@ -11,32 +11,26 @@ import static org.junit.Assert.assertEquals;
 
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.ByteBufAllocator;
-import org.junit.Before;
 import org.junit.Test;
 import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Nxm1Class;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxReg4;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.aug.nx.match.RegCaseValue;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.aug.nx.match.RegCaseValueBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.nx.match.reg.grouping.RegValuesBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.RegCaseValue;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.RegCaseValueBuilder;
+import org.opendaylight.yangtools.yang.common.Uint32;
 
 public class Reg4CodecTest {
-    Reg4Codec reg4Codec;
-    ByteBuf buffer;
-    MatchEntry input;
+    private final ByteBuf buffer = ByteBufAllocator.DEFAULT.buffer();
+    private final Reg4Codec reg4Codec = new Reg4Codec();
+
+    private MatchEntry input;
 
     private static final int NXM_FIELD_CODE = 4;
     private static final int VALUE_LENGTH = 4;
 
-    @Before
-    public void setUp() {
-        reg4Codec = new Reg4Codec();
-        buffer = ByteBufAllocator.DEFAULT.buffer();
-    }
-
-
     @Test
     public void serializeTest() {
         input = createMatchEntry();
@@ -60,7 +54,7 @@ public class Reg4CodecTest {
 
         assertEquals(Nxm1Class.class, input.getOxmClass());
         assertEquals(NxmNxReg4.class, input.getOxmMatchField());
-        assertEquals(false, input.isHasMask());
+        assertEquals(false, input.getHasMask());
         assertEquals(1, result.getRegValues().getValue().intValue());
     }
 
@@ -73,14 +67,14 @@ public class Reg4CodecTest {
         matchEntryBuilder.setOxmMatchField(NxmNxReg4.class);
         matchEntryBuilder.setHasMask(false);
 
-        valuesBuilder.setValue((long)1);
+        valuesBuilder.setValue(Uint32.ONE);
 
         caseBuilder.setRegValues(valuesBuilder.build());
         matchEntryBuilder.setMatchEntryValue(caseBuilder.build());
         return matchEntryBuilder.build();
     }
 
-    private static void createBuffer(ByteBuf message) {
+    private static void createBuffer(final ByteBuf message) {
         message.writeShort(OxmMatchConstants.NXM_1_CLASS);
 
         int fieldMask = NXM_FIELD_CODE << 1;