Fix checkstyle warnings for translator and registry package 36/61836/6
authormiroslav.macko <miroslav.macko@pantheon.tech>
Wed, 16 Aug 2017 11:58:47 +0000 (13:58 +0200)
committerMiroslav Macko <miroslav.macko@pantheon.tech>
Tue, 22 Aug 2017 08:46:47 +0000 (08:46 +0000)
See also: bug 8607

Change-Id: I793e00ae546e745cb42c0917494c7896f3b95719
Signed-off-by: miroslav.macko <miroslav.macko@pantheon.tech>
16 files changed:
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/registry/flow/DeviceFlowRegistryImpl.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/registry/flow/FlowDescriptorFactory.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/registry/flow/FlowRegistryKeyFactory.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/translator/AggregatedFlowStatisticsTranslator.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/translator/FlowRemovedTranslator.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/translator/FlowRemovedV10Translator.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/translator/PacketReceivedTranslator.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/translator/PortUpdateTranslator.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/translator/TranslatorLibraryBuilder.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/registry/flow/DeviceFlowRegistryImplTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/registry/flow/FlowRegistryKeyFactoryTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/registry/flow/TestFlowHelper.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/translator/AggregatedFlowStatisticsTranslatorTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/translator/FlowRemovedTranslatorTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/translator/PacketReceivedTranslatorTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/translator/PortUpdateTranslatorTest.java

index 5009323f93c76aa89aef1a84634578c7d5cdaa3b..bb53d3b5708096f198087cc34e66a07933dbd924 100644 (file)
@@ -55,7 +55,9 @@ public class DeviceFlowRegistryImpl implements DeviceFlowRegistry {
     private final List<ListenableFuture<List<Optional<FlowCapableNode>>>> lastFillFutures = new ArrayList<>();
     private final Consumer<Flow> flowConsumer;
 
-    public DeviceFlowRegistryImpl(final short version, final DataBroker dataBroker, final KeyedInstanceIdentifier<Node, NodeKey> instanceIdentifier) {
+    public DeviceFlowRegistryImpl(final short version,
+                                  final DataBroker dataBroker,
+                                  final KeyedInstanceIdentifier<Node, NodeKey> instanceIdentifier) {
         this.dataBroker = dataBroker;
         this.instanceIdentifier = instanceIdentifier;
 
@@ -81,22 +83,27 @@ public class DeviceFlowRegistryImpl implements DeviceFlowRegistry {
         final InstanceIdentifier<FlowCapableNode> path = instanceIdentifier.augmentation(FlowCapableNode.class);
 
         // First, try to fill registry with flows from DS/Configuration
-        final CheckedFuture<Optional<FlowCapableNode>, ReadFailedException> configFuture = fillFromDatastore(LogicalDatastoreType.CONFIGURATION, path);
+        final CheckedFuture<Optional<FlowCapableNode>, ReadFailedException> configFuture =
+                fillFromDatastore(LogicalDatastoreType.CONFIGURATION, path);
 
         // Now, try to fill registry with flows from DS/Operational
         // in case of cluster fail over, when clients are not using DS/Configuration
         // for adding flows, but only RPCs
-        final CheckedFuture<Optional<FlowCapableNode>, ReadFailedException> operationalFuture = fillFromDatastore(LogicalDatastoreType.OPERATIONAL, path);
+        final CheckedFuture<Optional<FlowCapableNode>, ReadFailedException> operationalFuture =
+                fillFromDatastore(LogicalDatastoreType.OPERATIONAL, path);
 
         // And at last, chain and return futures created above.
         // Also, cache this future, so call to DeviceFlowRegistry.close() will be able
         // to cancel this future immediately if it will be still in progress
-        final ListenableFuture<List<Optional<FlowCapableNode>>> lastFillFuture = Futures.allAsList(Arrays.asList(configFuture, operationalFuture));
+        final ListenableFuture<List<Optional<FlowCapableNode>>> lastFillFuture =
+                Futures.allAsList(Arrays.asList(configFuture, operationalFuture));
         lastFillFutures.add(lastFillFuture);
         return lastFillFuture;
     }
 
-    private CheckedFuture<Optional<FlowCapableNode>, ReadFailedException> fillFromDatastore(final LogicalDatastoreType logicalDatastoreType, final InstanceIdentifier<FlowCapableNode> path) {
+    private CheckedFuture<Optional<FlowCapableNode>, ReadFailedException>
+            fillFromDatastore(final LogicalDatastoreType logicalDatastoreType,
+                              final InstanceIdentifier<FlowCapableNode> path) {
         // Create new read-only transaction
         final ReadOnlyTransaction transaction = dataBroker.newReadOnlyTransaction();
 
@@ -135,7 +142,7 @@ public class DeviceFlowRegistryImpl implements DeviceFlowRegistry {
             }
 
             @Override
-            public void onFailure(Throwable t) {
+            public void onFailure(Throwable throwable) {
                 // Even when read operation failed, close the transaction
                 transaction.close();
             }
@@ -159,13 +166,16 @@ public class DeviceFlowRegistryImpl implements DeviceFlowRegistry {
         try {
             if (LOG.isTraceEnabled()) {
                 LOG.trace("Storing flowDescriptor with table ID : {} and flow ID : {} for flow hash : {}",
-                        flowDescriptor.getTableKey().getId(), flowDescriptor.getFlowId().getValue(), flowRegistryKey.hashCode());
+                        flowDescriptor.getTableKey().getId(),
+                        flowDescriptor.getFlowId().getValue(),
+                        flowRegistryKey.hashCode());
             }
 
             flowRegistry.put(flowRegistryKey, flowDescriptor);
         } catch (IllegalArgumentException ex) {
             if (LOG.isWarnEnabled()) {
-                LOG.warn("Flow with flow ID {} already exists in table {}, generating alien flow ID", flowDescriptor.getFlowId().getValue(),
+                LOG.warn("Flow with flow ID {} already exists in table {}, generating alien flow ID",
+                        flowDescriptor.getFlowId().getValue(),
                         flowDescriptor.getTableKey().getId());
             }
 
@@ -183,7 +193,8 @@ public class DeviceFlowRegistryImpl implements DeviceFlowRegistry {
     public void store(final FlowRegistryKey flowRegistryKey) {
         if (Objects.isNull(retrieveDescriptor(flowRegistryKey))) {
             if (LOG.isDebugEnabled()) {
-                LOG.debug("Flow descriptor for flow hash : {} not found, generating alien flow ID", flowRegistryKey.hashCode());
+                LOG.debug("Flow descriptor for flow hash : {} not found, generating alien flow ID",
+                        flowRegistryKey.hashCode());
             }
 
             // We do not found flow in flow registry, that means it do not have any ID already assigned, so we need
index 2638aaeee237c3479e2fa7ef64859fe8c2534fac..0668b2924f39dfe34751035032a98378c81b6d2b 100644 (file)
@@ -16,8 +16,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.Fl
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.TableKey;
 
 /**
- * This class serves as factory for creating {@link org.opendaylight.openflowplugin.api.openflow.registry.flow.FlowDescriptor}
- * Created by Martin Bobak &lt;mbobak@cisco.com&gt; on 9.4.2015.
+ * This class serves as factory for creating
+ * {@link org.opendaylight.openflowplugin.api.openflow.registry.flow.FlowDescriptor}.
  */
 public class FlowDescriptorFactory {
 
@@ -43,12 +43,15 @@ public class FlowDescriptorFactory {
         }
 
         @Override
-        public boolean equals(Object o) {
-            if (this == o) return true;
-            if (o == null || getClass() != o.getClass()) return false;
-            FlowDescriptorDto that = (FlowDescriptorDto) o;
-            return Objects.equal(flowId, that.flowId) &&
-                    Objects.equal(tableKey, that.tableKey);
+        public boolean equals(Object object) {
+            if (this == object) {
+                return true;
+            }
+            if (object == null || getClass() != object.getClass()) {
+                return false;
+            }
+            FlowDescriptorDto that = (FlowDescriptorDto) object;
+            return Objects.equal(flowId, that.flowId) && Objects.equal(tableKey, that.tableKey);
         }
 
         @Override
index 8febbd1f9fa463be67e73568bbd29dd65ffc0dc1..4a0908c2256806619ea17a66980259bc55255372 100644 (file)
@@ -29,8 +29,10 @@ public class FlowRegistryKeyFactory {
         //TODO: mandatory flow input values (or default values) should be specified via yang model
         final short tableId = Preconditions.checkNotNull(flow.getTableId(), "flow tableId must not be null");
         final int priority = MoreObjects.firstNonNull(flow.getPriority(), OFConstants.DEFAULT_FLOW_PRIORITY);
-        final BigInteger cookie = MoreObjects.firstNonNull(flow.getCookie(), OFConstants.DEFAULT_FLOW_COOKIE).getValue();
-        final Match match = MatchNormalizationUtil.normalizeMatch(MoreObjects.firstNonNull(flow.getMatch(), OFConstants.EMPTY_MATCH), version);
+        final BigInteger cookie =
+                MoreObjects.firstNonNull(flow.getCookie(), OFConstants.DEFAULT_FLOW_COOKIE).getValue();
+        final Match match = MatchNormalizationUtil
+                .normalizeMatch(MoreObjects.firstNonNull(flow.getMatch(), OFConstants.EMPTY_MATCH), version);
         return new FlowRegistryKeyDto(tableId, priority, cookie, match);
     }
 
@@ -51,21 +53,21 @@ public class FlowRegistryKeyFactory {
         }
 
         @Override
-        public boolean equals(final Object o) {
-            if (this == o) {
+        public boolean equals(final Object object) {
+            if (this == object) {
                 return true;
             }
 
-            if (o == null || !(o instanceof FlowRegistryKey)) {
+            if (object == null || !(object instanceof FlowRegistryKey)) {
                 return false;
             }
 
-            final FlowRegistryKey that = (FlowRegistryKey) o;
+            final FlowRegistryKey that = (FlowRegistryKey) object;
 
-            return getPriority() == that.getPriority() &&
-                    getTableId() == that.getTableId() &&
-                    getCookie().equals(that.getCookie()) &&
-                    getMatch().equals(that.getMatch());
+            return getPriority() == that.getPriority()
+                    && getTableId() == that.getTableId()
+                    && getCookie().equals(that.getCookie())
+                    && getMatch().equals(that.getMatch());
         }
 
         @Override
@@ -97,5 +99,4 @@ public class FlowRegistryKeyFactory {
             return match;
         }
     }
-
 }
index 443f08df118b50a774fd81d00397f36bb4218be5..c38341859e4ac6bb375d729f235ac0727871721e 100644 (file)
@@ -18,12 +18,11 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyAggregateCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.aggregate._case.MultipartReplyAggregate;
 
-/**
- * Created by tkubas on 4/27/15.
- */
 public class AggregatedFlowStatisticsTranslator implements MessageTranslator<MultipartReply, AggregatedFlowStatistics> {
     @Override
-    public AggregatedFlowStatistics translate(final MultipartReply input, final DeviceInfo deviceInfo, final Object connectionDistinguisher) {
+    public AggregatedFlowStatistics translate(final MultipartReply input,
+                                              final DeviceInfo deviceInfo,
+                                              final Object connectionDistinguisher) {
         AggregatedFlowStatisticsBuilder aggregatedFlowStatisticsBuilder = new AggregatedFlowStatisticsBuilder();
 
         MultipartReplyAggregateCase caseBody = (MultipartReplyAggregateCase)input.getMultipartReplyBody();
index cbf3ead09958666ecdf79027679e02abc75b00bb..46828cc205ed818d759a093e99950272ac22ec00 100644 (file)
@@ -23,11 +23,13 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
- * translate {@link FlowRemoved} message to FlowRemoved notification (omit instructions)
+ * Translate {@link FlowRemoved} message to FlowRemoved notification (omit instructions).
  */
-public class FlowRemovedTranslator implements MessageTranslator<FlowRemoved, org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowRemoved> {
+public class FlowRemovedTranslator implements MessageTranslator
+        <FlowRemoved, org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowRemoved> {
     private final ConvertorExecutor convertorExecutor;
     private static final Logger LOG = LoggerFactory.getLogger(FlowRemovedTranslator.class);
+
     public FlowRemovedTranslator(ConvertorExecutor convertorExecutor) {
         this.convertorExecutor = convertorExecutor;
     }
@@ -37,7 +39,8 @@ public class FlowRemovedTranslator implements MessageTranslator<FlowRemoved, org
     }
 
     @Override
-    public org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowRemoved translate(FlowRemoved input, DeviceInfo deviceInfo, Object connectionDistinguisher) {
+    public org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowRemoved
+            translate(FlowRemoved input, DeviceInfo deviceInfo, Object connectionDistinguisher) {
         FlowRemovedBuilder flowRemovedBld = new FlowRemovedBuilder()
                 .setMatch(translateMatch(input, deviceInfo).build())
                 .setCookie(new FlowCookie(input.getCookie()))
@@ -45,7 +48,7 @@ public class FlowRemovedTranslator implements MessageTranslator<FlowRemoved, org
                 .setPriority(input.getPriority())
                 .setTableId(translateTableId(input));
 
-        if(Objects.nonNull(input.getReason())) {
+        if (Objects.nonNull(input.getReason())) {
             flowRemovedBld.setReason(translateReason(input));
         }
 
@@ -53,7 +56,8 @@ public class FlowRemovedTranslator implements MessageTranslator<FlowRemoved, org
     }
 
     protected MatchBuilder translateMatch(FlowRemoved flowRemoved, DeviceInfo deviceInfo) {
-        final VersionDatapathIdConvertorData datapathIdConvertorData = new VersionDatapathIdConvertorData(deviceInfo.getVersion());
+        final VersionDatapathIdConvertorData datapathIdConvertorData =
+                new VersionDatapathIdConvertorData(deviceInfo.getVersion());
         datapathIdConvertorData.setDatapathId(deviceInfo.getDatapathId());
 
         final Optional<MatchBuilder> matchBuilderOptional = getConvertorExecutor().convert(
index 997321dfac858abe94f6898d68eaf64017e94f6b..ad69683633be1b2ebea1856d837dff1e993cbb5c 100644 (file)
@@ -16,7 +16,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.M
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowRemoved;
 
 /**
- * translate {@link FlowRemoved} message to FlowRemoved notification (omit instructions)
+ * Translate {@link FlowRemoved} message to FlowRemoved notification (omit instructions).
  */
 public class FlowRemovedV10Translator extends FlowRemovedTranslator {
 
@@ -26,7 +26,8 @@ public class FlowRemovedV10Translator extends FlowRemovedTranslator {
 
     @Override
     protected MatchBuilder translateMatch(FlowRemoved flowRemoved, DeviceInfo deviceInfo) {
-        final VersionDatapathIdConvertorData datapathIdConvertorData = new VersionDatapathIdConvertorData(deviceInfo.getVersion());
+        final VersionDatapathIdConvertorData datapathIdConvertorData =
+                new VersionDatapathIdConvertorData(deviceInfo.getVersion());
         datapathIdConvertorData.setDatapathId(deviceInfo.getDatapathId());
 
         final Optional<MatchBuilder> matchBuilderOptional = getConvertorExecutor().convert(
index a3423ac69a8ef3ec26e452cfa98dee142d287cc6..c7d3a54b25a150ec892b459ef73fbfad2ac5efca 100644 (file)
@@ -29,9 +29,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.Pa
 import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.packet.received.MatchBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TableId;
 
-/**
- * Created by tkubas on 4/1/15.
- */
 public class PacketReceivedTranslator implements MessageTranslator<PacketInMessage, PacketReceived> {
     private final ConvertorExecutor convertorExecutor;
 
@@ -40,7 +37,9 @@ public class PacketReceivedTranslator implements MessageTranslator<PacketInMessa
     }
 
     @Override
-    public PacketReceived translate(final PacketInMessage input, final DeviceInfo deviceInfo, final Object connectionDistinguisher) {
+    public PacketReceived translate(final PacketInMessage input,
+                                    final DeviceInfo deviceInfo,
+                                    final Object connectionDistinguisher) {
 
         PacketReceivedBuilder packetReceivedBuilder = new PacketReceivedBuilder();
         BigInteger datapathId = deviceInfo.getDatapathId();
@@ -69,7 +68,8 @@ public class PacketReceivedTranslator implements MessageTranslator<PacketInMessa
         }
 
         if (input.getMatch() != null) {
-            org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.packet.received.Match packetInMatch = getPacketInMatch(input, datapathId);
+            org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.packet.received.Match packetInMatch =
+                    getPacketInMatch(input, datapathId);
             packetReceivedBuilder.setMatch(packetInMatch);
         }
 
@@ -77,23 +77,28 @@ public class PacketReceivedTranslator implements MessageTranslator<PacketInMessa
     }
 
     @VisibleForTesting
-    org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.packet.received.Match getPacketInMatch(final PacketInMessage input, final BigInteger datapathId) {
-        final VersionDatapathIdConvertorData datapathIdConvertorData = new VersionDatapathIdConvertorData(input.getVersion());
+    org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.packet.received.Match
+            getPacketInMatch(final PacketInMessage input, final BigInteger datapathId) {
+
+        final VersionDatapathIdConvertorData datapathIdConvertorData =
+                new VersionDatapathIdConvertorData(input.getVersion());
         datapathIdConvertorData.setDatapathId(datapathId);
 
-        final Optional<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder> matchOptional = convertorExecutor.convert(input.getMatch(), datapathIdConvertorData);
-        final MatchBuilder matchBuilder = matchOptional.isPresent() ?
-                new MatchBuilder(matchOptional.get().build()) :
-                new MatchBuilder();
+        final Optional<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder>
+                matchOptional = convertorExecutor.convert(input.getMatch(), datapathIdConvertorData);
+        final MatchBuilder matchBuilder = matchOptional.isPresent()
+                ? new MatchBuilder(matchOptional.get().build())
+                : new MatchBuilder();
 
-        final AugmentTuple<org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.packet.received.Match> matchExtensionWrap =
-                MatchExtensionHelper.processAllExtensions(
+        final AugmentTuple<org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.packet.received.Match>
+                matchExtensionWrap = MatchExtensionHelper.processAllExtensions(
                         input.getMatch().getMatchEntry(),
                         OpenflowVersion.get(input.getVersion()),
                         MatchPath.PACKETRECEIVED_MATCH);
 
         if (matchExtensionWrap != null) {
-            matchBuilder.addAugmentation(matchExtensionWrap.getAugmentationClass(), matchExtensionWrap.getAugmentationObject());
+            matchBuilder.addAugmentation(matchExtensionWrap.getAugmentationClass(),
+                                         matchExtensionWrap.getAugmentationObject());
         }
 
         return matchBuilder.build();
index f09258f4dc7f0edcac25da55ac4961a43994e43f..062a835dde0ac95f82c54198bfaa549416501d78 100644 (file)
@@ -14,16 +14,13 @@ import org.opendaylight.openflowplugin.api.openflow.device.MessageTranslator;
 import org.opendaylight.openflowplugin.openflow.md.util.PortTranslatorUtil;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnectorBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortReason;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortNumberUni;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortReason;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortGrouping;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortStatusMessage;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-/**
- * @author tkubas
- */
 public class PortUpdateTranslator implements MessageTranslator<PortGrouping, FlowCapableNodeConnector> {
     private static final Logger LOG = LoggerFactory.getLogger(PortUpdateTranslator.class);
 
@@ -46,12 +43,13 @@ public class PortUpdateTranslator implements MessageTranslator<PortGrouping, Flo
             builder.setPeerFeatures(PortTranslatorUtil.translatePortFeatures(input.getPeerFeatures()));
             builder.setState(PortTranslatorUtil.translatePortState(input.getState()));
             builder.setSupported(PortTranslatorUtil.translatePortFeatures(input.getSupportedFeatures()));
-            builder.setQueue(Collections.<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.queues.Queue>emptyList());
+            builder.setQueue(Collections
+                    .<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.queues.Queue>emptyList());
         }
         if (input instanceof PortStatusMessage) {
             if (((PortStatusMessage) input).getReason() != null) {
                 builder.setReason(PortReason.forValue(((PortStatusMessage) input).getReason().getIntValue()));
-            }else {
+            } else {
                 LOG.debug("PortStatus Message has reason as null");
             }
         }
index 78ae6af76be56386f7734368535fd945d86816cb..af5dfbe75284c7a55115637f9742a2fe33298258 100644 (file)
@@ -15,9 +15,6 @@ import org.opendaylight.openflowplugin.api.openflow.device.MessageTranslator;
 import org.opendaylight.openflowplugin.api.openflow.device.TranslatorLibrary;
 import org.opendaylight.openflowplugin.api.openflow.md.core.TranslatorKey;
 
-/**
- * Created by Martin Bobak &lt;mbobak@cisco.com&gt; on 3.4.2015.
- */
 public class TranslatorLibraryBuilder {
 
     private final Map<TranslatorKey, MessageTranslator<?, ?>> translators = new HashMap<>();
index 55d07d9d849fba2f142ae06a24ea46ef59695ac0..9a6c2c141cfa09099da09a5f67759b2298e7b064 100644 (file)
@@ -73,9 +73,11 @@ public class DeviceFlowRegistryImplTest {
 
     @Before
     public void setUp() throws Exception {
-        nodeInstanceIdentifier = InstanceIdentifier.create(Nodes.class).child(Node.class, new NodeKey(new NodeId(NODE_ID)));
+        nodeInstanceIdentifier =
+                InstanceIdentifier.create(Nodes.class).child(Node.class, new NodeKey(new NodeId(NODE_ID)));
         when(dataBroker.newReadOnlyTransaction()).thenReturn(readOnlyTransaction);
-        deviceFlowRegistry = new DeviceFlowRegistryImpl(OFConstants.OFP_VERSION_1_3, dataBroker, nodeInstanceIdentifier);
+        deviceFlowRegistry =
+                new DeviceFlowRegistryImpl(OFConstants.OFP_VERSION_1_3, dataBroker, nodeInstanceIdentifier);
         final FlowAndStatisticsMapList flowStats = TestFlowHelper.createFlowAndStatisticsMapListBuilder(1).build();
         key = FlowRegistryKeyFactory.create(OFConstants.OFP_VERSION_1_3, flowStats);
         descriptor = FlowDescriptorFactory.create(key.getTableId(), new FlowId("ut:1"));
@@ -104,7 +106,7 @@ public class DeviceFlowRegistryImplTest {
                 .setTable(Collections.singletonList(table))
                 .build();
 
-        final Map<FlowRegistryKey, FlowDescriptor> allFlowDescriptors = testFill(path, flowCapableNode);
+        final Map<FlowRegistryKey, FlowDescriptor> allFlowDescriptors = fillRegistry(path, flowCapableNode);
         final FlowRegistryKey key = FlowRegistryKeyFactory.create(OFConstants.OFP_VERSION_1_3, flow);
 
         InOrder order = inOrder(dataBroker, readOnlyTransaction);
@@ -121,29 +123,29 @@ public class DeviceFlowRegistryImplTest {
     public void testFailedFill() throws Exception {
         final InstanceIdentifier<FlowCapableNode> path = nodeInstanceIdentifier.augmentation(FlowCapableNode.class);
 
-        testFill(path, null);
+        fillRegistry(path, null);
 
-        testFill(path, new FlowCapableNodeBuilder()
+        fillRegistry(path, new FlowCapableNodeBuilder()
                 .setTable(null)
                 .build());
 
-        testFill(path, new FlowCapableNodeBuilder()
+        fillRegistry(path, new FlowCapableNodeBuilder()
                 .setTable(Collections.singletonList(null))
                 .build());
 
-        testFill(path, new FlowCapableNodeBuilder()
+        fillRegistry(path, new FlowCapableNodeBuilder()
                 .setTable(Collections.singletonList(new TableBuilder()
                         .setFlow(null)
                         .build()))
                 .build());
 
-        testFill(path, new FlowCapableNodeBuilder()
+        fillRegistry(path, new FlowCapableNodeBuilder()
                 .setTable(Collections.singletonList(new TableBuilder()
                         .setFlow(Collections.singletonList(null))
                         .build()))
                 .build());
 
-        testFill(path, new FlowCapableNodeBuilder()
+        fillRegistry(path, new FlowCapableNodeBuilder()
                 .setTable(Collections.singletonList(new TableBuilder()
                         .setFlow(Collections.singletonList(new FlowBuilder()
                                 .setId(null)
@@ -158,9 +160,10 @@ public class DeviceFlowRegistryImplTest {
         Assert.assertEquals(1, deviceFlowRegistry.getAllFlowDescriptors().size());
     }
 
-    private Map<FlowRegistryKey, FlowDescriptor> testFill(final InstanceIdentifier<FlowCapableNode> path,
-                                                          final FlowCapableNode flowCapableNode) throws Exception {
-        when(readOnlyTransaction.read(any(), any())).thenReturn(Futures.immediateCheckedFuture(Optional.fromNullable(flowCapableNode)));
+    private Map<FlowRegistryKey, FlowDescriptor> fillRegistry(final InstanceIdentifier<FlowCapableNode> path,
+                                                              final FlowCapableNode flowCapableNode) throws Exception {
+        when(readOnlyTransaction.read(any(), any()))
+                .thenReturn(Futures.immediateCheckedFuture(Optional.fromNullable(flowCapableNode)));
         deviceFlowRegistry.fill().get();
         return deviceFlowRegistry.getAllFlowDescriptors();
     }
@@ -200,7 +203,8 @@ public class DeviceFlowRegistryImplTest {
 
         //store new key
         final String alienPrefix = "#UF$TABLE*2-";
-        final FlowRegistryKey key2 = FlowRegistryKeyFactory.create(OFConstants.OFP_VERSION_1_3, TestFlowHelper.createFlowAndStatisticsMapListBuilder(2).build());
+        final FlowRegistryKey key2 = FlowRegistryKeyFactory.create(OFConstants.OFP_VERSION_1_3,
+                TestFlowHelper.createFlowAndStatisticsMapListBuilder(2).build());
         deviceFlowRegistry.store(key2);
         newFlowId = deviceFlowRegistry.retrieveDescriptor(key2).getFlowId();
 
index 35e08e6cdf9f5171f915d95bb17c1e7736024597..e1f1e4ffd7813f4ad3f8497dea69701095c46f5d 100644 (file)
@@ -45,7 +45,8 @@ public class FlowRegistryKeyFactoryTest {
     private static final Logger LOG = LoggerFactory.getLogger(FlowRegistryKeyFactoryTest.class);
 
 
-    private static final FlowsStatisticsUpdateBuilder FLOWS_STATISTICS_UPDATE_BUILDER = new FlowsStatisticsUpdateBuilder();
+    private static final FlowsStatisticsUpdateBuilder FLOWS_STATISTICS_UPDATE_BUILDER =
+            new FlowsStatisticsUpdateBuilder();
     @Mock
     private DeviceContext deviceContext;
     @Mock
@@ -82,7 +83,8 @@ public class FlowRegistryKeyFactoryTest {
 
     @Test
     public void testEqualsNegative() throws Exception {
-        final FlowAndStatisticsMapList flowStatisticsMapList1 = TestFlowHelper.createFlowAndStatisticsMapListBuilder(1).build();
+        final FlowAndStatisticsMapList flowStatisticsMapList1 =
+                TestFlowHelper.createFlowAndStatisticsMapListBuilder(1).build();
         final FlowRegistryKey key1 = FlowRegistryKeyFactory.create(deviceInfo.getVersion(), flowStatisticsMapList1);
 
         FlowRegistryKey key2;
@@ -150,7 +152,7 @@ public class FlowRegistryKeyFactoryTest {
         try {
             FlowRegistryKeyFactory.create(deviceInfo.getVersion(), fb1.build());
             Assert.fail("hash creation should have failed because of NPE");
-        } catch (Exception e) {
+        } catch (NullPointerException e) {
             // expected
             Assert.assertEquals("flow tableId must not be null", e.getMessage());
         }
@@ -159,7 +161,7 @@ public class FlowRegistryKeyFactoryTest {
         fb2.setPriority(null);
         try {
             FlowRegistryKeyFactory.create(deviceInfo.getVersion(), fb2.build());
-        } catch (Exception e) {
+        } catch (NullPointerException e) {
             // not expected
             Assert.fail("no exception was expected while hash was creating.");
         }
index 6ba94f2d88cc19b314f1033dd09067a0413cf3e1..cdc392714ab7ae210d7bebf28fd7d9e95ea90fcb 100644 (file)
@@ -18,32 +18,32 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026
 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatchBuilder;
 
 /**
- * flow building helper
+ * Flow building helper.
  */
 public class TestFlowHelper {
     /**
-     * @param i data seed
+     * Creates flow and statistics builder.
+     * @param index data seed
      * @return flow stats builder with dummy content
      */
-    protected static FlowAndStatisticsMapListBuilder createFlowAndStatisticsMapListBuilder(int i) {
+    protected static FlowAndStatisticsMapListBuilder createFlowAndStatisticsMapListBuilder(int index) {
         FlowAndStatisticsMapListBuilder flowAndStatisticsMapListBuilder = new FlowAndStatisticsMapListBuilder();
-        flowAndStatisticsMapListBuilder.setPriority(i);
-        flowAndStatisticsMapListBuilder.setTableId((short) i);
+        flowAndStatisticsMapListBuilder.setPriority(index);
+        flowAndStatisticsMapListBuilder.setTableId((short) index);
         flowAndStatisticsMapListBuilder.setCookie(new FlowCookie(BigInteger.TEN));
 
-        MatchBuilder matchBuilder = new MatchBuilder();
-
         EthernetMatchBuilder ethernetMatchBuilder = new EthernetMatchBuilder();
 
         EthernetSourceBuilder ethernetSourceBuilder = new EthernetSourceBuilder();
-        MacAddress macAddress = new MacAddress("00:00:00:00:00:0" + i);
+        MacAddress macAddress = new MacAddress("00:00:00:00:00:0" + index);
         ethernetSourceBuilder.setAddress(macAddress);
         ethernetMatchBuilder.setEthernetSource(ethernetSourceBuilder.build());
 
         EthernetDestinationBuilder ethernetDestinationBuilder = new EthernetDestinationBuilder();
-        ethernetDestinationBuilder.setAddress(new MacAddress("00:00:00:0" + i + ":00:00"));
+        ethernetDestinationBuilder.setAddress(new MacAddress("00:00:00:0" + index + ":00:00"));
         ethernetMatchBuilder.setEthernetDestination(ethernetDestinationBuilder.build());
 
+        MatchBuilder matchBuilder = new MatchBuilder();
         matchBuilder.setEthernetMatch(ethernetMatchBuilder.build());
 
         flowAndStatisticsMapListBuilder.setMatch(matchBuilder.build());
index 270582ca0bd55bc870444be893804297b8be9487..d36eb811ee281ef6f4efed409d970556c38a79b2 100644 (file)
@@ -22,7 +22,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.aggregate._case.MultipartReplyAggregateBuilder;
 
 /**
- * Test of {@link AggregatedFlowStatisticsTranslator}
+ * Test of {@link AggregatedFlowStatisticsTranslator}.
  */
 @RunWith(MockitoJUnitRunner.class)
 public class AggregatedFlowStatisticsTranslatorTest {
index edcc1696750dd518518a653c066a41303950633d..9dfa372f90328457fa7b93b447e602d531e2efc5 100644 (file)
@@ -40,7 +40,7 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
 
 /**
- * Test of {@link AggregatedFlowStatisticsTranslator}
+ * Test of {@link AggregatedFlowStatisticsTranslator}.
  */
 @RunWith(MockitoJUnitRunner.class)
 public class FlowRemovedTranslatorTest {
@@ -82,7 +82,8 @@ public class FlowRemovedTranslatorTest {
 
     @Test
     public void testTranslate() throws Exception {
-        org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowRemoved flowRemovedMessage = buildMessage(false);
+        org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowRemoved flowRemovedMessage =
+                buildMessage(false);
         final FlowRemoved flowRemoved = translator.translate(flowRemovedMessage, deviceInfo, null);
 
         assertEquals(flowRemovedMessage.getCookie(), flowRemoved.getCookie().getValue());
@@ -92,7 +93,8 @@ public class FlowRemovedTranslatorTest {
 
     @Test
     public void testTranslateV10() throws Exception {
-        org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowRemoved flowRemovedMessage = buildMessage(true);
+        org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowRemoved flowRemovedMessage =
+                buildMessage(true);
         final FlowRemoved flowRemoved = translatorV10.translate(flowRemovedMessage, deviceInfo, null);
 
         assertEquals(flowRemovedMessage.getCookie(), flowRemoved.getCookie().getValue());
@@ -100,7 +102,8 @@ public class FlowRemovedTranslatorTest {
         assertEquals((short)0, flowRemoved.getTableId().shortValue());
     }
 
-    private org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowRemoved buildMessage(boolean isV10) {
+    private org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowRemoved
+            buildMessage(boolean isV10) {
         FlowRemovedMessageBuilder builder = new FlowRemovedMessageBuilder()
                 .setCookie(BigInteger.ONE)
                 .setReason(FlowRemovedReason.OFPRRGROUPDELETE)
index 809cfce7ab136ada550a7f823a9b07824950b25d..6803d5deb6f422457bb130cb3978d9197b34a475 100644 (file)
@@ -51,10 +51,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.Pa
 import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.packet.received.Match;
 import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
 
-/**
- * Created by tkubas on 4/1/15.
- */
-
 @RunWith(MockitoJUnitRunner.class)
 public class PacketReceivedTranslatorTest {
 
@@ -79,10 +75,10 @@ public class PacketReceivedTranslatorTest {
 
     ConvertorManager convertorManager;
 
-    static final Long PORT_NO = 5l;
-    static final Long PORT_NO_DS = 6l;
+    static final Long PORT_NO = 5L;
+    static final Long PORT_NO_DS = 6L;
     static final String DATA = "Test_Data";
-    static final Long PORT_NUM_VALUE = 11l;
+    static final Long PORT_NUM_VALUE = 11L;
 
     @Before
     public void setUp() throws Exception {
index 8133692c96c9f4d9edaa390ebc6b445a8b00cad2..4e3a449fe2f4fcf73203740c48907fa9646f66c8 100644 (file)
@@ -18,7 +18,6 @@ import org.mockito.runners.MockitoJUnitRunner;
 import org.opendaylight.openflowplugin.api.OFConstants;
 import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
 import org.opendaylight.openflowplugin.api.openflow.device.DeviceInfo;
-import org.opendaylight.openflowplugin.api.openflow.device.DeviceState;
 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.FlowCapableNodeConnector;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.flow.capable.port.StateBuilder;
@@ -32,7 +31,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev13
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortStatusMessageBuilder;
 
 /**
- * Test of {@link PortUpdateTranslator}
+ * Test of {@link PortUpdateTranslator}.
  */
 @RunWith(MockitoJUnitRunner.class)
 public class PortUpdateTranslatorTest {
@@ -41,8 +40,6 @@ public class PortUpdateTranslatorTest {
     @Mock
     private DeviceContext deviceContext;
     @Mock
-    private DeviceState deviceState;
-    @Mock
     private DeviceInfo deviceInfo;
 
     private org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortConfig portConfig;
@@ -69,7 +66,8 @@ public class PortUpdateTranslatorTest {
                         .getDefaultInstance("hundredGbFd");
 
 
-        final FlowCapableNodeConnector nodeConnector = portUpdateTranslator.translate(portBld.build(), deviceInfo, null);
+        final FlowCapableNodeConnector nodeConnector =
+                portUpdateTranslator.translate(portBld.build(), deviceInfo, null);
 
         commonCheck(nodeConnector);
 
@@ -99,7 +97,8 @@ public class PortUpdateTranslatorTest {
                         null, false, false, null, null, null, null, null
                 );
 
-        final FlowCapableNodeConnector nodeConnector = portUpdateTranslator.translate(portBld.build(), deviceInfo, null);
+        final FlowCapableNodeConnector nodeConnector =
+                portUpdateTranslator.translate(portBld.build(), deviceInfo, null);
 
         commonCheck(nodeConnector);