Update MRI upstreams for Phosphorus
[openflowplugin.git] / openflowjava / openflow-protocol-impl / src / test / java / org / opendaylight / openflowjava / protocol / impl / util / TypeKeyMakerFactoryTest.java
index c5bf61593849dd637ffe9a949611e20891ab7893..249c23cbe1e2c0b50e6b499fa175c8a974e33175 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.openflowjava.protocol.impl.util;
 
 import org.junit.Assert;
@@ -15,8 +14,8 @@ import org.opendaylight.openflowjava.protocol.api.keys.InstructionSerializerKey;
 import org.opendaylight.openflowjava.protocol.api.keys.MatchEntrySerializerKey;
 import org.opendaylight.openflowjava.protocol.api.keys.MessageTypeKey;
 import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.oxm.container.match.entry.value.ExperimenterIdCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.oxm.container.match.entry.value.experimenter.id._case.ExperimenterBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.experimenter.id.match.entry.ExperimenterIdCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.experimenter.id.match.entry.experimenter.id._case.ExperimenterBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.CopyTtlInCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.CopyTtlInCaseBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.OutputActionCase;
@@ -36,6 +35,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Matc
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OpenflowBasicClass;
 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.yangtools.yang.common.Uint32;
 
 /**
  * Unit tests for TypeKeyMakerFactory.
@@ -49,7 +49,7 @@ public class TypeKeyMakerFactoryTest {
      */
     @Test
     public void testActionKeyMaker() {
-        TypeKeyMaker<Action> keyMaker = TypeKeyMakerFactory.createActionKeyMaker(EncodeConstants.OF13_VERSION_ID);
+        TypeKeyMaker<Action> keyMaker = TypeKeyMakerFactory.createActionKeyMaker(EncodeConstants.OF_VERSION_1_3);
         Assert.assertNotNull("Null keyMaker", keyMaker);
 
         ActionBuilder builder = new ActionBuilder();
@@ -58,7 +58,7 @@ public class TypeKeyMakerFactoryTest {
         MessageTypeKey<?> key = keyMaker.make(action);
 
         Assert.assertNotNull("Null key", key);
-        Assert.assertEquals("Wrong key", new ActionSerializerKey<>(EncodeConstants.OF13_VERSION_ID,
+        Assert.assertEquals("Wrong key", new ActionSerializerKey<>(EncodeConstants.OF_VERSION_1_3,
                         OutputActionCase.class, null), key);
     }
 
@@ -67,19 +67,19 @@ public class TypeKeyMakerFactoryTest {
      */
     @Test
     public void testExperimenterActionKeyMaker() {
-        TypeKeyMaker<Action> keyMaker = TypeKeyMakerFactory.createActionKeyMaker(EncodeConstants.OF13_VERSION_ID);
+        TypeKeyMaker<Action> keyMaker = TypeKeyMakerFactory.createActionKeyMaker(EncodeConstants.OF_VERSION_1_3);
         Assert.assertNotNull("Null keyMaker", keyMaker);
 
         org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping
             .ActionBuilder builder = new ActionBuilder();
-        builder.setExperimenterId(new ExperimenterId(42L));
+        builder.setExperimenterId(new ExperimenterId(Uint32.valueOf(42)));
         builder.setActionChoice(new CopyTtlInCaseBuilder().build());
         Action action = builder.build();
         MessageTypeKey<?> key = keyMaker.make(action);
 
         Assert.assertNotNull("Null key", key);
-        Assert.assertEquals("Wrong key", new ActionSerializerKey<>(EncodeConstants.OF13_VERSION_ID,
-                CopyTtlInCase.class, 42L), key);
+        Assert.assertEquals("Wrong key", new ActionSerializerKey<>(EncodeConstants.OF_VERSION_1_3,
+                CopyTtlInCase.class, Uint32.valueOf(42)), key);
     }
 
     /**
@@ -88,7 +88,7 @@ public class TypeKeyMakerFactoryTest {
     @Test
     public void testInstructionKeyMaker() {
         TypeKeyMaker<Instruction> keyMaker =
-                TypeKeyMakerFactory.createInstructionKeyMaker(EncodeConstants.OF13_VERSION_ID);
+                TypeKeyMakerFactory.createInstructionKeyMaker(EncodeConstants.OF_VERSION_1_3);
         Assert.assertNotNull("Null keyMaker", keyMaker);
 
         InstructionBuilder builder = new InstructionBuilder();
@@ -97,7 +97,7 @@ public class TypeKeyMakerFactoryTest {
         MessageTypeKey<?> key = keyMaker.make(instruction);
 
         Assert.assertNotNull("Null key", key);
-        Assert.assertEquals("Wrong key", new InstructionSerializerKey<>(EncodeConstants.OF13_VERSION_ID,
+        Assert.assertEquals("Wrong key", new InstructionSerializerKey<>(EncodeConstants.OF_VERSION_1_3,
                         GotoTableCase.class, null), key);
     }
 
@@ -107,17 +107,17 @@ public class TypeKeyMakerFactoryTest {
     @Test
     public void testExperimenterInstructionKeyMaker() {
         TypeKeyMaker<Instruction> keyMaker =
-                TypeKeyMakerFactory.createInstructionKeyMaker(EncodeConstants.OF13_VERSION_ID);
+                TypeKeyMakerFactory.createInstructionKeyMaker(EncodeConstants.OF_VERSION_1_3);
         Assert.assertNotNull("Null keyMaker", keyMaker);
 
         InstructionBuilder builder = new InstructionBuilder();
-        builder.setExperimenterId(new ExperimenterId(42L));
+        builder.setExperimenterId(new ExperimenterId(Uint32.valueOf(42)));
         builder.setInstructionChoice(new ClearActionsCaseBuilder().build());
         Instruction instruction = builder.build();
         MessageTypeKey<?> key = keyMaker.make(instruction);
 
         Assert.assertNotNull("Null key", key);
-        Assert.assertEquals("Wrong key", new InstructionSerializerKey<>(EncodeConstants.OF13_VERSION_ID,
+        Assert.assertEquals("Wrong key", new InstructionSerializerKey<>(EncodeConstants.OF_VERSION_1_3,
                         ClearActionsCase.class, 42L), key);
     }
 
@@ -127,7 +127,7 @@ public class TypeKeyMakerFactoryTest {
     @Test
     public void testMatchEntriesKeyMaker() {
         TypeKeyMaker<MatchEntry> keyMaker =
-                TypeKeyMakerFactory.createMatchEntriesKeyMaker(EncodeConstants.OF13_VERSION_ID);
+                TypeKeyMakerFactory.createMatchEntriesKeyMaker(EncodeConstants.OF_VERSION_1_3);
         Assert.assertNotNull("Null keyMaker", keyMaker);
 
         MatchEntryBuilder builder = new MatchEntryBuilder();
@@ -138,7 +138,7 @@ public class TypeKeyMakerFactoryTest {
         MessageTypeKey<?> key = keyMaker.make(entry);
 
         Assert.assertNotNull("Null key", key);
-        MatchEntrySerializerKey<?, ?> comparationKey = new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID,
+        MatchEntrySerializerKey<?, ?> comparationKey = new MatchEntrySerializerKey<>(EncodeConstants.OF_VERSION_1_3,
                 OpenflowBasicClass.class, InPort.class);
         Assert.assertEquals("Wrong key", comparationKey, key);
     }
@@ -149,7 +149,7 @@ public class TypeKeyMakerFactoryTest {
     @Test
     public void testExperimenterMatchEntriesKeyMaker() {
         TypeKeyMaker<MatchEntry> keyMaker =
-                TypeKeyMakerFactory.createMatchEntriesKeyMaker(EncodeConstants.OF13_VERSION_ID);
+                TypeKeyMakerFactory.createMatchEntriesKeyMaker(EncodeConstants.OF_VERSION_1_3);
         Assert.assertNotNull("Null keyMaker", keyMaker);
 
         MatchEntryBuilder builder = new MatchEntryBuilder();
@@ -158,16 +158,16 @@ public class TypeKeyMakerFactoryTest {
         builder.setHasMask(true);
         ExperimenterIdCaseBuilder caseBuilder = new ExperimenterIdCaseBuilder();
         ExperimenterBuilder expBuilder = new ExperimenterBuilder();
-        expBuilder.setExperimenter(new ExperimenterId(42L));
+        expBuilder.setExperimenter(new ExperimenterId(Uint32.valueOf(42)));
         caseBuilder.setExperimenter(expBuilder.build());
         builder.setMatchEntryValue(caseBuilder.build());
         MatchEntry entry = builder.build();
         MessageTypeKey<?> key = keyMaker.make(entry);
 
         Assert.assertNotNull("Null key", key);
-        MatchEntrySerializerKey<?, ?> comparationKey = new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID,
+        MatchEntrySerializerKey<?, ?> comparationKey = new MatchEntrySerializerKey<>(EncodeConstants.OF_VERSION_1_3,
                 ExperimenterClass.class, OxmMatchFieldClass.class);
-        comparationKey.setExperimenterId(42L);
+        comparationKey.setExperimenterId(Uint32.valueOf(42L));
         Assert.assertEquals("Wrong key", comparationKey, key);
     }