Merge "Remove redundant type specifiers"
[openflowplugin.git] / openflowplugin / src / test / java / org / opendaylight / openflowplugin / openflow / md / core / sal / convertor / PortConvertorTest.java
index 06e143c648aae36370908ffbaa760ec1054f15c1..7542174e2a3acafaf6478f8d5371243d7cc69ff0 100644 (file)
@@ -11,10 +11,11 @@ import java.util.Optional;
 import org.junit.Assert;
 import org.junit.Test;
 import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
 import org.opendaylight.openflowplugin.api.OFConstants;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnectorBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.FlowCapablePort;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortConfig;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortFeatures;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortNumberUni;
@@ -31,35 +32,32 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731
 
 public class PortConvertorTest {
 
-    /** defautl mac address */
     private static final String DEFAULT_MAC_ADDRESS = "01:02:03:04:05:06";
 
-    private PortFeatures features = new PortFeatures(true, null, null, null, null, null, null, null, null, null, null,
-            null, null, null, null, null);
+    private final PortFeatures features = new PortFeatures(true, null, null, null, null, null, null, null, null, null,
+            null, null, null, null, null, null);
 
-    private PortConfig config = new PortConfig(false, false, false, false);
+    private final PortConfig config = new PortConfig(false, false, false, false);
 
-    private org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortFeatures portf31=
+    private final org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortFeatures portf31 =
             new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortFeatures(
                     null, null, null, null, null, null, null, null, null, null, true, null, null, null, null, null);
 
-    private org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortConfig config31 =
+    private final org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortConfig config31 =
             new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortConfig(
                     false, false, false, false);
 
-    private org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortConfig configMask31 =
-            new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortConfig(
+    private final org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortConfig
+        configMask31 = new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortConfig(
             true, true, true, true);
 
-    private PortConfigV10 portConfMaskV10 = new PortConfigV10(true, true, true, true, true, true, true);;
+    private final PortConfigV10 portConfMaskV10 = new PortConfigV10(true, true, true, true, true, true, true);
 
     /**
-     * test of {@link org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.PortConvertor#convert(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.port.mod.port.Port, org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData)} }
+     * test of {@link PortConvertor#convert(Port, VersionConvertorData)} }.
      */
     @Test
-    public void testtoPortModInputwithAllParameters()
-    {
-
+    public void testtoPortModInputwithAllParameters() {
         PortBuilder portBld = new PortBuilder();
         portBld.setAdvertisedFeatures(features);
         portBld.setConfiguration(config);
@@ -69,7 +67,7 @@ public class PortConvertorTest {
         VersionConvertorData data = new VersionConvertorData(OFConstants.OFP_VERSION_1_3);
         final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
         Optional<PortModInput> portOutOptional = convertorManager.convert(portBld.build(), data);
-        PortModInput portOut = portOutOptional.orElse(PortConvertor.defaultResult(OFConstants.OFP_VERSION_1_3));
+        final PortModInput portOut = portOutOptional.orElse(PortConvertor.defaultResult(OFConstants.OFP_VERSION_1_3));
 
         PortConfigV10 portConfV10 = new PortConfigV10(false, false, false, false, true, true, false);
 
@@ -93,13 +91,12 @@ public class PortConvertorTest {
     }
 
     /**
-     * test of {@link PortConvertor#toPortDesc(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.FlowCapablePort , short)}
+     * test of {@link PortConvertor#toPortDesc(FlowCapablePort , short)}.
      */
     @Test
-    public void testtoPortDescwithAllParameters(){
+    public void testtoPortDescwithAllParameters() {
 
         State state = new StateBuilder().setBlocked(false).setLinkDown(false).setLive(false).build();
-        PortState state31= new PortState(false, false, false);
 
         FlowCapableNodeConnectorBuilder flowCapableNodeConnectorBuilder = new FlowCapableNodeConnectorBuilder();
 
@@ -115,7 +112,8 @@ public class PortConvertorTest {
         flowCapableNodeConnectorBuilder.setState(state);
         flowCapableNodeConnectorBuilder.setSupported(features);
 
-        Ports portsOut = PortConvertor.toPortDesc(flowCapableNodeConnectorBuilder.build(), EncodeConstants.OF13_VERSION_ID);
+        final Ports portsOut = PortConvertor.toPortDesc(
+                flowCapableNodeConnectorBuilder.build(), EncodeConstants.OF13_VERSION_ID);
 
         PortsBuilder portsB = new PortsBuilder();
 
@@ -128,10 +126,9 @@ public class PortConvertorTest {
         portsB.setName("foo");
         portsB.setPeerFeatures(portf31);
         portsB.setPortNo(42L);
-        portsB.setState(state31);
+        portsB.setState(new PortState(false, false, false));
         portsB.setSupportedFeatures(portf31);
 
         Assert.assertEquals(portsB.build(), portsOut);
     }
-
 }