Bump upstreams for 2022.09 Chlorine
[openflowplugin.git] / extension / openflowjava-extension-nicira / src / test / java / org / opendaylight / openflowjava / nx / codec / match / CtStateCodecTest.java
index 6e5a6c491e13a484222996fc1d1f774f0e489d4f..d22122c717663db9b8821ee2b5ba2cf3d815a91c 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.NxmNxCtState;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.aug.nx.match.CtStateCaseValue;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.aug.nx.match.CtStateCaseValueBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.nx.match.ct.state.grouping.CtStateValuesBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.CtStateCaseValue;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.CtStateCaseValueBuilder;
+import org.opendaylight.yangtools.yang.common.Uint32;
 
 public class CtStateCodecTest {
+    private final ByteBuf buffer = ByteBufAllocator.DEFAULT.buffer();
+    private final CtStateCodec ctStateCodec = new CtStateCodec();
 
-    CtStateCodec ctStateCodec;
-    ByteBuf buffer;
-    MatchEntry input;
+    private MatchEntry input;
 
     private static final int VALUE_LENGTH = 8;
     private static final int NXM_FIELD_CODE = 105;
 
-    @Before
-    public void setUp() {
-        ctStateCodec = new CtStateCodec();
-        buffer = ByteBufAllocator.DEFAULT.buffer();
-    }
-
     @Test
     public void serializeTest() {
         input = createMatchEntry();
@@ -58,9 +52,9 @@ public class CtStateCodecTest {
 
         final CtStateCaseValue result = (CtStateCaseValue) input.getMatchEntryValue();
 
-        assertEquals(Nxm1Class.class, input.getOxmClass());
-        assertEquals(NxmNxCtState.class, input.getOxmMatchField());
-        assertEquals(true, input.isHasMask());
+        assertEquals(Nxm1Class.VALUE, input.getOxmClass());
+        assertEquals(NxmNxCtState.VALUE, input.getOxmMatchField());
+        assertEquals(true, input.getHasMask());
         assertEquals(1, result.getCtStateValues().getCtState().intValue());
         assertEquals(2, result.getCtStateValues().getMask().intValue());
     }
@@ -70,19 +64,19 @@ public class CtStateCodecTest {
         final CtStateCaseValueBuilder caseBuilder = new CtStateCaseValueBuilder();
         final CtStateValuesBuilder valuesBuilder = new CtStateValuesBuilder();
 
-        matchEntryBuilder.setOxmClass(Nxm1Class.class);
-        matchEntryBuilder.setOxmMatchField(NxmNxCtState.class);
+        matchEntryBuilder.setOxmClass(Nxm1Class.VALUE);
+        matchEntryBuilder.setOxmMatchField(NxmNxCtState.VALUE);
         matchEntryBuilder.setHasMask(true);
 
-        valuesBuilder.setCtState((long)1);
-        valuesBuilder.setMask((long)2);
+        valuesBuilder.setCtState(Uint32.ONE);
+        valuesBuilder.setMask(Uint32.TWO);
 
         caseBuilder.setCtStateValues(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;