Fix checkstyle warnings for impl/device package 10/62310/1
authormiroslav.macko <miroslav.macko@pantheon.tech>
Fri, 25 Aug 2017 11:40:29 +0000 (13:40 +0200)
committermiroslav.macko <miroslav.macko@pantheon.tech>
Fri, 25 Aug 2017 11:40:34 +0000 (13:40 +0200)
See also: bug 8607

Change-Id: I3f29d2ea40989877995b34211ac3e2f3aee5f637
Signed-off-by: miroslav.macko <miroslav.macko@pantheon.tech>
19 files changed:
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/device/DeviceContextImpl.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/device/DeviceManagerImpl.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/device/DeviceStateImpl.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/device/ItemLifeCycleRegistryImpl.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/device/PacketInRateLimiter.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/device/SimpleRatelimiter.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/device/TransactionChainManager.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/device/initialization/AbstractDeviceInitializer.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/device/initialization/DeviceInitializerProviderFactory.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/device/initialization/OF10DeviceInitializer.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/device/initialization/OF13DeviceInitializer.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/device/listener/MultiMsgCollectorImpl.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/device/listener/OpenflowProtocolListenerFullImpl.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/device/DeviceContextImplTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/device/DeviceManagerImplTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/device/DeviceStateImplTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/device/TransactionChainManagerTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/device/listener/MultiMsgCollectorImplTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/device/listener/OpenflowProtocolListenerFullImplTest.java

index 810673b138cdf528b3ae176747b19d17e0870a1d..0ba9468a74f6ab712bef5a6a7044e67b23a64922 100644 (file)
@@ -104,7 +104,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.Pa
 import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.PacketReceivedBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.FlowCapableNodeConnectorStatisticsData;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.FlowCapableNodeConnectorStatisticsDataBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.role.service.rev150727.SalRoleService;
 import org.opendaylight.yangtools.yang.binding.DataContainer;
 import org.opendaylight.yangtools.yang.binding.DataObject;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
@@ -141,7 +140,8 @@ public class DeviceContextImpl implements DeviceContext, ExtensionConverterProvi
     private final ItemLifeCycleKeeper flowLifeCycleKeeper;
     private final MessageTranslator<PortGrouping, FlowCapableNodeConnector> portStatusTranslator;
     private final MessageTranslator<PacketInMessage, PacketReceived> packetInTranslator;
-    private final MessageTranslator<FlowRemoved, org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowRemoved> flowRemovedTranslator;
+    private final MessageTranslator<FlowRemoved, org.opendaylight.yang.gen.v1.urn.opendaylight
+            .flow.service.rev130819.FlowRemoved> flowRemovedTranslator;
     private final TranslatorLibrary translatorLibrary;
     private final ItemLifeCycleRegistry itemLifeCycleSourceRegistry;
     private final ConvertorExecutor convertorExecutor;
@@ -162,7 +162,6 @@ public class DeviceContextImpl implements DeviceContext, ExtensionConverterProvi
     private DeviceGroupRegistry deviceGroupRegistry;
     private DeviceMeterRegistry deviceMeterRegistry;
     private ExtensionConverterProvider extensionConverterProvider;
-    private SalRoleService salRoleService;
     private ContextChainMastershipWatcher contextChainMastershipWatcher;
 
     DeviceContextImpl(@Nonnull final ConnectionContext primaryConnectionContext,
@@ -194,7 +193,8 @@ public class DeviceContextImpl implements DeviceContext, ExtensionConverterProvi
         this.portStatusTranslator = translatorLibrary.lookupTranslator(
                 new TranslatorKey(deviceInfo.getVersion(), PortGrouping.class.getName()));
         this.packetInTranslator = translatorLibrary.lookupTranslator(
-                new TranslatorKey(deviceInfo.getVersion(), org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731
+                new TranslatorKey(deviceInfo.getVersion(), org.opendaylight.yang.gen.v1.urn.opendaylight.openflow
+                        .protocol.rev130731
                         .PacketIn.class.getName()));
         this.flowRemovedTranslator = translatorLibrary.lookupTranslator(
                 new TranslatorKey(deviceInfo.getVersion(), FlowRemoved.class.getName()));
@@ -237,7 +237,7 @@ public class DeviceContextImpl implements DeviceContext, ExtensionConverterProvi
     @Override
     public <T extends DataObject> void writeToTransaction(final LogicalDatastoreType store,
                                                           final InstanceIdentifier<T> path,
-                                                          final T data){
+                                                          final T data) {
         if (initialized.get()) {
             transactionChainManager.writeToTransaction(store, path, data, false);
         }
@@ -246,14 +246,15 @@ public class DeviceContextImpl implements DeviceContext, ExtensionConverterProvi
     @Override
     public <T extends DataObject> void writeToTransactionWithParentsSlow(final LogicalDatastoreType store,
                                                                          final InstanceIdentifier<T> path,
-                                                                         final T data){
+                                                                         final T data) {
         if (initialized.get()) {
             transactionChainManager.writeToTransaction(store, path, data, true);
         }
     }
 
     @Override
-    public <T extends DataObject> void addDeleteToTxChain(final LogicalDatastoreType store, final InstanceIdentifier<T> path) {
+    public <T extends DataObject> void addDeleteToTxChain(final LogicalDatastoreType store,
+                                                          final InstanceIdentifier<T> path) {
         if (initialized.get()) {
             transactionChainManager.addDeleteOperationTotTxChain(store, path);
         }
@@ -316,7 +317,8 @@ public class DeviceContextImpl implements DeviceContext, ExtensionConverterProvi
         final ItemLifecycleListener itemLifecycleListener = flowLifeCycleKeeper.getItemLifecycleListener();
         if (itemLifecycleListener != null) {
             //2. create registry key
-            final FlowRegistryKey flowRegKey = FlowRegistryKeyFactory.create(getDeviceInfo().getVersion(), flowRemovedNotification);
+            final FlowRegistryKey flowRegKey = FlowRegistryKeyFactory.create(getDeviceInfo().getVersion(),
+                    flowRemovedNotification);
             //3. lookup flowId
             final FlowDescriptor flowDescriptor = deviceFlowRegistry.retrieveDescriptor(flowRegKey);
             //4. if flowId present:
@@ -336,8 +338,10 @@ public class DeviceContextImpl implements DeviceContext, ExtensionConverterProvi
     }
 
     @Override
+    @SuppressWarnings("checkstyle:IllegalCatch")
     public void processPortStatusMessage(final PortStatusMessage portStatus) {
-        messageSpy.spyMessage(portStatus.getImplementedInterface(), MessageSpy.StatisticsGroup.FROM_SWITCH_PUBLISHED_SUCCESS);
+        messageSpy.spyMessage(portStatus.getImplementedInterface(), MessageSpy.StatisticsGroup
+                .FROM_SWITCH_PUBLISHED_SUCCESS);
 
         if (initialized.get()) {
             try {
@@ -364,11 +368,13 @@ public class DeviceContextImpl implements DeviceContext, ExtensionConverterProvi
                                 portStatusMessage.getPortNo(),
                                 OpenflowVersion.get(deviceInfo.getVersion()))));
 
-        if (PortReason.OFPPRADD.equals(portStatusMessage.getReason()) || PortReason.OFPPRMODIFY.equals(portStatusMessage.getReason())) {
+        if (PortReason.OFPPRADD.equals(portStatusMessage.getReason())
+                || PortReason.OFPPRMODIFY.equals(portStatusMessage.getReason())) {
             // because of ADD status node connector has to be created
             writeToTransaction(LogicalDatastoreType.OPERATIONAL, iiToNodeConnector, new NodeConnectorBuilder()
                     .setKey(iiToNodeConnector.getKey())
-                    .addAugmentation(FlowCapableNodeConnectorStatisticsData.class, new FlowCapableNodeConnectorStatisticsDataBuilder().build())
+                    .addAugmentation(FlowCapableNodeConnectorStatisticsData.class, new
+                            FlowCapableNodeConnectorStatisticsDataBuilder().build())
                     .addAugmentation(FlowCapableNodeConnector.class, flowCapableNodeConnector)
                     .build());
         } else if (PortReason.OFPPRDELETE.equals(portStatusMessage.getReason())) {
@@ -416,7 +422,8 @@ public class DeviceContextImpl implements DeviceContext, ExtensionConverterProvi
         if (!packetInLimiter.acquirePermit()) {
             LOG.debug("Packet limited");
             // TODO: save packet into emergency slot if possible
-            messageSpy.spyMessage(implementedInterface, MessageSpy.StatisticsGroup.FROM_SWITCH_PACKET_IN_LIMIT_REACHED_AND_DROPPED);
+            messageSpy.spyMessage(implementedInterface, MessageSpy.StatisticsGroup
+                    .FROM_SWITCH_PACKET_IN_LIMIT_REACHED_AND_DROPPED);
             return;
         }
 
@@ -444,10 +451,11 @@ public class DeviceContextImpl implements DeviceContext, ExtensionConverterProvi
             }
 
             @Override
-            public void onFailure(final Throwable t) {
-                messageSpy.spyMessage(implementedInterface, MessageSpy.StatisticsGroup.FROM_SWITCH_NOTIFICATION_REJECTED);
-                LOG.debug("notification offer failed: {}", t.getMessage());
-                LOG.trace("notification offer failed..", t);
+            public void onFailure(final Throwable throwable) {
+                messageSpy.spyMessage(implementedInterface, MessageSpy.StatisticsGroup
+                        .FROM_SWITCH_NOTIFICATION_REJECTED);
+                LOG.debug("notification offer failed: {}", throwable.getMessage());
+                LOG.trace("notification offer failed..", throwable);
                 packetInLimiter.releasePermit();
             }
         });
@@ -460,7 +468,8 @@ public class DeviceContextImpl implements DeviceContext, ExtensionConverterProvi
         final MessageTypeKey<? extends ExperimenterDataOfChoice> key = new MessageTypeKey<>(
                 getDeviceInfo().getVersion(),
                 (Class<? extends ExperimenterDataOfChoice>) vendorData.getImplementedInterface());
-        final ConvertorMessageFromOFJava<ExperimenterDataOfChoice, MessagePath> messageConverter = extensionConverterProvider.getMessageConverter(key);
+        final ConvertorMessageFromOFJava<ExperimenterDataOfChoice, MessagePath> messageConverter =
+                extensionConverterProvider.getMessageConverter(key);
         if (messageConverter == null) {
             LOG.warn("custom converter for {}[OF:{}] not found",
                     notification.getExperimenterDataOfChoice().getImplementedInterface(),
@@ -471,7 +480,8 @@ public class DeviceContextImpl implements DeviceContext, ExtensionConverterProvi
         final ExperimenterMessageOfChoice messageOfChoice;
         try {
             messageOfChoice = messageConverter.convert(vendorData, MessagePath.MESSAGE_NOTIFICATION);
-            final ExperimenterMessageFromDevBuilder experimenterMessageFromDevBld = new ExperimenterMessageFromDevBuilder()
+            final ExperimenterMessageFromDevBuilder experimenterMessageFromDevBld = new
+                    ExperimenterMessageFromDevBuilder()
                     .setNode(new NodeRef(getDeviceInfo().getNodeInstanceIdentifier()))
                     .setExperimenterMessageOfChoice(messageOfChoice);
             // publish
@@ -519,13 +529,15 @@ public class DeviceContextImpl implements DeviceContext, ExtensionConverterProvi
     }
 
     @Override
-    public <T extends OfHeader> MultiMsgCollector<T> getMultiMsgCollector(final RequestContext<List<T>> requestContext) {
+    public <T extends OfHeader> MultiMsgCollector<T> getMultiMsgCollector(final RequestContext<List<T>>
+                                                                                      requestContext) {
         return new MultiMsgCollectorImpl<>(this, requestContext);
     }
 
     @Override
     public void updatePacketInRateLimit(final long upperBound) {
-        packetInLimiter.changeWaterMarks((int) (LOW_WATERMARK_FACTOR * upperBound), (int) (HIGH_WATERMARK_FACTOR * upperBound));
+        packetInLimiter.changeWaterMarks((int) (LOW_WATERMARK_FACTOR * upperBound),
+                (int) (HIGH_WATERMARK_FACTOR * upperBound));
     }
 
     @Override
@@ -554,7 +566,7 @@ public class DeviceContextImpl implements DeviceContext, ExtensionConverterProvi
                 ? transactionChainManager.deactivateTransactionManager()
                 : Futures.immediateFuture(null);
 
-        hashedWheelTimer.newTimeout((t) -> {
+        hashedWheelTimer.newTimeout((timerTask) -> {
             if (!listenableFuture.isDone() && !listenableFuture.isCancelled()) {
                 listenableFuture.cancel(true);
             }
@@ -597,7 +609,7 @@ public class DeviceContextImpl implements DeviceContext, ExtensionConverterProvi
                 }
 
                 @Override
-                public void onFailure(final Throwable t) {
+                public void onFailure(final Throwable throwable) {
                     transactionChainManager.close();
                     transactionChainManager = null;
                 }
@@ -615,6 +627,7 @@ public class DeviceContextImpl implements DeviceContext, ExtensionConverterProvi
     }
 
     @Override
+    @SuppressWarnings("checkstyle:IllegalCatch")
     public void instantiateServiceInstance() {
         lazyTransactionManagerInitialization();
 
@@ -657,7 +670,8 @@ public class DeviceContextImpl implements DeviceContext, ExtensionConverterProvi
                     deviceInfo.toString()));
         }
 
-        final ListenableFuture<List<com.google.common.base.Optional<FlowCapableNode>>> deviceFlowRegistryFill = getDeviceFlowRegistry().fill();
+        final ListenableFuture<List<com.google.common.base.Optional<FlowCapableNode>>> deviceFlowRegistryFill =
+                getDeviceFlowRegistry().fill();
         Futures.addCallback(deviceFlowRegistryFill,
                 new DeviceFlowRegistryCallback(deviceFlowRegistryFill, contextChainMastershipWatcher));
     }
@@ -669,7 +683,8 @@ public class DeviceContextImpl implements DeviceContext, ExtensionConverterProvi
                 LOG.debug("Transaction chain manager for node {} created", deviceInfo.getLOGValue());
             }
             this.transactionChainManager = new TransactionChainManager(dataBroker, deviceInfo);
-            this.deviceFlowRegistry = new DeviceFlowRegistryImpl(deviceInfo.getVersion(), dataBroker, deviceInfo.getNodeInstanceIdentifier());
+            this.deviceFlowRegistry = new DeviceFlowRegistryImpl(deviceInfo.getVersion(), dataBroker, deviceInfo
+                    .getNodeInstanceIdentifier());
             this.deviceGroupRegistry = new DeviceGroupRegistryImpl();
             this.deviceMeterRegistry = new DeviceMeterRegistryImpl();
         }
@@ -699,7 +714,8 @@ public class DeviceContextImpl implements DeviceContext, ExtensionConverterProvi
         hasState.set(true);
     }
 
-    private class DeviceFlowRegistryCallback implements FutureCallback<List<com.google.common.base.Optional<FlowCapableNode>>> {
+    private class DeviceFlowRegistryCallback implements FutureCallback<List<com.google.common.base
+            .Optional<FlowCapableNode>>> {
         private final ListenableFuture<List<com.google.common.base.Optional<FlowCapableNode>>> deviceFlowRegistryFill;
         private final ContextChainMastershipWatcher contextChainMastershipWatcher;
 
@@ -732,19 +748,22 @@ public class DeviceContextImpl implements DeviceContext, ExtensionConverterProvi
                         .filter(Objects::nonNull)
                         .count();
 
-                LOG.debug("Finished filling flow registry with {} flows for node: {}", flowCount, deviceInfo.getLOGValue());
+                LOG.debug("Finished filling flow registry with {} flows for node: {}", flowCount, deviceInfo
+                        .getLOGValue());
             }
-            this.contextChainMastershipWatcher.onMasterRoleAcquired(deviceInfo, ContextChainMastershipState.INITIAL_FLOW_REGISTRY_FILL);
+            this.contextChainMastershipWatcher.onMasterRoleAcquired(deviceInfo, ContextChainMastershipState
+                    .INITIAL_FLOW_REGISTRY_FILL);
         }
 
         @Override
-        public void onFailure(Throwable t) {
+        public void onFailure(Throwable throwable) {
             if (deviceFlowRegistryFill.isCancelled()) {
                 if (LOG.isDebugEnabled()) {
                     LOG.debug("Cancelled filling flow registry with flows for node: {}", deviceInfo.getLOGValue());
                 }
             } else {
-                LOG.warn("Failed filling flow registry with flows for node: {} with exception: {}", deviceInfo.getLOGValue(), t);
+                LOG.warn("Failed filling flow registry with flows for node: {} with exception: {}", deviceInfo
+                        .getLOGValue(), throwable);
             }
             contextChainMastershipWatcher.onNotAbleToStartMastership(
                     deviceInfo,
index 39e2954a888114ab2a659a3837b016fa928a4ab7..365674f2ab547fd45664ae4a794b0124980ae262 100644 (file)
@@ -48,9 +48,6 @@ import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-/**
- *
- */
 public class DeviceManagerImpl implements DeviceManager, ExtensionConverterProviderKeeper {
 
     private static final Logger LOG = LoggerFactory.getLogger(DeviceManagerImpl.class);
index d7ec195a11c68df293419b480fe899bb0083441e..6001d5c6482b64a8f67d9384ea0ff661bcdc644a 100644 (file)
@@ -9,11 +9,9 @@
 package org.opendaylight.openflowplugin.impl.device;
 
 import org.opendaylight.openflowplugin.api.openflow.device.DeviceState;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FeaturesReply;
 
 /**
- * Holder for device features
+ * Holder for device features.
  */
 class DeviceStateImpl implements DeviceState {
 
index 50d4893fdb97fe2baaf19d6d230c9a6dea1b6ae9..c2cfda5b69ef62a55c2d022f86322a9bf73f3b59 100644 (file)
@@ -16,7 +16,7 @@ import org.opendaylight.openflowplugin.api.openflow.rpc.ItemLifeCycleSource;
 import org.opendaylight.yangtools.concepts.Registration;
 
 /**
- * default implementation
+ * Default implementation.
  */
 public class ItemLifeCycleRegistryImpl implements ItemLifeCycleRegistry {
 
index dae48def27c5c90d9271bf818defd77e62450628..5dd81c30bf600d3ac9c79cccdb7efcc1c57df6bf 100644 (file)
@@ -20,7 +20,11 @@ final class PacketInRateLimiter extends SimpleRatelimiter {
     private final ConnectionAdapter connectionAdapter;
     private final MessageSpy messageSpy;
 
-    PacketInRateLimiter(final ConnectionAdapter connectionAdapter, final int lowWatermark, final int highWatermark, final MessageSpy messageSpy, float rejectedDrainFactor) {
+    PacketInRateLimiter(final ConnectionAdapter connectionAdapter,
+                        final int lowWatermark,
+                        final int highWatermark,
+                        final MessageSpy messageSpy,
+                        float rejectedDrainFactor) {
         super(lowWatermark, highWatermark);
         Preconditions.checkArgument(rejectedDrainFactor > 0 && rejectedDrainFactor < 1);
         this.rejectedDrainFactor = rejectedDrainFactor;
index cee15859cf9bc1b357698b5229d99a27c3b801be..0c2578303a34892988add02ea36897a8abac3931 100644 (file)
@@ -34,6 +34,7 @@ abstract class SimpleRatelimiter {
     }
 
     protected abstract void disableFlow();
+
     protected abstract void enableFlow();
 
     boolean acquirePermit() {
index 79d025dcde7b8c177ca253da1826aeaa5367299c..23790303b91d3c627e44c8f5d78f74e32cfff080 100644 (file)
@@ -38,13 +38,11 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
- * openflowplugin-impl
- * org.opendaylight.openflowplugin.impl.device
- * <p/>
- * Package protected class for controlling {@link WriteTransaction} life cycle. It is
+ * The openflowplugin-impl.org.opendaylight.openflowplugin.impl.device
+ * package protected class for controlling {@link WriteTransaction} life cycle. It is
  * a {@link TransactionChainListener} and provide package protected methods for writeToTransaction
  * method (wrapped {@link WriteTransaction#put(LogicalDatastoreType, InstanceIdentifier, DataObject)})
- * and submitTransaction method (wrapped {@link WriteTransaction#submit()})
+ * and submitTransaction method (wrapped {@link WriteTransaction#submit()}).
  */
 class TransactionChainManager implements TransactionChainListener, AutoCloseable {
 
@@ -56,7 +54,7 @@ class TransactionChainManager implements TransactionChainListener, AutoCloseable
     private final String nodeId;
 
     @GuardedBy("txLock")
-    private WriteTransaction wTx;
+    private WriteTransaction writeTx;
     @GuardedBy("txLock")
     private BindingTransactionChain txChainFactory;
     @GuardedBy("txLock")
@@ -102,7 +100,7 @@ class TransactionChainManager implements TransactionChainListener, AutoCloseable
             if (TransactionChainManagerStatus.SLEEPING == transactionChainManagerStatus) {
                 Preconditions.checkState(txChainFactory == null,
                         "TxChainFactory survive last close.");
-                Preconditions.checkState(wTx == null,
+                Preconditions.checkState(writeTx == null,
                         "We have some unexpected WriteTransaction.");
                 this.transactionChainManagerStatus = TransactionChainManagerStatus.WORKING;
                 this.submitIsEnabled = false;
@@ -127,7 +125,7 @@ class TransactionChainManager implements TransactionChainListener, AutoCloseable
             if (TransactionChainManagerStatus.WORKING == transactionChainManagerStatus) {
                 transactionChainManagerStatus = TransactionChainManagerStatus.SLEEPING;
                 future = txChainShuttingDown();
-                Preconditions.checkState(wTx == null,
+                Preconditions.checkState(writeTx == null,
                         "We have some unexpected WriteTransaction.");
                 Futures.addCallback(future, new FutureCallback<Void>() {
                     @Override
@@ -136,7 +134,7 @@ class TransactionChainManager implements TransactionChainListener, AutoCloseable
                     }
 
                     @Override
-                    public void onFailure(final Throwable t) {
+                    public void onFailure(final Throwable throwable) {
                         removeTxChainFactory();
                     }
                 });
@@ -161,7 +159,7 @@ class TransactionChainManager implements TransactionChainListener, AutoCloseable
                 }
                 return false;
             }
-            if (Objects.isNull(wTx)) {
+            if (Objects.isNull(writeTx)) {
                 if (LOG.isTraceEnabled()) {
                     LOG.trace("nothing to commit - submit returns true");
                 }
@@ -170,9 +168,9 @@ class TransactionChainManager implements TransactionChainListener, AutoCloseable
             Preconditions.checkState(TransactionChainManagerStatus.WORKING == transactionChainManagerStatus,
                     "we have here Uncompleted Transaction for node {} and we are not MASTER",
                     this.nodeId);
-            final ListenableFuture<Void> submitFuture = wTx.submit();
+            final ListenableFuture<Void> submitFuture = writeTx.submit();
             lastSubmittedFuture = submitFuture;
-            wTx = null;
+            writeTx = null;
 
             if (initCommit) {
                 try {
@@ -192,15 +190,15 @@ class TransactionChainManager implements TransactionChainListener, AutoCloseable
                 }
 
                 @Override
-                public void onFailure(final Throwable t) {
-                    if (t instanceof TransactionCommitFailedException) {
-                        LOG.error("Transaction commit failed. ", t);
+                public void onFailure(final Throwable throwable) {
+                    if (throwable instanceof TransactionCommitFailedException) {
+                        LOG.error("Transaction commit failed. ", throwable);
                     } else {
-                        if (t instanceof CancellationException) {
+                        if (throwable instanceof CancellationException) {
                             LOG.warn("Submit task was canceled");
-                            LOG.trace("Submit exception: ", t);
+                            LOG.trace("Submit exception: ", throwable);
                         } else {
-                            LOG.error("Exception during transaction submitting. ", t);
+                            LOG.error("Exception during transaction submitting. ", throwable);
                         }
                     }
                 }
@@ -210,30 +208,30 @@ class TransactionChainManager implements TransactionChainListener, AutoCloseable
     }
 
     <T extends DataObject> void addDeleteOperationTotTxChain(final LogicalDatastoreType store,
-                                                             final InstanceIdentifier<T> path){
+                                                             final InstanceIdentifier<T> path) {
         synchronized (txLock) {
             ensureTransaction();
-            if (wTx == null) {
+            if (writeTx == null) {
                 LOG.debug("WriteTx is null for node {}. Delete {} was not realized.", this.nodeId, path);
                 throw new TransactionChainClosedException(CANNOT_WRITE_INTO_TRANSACTION);
             }
 
-            wTx.delete(store, path);
+            writeTx.delete(store, path);
         }
     }
 
     <T extends DataObject> void writeToTransaction(final LogicalDatastoreType store,
                                                    final InstanceIdentifier<T> path,
                                                    final T data,
-                                                   final boolean createParents){
+                                                   final boolean createParents) {
         synchronized (txLock) {
             ensureTransaction();
-            if (wTx == null) {
+            if (writeTx == null) {
                 LOG.debug("WriteTx is null for node {}. Write data for {} was not realized.", this.nodeId, path);
                 throw new TransactionChainClosedException(CANNOT_WRITE_INTO_TRANSACTION);
             }
 
-            wTx.put(store, path, data, createParents);
+            writeTx.put(store, path, data, createParents);
         }
     }
 
@@ -244,7 +242,7 @@ class TransactionChainManager implements TransactionChainListener, AutoCloseable
             if (TransactionChainManagerStatus.WORKING == transactionChainManagerStatus) {
                 LOG.warn("Transaction chain failed, recreating chain due to ", cause);
                 createTxChain();
-                wTx = null;
+                writeTx = null;
             }
         }
     }
@@ -256,9 +254,9 @@ class TransactionChainManager implements TransactionChainListener, AutoCloseable
 
     @GuardedBy("txLock")
     private void ensureTransaction() {
-        if (wTx == null && TransactionChainManagerStatus.WORKING == transactionChainManagerStatus
-            && txChainFactory != null) {
-                wTx = txChainFactory.newWriteOnlyTransaction();
+        if (writeTx == null && TransactionChainManagerStatus.WORKING == transactionChainManagerStatus
+                && txChainFactory != null) {
+            writeTx = txChainFactory.newWriteOnlyTransaction();
         }
     }
 
@@ -290,11 +288,11 @@ class TransactionChainManager implements TransactionChainListener, AutoCloseable
             // stay with actual thread
             future = Futures.immediateCheckedFuture(null);
 
-            if (wTx != null) {
-                wTx.cancel();
-                wTx = null;
+            if (writeTx != null) {
+                writeTx.cancel();
+                writeTx = null;
             }
-        } else if (wTx == null) {
+        } else if (writeTx == null) {
             // hijack md-sal thread
             future = lastSubmittedFuture;
         } else {
@@ -302,8 +300,8 @@ class TransactionChainManager implements TransactionChainListener, AutoCloseable
                 LOG.debug("Submitting all transactions for Node {}", this.nodeId);
             }
             // hijack md-sal thread
-            future = wTx.submit();
-            wTx = null;
+            future = writeTx.submit();
+            writeTx = null;
         }
 
         return future;
@@ -320,11 +318,17 @@ class TransactionChainManager implements TransactionChainListener, AutoCloseable
     }
 
     private enum TransactionChainManagerStatus {
-        /** txChainManager is sleeping - is not active (SLAVE or default init value) */
+        /**
+         * txChainManager is working - is active (MASTER).
+         */
         WORKING,
-        /** txChainManager is working - is active (MASTER) */
+        /**
+         * txChainManager is sleeping - is not active (SLAVE or default init value).
+         */
         SLEEPING,
-        /** txChainManager is trying to be closed - device disconnecting */
+        /**
+         * txChainManager is trying to be closed - device disconnecting.
+         */
         SHUTTING_DOWN;
     }
 }
index 90a5846cb725cebc1aa26325852e06a0ec576aa3..7fad99e45ef0d18e8f8be3af7ff45b2aca1b6984 100644 (file)
@@ -28,13 +28,15 @@ public abstract class AbstractDeviceInitializer {
     private static final Logger LOG = LoggerFactory.getLogger(AbstractDeviceInitializer.class);
 
     /**
-     * Perform initial information gathering and store them to operational datastore
+     * Perform initial information gathering and store them to operational datastore.
+     *
      * @param deviceContext device context
      * @param switchFeaturesMandatory is switch features mandatory
      * @param skipTableFeatures skip collecting of table features
      * @param multipartWriterProvider multipart writer provider
      * @param convertorExecutor convertor executor
      */
+    @SuppressWarnings("checkstyle:IllegalCatch")
     public Future<Void> initialize(@Nonnull final DeviceContext deviceContext,
                                    final boolean switchFeaturesMandatory,
                                    final boolean skipTableFeatures,
@@ -63,9 +65,9 @@ public abstract class AbstractDeviceInitializer {
                 multipartWriterProvider, convertorExecutor);
     }
 
-    protected abstract Future<Void> initializeNodeInformation(@Nonnull final DeviceContext deviceContext,
-                                                              final boolean switchFeaturesMandatory,
-                                                              final boolean skipTableFeatures,
-                                                              @Nullable final MultipartWriterProvider multipartWriterProvider,
-                                                              @Nullable final ConvertorExecutor convertorExecutor);
+    protected abstract Future<Void> initializeNodeInformation(@Nonnull DeviceContext deviceContext,
+                                                              boolean switchFeaturesMandatory,
+                                                              boolean skipTableFeatures,
+                                                              @Nullable MultipartWriterProvider multipartWriterProvider,
+                                                              @Nullable ConvertorExecutor convertorExecutor);
 }
index a49515f171eff1dd6a9080e5b5787d0e049b4e48..e5ca211102a02e2a4ce9b0a3481ac7499a4b87b8 100644 (file)
@@ -11,12 +11,12 @@ package org.opendaylight.openflowplugin.impl.device.initialization;
 import org.opendaylight.openflowplugin.api.OFConstants;
 
 /**
- * Multipart writer provider factory
+ * Multipart writer provider factory.
  */
 public class DeviceInitializerProviderFactory {
 
     /**
-     * Create default #{@link org.opendaylight.openflowplugin.impl.device.initialization.DeviceInitializerProvider}
+     * Create default #{@link org.opendaylight.openflowplugin.impl.device.initialization.DeviceInitializerProvider}.
      * @return the device initialization provider
      */
     public static DeviceInitializerProvider createDefaultProvider() {
index b6d1dcfcf4a876254a9487a66dd9633cc07efb64..95c78e43a4e02056081387e64a2d0496da6a44a8 100644 (file)
@@ -60,7 +60,8 @@ public class OF10DeviceInitializer extends AbstractDeviceInitializer {
                                                      final boolean skipTableFeatures,
                                                      @Nullable final MultipartWriterProvider multipartWriterProvider,
                                                      @Nullable final ConvertorExecutor convertorExecutor) {
-        final ConnectionContext connectionContext = Preconditions.checkNotNull(deviceContext.getPrimaryConnectionContext());
+        final ConnectionContext connectionContext =
+                Preconditions.checkNotNull(deviceContext.getPrimaryConnectionContext());
         final DeviceState deviceState = Preconditions.checkNotNull(deviceContext.getDeviceState());
         final DeviceInfo deviceInfo = Preconditions.checkNotNull(deviceContext.getDeviceInfo());
         final CapabilitiesV10 capabilitiesV10 = connectionContext.getFeatures().getCapabilitiesV10();
@@ -86,9 +87,9 @@ public class OF10DeviceInitializer extends AbstractDeviceInitializer {
             }
 
             @Override
-            public void onFailure(@Nonnull final Throwable t) {
+            public void onFailure(@Nonnull final Throwable throwable) {
                 LOG.warn("Error occurred in preparation node {} for protocol 1.0", deviceInfo);
-                LOG.trace("Error for node {} : ", deviceInfo, t);
+                LOG.trace("Error for node {} : ", deviceInfo, throwable);
             }
         });
 
@@ -103,6 +104,7 @@ public class OF10DeviceInitializer extends AbstractDeviceInitializer {
         });
     }
 
+    @SuppressWarnings("checkstyle:IllegalCatch")
     private static void writePhyPortInformation(final DeviceContext deviceContext) {
         final DeviceInfo deviceInfo = deviceContext.getDeviceInfo();
         final ConnectionContext connectionContext = deviceContext.getPrimaryConnectionContext();
@@ -136,6 +138,7 @@ public class OF10DeviceInitializer extends AbstractDeviceInitializer {
         });
     }
 
+    @SuppressWarnings("checkstyle:IllegalCatch")
     private static void makeEmptyFlowCapableNode(final TxFacade txFacade, final DeviceInfo deviceInfo) {
         try {
             txFacade.writeToTransaction(LogicalDatastoreType.OPERATIONAL,
@@ -152,27 +155,32 @@ public class OF10DeviceInitializer extends AbstractDeviceInitializer {
                                                               final DeviceContext deviceContext) {
         if (deviceContext.canUseSingleLayerSerialization()) {
             final SingleLayerMultipartCollectorService service =
-                new SingleLayerMultipartCollectorService(deviceContext, deviceContext);
-
-            return Futures.transform(service.handleServiceCall(multipartType), new Function<RpcResult<List<MultipartReply>>, Boolean>() {
-                @Nonnull
-                @Override
-                public Boolean apply(final RpcResult<List<MultipartReply>> input) {
-                    return input.isSuccessful();
-                }
-            });
+                    new SingleLayerMultipartCollectorService(deviceContext, deviceContext);
+
+            return Futures.transform(service.handleServiceCall(multipartType),
+                    new Function<RpcResult<List<MultipartReply>>, Boolean>() {
+                        @Nonnull
+                        @Override
+                        public Boolean apply(final RpcResult<List<MultipartReply>> input) {
+                            return input.isSuccessful();
+                        }
+                    });
         }
 
         final MultiLayerMultipartCollectorService service =
-            new MultiLayerMultipartCollectorService(deviceContext, deviceContext);
-
-        return Futures.transform(service.handleServiceCall(multipartType), new Function<RpcResult<List<org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReply>>, Boolean>() {
-            @Nonnull
-            @Override
-            public Boolean apply(final RpcResult<List<org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReply>> input) {
-                return input.isSuccessful();
-            }
-        });
+                new MultiLayerMultipartCollectorService(deviceContext, deviceContext);
+
+        return Futures.transform(service.handleServiceCall(multipartType),
+                new Function<RpcResult<List<org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol
+                        .rev130731.MultipartReply>>, Boolean>() {
+                    @Nonnull
+                    @Override
+                    public Boolean apply(final RpcResult<List<org.opendaylight.yang.gen.v1.urn.opendaylight.openflow
+                            .protocol
+                            .rev130731.MultipartReply>> input) {
+                        return input.isSuccessful();
+                    }
+                });
     }
 
 }
index 227d9c30c06223f59f27bf953d3d107fbd50ceb9..3d5b60b4074b906beb666a24d0894d0d7e7f78bc 100644 (file)
@@ -53,7 +53,8 @@ public class OF13DeviceInitializer extends AbstractDeviceInitializer {
                                                      final boolean skipTableFeatures,
                                                      @Nullable final MultipartWriterProvider multipartWriterProvider,
                                                      @Nullable final ConvertorExecutor convertorExecutor) {
-        final ConnectionContext connectionContext = Preconditions.checkNotNull(deviceContext.getPrimaryConnectionContext());
+        final ConnectionContext connectionContext =
+                Preconditions.checkNotNull(deviceContext.getPrimaryConnectionContext());
         final DeviceState deviceState = Preconditions.checkNotNull(deviceContext.getDeviceState());
         final DeviceInfo deviceInfo = Preconditions.checkNotNull(deviceContext.getDeviceInfo());
         final Capabilities capabilities = connectionContext.getFeatures().getCapabilities();
@@ -72,10 +73,14 @@ public class OF13DeviceInitializer extends AbstractDeviceInitializer {
                     convertorExecutor);
 
                 final List<ListenableFuture<RpcResult<List<OfHeader>>>> futures = new ArrayList<>();
-                futures.add(requestAndProcessMultipart(MultipartType.OFPMPMETERFEATURES, deviceContext, skipTableFeatures, multipartWriterProvider, convertorExecutor));
-                futures.add(requestAndProcessMultipart(MultipartType.OFPMPGROUPFEATURES, deviceContext, skipTableFeatures, multipartWriterProvider, convertorExecutor));
-                futures.add(requestAndProcessMultipart(MultipartType.OFPMPTABLEFEATURES, deviceContext, skipTableFeatures, multipartWriterProvider, convertorExecutor));
-                futures.add(requestAndProcessMultipart(MultipartType.OFPMPPORTDESC, deviceContext, skipTableFeatures, multipartWriterProvider, convertorExecutor));
+                futures.add(requestAndProcessMultipart(MultipartType.OFPMPMETERFEATURES, deviceContext,
+                        skipTableFeatures, multipartWriterProvider, convertorExecutor));
+                futures.add(requestAndProcessMultipart(MultipartType.OFPMPGROUPFEATURES, deviceContext,
+                        skipTableFeatures, multipartWriterProvider, convertorExecutor));
+                futures.add(requestAndProcessMultipart(MultipartType.OFPMPTABLEFEATURES, deviceContext,
+                        skipTableFeatures, multipartWriterProvider, convertorExecutor));
+                futures.add(requestAndProcessMultipart(MultipartType.OFPMPPORTDESC, deviceContext, skipTableFeatures,
+                        multipartWriterProvider, convertorExecutor));
 
                 return Futures.transform(
                     (switchFeaturesMandatory ? Futures.allAsList(futures) : Futures.successfulAsList(futures)),
@@ -83,7 +88,8 @@ public class OF13DeviceInitializer extends AbstractDeviceInitializer {
                         @Nullable
                         @Override
                         public Void apply(@Nullable final List<RpcResult<List<OfHeader>>> input) {
-                            LOG.info("Static node {} successfully finished collecting", deviceContext.getDeviceInfo().getLOGValue());
+                            LOG.info("Static node {} successfully finished collecting",
+                                    deviceContext.getDeviceInfo().getLOGValue());
                             return null;
                         }
                     });
@@ -92,7 +98,8 @@ public class OF13DeviceInitializer extends AbstractDeviceInitializer {
     }
 
     /**
-     * Request multipart of specified type and then run some processing on it
+     * Request multipart of specified type and then run some processing on it.
+     *
      * @param type multipart type
      * @param deviceContext device context
      * @param skipTableFeatures skip collecting of table features
@@ -101,10 +108,10 @@ public class OF13DeviceInitializer extends AbstractDeviceInitializer {
      * @return list of multipart messages unified to parent interface
      */
     private static ListenableFuture<RpcResult<List<OfHeader>>> requestAndProcessMultipart(final MultipartType type,
-                                                                                          final DeviceContext deviceContext,
-                                                                                          final boolean skipTableFeatures,
-                                                                                          final MultipartWriterProvider multipartWriterProvider,
-                                                                                          @Nullable final ConvertorExecutor convertorExecutor) {
+                                                                  final DeviceContext deviceContext,
+                                                                  final boolean skipTableFeatures,
+                                                                  final MultipartWriterProvider multipartWriterProvider,
+                                                                  @Nullable final ConvertorExecutor convertorExecutor) {
         final ListenableFuture<RpcResult<List<OfHeader>>> rpcResultListenableFuture =
             MultipartType.OFPMPTABLEFEATURES.equals(type) && skipTableFeatures
                 ? RpcResultBuilder.<List<OfHeader>>success().buildFuture()
@@ -116,7 +123,8 @@ public class OF13DeviceInitializer extends AbstractDeviceInitializer {
 
     /**
      * Inject callback ti future for specified multipart type. This callback will translate and write
-     * result of multipart messages
+     * result of multipart messages.
+     *
      * @param type multipart type
      * @param future multipart collection future
      * @param deviceContext device context
@@ -159,20 +167,23 @@ public class OF13DeviceInitializer extends AbstractDeviceInitializer {
             }
 
             @Override
-            public void onFailure(@Nonnull final Throwable t) {
-                LOG.warn("Request of type {} for static info of node {} failed.", type, deviceContext.getDeviceInfo().getLOGValue());
+            public void onFailure(@Nonnull final Throwable throwable) {
+                LOG.warn("Request of type {} for static info of node {} failed.",
+                        type, deviceContext.getDeviceInfo().getLOGValue());
             }
         });
     }
 
     /**
-     * Translate and write multipart messages from OpenflowJava
+     * Translate and write multipart messages from OpenflowJava.
+     *
      * @param type multipart type
      * @param result multipart messages
      * @param deviceContext device context
      * @param multipartWriterProvider multipart writer provider
      * @param convertorExecutor convertor executor
      */
+    @SuppressWarnings("checkstyle:IllegalCatch")
     private static void translateAndWriteResult(final MultipartType type,
                                                 final List<OfHeader> result,
                                                 final DeviceContext deviceContext,
@@ -191,8 +202,8 @@ public class OF13DeviceInitializer extends AbstractDeviceInitializer {
                         .ifPresent(translatedReply -> {
                             // If we collected meter features, check if we have support for meters
                             // and pass this information to device context
-                            if (MultipartType.OFPMPMETERFEATURES.equals(type) &&
-                                translatedReply instanceof MeterFeatures) {
+                            if (MultipartType.OFPMPMETERFEATURES.equals(type)
+                                    && translatedReply instanceof MeterFeatures) {
                                 final MeterFeatures meterFeatures = (MeterFeatures) translatedReply;
 
                                 if (meterFeatures.getMaxMeter().getValue() > 0) {
@@ -216,7 +227,8 @@ public class OF13DeviceInitializer extends AbstractDeviceInitializer {
     }
 
     /**
-     * Send request to device and unify different possible reply types from OpenflowJava to common parent interface
+     * Send request to device and unify different possible reply types from OpenflowJava to common parent interface.
+     *
      * @param multipartType multipart type
      * @param deviceContext device context
      * @return unified replies
@@ -225,53 +237,57 @@ public class OF13DeviceInitializer extends AbstractDeviceInitializer {
                                                                                 final DeviceContext deviceContext) {
         if (deviceContext.canUseSingleLayerSerialization()) {
             final SingleLayerMultipartCollectorService service =
-                new SingleLayerMultipartCollectorService(deviceContext, deviceContext);
+                    new SingleLayerMultipartCollectorService(deviceContext, deviceContext);
 
-            return Futures.transform(service.handleServiceCall(multipartType), new Function<RpcResult<List<MultipartReply>>, RpcResult<List<OfHeader>>>() {
-                @Nonnull
-                @Override
-                public RpcResult<List<OfHeader>> apply(final RpcResult<List<MultipartReply>> input) {
-                    if (Objects.isNull(input.getResult()) && input.isSuccessful()) {
-                        final List<OfHeader> temp = null;
-                        return RpcResultBuilder.success(temp).build();
-                    }
+            return Futures.transform(service.handleServiceCall(multipartType),
+                    new Function<RpcResult<List<MultipartReply>>, RpcResult<List<OfHeader>>>() {
+                        @Nonnull
+                        @Override
+                        public RpcResult<List<OfHeader>> apply(final RpcResult<List<MultipartReply>> input) {
+                            if (Objects.isNull(input.getResult()) && input.isSuccessful()) {
+                                final List<OfHeader> temp = null;
+                                return RpcResultBuilder.success(temp).build();
+                            }
 
-                    return input.isSuccessful()
-                        ? RpcResultBuilder.success(input
-                            .getResult()
-                        .stream()
-                        .map(OfHeader.class::cast)
-                        .collect(Collectors.toList()))
-                        .build()
-                        : RpcResultBuilder.<List<OfHeader>>failed()
-                        .withRpcErrors(input.getErrors())
-                        .build();
-                }
-            });
+                            return input.isSuccessful()
+                                    ? RpcResultBuilder.success(input
+                                    .getResult()
+                                    .stream()
+                                    .map(OfHeader.class::cast)
+                                    .collect(Collectors.toList()))
+                                    .build()
+                                    : RpcResultBuilder.<List<OfHeader>>failed()
+                                    .withRpcErrors(input.getErrors())
+                                    .build();
+                        }
+                    });
         }
 
         final MultiLayerMultipartCollectorService service =
             new MultiLayerMultipartCollectorService(deviceContext, deviceContext);
 
-        return Futures.transform(service.handleServiceCall(multipartType), new Function<RpcResult<List<org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReply>>, RpcResult<List<OfHeader>>>() {
+        return Futures.transform(service.handleServiceCall(multipartType), new Function<RpcResult<List<org
+                .opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReply>>,
+                RpcResult<List<OfHeader>>>() {
             @Nonnull
             @Override
-            public RpcResult<List<OfHeader>> apply(final RpcResult<List<org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReply>> input) {
+            public RpcResult<List<OfHeader>> apply(final RpcResult<List<org.opendaylight.yang.gen.v1.urn.opendaylight
+                    .openflow.protocol.rev130731.MultipartReply>> input) {
                 if (Objects.isNull(input.getResult()) && input.isSuccessful()) {
                     final List<OfHeader> temp = null;
                     return RpcResultBuilder.success(temp).build();
                 }
 
                 return input.isSuccessful()
-                    ? RpcResultBuilder.success(input
-                    .getResult()
-                    .stream()
-                    .map(OfHeader.class::cast)
-                    .collect(Collectors.toList()))
-                    .build()
-                    : RpcResultBuilder.<List<OfHeader>>failed()
-                    .withRpcErrors(input.getErrors())
-                    .build();
+                        ? RpcResultBuilder.success(input
+                        .getResult()
+                        .stream()
+                        .map(OfHeader.class::cast)
+                        .collect(Collectors.toList()))
+                        .build()
+                        : RpcResultBuilder.<List<OfHeader>>failed()
+                        .withRpcErrors(input.getErrors())
+                        .build();
             }
         });
     }
index 532a81fbf893f19924281b7dd7753d9274f4ef1f..3046ac9e348465b9a080787a3399ff8cdabfad96 100644 (file)
@@ -27,13 +27,10 @@ import org.slf4j.LoggerFactory;
 
 
 /**
- * <p>
- * Implementation for {@link MultiMsgCollector} interface
+ * Implementation for {@link MultiMsgCollector} interface.
  *
  * @author <a href="mailto:vdemcak@cisco.com">Vaclav Demcak</a>
  * @author <a href="mailto:tkubas@cisco.com">Timotej Kubas</a>
- *         </p>
- *         Created: Mar 23, 2015
  */
 public class MultiMsgCollectorImpl<T extends OfHeader> implements MultiMsgCollector<T> {
     private static final Logger LOG = LoggerFactory.getLogger(MultiMsgCollectorImpl.class);
@@ -41,13 +38,15 @@ public class MultiMsgCollectorImpl<T extends OfHeader> implements MultiMsgCollec
     private final RequestContext<List<T>> requestContext;
     private final DeviceReplyProcessor deviceReplyProcessor;
 
-    public MultiMsgCollectorImpl(final DeviceReplyProcessor deviceReplyProcessor, final RequestContext<List<T>> requestContext) {
+    public MultiMsgCollectorImpl(final DeviceReplyProcessor deviceReplyProcessor,
+                                 final RequestContext<List<T>> requestContext) {
         this.deviceReplyProcessor = Preconditions.checkNotNull(deviceReplyProcessor);
         this.requestContext = Preconditions.checkNotNull(requestContext);
     }
 
     @Override
-    public void addMultipartMsg(@Nonnull final T reply, final boolean reqMore, @Nullable final EventIdentifier eventIdentifier) {
+    public void addMultipartMsg(@Nonnull final T reply, final boolean reqMore,
+                                @Nullable final EventIdentifier eventIdentifier) {
         Preconditions.checkNotNull(reply);
         Preconditions.checkNotNull(requestContext.getXid());
         Preconditions.checkArgument(requestContext.getXid().getValue().equals(reply.getXid()));
index fd16c7ce1df9bb2236afe326e27baed729d4ded3..574fa1c4db1cf1de409877cfcdbe75c067026a76 100644 (file)
@@ -24,9 +24,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-/**
- *
- */
 public class OpenflowProtocolListenerFullImpl implements AlienMessageListener, OpenflowMessageListenerFacade {
 
     private static final Logger LOG = LoggerFactory.getLogger(OpenflowProtocolListenerFullImpl.class);
@@ -35,17 +32,20 @@ public class OpenflowProtocolListenerFullImpl implements AlienMessageListener, O
     private final DeviceReplyProcessor deviceReplyProcessor;
 
     /**
-     * @param connectionAdapter
-     * @param deviceReplyProcessor
+     * Constructor.
+     *
+     * @param connectionAdapter - connection adapter
+     * @param deviceReplyProcessor - device replay processor
      */
-    public OpenflowProtocolListenerFullImpl(final ConnectionAdapter connectionAdapter, final DeviceReplyProcessor deviceReplyProcessor) {
+    public OpenflowProtocolListenerFullImpl(final ConnectionAdapter connectionAdapter,
+                                            final DeviceReplyProcessor deviceReplyProcessor) {
         this.connectionAdapter = connectionAdapter;
         this.deviceReplyProcessor = deviceReplyProcessor;
     }
 
     @Override
     public void onEchoRequestMessage(final EchoRequestMessage echoRequestMessage) {
-        if(LOG.isDebugEnabled()) {
+        if (LOG.isDebugEnabled()) {
             LOG.debug("echo request received: {}", echoRequestMessage.getXid());
         }
         final EchoReplyInputBuilder builder = new EchoReplyInputBuilder();
@@ -74,16 +74,17 @@ public class OpenflowProtocolListenerFullImpl implements AlienMessageListener, O
 
     @Override
     public void onHelloMessage(final HelloMessage hello) {
-        LOG.warn("hello message received outside handshake phase -> dropping connection {}", connectionAdapter.getRemoteAddress());
+        LOG.warn("hello message received outside handshake phase -> dropping connection {}",
+                connectionAdapter.getRemoteAddress());
         connectionAdapter.disconnect();
     }
 
     @Override
     public void onMultipartReplyMessage(final MultipartReplyMessage notification) {
-        if(LOG.isTraceEnabled()) {
+        if (LOG.isTraceEnabled()) {
             LOG.trace("Multipart Reply with XID: {}", notification.getXid());
         }
-//        multiMsgCollector.addMultipartMsg(notification);
+        // multiMsgCollector.addMultipartMsg(notification);
     }
 
     @Override
index 8f7b7c976fd7c209a1f9635599007878d775f48a..9f549a7b84ac06c2a4a9f1de7d500246c972a385 100644 (file)
@@ -135,9 +135,9 @@ public class DeviceContextImplTest {
     @Mock
     DataBroker dataBroker;
     @Mock
-    WriteTransaction wTx;
+    WriteTransaction writeTx;
     @Mock
-    ReadOnlyTransaction rTx;
+    ReadOnlyTransaction readTx;
     @Mock
     BindingTransactionChain txChainFactory;
     @Mock
@@ -174,11 +174,13 @@ public class DeviceContextImplTest {
     private DeviceContext deviceContextSpy;
 
     @Before
-    public void setUp() throws Exception{
-        final CheckedFuture<Optional<Node>, ReadFailedException> noExistNodeFuture = Futures.immediateCheckedFuture(Optional.<Node>absent());
-        Mockito.when(rTx.read(LogicalDatastoreType.OPERATIONAL, nodeKeyIdent)).thenReturn(noExistNodeFuture);
-        Mockito.when(dataBroker.newReadOnlyTransaction()).thenReturn(rTx);
-        Mockito.when(dataBroker.createTransactionChain(Mockito.any(TransactionChainManager.class))).thenReturn(txChainFactory);
+    public void setUp() throws Exception {
+        final CheckedFuture<Optional<Node>, ReadFailedException> noExistNodeFuture =
+                Futures.immediateCheckedFuture(Optional.<Node>absent());
+        Mockito.when(readTx.read(LogicalDatastoreType.OPERATIONAL, nodeKeyIdent)).thenReturn(noExistNodeFuture);
+        Mockito.when(dataBroker.newReadOnlyTransaction()).thenReturn(readTx);
+        Mockito.when(dataBroker.createTransactionChain(Mockito.any(TransactionChainManager.class)))
+                .thenReturn(txChainFactory);
         Mockito.when(deviceInfo.getNodeInstanceIdentifier()).thenReturn(nodeKeyIdent);
         Mockito.when(deviceInfo.getNodeId()).thenReturn(nodeId);
         Mockito.when(deviceInfo.getDatapathId()).thenReturn(BigInteger.ONE);
@@ -195,8 +197,8 @@ public class DeviceContextImplTest {
             settableFutureMultiReply.set((RpcResult<MultipartReply>) invocation.getArguments()[0]);
             return null;
         }).when(requestContextMultiReply).setResult(any(RpcResult.class));
-        Mockito.when(txChainFactory.newWriteOnlyTransaction()).thenReturn(wTx);
-        Mockito.when(dataBroker.newReadOnlyTransaction()).thenReturn(rTx);
+        Mockito.when(txChainFactory.newWriteOnlyTransaction()).thenReturn(writeTx);
+        Mockito.when(dataBroker.newReadOnlyTransaction()).thenReturn(readTx);
         Mockito.when(connectionContext.getOutboundQueueProvider()).thenReturn(outboundQueueProvider);
         Mockito.when(connectionContext.getConnectionAdapter()).thenReturn(connectionAdapter);
         Mockito.when(connectionContext.getDeviceInfo()).thenReturn(deviceInfo);
@@ -209,18 +211,22 @@ public class DeviceContextImplTest {
         Mockito.when(featuresOutput.getVersion()).thenReturn(OFConstants.OFP_VERSION_1_3);
 
         final PacketReceived packetReceived = new PacketReceivedBuilder()
-                .setMatch(new org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.packet.received.MatchBuilder()
+                .setMatch(new org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.packet.received
+                        .MatchBuilder()
                         .setInPort(new NodeConnectorId("openflow:1:LOCAL"))
                         .build())
                 .build();
 
-        Mockito.when(messageTranslatorPacketReceived.translate(any(Object.class), any(DeviceInfo.class), any(Object.class))).thenReturn(packetReceived);
-        Mockito.when(messageTranslatorFlowCapableNodeConnector.translate(any(Object.class), any(DeviceInfo.class), any(Object.class))).thenReturn(mock(FlowCapableNodeConnector.class));
-        Mockito.when(translatorLibrary.lookupTranslator(eq(new TranslatorKey(OFConstants.OFP_VERSION_1_3, PacketIn.class.getName())))).thenReturn(messageTranslatorPacketReceived);
-        Mockito.when(translatorLibrary.lookupTranslator(eq(new TranslatorKey(OFConstants.OFP_VERSION_1_3, PortGrouping.class.getName())))).thenReturn(messageTranslatorFlowCapableNodeConnector);
+        Mockito.when(messageTranslatorPacketReceived.translate(any(Object.class), any(DeviceInfo.class),
+                any(Object.class))).thenReturn(packetReceived);
+        Mockito.when(messageTranslatorFlowCapableNodeConnector.translate(any(Object.class), any(DeviceInfo.class),
+                any(Object.class))).thenReturn(mock(FlowCapableNodeConnector.class));
         Mockito.when(translatorLibrary.lookupTranslator(eq(new TranslatorKey(OFConstants.OFP_VERSION_1_3,
-                FlowRemoved.class.getName()))))
-                .thenReturn(messageTranslatorFlowRemoved);
+                PacketIn.class.getName())))).thenReturn(messageTranslatorPacketReceived);
+        Mockito.when(translatorLibrary.lookupTranslator(eq(new TranslatorKey(OFConstants.OFP_VERSION_1_3,
+                PortGrouping.class.getName())))).thenReturn(messageTranslatorFlowCapableNodeConnector);
+        Mockito.when(translatorLibrary.lookupTranslator(eq(new TranslatorKey(OFConstants.OFP_VERSION_1_3,
+                FlowRemoved.class.getName())))).thenReturn(messageTranslatorFlowRemoved);
 
         Mockito.when(abstractDeviceInitializer.initialize(any(), anyBoolean(), anyBoolean(), any(), any()))
                 .thenReturn(Futures.immediateFuture(null));
@@ -255,21 +261,18 @@ public class DeviceContextImplTest {
     public void testGetReadTransaction() {
         final ReadTransaction readTx = deviceContext.getReadTransaction();
         assertNotNull(readTx);
-        assertEquals(rTx, readTx);
+        assertEquals(this.readTx, readTx);
     }
 
-    /**
-     * @throws Exception
-     */
     @Test
     public void testInitialSubmitTransaction() throws Exception {
-        Mockito.when(wTx.submit()).thenReturn(Futures.immediateCheckedFuture(null));
+        Mockito.when(writeTx.submit()).thenReturn(Futures.immediateCheckedFuture(null));
         final InstanceIdentifier<Nodes> dummyII = InstanceIdentifier.create(Nodes.class);
         ((DeviceContextImpl) deviceContext).getTransactionChainManager().activateTransactionManager() ;
         ((DeviceContextImpl) deviceContext).getTransactionChainManager().enableSubmit();
         deviceContext.addDeleteToTxChain(LogicalDatastoreType.CONFIGURATION, dummyII);
         deviceContext.initialSubmitTransaction();
-        verify(wTx).submit();
+        verify(writeTx).submit();
     }
 
     private ConnectionContext prepareConnectionContext() {
@@ -280,21 +283,15 @@ public class DeviceContextImplTest {
         return mockedConnectionContext;
     }
 
-    /**
-     * @throws Exception
-     */
     @Test
-    public void testAddDeleteToTxChain() throws Exception{
+    public void testAddDeleteToTxChain() throws Exception {
         final InstanceIdentifier<Nodes> dummyII = InstanceIdentifier.create(Nodes.class);
         ((DeviceContextImpl) deviceContext).getTransactionChainManager().activateTransactionManager() ;
         ((DeviceContextImpl) deviceContext).getTransactionChainManager().enableSubmit();
         deviceContext.addDeleteToTxChain(LogicalDatastoreType.CONFIGURATION, dummyII);
-        verify(wTx).delete(eq(LogicalDatastoreType.CONFIGURATION), eq(dummyII));
+        verify(writeTx).delete(eq(LogicalDatastoreType.CONFIGURATION), eq(dummyII));
     }
 
-    /**
-     * @throws Exception
-     */
     @Test
     public void testSubmitTransaction() throws Exception {
         ((DeviceContextImpl) deviceContext).getTransactionChainManager().activateTransactionManager() ;
@@ -355,7 +352,8 @@ public class DeviceContextImplTest {
         final NotificationPublishService mockedNotificationPublishService = mock(NotificationPublishService.class);
         final ListenableFuture stringListenableFuture = Futures.immediateFuture(new String("dummy value"));
 
-        when(mockedNotificationPublishService.offerNotification(any(PacketReceived.class))).thenReturn(stringListenableFuture);
+        when(mockedNotificationPublishService.offerNotification(any(PacketReceived.class)))
+                .thenReturn(stringListenableFuture);
         deviceContext.setNotificationPublishService(mockedNotificationPublishService);
         deviceContext.processPacketInMessage(mockedPacketInMessage);
         verify(messageSpy).spyMessage(any(Class.class), eq(MessageSpy.StatisticsGroup.FROM_SWITCH));
@@ -371,7 +369,8 @@ public class DeviceContextImplTest {
         when(mockedNotificationPublishService.offerNotification(any(PacketReceived.class))).thenReturn(dummyFuture);
         deviceContext.setNotificationPublishService(mockedNotificationPublishService);
         deviceContext.processPacketInMessage(mockedPacketInMessage);
-        verify(messageSpy).spyMessage(any(Class.class), eq(MessageSpy.StatisticsGroup.FROM_SWITCH_NOTIFICATION_REJECTED));
+        verify(messageSpy).spyMessage(any(Class.class),
+                eq(MessageSpy.StatisticsGroup.FROM_SWITCH_NOTIFICATION_REJECTED));
     }
 
     @Test
@@ -396,7 +395,7 @@ public class DeviceContextImplTest {
     }
 
     @Test
-    public void testPortStatusMessage() throws Exception{
+    public void testPortStatusMessage() throws Exception {
         final PortStatusMessage mockedPortStatusMessage = mock(PortStatusMessage.class);
         final Class dummyClass = Class.class;
         when(mockedPortStatusMessage.getImplementedInterface()).thenReturn(dummyClass);
@@ -423,17 +422,20 @@ public class DeviceContextImplTest {
                 .setMatch(new MatchBuilder().build());
         final NotificationPublishService mockedNotificationPublishService = mock(NotificationPublishService.class);
 
-        Mockito.when(messageTranslatorFlowRemoved.translate(any(Object.class), any(DeviceInfo.class), any(Object.class)))
+        Mockito.when(messageTranslatorFlowRemoved
+                .translate(any(Object.class), any(DeviceInfo.class), any(Object.class)))
                 .thenReturn(flowRemovedMdsalBld.build());
 
         // insert flow+flowId into local registry
-        final FlowRegistryKey flowRegKey = FlowRegistryKeyFactory.create(deviceInfo.getVersion(), flowRemovedMdsalBld.build());
+        final FlowRegistryKey flowRegKey =
+                FlowRegistryKeyFactory.create(deviceInfo.getVersion(), flowRemovedMdsalBld.build());
         final FlowDescriptor flowDescriptor = FlowDescriptorFactory.create((short) 0, new FlowId("ut-ofp:f456"));
         deviceContext.getDeviceFlowRegistry().storeDescriptor(flowRegKey, flowDescriptor);
 
         // plug in lifecycleListener
         final ItemLifecycleListener itemLifecycleListener = Mockito.mock(ItemLifecycleListener.class);
-        for (final ItemLifeCycleSource lifeCycleSource : deviceContext.getItemLifeCycleSourceRegistry().getLifeCycleSources()) {
+        for (final ItemLifeCycleSource lifeCycleSource : deviceContext.getItemLifeCycleSourceRegistry()
+                .getLifeCycleSources()) {
             lifeCycleSource.setItemLifecycleListener(itemLifecycleListener);
         }
 
@@ -456,7 +458,8 @@ public class DeviceContextImplTest {
     public void testProcessExperimenterMessage() {
         final ConvertorMessageFromOFJava mockedMessageConverter = mock(ConvertorMessageFromOFJava.class);
         final ExtensionConverterProvider mockedExtensionConverterProvider = mock(ExtensionConverterProvider.class);
-        when(mockedExtensionConverterProvider.getMessageConverter(any(MessageTypeKey.class))).thenReturn(mockedMessageConverter);
+        when(mockedExtensionConverterProvider.getMessageConverter(any(MessageTypeKey.class)))
+                .thenReturn(mockedMessageConverter);
 
         final ExperimenterDataOfChoice mockedExperimenterDataOfChoice = mock(ExperimenterDataOfChoice.class);
         final ExperimenterMessage experimenterMessage = new ExperimenterMessageBuilder()
index 3be489dede78b4e6edbdd413c32ac1381a3c12ae..fbb1165834b90131d4708b36381d46b107dbe106 100644 (file)
@@ -60,14 +60,13 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.provider.config.rev160510.NonZeroUint32Type;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.provider.config.rev160510.OpenflowProviderConfigBuilder;
 import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
-import org.opendaylight.yangtools.yang.common.RpcError;
 
 @RunWith(MockitoJUnitRunner.class)
 public class DeviceManagerImplTest {
 
     private static final long TEST_VALUE_GLOBAL_NOTIFICATION_QUOTA = 2000L;
-    private static final int barrierCountLimit = 25600;
-    private static final long barrierIntervalNanos = 500;
+    private static final int BARRIER_COUNT_LIMIT = 25600;
+    private static final long BARRIER_INTERVAL_NANOS = 500;
     private static final NodeId DUMMY_NODE_ID = new NodeId("dummyNodeId");
     private static final KeyedInstanceIdentifier<Node, NodeKey> DUMMY_IDENTIFIER  = DeviceStateUtil
             .createNodeInstanceIdentifier(DUMMY_NODE_ID);
@@ -127,8 +126,8 @@ public class DeviceManagerImplTest {
 
         deviceManager = new DeviceManagerImpl(
                 new OpenflowProviderConfigBuilder()
-                        .setBarrierCountLimit(new NonZeroUint16Type(barrierCountLimit))
-                        .setBarrierIntervalTimeoutLimit(new NonZeroUint32Type(barrierIntervalNanos))
+                        .setBarrierCountLimit(new NonZeroUint16Type(BARRIER_COUNT_LIMIT))
+                        .setBarrierIntervalTimeoutLimit(new NonZeroUint32Type(BARRIER_INTERVAL_NANOS))
                         .setGlobalNotificationQuota(TEST_VALUE_GLOBAL_NOTIFICATION_QUOTA)
                         .setSwitchFeaturesMandatory(false)
                         .setEnableFlowRemovedNotification(true)
@@ -209,7 +208,8 @@ public class DeviceManagerImplTest {
     }
 
     @SuppressWarnings("unchecked")
-    private static ConcurrentHashMap<DeviceInfo, DeviceContext> getContextsCollection(final DeviceManagerImpl deviceManager) throws NoSuchFieldException, IllegalAccessException {
+    private static ConcurrentHashMap<DeviceInfo, DeviceContext> getContextsCollection(
+            final DeviceManagerImpl deviceManager) throws NoSuchFieldException, IllegalAccessException {
         // HACK: contexts collection for testing shall be accessed in some more civilized way
         final Field contextsField = DeviceManagerImpl.class.getDeclaredField("deviceContexts");
         Assert.assertNotNull(contextsField);
index f1e14daf3e6a6be64d98487fc5c403d2dcb78ed5..0e0a79f46530939ca02a85c9240689b1db282b13 100644 (file)
@@ -12,22 +12,14 @@ import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
-import org.mockito.Mock;
 import org.mockito.runners.MockitoJUnitRunner;
-import org.opendaylight.openflowplugin.api.openflow.device.DeviceInfo;
 
 /**
- * openflowplugin-impl
- * org.opendaylight.openflowplugin.impl.device
- *
- * test of {@link DeviceStateImpl} - lightweight version, using basic ways (TDD)
+ * openflowplugin-impl.org.opendaylight.openflowplugin.impl.device
+ * test of {@link DeviceStateImpl} - lightweight version, using basic ways (TDD).
  */
 @RunWith(MockitoJUnitRunner.class)
 public class DeviceStateImplTest {
-
-    @Mock
-    private DeviceInfo deviceInfo;
-
     private DeviceStateImpl deviceState;
 
     @Before
@@ -36,7 +28,7 @@ public class DeviceStateImplTest {
     }
 
     @Test
-    public void testStatistics_initialValue(){
+    public void testStatistics_initialValue() {
         Assert.assertFalse(deviceState.isFlowStatisticsAvailable());
         Assert.assertFalse(deviceState.isPortStatisticsAvailable());
         Assert.assertFalse(deviceState.isQueueStatisticsAvailable());
@@ -44,7 +36,7 @@ public class DeviceStateImplTest {
     }
 
     @Test
-    public void testMeterAndGroupAvailable_initialValue(){
+    public void testMeterAndGroupAvailable_initialValue() {
         Assert.assertFalse(deviceState.isGroupAvailable());
         Assert.assertFalse(deviceState.isMetersAvailable());
     }
index 12bff2a6cdc495df394e235662d6dc079bb35846..1abf811e9f8403d3121dcbcafdd70a016ed8b572 100644 (file)
@@ -30,7 +30,6 @@ import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
 import org.opendaylight.controller.md.sal.common.api.data.TransactionChain;
 import org.opendaylight.controller.md.sal.common.api.data.TransactionChainListener;
 import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
-import org.opendaylight.openflowplugin.api.openflow.connection.ConnectionContext;
 import org.opendaylight.openflowplugin.api.openflow.device.DeviceInfo;
 import org.opendaylight.openflowplugin.api.openflow.device.DeviceState;
 import org.opendaylight.openflowplugin.impl.util.DeviceStateUtil;
@@ -43,17 +42,12 @@ import org.opendaylight.yangtools.concepts.Registration;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
 
-/**
- * Created by mirehak on 4/5/15.
- */
 @RunWith(MockitoJUnitRunner.class)
 public class TransactionChainManagerTest {
 
     @Mock
     private DataBroker dataBroker;
     @Mock
-    private ConnectionContext connectionContext;
-    @Mock
     private BindingTransactionChain txChain;
     @Mock
     private WriteTransaction writeTx;
@@ -78,7 +72,8 @@ public class TransactionChainManagerTest {
     @Before
     public void setUp() throws Exception {
         final ReadOnlyTransaction readOnlyTx = Mockito.mock(ReadOnlyTransaction.class);
-        final CheckedFuture<Optional<Node>, ReadFailedException> noExistNodeFuture = Futures.immediateCheckedFuture(Optional.<Node>absent());
+        final CheckedFuture<Optional<Node>, ReadFailedException> noExistNodeFuture =
+                Futures.immediateCheckedFuture(Optional.<Node>absent());
         Mockito.when(readOnlyTx.read(LogicalDatastoreType.OPERATIONAL, nodeKeyIdent)).thenReturn(noExistNodeFuture);
         Mockito.when(dataBroker.newReadOnlyTransaction()).thenReturn(readOnlyTx);
         Mockito.when(dataBroker.createTransactionChain(Matchers.any(TransactionChainListener.class)))
@@ -91,7 +86,8 @@ public class TransactionChainManagerTest {
         Mockito.when(txChain.newWriteOnlyTransaction()).thenReturn(writeTx);
 
         path = InstanceIdentifier.create(Nodes.class).child(Node.class, new NodeKey(nodeId));
-        Mockito.when(writeTx.submit()).thenReturn(Futures.<Void, TransactionCommitFailedException>immediateCheckedFuture(null));
+        Mockito.when(writeTx.submit())
+                .thenReturn(Futures.<Void, TransactionCommitFailedException>immediateCheckedFuture(null));
         txChainManager.activateTransactionManager();
     }
 
@@ -110,8 +106,7 @@ public class TransactionChainManagerTest {
     }
 
     /**
-     * test of {@link TransactionChainManager#submitWriteTransaction()}
-     * @throws Exception
+     * Test of {@link TransactionChainManager#submitWriteTransaction()}.
      */
     @Test
     public void testSubmitTransaction() throws Exception {
@@ -126,8 +121,7 @@ public class TransactionChainManagerTest {
     }
 
     /**
-     * test of {@link TransactionChainManager#submitWriteTransaction()}: no submit, never enabled
-     * @throws Exception
+     * Test of {@link TransactionChainManager#submitWriteTransaction()}: no submit, never enabled.
      */
     @Test
     public void testSubmitTransaction1() throws Exception {
@@ -140,12 +134,10 @@ public class TransactionChainManagerTest {
         Mockito.verify(writeTx, Mockito.never()).submit();
     }
 
-    /**
-     * @throws Exception
-     */
     @Test
     public void testSubmitTransactionFailed() throws Exception {
-        Mockito.when(writeTx.submit()).thenReturn(Futures.immediateFailedCheckedFuture(new TransactionCommitFailedException("mock")));
+        Mockito.when(writeTx.submit())
+                .thenReturn(Futures.immediateFailedCheckedFuture(new TransactionCommitFailedException("mock")));
         final Node data = new NodeBuilder().setId(nodeId).build();
         txChainManager.initialSubmitWriteTransaction();
         txChainManager.writeToTransaction(LogicalDatastoreType.CONFIGURATION, path, data, false);
@@ -163,7 +155,8 @@ public class TransactionChainManagerTest {
         txChainManager.writeToTransaction(LogicalDatastoreType.CONFIGURATION, path, data, false);
         txChainManager.submitWriteTransaction();
 
-        Mockito.when(writeTx.submit()).thenReturn(Futures.immediateFailedCheckedFuture(new TransactionCommitFailedException("mock")));
+        Mockito.when(writeTx.submit())
+                .thenReturn(Futures.immediateFailedCheckedFuture(new TransactionCommitFailedException("mock")));
         txChainManager.writeToTransaction(LogicalDatastoreType.CONFIGURATION, path, data, false);
         txChainManager.submitWriteTransaction();
 
@@ -173,9 +166,7 @@ public class TransactionChainManagerTest {
     }
 
     /**
-     * test of {@link TransactionChainManager#enableSubmit()}: no submit - counter is not active
-     *
-     * @throws Exception
+     * Test of {@link TransactionChainManager#enableSubmit()}: no submit - counter is not active.
      */
     @Test
     public void testEnableCounter1() throws Exception {
@@ -188,12 +179,10 @@ public class TransactionChainManagerTest {
         Mockito.verify(writeTx, Mockito.never()).submit();
     }
 
-    /**
-     * @throws Exception
-     */
     @Test
     public void testOnTransactionChainFailed() throws Exception {
-        txChainManager.onTransactionChainFailed(transactionChain, Mockito.mock(AsyncTransaction.class), Mockito.mock(Throwable.class));
+        txChainManager.onTransactionChainFailed(transactionChain,
+                Mockito.mock(AsyncTransaction.class), Mockito.mock(Throwable.class));
         Mockito.verify(txChain).close();
         Mockito.verify(dataBroker, Mockito.times(2)).createTransactionChain(txChainManager);
     }
@@ -220,12 +209,11 @@ public class TransactionChainManagerTest {
         Mockito.verify(txChain).close();
     }
 
-    /**
-     * @throws Exception
-     */
     @Test
     public void testDeactivateTransactionChainManagerFailed() throws Exception {
-        Mockito.when(writeTx.submit()).thenReturn(Futures.<Void, TransactionCommitFailedException>immediateFailedCheckedFuture(new TransactionCommitFailedException("mock")));
+        Mockito.when(writeTx.submit())
+                .thenReturn(Futures.<Void, TransactionCommitFailedException>immediateFailedCheckedFuture(
+                        new TransactionCommitFailedException("mock")));
         final Node data = new NodeBuilder().setId(nodeId).build();
         txChainManager.writeToTransaction(LogicalDatastoreType.CONFIGURATION, path, data, false);
 
@@ -239,7 +227,7 @@ public class TransactionChainManagerTest {
     }
 
     @Test
-    public void testShuttingDown() throws Exception{
+    public void testShuttingDown() throws Exception {
         final Node data = new NodeBuilder().setId(nodeId).build();
         txChainManager.writeToTransaction(LogicalDatastoreType.CONFIGURATION, path, data, false);
         txChainManager.enableSubmit();
index 5e59a828d37c268b0266e800ab412bfb45b7d82e..379326545925ba5c4a963c68085f8e3710c58d01 100644 (file)
@@ -34,13 +34,11 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731
 /**
  * openflowplugin-api
  * org.opendaylight.openflowplugin.impl.openflow.device
- * <p/>
- * Test class for testing basic method functionality for {@link MultiMsgCollector}
+ * Test class for testing basic method functionality for {@link MultiMsgCollector}.
  *
  * @author <a href="mailto:vdemcak@cisco.com">Vaclav Demcak</a>
  * @author <a href="mailto:tkubas@cisco.com">Timotej Kubas</a>
- *         <p/>
- *         Created: Mar 23, 2015
+ *
  */
 @RunWith(MockitoJUnitRunner.class)
 public class MultiMsgCollectorImplTest {
@@ -83,12 +81,13 @@ public class MultiMsgCollectorImplTest {
     }
 
     /**
-     * test of ${link MultiMsgCollector#addMultipartMsg} <br>
-     * success with message consisting of 1 part
+     * Test of ${link MultiMsgCollector#addMultipartMsg}
+     * success with message consisting of 1 part.
      */
     @Test
     public void testAddMultipartMsgOne() {
-        collector.addMultipartMsg(MsgGeneratorTestUtils.makeMultipartDescReply(xid, hwTestValue, false).build(), false, null);
+        collector.addMultipartMsg(MsgGeneratorTestUtils
+                .makeMultipartDescReply(xid, hwTestValue, false).build(), false, null);
 
         Mockito.verify(deviceProcessor).processReply(xidCaptor.capture(), mmCaptor.capture());
         Assert.assertEquals(xid, xidCaptor.getValue().getValue());
@@ -99,13 +98,15 @@ public class MultiMsgCollectorImplTest {
     }
 
     /**
-     * test of ${link MultiMsgCollector#addMultipartMsg} <br>
-     * success with message consisting of 2 parts
+     * Test of ${link MultiMsgCollector#addMultipartMsg}
+     * success with message consisting of 2 parts.
      */
     @Test
     public void testAddMultipartMsgTwo() {
-        collector.addMultipartMsg(MsgGeneratorTestUtils.makeMultipartDescReply(xid, hwTestValue, true).build(), true, null);
-        collector.addMultipartMsg(MsgGeneratorTestUtils.makeMultipartDescReply(xid, hwTestValue, false).build(), false, null);
+        collector.addMultipartMsg(MsgGeneratorTestUtils
+                .makeMultipartDescReply(xid, hwTestValue, true).build(), true, null);
+        collector.addMultipartMsg(MsgGeneratorTestUtils
+                .makeMultipartDescReply(xid, hwTestValue, false).build(), false, null);
 
         Mockito.verify(deviceProcessor).processReply(xidCaptor.capture(), mmCaptor.capture());
         Assert.assertEquals(xid, xidCaptor.getValue().getValue());
@@ -117,23 +118,25 @@ public class MultiMsgCollectorImplTest {
     }
 
     /**
-     * test of ${link MultiMsgCollector#addMultipartMsg} <br>
-     * xid not registered before message
+     * Test of ${link MultiMsgCollector#addMultipartMsg}
+     * xid not registered before message.
      */
-    @Test(expected=IllegalArgumentException.class)
+    @Test(expected = IllegalArgumentException.class)
     public void testAddMultipartMsgNotExpectedXid() {
         final Long dif_xid = 5L;
-        final MultipartReplyMessage mrMsg = MsgGeneratorTestUtils.makeMultipartDescReply(dif_xid, hwTestValue, true).build();
+        final MultipartReplyMessage mrMsg = MsgGeneratorTestUtils
+                .makeMultipartDescReply(dif_xid, hwTestValue, true).build();
         collector.addMultipartMsg(mrMsg, true, null);
     }
 
     /**
-     * test of ${link MultiMsgCollector#addMultipartMsg} <br>
-     * message types are inconsistent - second message is final and should be rejected
+     * Test of ${link MultiMsgCollector#addMultipartMsg}
+     * message types are inconsistent - second message is final and should be rejected.
      */
     @Test
     public void testAddMultipartMsgWrongType1() {
-        collector.addMultipartMsg(MsgGeneratorTestUtils.makeMultipartDescReply(xid, hwTestValue, true).build(), true, null);
+        collector.addMultipartMsg(MsgGeneratorTestUtils
+                .makeMultipartDescReply(xid, hwTestValue, true).build(), true, null);
         collector.addMultipartMsg(MsgGeneratorTestUtils.makeMultipartDescReply(xid, hwTestValue, false)
                 .setType(MultipartType.OFPMPPORTDESC).build(), false, null);
 
@@ -153,15 +156,17 @@ public class MultiMsgCollectorImplTest {
     }
 
     /**
-     * test of ${link MultiMsgCollector#addMultipartMsg} <br>
-     * message types are inconsistent - second message is not final and should be rejected
+     * Test of ${link MultiMsgCollector#addMultipartMsg}
+     * message types are inconsistent - second message is not final and should be rejected.
      */
     @Test
     public void testAddMultipartMsgWrongType2() {
-        collector.addMultipartMsg(MsgGeneratorTestUtils.makeMultipartDescReply(xid, hwTestValue, true).build(), true, null);
+        collector.addMultipartMsg(MsgGeneratorTestUtils
+                .makeMultipartDescReply(xid, hwTestValue, true).build(), true, null);
         collector.addMultipartMsg(MsgGeneratorTestUtils.makeMultipartDescReply(xid, hwTestValue, true)
                 .setType(MultipartType.OFPMPPORTDESC).build(), true, null);
-        collector.addMultipartMsg(MsgGeneratorTestUtils.makeMultipartDescReply(xid, hwTestValue, false).build(), false, null);
+        collector.addMultipartMsg(MsgGeneratorTestUtils
+                .makeMultipartDescReply(xid, hwTestValue, false).build(), false, null);
 
         Mockito.verify(deviceProcessor).processReply(xidCaptor.capture(), mmCaptor.capture());
         Mockito.verify(deviceProcessor).processReply(xidCaptor.capture(), mmCaptor.capture());
@@ -180,15 +185,17 @@ public class MultiMsgCollectorImplTest {
     }
 
     /**
-     * test of ${link MultiMsgCollector#addMultipartMsg} <br>
-     * message types are inconsistent - second message and third should be rejected
+     * Test of ${link MultiMsgCollector#addMultipartMsg}
+     * message types are inconsistent - second message and third should be rejected.
      */
     @Test
     public void testAddMultipartMsgWrongType3() {
-        collector.addMultipartMsg(MsgGeneratorTestUtils.makeMultipartDescReply(xid, hwTestValue, true).build(), true, null);
+        collector.addMultipartMsg(MsgGeneratorTestUtils
+                .makeMultipartDescReply(xid, hwTestValue, true).build(), true, null);
         collector.addMultipartMsg(MsgGeneratorTestUtils.makeMultipartDescReply(xid, hwTestValue, true)
                 .setType(MultipartType.OFPMPPORTDESC).build(), true, null);
-        collector.addMultipartMsg(MsgGeneratorTestUtils.makeMultipartDescReply(xid, hwTestValue, false).build(), false, null);
+        collector.addMultipartMsg(MsgGeneratorTestUtils
+                .makeMultipartDescReply(xid, hwTestValue, false).build(), false, null);
 
         Mockito.verify(deviceProcessor).processReply(xidCaptor.capture(), mmCaptor.capture());
         Assert.assertEquals(xid, xidCaptor.getValue().getValue());
index b60c618e5f5cc20eee3124c46b2d77297b6e5b15..b54ec50a873e25b76b34cc3822109dc1b30b91dc 100644 (file)
@@ -40,12 +40,10 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731
 /**
  * openflowplugin-impl
  * org.opendaylight.openflowplugin.impl.connection.listener
- * <p/>
- * test of {@link OpenflowProtocolListenerFullImpl} - lightweight version, using basic ways (TDD)
+ * test of {@link OpenflowProtocolListenerFullImpl} - lightweight version, using basic ways (TDD).
  *
  * @author <a href="mailto:vdemcak@cisco.com">Vaclav Demcak</a>
- *         <p/>
- *         Created: Mar 26, 2015
+ *
  */
 @RunWith(MockitoJUnitRunner.class)
 public class OpenflowProtocolListenerFullImplTest {
@@ -64,7 +62,8 @@ public class OpenflowProtocolListenerFullImplTest {
         // place for mocking method's general behavior for HandshakeContext and ConnectionContext
         ofProtocolListener = new OpenflowProtocolListenerFullImpl(connectionAdapter, deviceReplyProcessor);
         connectionAdapter.setMessageListener(ofProtocolListener);
-        Mockito.when(connectionAdapter.getRemoteAddress()).thenReturn(InetSocketAddress.createUnresolved("ofp-junit.example.org", 6663));
+        Mockito.when(connectionAdapter.getRemoteAddress())
+                .thenReturn(InetSocketAddress.createUnresolved("ofp-junit.example.org", 6663));
         Mockito.verify(connectionAdapter).setMessageListener(Matchers.any(OpenflowProtocolListener.class));
     }
 
@@ -74,7 +73,9 @@ public class OpenflowProtocolListenerFullImplTest {
     }
 
     /**
-     * Test method for {@link OpenflowProtocolListenerFullImpl#onEchoRequestMessage(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoRequestMessage)}.
+     * Test method for
+     * {@link OpenflowProtocolListenerFullImpl#onEchoRequestMessage(
+     * org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoRequestMessage)}.
      */
     @Test
     public void testOnEchoRequestMessage() {
@@ -86,7 +87,9 @@ public class OpenflowProtocolListenerFullImplTest {
     }
 
     /**
-     * Test method for {@link OpenflowProtocolListenerFullImpl#onErrorMessage(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ErrorMessage)}.
+     * Test method for
+     * {@link OpenflowProtocolListenerFullImpl#onErrorMessage(
+     * org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ErrorMessage)}.
      */
     @Test
     public void testOnErrorMessage() {
@@ -98,7 +101,9 @@ public class OpenflowProtocolListenerFullImplTest {
     }
 
     /**
-     * Test method for {@link OpenflowProtocolListenerFullImpl#onExperimenterMessage(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessage)}.
+     * Test method for
+     * {@link OpenflowProtocolListenerFullImpl#onExperimenterMessage(
+     * org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessage)}.
      */
     @Test
     public void testOnExperimenterMessage() {
@@ -110,7 +115,9 @@ public class OpenflowProtocolListenerFullImplTest {
     }
 
     /**
-     * Test method for {@link OpenflowProtocolListenerFullImpl#onFlowRemovedMessage(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowRemovedMessage)}.
+     * Test method for
+     * {@link OpenflowProtocolListenerFullImpl#onFlowRemovedMessage(
+     * org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowRemovedMessage)}.
      */
     @Test
     public void testOnFlowRemovedMessage() {
@@ -122,7 +129,9 @@ public class OpenflowProtocolListenerFullImplTest {
     }
 
     /**
-     * Test method for {@link OpenflowProtocolListenerFullImpl#onHelloMessage(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloMessage)}.
+     * Test method for
+     * {@link OpenflowProtocolListenerFullImpl#onHelloMessage(
+     * org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloMessage)}.
      */
     @Test
     public void testOnHelloMessage() {
@@ -135,7 +144,9 @@ public class OpenflowProtocolListenerFullImplTest {
     }
 
     /**
-     * Test method for {@link OpenflowProtocolListenerFullImpl#onPacketInMessage(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PacketInMessage)}.
+     * Test method for
+     * {@link OpenflowProtocolListenerFullImpl#onPacketInMessage(
+     * org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PacketInMessage)}.
      */
     @Test
     public void testOnPacketInMessage() {
@@ -147,7 +158,9 @@ public class OpenflowProtocolListenerFullImplTest {
     }
 
     /**
-     * Test method for {@link OpenflowProtocolListenerFullImpl#onPortStatusMessage(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortStatusMessage)}.
+     * Test method for
+     * {@link OpenflowProtocolListenerFullImpl#onPortStatusMessage(
+     * org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortStatusMessage)}.
      */
     @Test
     public void testOnPortStatusMessage() {