Fixup Augmentable and Identifiable methods changing
[openflowplugin.git] / test-provider / src / main / java / org / opendaylight / openflowplugin / test / OpenflowpluginTableFeaturesTestCommandProvider.java
index 847c95f3d328943551c9fd3c180d4c1a2eabb963..751eb532d89be6f88aabf1f149baea4015039f0c 100644 (file)
@@ -7,6 +7,7 @@
  */
 package org.opendaylight.openflowplugin.test;
 
+import com.google.common.base.Preconditions;
 import com.google.common.util.concurrent.CheckedFuture;
 import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.Futures;
@@ -73,23 +74,18 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
 import org.osgi.framework.BundleContext;
 
-
+@SuppressWarnings("checkstyle:MethodName")
 public class OpenflowpluginTableFeaturesTestCommandProvider implements CommandProvider {
 
     private DataBroker dataBroker;
-    private ProviderContext pc;
     private final BundleContext ctx;
-    private TableFeatures testTable;
     private Node testNode;
-    private final String originalTableName = "Foo";
-    private final String updatedTableName = "Bar";
 
     public OpenflowpluginTableFeaturesTestCommandProvider(BundleContext ctx) {
         this.ctx = ctx;
     }
 
     public void onSessionInitiated(ProviderContext session) {
-        pc = session;
         dataBroker = session.getSALService(DataBroker.class);
         ctx.registerService(CommandProvider.class.getName(), this, null);
         // createTestNode();
@@ -99,19 +95,19 @@ public class OpenflowpluginTableFeaturesTestCommandProvider implements CommandPr
     private void createUserNode(String nodeRef) {
         NodeBuilder builder = new NodeBuilder();
         builder.setId(new NodeId(nodeRef));
-        builder.setKey(new NodeKey(builder.getId()));
+        builder.withKey(new NodeKey(builder.getId()));
         testNode = builder.build();
     }
 
     private void createTestNode() {
         NodeBuilder builder = new NodeBuilder();
         builder.setId(new NodeId(OpenflowpluginTestActivator.NODE_ID));
-        builder.setKey(new NodeKey(builder.getId()));
+        builder.withKey(new NodeKey(builder.getId()));
         testNode = builder.build();
     }
 
     private InstanceIdentifier<Node> nodeToInstanceId(Node node) {
-        return InstanceIdentifier.create(Nodes.class).child(Node.class, node.getKey());
+        return InstanceIdentifier.create(Nodes.class).child(Node.class, node.key());
     }
 
     private TableFeaturesBuilder createTestTableFeatures(String tableFeatureTypeArg) {
@@ -136,7 +132,7 @@ public class OpenflowpluginTableFeaturesTestCommandProvider implements CommandPr
 
             tableFeature.setConfig(new TableConfig(false));
 
-            List<TableFeatureProperties> properties = new ArrayList<TableFeatureProperties>();
+            List<TableFeatureProperties> properties = new ArrayList<>();
 
 
             switch (tableFeatureType) {
@@ -196,6 +192,8 @@ public class OpenflowpluginTableFeaturesTestCommandProvider implements CommandPr
                     // To set the wildcards set field match
                     properties.add(createWildCardsTblFeatureProp().build());
                     break;
+                default:
+                    break;
             }
 
 
@@ -203,7 +201,6 @@ public class OpenflowpluginTableFeaturesTestCommandProvider implements CommandPr
             propertyBld.setTableFeatureProperties(properties);
             tableFeature.setTableProperties(propertyBld.build());
         }
-        testTable = tableFeature.build();
         return tableFeature;
     }
 
@@ -211,18 +208,19 @@ public class OpenflowpluginTableFeaturesTestCommandProvider implements CommandPr
         TableFeaturePropertiesBuilder tableFeatureProperty = new TableFeaturePropertiesBuilder();
 
         //To set the ApplyActionsMiss
-        List<Action> actionList = new ArrayList<Action>();
+        List<Action> actionList = new ArrayList<>();
         ActionBuilder ab = new ActionBuilder();
 
         ab.setAction(new PopMplsActionCaseBuilder().build());
         actionList.add(ab.build());
 
         tableFeatureProperty.setTableFeaturePropType(
-                new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.ApplyActionsMissBuilder()
+            new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table
+                .feature.prop.type.ApplyActionsMissBuilder()
                         .setApplyActionsMiss(new ApplyActionsMissBuilder().setAction(actionList).build()).build());
 
         TableFeaturePropertiesKey keyValue = new TableFeaturePropertiesKey(0);
-        tableFeatureProperty.setKey(keyValue);
+        tableFeatureProperty.withKey(keyValue);
         tableFeatureProperty.setOrder(1);
 
         return tableFeatureProperty;
@@ -231,18 +229,19 @@ public class OpenflowpluginTableFeaturesTestCommandProvider implements CommandPr
 
     private TableFeaturePropertiesBuilder createApplyActionsTblFeatureProp() {
         TableFeaturePropertiesBuilder tableFeatureProperty = new TableFeaturePropertiesBuilder();
-        List<Action> actionListt5 = new ArrayList<Action>();
+        List<Action> actionListt5 = new ArrayList<>();
         ActionBuilder abt5 = new ActionBuilder();
 
         abt5.setAction(new PopMplsActionCaseBuilder().build());
         actionListt5.add(abt5.build());
 
         tableFeatureProperty.setTableFeaturePropType(
-                new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.ApplyActionsBuilder()
+            new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table
+                .feature.prop.type.ApplyActionsBuilder()
                         .setApplyActions(new ApplyActionsBuilder().setAction(actionListt5).build()).build());
 
         TableFeaturePropertiesKey keyValue = new TableFeaturePropertiesKey(0);
-        tableFeatureProperty.setKey(keyValue);
+        tableFeatureProperty.withKey(keyValue);
         tableFeatureProperty.setOrder(1);
 
         return tableFeatureProperty;
@@ -257,7 +256,7 @@ public class OpenflowpluginTableFeaturesTestCommandProvider implements CommandPr
         tableFeatureProperty.setTableFeaturePropType(nextTblBld.build());
 
         TableFeaturePropertiesKey keyValue = new TableFeaturePropertiesKey(0);
-        tableFeatureProperty.setKey(keyValue);
+        tableFeatureProperty.withKey(keyValue);
         tableFeatureProperty.setOrder(1);
 
         return tableFeatureProperty;
@@ -272,7 +271,7 @@ public class OpenflowpluginTableFeaturesTestCommandProvider implements CommandPr
         tableFeatureProperty.setTableFeaturePropType(nextTblMissBld.build());
 
         TableFeaturePropertiesKey keyValue = new TableFeaturePropertiesKey(0);
-        tableFeatureProperty.setKey(keyValue);
+        tableFeatureProperty.withKey(keyValue);
         tableFeatureProperty.setOrder(1);
 
         return tableFeatureProperty;
@@ -280,21 +279,24 @@ public class OpenflowpluginTableFeaturesTestCommandProvider implements CommandPr
 
 
     private TableFeaturePropertiesBuilder createInstructionsTblFeatureProp() {
-        TableFeaturePropertiesBuilder tableFeatureProperty = new TableFeaturePropertiesBuilder();
-
-        List<Instruction> instLst = new ArrayList<Instruction>();
         InstructionBuilder ib = new InstructionBuilder();
         ib.setOrder(1);
-        ib.setInstruction(new org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ApplyActionsCaseBuilder().build());
-        ib.setKey(new InstructionKey(1));
+        ib.setInstruction(new org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction
+                .instruction.ApplyActionsCaseBuilder().build());
+        ib.withKey(new InstructionKey(1));
 
+        List<Instruction> instLst = new ArrayList<>();
+        TableFeaturePropertiesBuilder tableFeatureProperty = new TableFeaturePropertiesBuilder();
         tableFeatureProperty.setTableFeaturePropType(
-                new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.InstructionsBuilder().setInstructions(
-                        new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.instructions.InstructionsBuilder().setInstruction(instLst).build()).build());
+            new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table
+                .feature.prop.type.InstructionsBuilder().setInstructions(
+                    new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type
+                        .table.feature.prop.type.instructions.InstructionsBuilder().setInstruction(instLst).build())
+                            .build());
 
 
         TableFeaturePropertiesKey keyValue = new TableFeaturePropertiesKey(0);
-        tableFeatureProperty.setKey(keyValue);
+        tableFeatureProperty.withKey(keyValue);
         tableFeatureProperty.setOrder(1);
 
         return tableFeatureProperty;
@@ -302,26 +304,31 @@ public class OpenflowpluginTableFeaturesTestCommandProvider implements CommandPr
 
     private TableFeaturePropertiesBuilder createInstructionsMissTblFeatureProp() {
         // To set the instructions miss -- "t7"
-        TableFeaturePropertiesBuilder tableFeatureProperty = new TableFeaturePropertiesBuilder();
 
-        List<Instruction> instLst = new ArrayList<Instruction>();
         InstructionBuilder ib1 = new InstructionBuilder();
         ib1.setOrder(1);
-        ib1.setInstruction(new org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.WriteMetadataCaseBuilder().build());
-        ib1.setKey(new InstructionKey(1));
+        ib1.setInstruction(new org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction
+                .instruction.WriteMetadataCaseBuilder().build());
+        ib1.withKey(new InstructionKey(1));
 
         InstructionBuilder ib2 = new InstructionBuilder();
         ib2.setOrder(2);
-        ib2.setInstruction(new org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.MeterCaseBuilder().build());
-        ib2.setKey(new InstructionKey(2));
+        ib2.setInstruction(new org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction
+                .instruction.MeterCaseBuilder().build());
+        ib2.withKey(new InstructionKey(2));
 
+        List<Instruction> instLst = new ArrayList<>();
+        TableFeaturePropertiesBuilder tableFeatureProperty = new TableFeaturePropertiesBuilder();
         tableFeatureProperty.setTableFeaturePropType(
-                new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.InstructionsMissBuilder().setInstructionsMiss(
-                        new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.instructions.miss.InstructionsMissBuilder().setInstruction(instLst).build()).build());
+            new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table
+                .feature.prop.type.InstructionsMissBuilder().setInstructionsMiss(
+                    new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type
+                        .table.feature.prop.type.instructions.miss.InstructionsMissBuilder().setInstruction(instLst)
+                            .build()).build());
 
 
         TableFeaturePropertiesKey keyValue = new TableFeaturePropertiesKey(0);
-        tableFeatureProperty.setKey(keyValue);
+        tableFeatureProperty.withKey(keyValue);
         tableFeatureProperty.setOrder(1);
 
         return tableFeatureProperty;
@@ -329,9 +336,8 @@ public class OpenflowpluginTableFeaturesTestCommandProvider implements CommandPr
 
     private TableFeaturePropertiesBuilder createWriteActionsTblFeatureProp() {
         // t8
-        TableFeaturePropertiesBuilder tableFeatureProperty = new TableFeaturePropertiesBuilder();
 
-        List<Action> actionList = new ArrayList<Action>();
+        List<Action> actionList = new ArrayList<>();
 
         ActionBuilder abt1 = new ActionBuilder();
         abt1.setAction(new CopyTtlOutCaseBuilder().build());
@@ -341,12 +347,15 @@ public class OpenflowpluginTableFeaturesTestCommandProvider implements CommandPr
         abt2.setAction(new PopVlanActionCaseBuilder().build());
         actionList.add(abt2.build());
 
+        TableFeaturePropertiesBuilder tableFeatureProperty = new TableFeaturePropertiesBuilder();
         tableFeatureProperty.setTableFeaturePropType(
-                new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.WriteActionsBuilder()
-                        .setWriteActions(new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.write.actions.WriteActionsBuilder().setAction(actionList).build()).build());
+            new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table
+                .feature.prop.type.WriteActionsBuilder().setWriteActions(new org.opendaylight.yang.gen.v1.urn
+                    .opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.write.actions
+                        .WriteActionsBuilder().setAction(actionList).build()).build());
 
         TableFeaturePropertiesKey keyValue = new TableFeaturePropertiesKey(0);
-        tableFeatureProperty.setKey(keyValue);
+        tableFeatureProperty.withKey(keyValue);
         tableFeatureProperty.setOrder(1);
 
         return tableFeatureProperty;
@@ -354,9 +363,7 @@ public class OpenflowpluginTableFeaturesTestCommandProvider implements CommandPr
 
     private TableFeaturePropertiesBuilder createWriteActionsMissTblFeatureProp() {
         // t9
-        TableFeaturePropertiesBuilder tableFeatureProperty = new TableFeaturePropertiesBuilder();
-
-        List<Action> actionList = new ArrayList<Action>();
+        List<Action> actionList = new ArrayList<>();
 
         ActionBuilder abt1 = new ActionBuilder();
         abt1.setAction(new CopyTtlInCaseBuilder().build());
@@ -366,12 +373,15 @@ public class OpenflowpluginTableFeaturesTestCommandProvider implements CommandPr
         abt2.setAction(new PushPbbActionCaseBuilder().build());
         actionList.add(abt2.build());
 
+        TableFeaturePropertiesBuilder tableFeatureProperty = new TableFeaturePropertiesBuilder();
         tableFeatureProperty.setTableFeaturePropType(
-                new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.WriteActionsMissBuilder()
-                        .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(actionList).build()).build());
+            new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table
+                .feature.prop.type.WriteActionsMissBuilder().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(actionList).build()).build());
 
         TableFeaturePropertiesKey keyValue = new TableFeaturePropertiesKey(0);
-        tableFeatureProperty.setKey(keyValue);
+        tableFeatureProperty.withKey(keyValue);
         tableFeatureProperty.setOrder(1);
 
         return tableFeatureProperty;
@@ -379,10 +389,8 @@ public class OpenflowpluginTableFeaturesTestCommandProvider implements CommandPr
 
     private TableFeaturePropertiesBuilder createMatchFieldTblFeatureProp() {
         //t10
-        TableFeaturePropertiesBuilder tableFeatureProperty = new TableFeaturePropertiesBuilder();
-
 
-        List<SetFieldMatch> setFieldMatch = new ArrayList<SetFieldMatch>();
+        List<SetFieldMatch> setFieldMatch = new ArrayList<>();
         SetFieldMatchBuilder setFieldMatchBld = new SetFieldMatchBuilder();
         setFieldMatchBld.setHasMask(false);
         setFieldMatchBld.setMatchType(MplsLabel.class);
@@ -394,9 +402,10 @@ public class OpenflowpluginTableFeaturesTestCommandProvider implements CommandPr
         matchSetfieldBld.setSetFieldMatch(setFieldMatch);
         matchBld.setMatchSetfield(matchSetfieldBld.build());
 
+        TableFeaturePropertiesBuilder tableFeatureProperty = new TableFeaturePropertiesBuilder();
         tableFeatureProperty.setTableFeaturePropType(matchBld.build());
         TableFeaturePropertiesKey keyValue = new TableFeaturePropertiesKey(0);
-        tableFeatureProperty.setKey(keyValue);
+        tableFeatureProperty.withKey(keyValue);
         tableFeatureProperty.setOrder(1);
 
         return tableFeatureProperty;
@@ -405,9 +414,7 @@ public class OpenflowpluginTableFeaturesTestCommandProvider implements CommandPr
 
     private TableFeaturePropertiesBuilder createWriteSetFieldTblFeatureProp() {
         //t11
-        TableFeaturePropertiesBuilder tableFeatureProperty = new TableFeaturePropertiesBuilder();
 
-        List<SetFieldMatch> setFieldMatch = new ArrayList<SetFieldMatch>();
         SetFieldMatchBuilder setFieldMatchBld1 = new SetFieldMatchBuilder();
         setFieldMatchBld1.setHasMask(false);
         setFieldMatchBld1.setMatchType(MplsLabel.class);
@@ -420,20 +427,23 @@ public class OpenflowpluginTableFeaturesTestCommandProvider implements CommandPr
         setFieldMatchBld3.setHasMask(true);
         setFieldMatchBld3.setMatchType(EthDst.class);
 
+        List<SetFieldMatch> setFieldMatch = new ArrayList<>();
         setFieldMatch.add(setFieldMatchBld1.build());
         setFieldMatch.add(setFieldMatchBld2.build());
         setFieldMatch.add(setFieldMatchBld3.build());
 
         WriteSetfieldBuilder writeSetfieldBld = new WriteSetfieldBuilder();
-        org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.write.setfield.WriteSetfieldBuilder writeSetfieldBuilder =
-                new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.write.setfield.WriteSetfieldBuilder();
+        org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop
+            .type.write.setfield.WriteSetfieldBuilder writeSetfieldBuilder =
+                new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table
+                    .feature.prop.type.write.setfield.WriteSetfieldBuilder();
         writeSetfieldBuilder.setSetFieldMatch(setFieldMatch);
         writeSetfieldBld.setWriteSetfield(writeSetfieldBuilder.build());
 
-
+        TableFeaturePropertiesBuilder tableFeatureProperty = new TableFeaturePropertiesBuilder();
         tableFeatureProperty.setTableFeaturePropType(writeSetfieldBld.build());
         TableFeaturePropertiesKey keyValue = new TableFeaturePropertiesKey(0);
-        tableFeatureProperty.setKey(keyValue);
+        tableFeatureProperty.withKey(keyValue);
         tableFeatureProperty.setOrder(1);
 
         return tableFeatureProperty;
@@ -441,9 +451,7 @@ public class OpenflowpluginTableFeaturesTestCommandProvider implements CommandPr
 
     private TableFeaturePropertiesBuilder createWriteSetFieldMissTblFeatureProp() {
         // t12
-        TableFeaturePropertiesBuilder tableFeatureProperty = new TableFeaturePropertiesBuilder();
 
-        List<SetFieldMatch> setFieldMatch = new ArrayList<SetFieldMatch>();
         SetFieldMatchBuilder setFieldMatchBld1 = new SetFieldMatchBuilder();
         setFieldMatchBld1.setHasMask(false);
         setFieldMatchBld1.setMatchType(EthSrc.class);
@@ -456,19 +464,23 @@ public class OpenflowpluginTableFeaturesTestCommandProvider implements CommandPr
         setFieldMatchBld3.setHasMask(true);
         setFieldMatchBld3.setMatchType(Ipv4Dst.class);
 
+        List<SetFieldMatch> setFieldMatch = new ArrayList<>();
         setFieldMatch.add(setFieldMatchBld1.build());
         setFieldMatch.add(setFieldMatchBld2.build());
         setFieldMatch.add(setFieldMatchBld3.build());
 
         WriteSetfieldMissBuilder writeSetfieldBld = new WriteSetfieldMissBuilder();
-        org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.write.setfield.miss.WriteSetfieldMissBuilder writeSetfieldMissBuilder =
-                new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.write.setfield.miss.WriteSetfieldMissBuilder();
+        org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop
+            .type.write.setfield.miss.WriteSetfieldMissBuilder writeSetfieldMissBuilder =
+                new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table
+                    .feature.prop.type.write.setfield.miss.WriteSetfieldMissBuilder();
         writeSetfieldMissBuilder.setSetFieldMatch(setFieldMatch);
         writeSetfieldBld.setWriteSetfieldMiss(writeSetfieldMissBuilder.build());
 
+        TableFeaturePropertiesBuilder tableFeatureProperty = new TableFeaturePropertiesBuilder();
         tableFeatureProperty.setTableFeaturePropType(writeSetfieldBld.build());
         TableFeaturePropertiesKey keyValue = new TableFeaturePropertiesKey(0);
-        tableFeatureProperty.setKey(keyValue);
+        tableFeatureProperty.withKey(keyValue);
         tableFeatureProperty.setOrder(1);
 
         return tableFeatureProperty;
@@ -476,9 +488,7 @@ public class OpenflowpluginTableFeaturesTestCommandProvider implements CommandPr
 
     private TableFeaturePropertiesBuilder createApplySetFieldTblFeatureProp() {
         //t13
-        TableFeaturePropertiesBuilder tableFeatureProperty = new TableFeaturePropertiesBuilder();
 
-        List<SetFieldMatch> setFieldMatch = new ArrayList<SetFieldMatch>();
         SetFieldMatchBuilder setFieldMatchBld1 = new SetFieldMatchBuilder();
         setFieldMatchBld1.setHasMask(false);
         setFieldMatchBld1.setMatchType(ArpOp.class);
@@ -491,19 +501,23 @@ public class OpenflowpluginTableFeaturesTestCommandProvider implements CommandPr
         setFieldMatchBld3.setHasMask(true);
         setFieldMatchBld3.setMatchType(Ipv4Dst.class);
 
+        List<SetFieldMatch> setFieldMatch = new ArrayList<>();
         setFieldMatch.add(setFieldMatchBld1.build());
         setFieldMatch.add(setFieldMatchBld2.build());
         setFieldMatch.add(setFieldMatchBld3.build());
 
         ApplySetfieldBuilder applySetfieldBld = new ApplySetfieldBuilder();
-        org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.apply.setfield.ApplySetfieldBuilder applySetfieldBuilder =
-                new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.apply.setfield.ApplySetfieldBuilder();
+        org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop
+            .type.apply.setfield.ApplySetfieldBuilder applySetfieldBuilder =
+                new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table
+                    .feature.prop.type.apply.setfield.ApplySetfieldBuilder();
         applySetfieldBuilder.setSetFieldMatch(setFieldMatch);
         applySetfieldBld.setApplySetfield(applySetfieldBuilder.build());
 
+        TableFeaturePropertiesBuilder tableFeatureProperty = new TableFeaturePropertiesBuilder();
         tableFeatureProperty.setTableFeaturePropType(applySetfieldBld.build());
         TableFeaturePropertiesKey keyValue = new TableFeaturePropertiesKey(0);
-        tableFeatureProperty.setKey(keyValue);
+        tableFeatureProperty.withKey(keyValue);
         tableFeatureProperty.setOrder(1);
 
         return tableFeatureProperty;
@@ -511,9 +525,7 @@ public class OpenflowpluginTableFeaturesTestCommandProvider implements CommandPr
 
     private TableFeaturePropertiesBuilder createApplySetFieldMissTblFeatureProp() {
         //t14
-        TableFeaturePropertiesBuilder tableFeatureProperty = new TableFeaturePropertiesBuilder();
 
-        List<SetFieldMatch> setFieldMatch = new ArrayList<SetFieldMatch>();
         SetFieldMatchBuilder setFieldMatchBld1 = new SetFieldMatchBuilder();
         setFieldMatchBld1.setHasMask(false);
         setFieldMatchBld1.setMatchType(ArpOp.class);
@@ -526,19 +538,23 @@ public class OpenflowpluginTableFeaturesTestCommandProvider implements CommandPr
         setFieldMatchBld3.setHasMask(true);
         setFieldMatchBld3.setMatchType(Ipv4Dst.class);
 
+        List<SetFieldMatch> setFieldMatch = new ArrayList<>();
         setFieldMatch.add(setFieldMatchBld1.build());
         setFieldMatch.add(setFieldMatchBld2.build());
         setFieldMatch.add(setFieldMatchBld3.build());
 
         ApplySetfieldMissBuilder applySetfieldMissBld = new ApplySetfieldMissBuilder();
-        org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.apply.setfield.miss.ApplySetfieldMissBuilder applySetfieldMissBuilder =
-                new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.apply.setfield.miss.ApplySetfieldMissBuilder();
+        org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop
+            .type.apply.setfield.miss.ApplySetfieldMissBuilder applySetfieldMissBuilder =
+                new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table
+                    .feature.prop.type.apply.setfield.miss.ApplySetfieldMissBuilder();
         applySetfieldMissBuilder.setSetFieldMatch(setFieldMatch);
         applySetfieldMissBld.setApplySetfieldMiss(applySetfieldMissBuilder.build());
 
+        TableFeaturePropertiesBuilder tableFeatureProperty = new TableFeaturePropertiesBuilder();
         tableFeatureProperty.setTableFeaturePropType(applySetfieldMissBld.build());
         TableFeaturePropertiesKey keyValue = new TableFeaturePropertiesKey(0);
-        tableFeatureProperty.setKey(keyValue);
+        tableFeatureProperty.withKey(keyValue);
         tableFeatureProperty.setOrder(1);
 
         return tableFeatureProperty;
@@ -546,9 +562,7 @@ public class OpenflowpluginTableFeaturesTestCommandProvider implements CommandPr
 
     private TableFeaturePropertiesBuilder createWildCardsTblFeatureProp() {
         //t15
-        TableFeaturePropertiesBuilder tableFeatureProperty = new TableFeaturePropertiesBuilder();
 
-        List<SetFieldMatch> setFieldMatch = new ArrayList<SetFieldMatch>();
         SetFieldMatchBuilder setFieldMatchBld1 = new SetFieldMatchBuilder();
         setFieldMatchBld1.setHasMask(false);
         setFieldMatchBld1.setMatchType(ArpOp.class);
@@ -557,7 +571,7 @@ public class OpenflowpluginTableFeaturesTestCommandProvider implements CommandPr
         setFieldMatchBld2.setHasMask(true);
         setFieldMatchBld2.setMatchType(InPort.class);
 
-
+        List<SetFieldMatch> setFieldMatch = new ArrayList<>();
         setFieldMatch.add(setFieldMatchBld1.build());
         setFieldMatch.add(setFieldMatchBld2.build());
 
@@ -567,22 +581,21 @@ public class OpenflowpluginTableFeaturesTestCommandProvider implements CommandPr
         wildcardsBuilder.setSetFieldMatch(setFieldMatch);
         wildCardsBld.setWildcardSetfield(wildcardsBuilder.build());
 
+        TableFeaturePropertiesBuilder tableFeatureProperty = new TableFeaturePropertiesBuilder();
         tableFeatureProperty.setTableFeaturePropType(wildCardsBld.build());
         TableFeaturePropertiesKey keyValue = new TableFeaturePropertiesKey(0);
-        tableFeatureProperty.setKey(keyValue);
+        tableFeatureProperty.withKey(keyValue);
         tableFeatureProperty.setOrder(1);
 
         return tableFeatureProperty;
     }
 
-
     private void writeTableFeatures(final CommandInterpreter ci, TableFeatures tableFeatures) {
-        ReadWriteTransaction modification = dataBroker.newReadWriteTransaction();
+        ReadWriteTransaction modification = Preconditions.checkNotNull(dataBroker).newReadWriteTransaction();
 
         KeyedInstanceIdentifier<TableFeatures, TableFeaturesKey> path1 = InstanceIdentifier.create(Nodes.class)
-                .child(Node.class, testNode.getKey()).augmentation(FlowCapableNode.class).
-                        child(TableFeatures.class, new TableFeaturesKey(tableFeatures.getTableId()));
-
+                .child(Node.class, testNode.key()).augmentation(FlowCapableNode.class)
+                        .child(TableFeatures.class, new TableFeaturesKey(tableFeatures.getTableId()));
 
         modification.merge(LogicalDatastoreType.OPERATIONAL, nodeToInstanceId(testNode), testNode, true);
         modification.merge(LogicalDatastoreType.OPERATIONAL, path1, tableFeatures, true);
@@ -591,7 +604,7 @@ public class OpenflowpluginTableFeaturesTestCommandProvider implements CommandPr
         CheckedFuture<Void, TransactionCommitFailedException> commitFuture = modification.submit();
         Futures.addCallback(commitFuture, new FutureCallback<Void>() {
             @Override
-            public void onSuccess(Void aVoid) {
+            public void onSuccess(Void notUsed) {
                 ci.println("Status of Group Data Loaded Transaction: success.");
             }
 
@@ -627,6 +640,5 @@ public class OpenflowpluginTableFeaturesTestCommandProvider implements CommandPr
 
         return help.toString();
     }
-
 }