Merge "BUG-5489 Group Delete not working with ovs2.5"
authorAnil Vishnoi <vishnoianil@gmail.com>
Mon, 21 Mar 2016 22:13:19 +0000 (22:13 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Mon, 21 Mar 2016 22:13:19 +0000 (22:13 +0000)
36 files changed:
applications/inventory-manager/src/main/java/org/opendaylight/openflowplugin/applications/inventory/manager/NodeTablesFeatureCommitter.java
applications/statistics-manager/src/main/java/org/opendaylight/openflowplugin/applications/statistics/manager/impl/StatListenCommitGroup.java
openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/device/DeviceContext.java
openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/md/core/HandshakeListener.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/OpenFlowPluginProviderImpl.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/connection/listener/HandshakeListenerImpl.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/device/DeviceContextImpl.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/device/DeviceStateImpl.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/device/TransactionChainManager.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/role/RoleContextImpl.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/role/RoleManagerImpl.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/rpc/RpcContextImpl.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/rpc/RpcManagerImpl.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/StatisticsManagerImpl.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/util/MdSalRegistrationUtils.java [moved from openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/util/MdSalRegistratorUtils.java with 98% similarity]
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/connection/listener/HandshakeListenerImplTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/device/DeviceContextImplTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/device/DeviceStateImplTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/StatisticsGatheringUtilsTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/util/DeviceInitializationUtilsTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/util/MdSalRegistrationUtilsTest.java [moved from openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/util/MdSalRegistratorUtilsTest.java with 83% similarity]
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/ConnectionConductorImpl.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/HandshakeManagerImpl.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/PacketOutConvertor.java
openflowplugin/src/test/java/org/opendaylight/openflowplugin/openflow/md/core/HandshakeManagerImplTest.java
openflowplugin/src/test/java/org/opendaylight/openflowplugin/openflow/md/core/sal/ConcurrentSalRegistrationManagerTest.java
openflowplugin/src/test/java/org/opendaylight/openflowplugin/openflow/md/core/sal/OFRpcTaskUtilTest.java
openflowplugin/src/test/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/GroupConvertorTest.java
openflowplugin/src/test/java/org/opendaylight/openflowplugin/openflow/md/core/session/SessionManagerOFImplTest.java
openflowplugin/src/test/java/org/opendaylight/openflowplugin/openflow/md/core/translator/PacketInV10TranslatorTest.java
openflowplugin/src/test/java/org/opendaylight/openflowplugin/openflow/md/util/InventoryDataServiceUtilTest.java
samples/learning-switch/src/main/java/org/opendaylight/openflowplugin/learningswitch/LearningSwitchHandlerSimpleImpl.java
test-common/src/main/java/org/opendaylight/openflowplugin/testcommon/DropTestRpcProvider.java
test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowPluginBulkTransactionProvider.java
test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginTestNodeConnectorNotification.java
test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginTestTopologyNotification.java

index 685938fbb3048f57b700de10b758fcf00096c873..7784b8e477564ef741fa2cee39107dd399f48de5 100644 (file)
@@ -36,7 +36,7 @@ import java.util.List;
  */
 public class NodeTablesFeatureCommitter implements SalTableListener {
 
-    private static final Logger LOG = LoggerFactory.getLogger(NodeChangeCommiter.class);
+    private static final Logger LOG = LoggerFactory.getLogger(NodeTablesFeatureCommitter.class);
 
     private final FlowCapableInventoryProvider manager;
 
index 71fb54f31ab608a9c23b8c43a87f62738ae358dc..c68acd76c302ac3522a9e8e529e10c0e067a1ed7 100644 (file)
@@ -74,7 +74,7 @@ import com.google.common.base.Preconditions;
 public class StatListenCommitGroup extends StatAbstractListenCommit<Group, OpendaylightGroupStatisticsListener>
                                                     implements OpendaylightGroupStatisticsListener {
 
-    private static final Logger LOG = LoggerFactory.getLogger(StatListenCommitMeter.class);
+    private static final Logger LOG = LoggerFactory.getLogger(StatListenCommitGroup.class);
 
     public StatListenCommitGroup(final StatisticsManager manager,  final DataBroker db,
             final NotificationProviderService nps,
index 0e96d1aeb85a11e83bf3c6673385303dabc6e95e..85cb3636c514ed6ecb3e650f61bac1ec5bdef653 100644 (file)
@@ -66,14 +66,14 @@ public interface DeviceContext extends AutoCloseable,
      *
      * @param connectionContext
      */
-    void addAuxiliaryConenctionContext(ConnectionContext connectionContext);
+    void addAuxiliaryConnectionContext(ConnectionContext connectionContext);
 
     /**
      * Method removes auxiliary connection context from this context representing single device connection.
      *
      * @param connectionContext
      */
-    void removeAuxiliaryConenctionContext(ConnectionContext connectionContext);
+    void removeAuxiliaryConnectionContext(ConnectionContext connectionContext);
 
 
     /**
index deb2efc34170a443963aa93c63311d21fd1bf1ed..5140977e4feadaa388c7f32bd68c134f9a5b5f8d 100644 (file)
@@ -20,7 +20,7 @@ public interface HandshakeListener {
      * @param featureOutput obtained
      * @param version negotiated
      */
-    void onHandshakeSuccessfull(GetFeaturesOutput featureOutput, Short version);
+    void onHandshakeSuccessful(GetFeaturesOutput featureOutput, Short version);
 
     /**
      * This method is called when handshake fails for some reason. It allows
index 7f2a3b700fce6c2122dd0c61d0f374b1b9e4fab1..463998a6a8e80e7306b891680ff4bdbda2570c09 100644 (file)
@@ -192,7 +192,7 @@ public class OpenFlowPluginProviderImpl implements OpenFlowPluginProvider, OpenF
         deviceManager = new DeviceManagerImpl(dataBroker, messageIntelligenceAgency, globalNotificationQuota,
                 switchFeaturesMandatory, barrierInterval, barrierCountLimit);
         ((ExtensionConverterProviderKeeper) deviceManager).setExtensionConverterProvider(extensionConverterManager);
-        roleManager = new RoleManagerImpl(entityOwnershipService, dataBroker, switchFeaturesMandatory);
+        roleManager = new RoleManagerImpl(entityOwnershipService, dataBroker);
         statisticsManager = new StatisticsManagerImpl(rpcProviderRegistry, isStatisticsPollingOff);
         rpcManager = new RpcManagerImpl(rpcProviderRegistry, rpcRequestsQuota);
 
index 61480de5f0f91aabee7f0171a976a626d8860933..f1c7a9a2e41ed3930e118d7ef2df2357a66eb7da 100644 (file)
@@ -48,7 +48,7 @@ public class HandshakeListenerImpl implements HandshakeListener {
     }
 
     @Override
-    public void onHandshakeSuccessfull(final GetFeaturesOutput featureOutput, final Short version) {
+    public void onHandshakeSuccessful(final GetFeaturesOutput featureOutput, final Short version) {
         LOG.debug("handshake succeeded: {}", connectionContext.getConnectionAdapter().getRemoteAddress());
         closeHandshakeContext();
         connectionContext.changeStateToWorking();
@@ -102,7 +102,7 @@ public class HandshakeListenerImpl implements HandshakeListener {
             handshakeContext.close();
         } catch (final Exception e) {
             LOG.warn("Closing handshake context failed: {}", e.getMessage());
-            LOG.debug("Detail in hanshake context close:", e);
+            LOG.debug("Detail in handshake context close:", e);
         }
     }
 
index e5c62d7e657a82bcfac6debb342a7f2d548fbc10..3aed9d60b670a4e2e8c558784846cf5e5875abf4 100644 (file)
@@ -30,8 +30,6 @@ import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 import javax.annotation.CheckForNull;
 import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
 import org.opendaylight.controller.md.sal.binding.api.NotificationService;
@@ -77,7 +75,7 @@ import org.opendaylight.openflowplugin.impl.registry.flow.FlowRegistryKeyFactory
 import org.opendaylight.openflowplugin.impl.registry.group.DeviceGroupRegistryImpl;
 import org.opendaylight.openflowplugin.impl.registry.meter.DeviceMeterRegistryImpl;
 import org.opendaylight.openflowplugin.impl.util.DeviceInitializationUtils;
-import org.opendaylight.openflowplugin.impl.util.MdSalRegistratorUtils;
+import org.opendaylight.openflowplugin.impl.util.MdSalRegistrationUtils;
 import org.opendaylight.openflowplugin.openflow.md.core.session.SwitchConnectionCookieOFImpl;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.experimenter.message.service.rev151020.ExperimenterMessageFromDevBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
@@ -155,7 +153,7 @@ public class DeviceContextImpl implements DeviceContext, ExtensionConverterProvi
     private ExtensionConverterProvider extensionConverterProvider;
 
     private final boolean switchFeaturesMandatory;
-    private StatisticsContext statCtx;
+    private StatisticsContext statisticsContext;
 
 
     @VisibleForTesting
@@ -214,7 +212,7 @@ public class DeviceContextImpl implements DeviceContext, ExtensionConverterProvi
     }
 
     @Override
-    public void addAuxiliaryConenctionContext(final ConnectionContext connectionContext) {
+    public void addAuxiliaryConnectionContext(final ConnectionContext connectionContext) {
         final SwitchConnectionDistinguisher connectionDistinguisher = createConnectionDistinguisher(connectionContext);
         auxiliaryConnectionContexts.put(connectionDistinguisher, connectionContext);
     }
@@ -224,8 +222,11 @@ public class DeviceContextImpl implements DeviceContext, ExtensionConverterProvi
     }
 
     @Override
-    public void removeAuxiliaryConenctionContext(final ConnectionContext connectionContext) {
-        // TODO Auto-generated method stub
+    public void removeAuxiliaryConnectionContext(final ConnectionContext connectionContext) {
+        final SwitchConnectionDistinguisher connectionDistinguisher = createConnectionDistinguisher(connectionContext);
+        if (null != connectionDistinguisher) {
+            auxiliaryConnectionContexts.remove(connectionDistinguisher);
+        }
     }
 
     @Override
@@ -247,42 +248,23 @@ public class DeviceContextImpl implements DeviceContext, ExtensionConverterProvi
             return Futures.immediateFuture(null);
         }
         if (OfpRole.BECOMEMASTER.equals(role)) {
-            MdSalRegistratorUtils.registerMasterServices(getRpcContext(), DeviceContextImpl.this, role);
-            getRpcContext().registerStatCompatibilityServices();
             if (!deviceState.deviceSynchronized()) {
                 //TODO: no necessary code for yet - it needs for initialization phase only
                 LOG.debug("Setup Empty TxManager {} for initialization phase", getDeviceState().getNodeId());
                 transactionChainManager.activateTransactionManager();
                 return Futures.immediateCheckedFuture(null);
             }
-            /* Relevant for no initial Slave-to-Master scenario in cluster */
-            final ListenableFuture<Void> deviceInitialization = asyncClusterRoleChange();
-            Futures.addCallback(deviceInitialization, new FutureCallback<Void>() {
-
-                @Override
-                public void onSuccess(@Nullable Void aVoid) {
-                    //No operation
-                }
-
-                @Override
-                public void onFailure(Throwable throwable) {
-                    LOG.debug("Device {} init unexpected fail. Unregister RPCs", getDeviceState().getNodeId());
-                    MdSalRegistratorUtils.unregisterServices(getRpcContext());
-                }
-
-            });
-
-            return deviceInitialization;
+            return asyncClusterRoleChange();
 
         } else if (OfpRole.BECOMESLAVE.equals(role)) {
             if (null != rpcContext) {
-                MdSalRegistratorUtils.registerSlaveServices(rpcContext, role);
+                MdSalRegistrationUtils.registerSlaveServices(rpcContext, role);
             }
             return transactionChainManager.deactivateTransactionManager();
         } else {
             LOG.warn("Unknown OFCluster Role {} for Node {}", role, deviceState.getNodeId());
             if (null != rpcContext) {
-                MdSalRegistratorUtils.unregisterServices(rpcContext);
+                MdSalRegistrationUtils.unregisterServices(rpcContext);
             }
             return transactionChainManager.deactivateTransactionManager();
         }
@@ -294,7 +276,7 @@ public class DeviceContextImpl implements DeviceContext, ExtensionConverterProvi
      * all possible MultipartTypes for polling in StatTypeList
      */
     private ListenableFuture<Void> asyncClusterRoleChange() {
-        if (statCtx == null) {
+        if (statisticsContext == null) {
             final String errMsg = String.format("DeviceCtx %s is up but we are missing StatisticsContext", deviceState.getNodeId());
             LOG.warn(errMsg);
             return Futures.immediateFailedFuture(new IllegalStateException(errMsg));
@@ -359,6 +341,8 @@ public class DeviceContextImpl implements DeviceContext, ExtensionConverterProvi
                 LOG.debug("Get Initial Device {} information is successful", getDeviceState().getNodeId());
                 getDeviceState().setDeviceSynchronized(true);
                 transactionChainManager.activateTransactionManager();
+                MdSalRegistrationUtils.registerMasterServices(getRpcContext(), DeviceContextImpl.this, OfpRole.BECOMEMASTER);
+                getRpcContext().registerStatCompatibilityServices();
                 initialSubmitTransaction();
                 getDeviceState().setStatisticsPollingEnabledProp(true);
                 return null;
@@ -590,7 +574,7 @@ public class DeviceContextImpl implements DeviceContext, ExtensionConverterProvi
 
                 @Override
                 public void onSuccess(final Void result) {
-                    LOG.info("TxChain {} was shutdown successfull.", getDeviceState().getNodeId());
+                    LOG.info("TxChain {} was shutdown successful.", getDeviceState().getNodeId());
                     tearDownClean();
                 }
 
@@ -643,8 +627,8 @@ public class DeviceContextImpl implements DeviceContext, ExtensionConverterProvi
     }
 
     @Override
-    public void setNotificationService(final NotificationService notificationServiceParam) {
-        notificationService = notificationServiceParam;
+    public void setNotificationService(final NotificationService notificationService) {
+        this.notificationService = notificationService;
     }
 
     @Override
@@ -719,11 +703,11 @@ public class DeviceContextImpl implements DeviceContext, ExtensionConverterProvi
 
     @Override
     public void setStatisticsContext(final StatisticsContext statisticsContext) {
-        this.statCtx = statisticsContext;
+        this.statisticsContext = statisticsContext;
     }
 
     @Override
     public StatisticsContext getStatisticsContext() {
-        return statCtx;
+        return statisticsContext;
     }
 }
index d49021ed1e067e1e508b2617f9f148b6dfb2332c..efbeefdbc7ea41eca83ca37ad0ca8b4f34fff330 100644 (file)
@@ -58,6 +58,7 @@ class DeviceStateImpl implements DeviceState {
         version = featuresReply.getVersion();
         statPollEnabled = false;
         deviceSynchronized = false;
+        role = OfpRole.BECOMESLAVE;
     }
 
     @Override
index d9a446dc126d96dfc663a40d709fdf3e76db681c..f2d1b11ae0a6e4b4ead93162d2f10a857d5ef1c8 100644 (file)
@@ -110,6 +110,7 @@ class TransactionChainManager implements TransactionChainListener, AutoCloseable
                 Preconditions.checkState(txChainFactory == null, "TxChainFactory survive last close.");
                 Preconditions.checkState(wTx == null, "We have some unexpected WriteTransaction.");
                 this.transactionChainManagerStatus = TransactionChainManagerStatus.WORKING;
+                this.submitIsEnabled = false;
                 createTxChain();
             } else {
                 LOG.debug("Transaction is active {}", nodeId());
index d2e8fb80e056b8d9e125369bb66496e264729ebe..7fc9739892fcfb7aba176f25679aaf8d0f9164ad 100644 (file)
@@ -55,23 +55,24 @@ public class RoleContextImpl implements RoleContext {
 
     private final EntityOwnershipService entityOwnershipService;
     private EntityOwnershipCandidateRegistration entityOwnershipCandidateRegistration;
+    private EntityOwnershipCandidateRegistration txEntityOwnershipCandidateRegistration;
+
     private final DeviceContext deviceContext;
-    private final Entity entity;
-    private SalRoleService salRoleService;
 
-    private EntityOwnershipCandidateRegistration txEntityOwnershipCandidateRegistration;
+    private final Entity entity;
     private final Entity txEntity;
 
+    private SalRoleService salRoleService;
+
     private final Semaphore mainCandidateGuard = new Semaphore(1, true);
     private final Semaphore txCandidateGuard = new Semaphore(1, true);
 
     public RoleContextImpl(final DeviceContext deviceContext, final EntityOwnershipService entityOwnershipService,
-                           final Entity entity, final Entity txEnitity) {
+                           final Entity entity, final Entity txEntity) {
         this.entityOwnershipService = Preconditions.checkNotNull(entityOwnershipService);
         this.deviceContext = Preconditions.checkNotNull(deviceContext);
         this.entity = Preconditions.checkNotNull(entity);
-        this.txEntity = Preconditions.checkNotNull(txEnitity);
-
+        this.txEntity = Preconditions.checkNotNull(txEntity);
         salRoleService = new SalRoleServiceImpl(this, deviceContext);
     }
 
@@ -110,7 +111,7 @@ public class RoleContextImpl implements RoleContext {
         LOG.trace("onRoleChanged method call for Entity {}", entity);
 
         if (!isDeviceConnected()) {
-            // this can happen as after the disconnect, we still get a last messsage from EntityOwnershipService.
+            // this can happen as after the disconnect, we still get a last message from EntityOwnershipService.
             LOG.info("Device {} is disconnected from this node. Hence not attempting a role change.",
                     deviceContext.getPrimaryConnectionContext().getNodeId());
             LOG.debug("SetRole cancelled for entity [{}], reason = device disconnected.", entity);
@@ -210,7 +211,7 @@ public class RoleContextImpl implements RoleContext {
     }
 
     private ListenableFuture<Void> sendRoleChangeToDevice(final OfpRole newRole, final AsyncFunction<RpcResult<SetRoleOutput>, Void> function) {
-        LOG.debug("Send new Role {} to Device {}", newRole, deviceContext.getDeviceState().getNodeId());
+        LOG.debug("Send new role {} to device {}", newRole, deviceContext.getDeviceState().getNodeId());
         final Future<RpcResult<SetRoleOutput>> setRoleOutputFuture;
         if (deviceContext.getDeviceState().getFeatures().getVersion() < OFConstants.OFP_VERSION_1_3) {
             LOG.debug("Device OF version {} not support ROLE", deviceContext.getDeviceState().getFeatures().getVersion());
@@ -224,7 +225,7 @@ public class RoleContextImpl implements RoleContext {
                 @Override
                 public void run(final Timeout timeout) throws Exception {
                     if (!setRoleOutputFuture.isDone()) {
-                        LOG.info("New Role {} was not propagated to device {} during 10 sec. Close connection immediately.",
+                        LOG.info("New role {} was not propagated to device {} during 10 sec. Close connection immediately.",
                                 newRole, deviceContext.getDeviceState().getNodeId());
                         deviceContext.close();
                     }
index b365c797b7eadb1b298bd5e951bd82c02c04e9f9..fc159499cff4c61bb2cfe325d43b82da7a297d94 100644 (file)
@@ -63,15 +63,13 @@ public class RoleManagerImpl implements RoleManager, EntityOwnershipListener {
     private final ConcurrentMap<Entity, RoleContext> txContexts = new ConcurrentHashMap<>();
     private final EntityOwnershipListenerRegistration entityOwnershipListenerRegistration;
     private final EntityOwnershipListenerRegistration txEntityOwnershipListenerRegistration;
-    private final boolean switchFeaturesMandatory;
 
-    public RoleManagerImpl(final EntityOwnershipService entityOwnershipService, final DataBroker dataBroker, final boolean switchFeaturesMandatory) {
+    public RoleManagerImpl(final EntityOwnershipService entityOwnershipService, final DataBroker dataBroker) {
         this.entityOwnershipService = Preconditions.checkNotNull(entityOwnershipService);
         this.dataBroker = Preconditions.checkNotNull(dataBroker);
-        this.switchFeaturesMandatory = switchFeaturesMandatory;
         this.entityOwnershipListenerRegistration = Preconditions.checkNotNull(entityOwnershipService.registerListener(RoleManager.ENTITY_TYPE, this));
         this.txEntityOwnershipListenerRegistration = Preconditions.checkNotNull(entityOwnershipService.registerListener(TX_ENTITY_TYPE, this));
-        LOG.debug("Registering OpenflowOwnershipListener listening to all entity ownership changes");
+        LOG.debug("Register OpenflowOwnershipListener to all entity ownership changes");
     }
 
     @Override
@@ -81,14 +79,14 @@ public class RoleManagerImpl implements RoleManager, EntityOwnershipListener {
 
     @Override
     public void onDeviceContextLevelUp(@CheckForNull final DeviceContext deviceContext) throws Exception {
-        LOG.debug("RoleManager called for device:{}", deviceContext.getPrimaryConnectionContext().getNodeId());
+        LOG.trace("Role manager called for device:{}", deviceContext.getPrimaryConnectionContext().getNodeId());
         final RoleContext roleContext = new RoleContextImpl(deviceContext, entityOwnershipService,
                 makeEntity(deviceContext.getDeviceState().getNodeId()),
                 makeTxEntity(deviceContext.getDeviceState().getNodeId()));
 
-        Verify.verify(contexts.putIfAbsent(roleContext.getEntity(), roleContext) == null, "RoleCtx for master Node {} is still not closed.", deviceContext.getDeviceState().getNodeId());
+        Verify.verify(contexts.putIfAbsent(roleContext.getEntity(), roleContext) == null, "Role context for master Node {} is still not closed.", deviceContext.getDeviceState().getNodeId());
         Verify.verify(!txContexts.containsKey(roleContext.getTxEntity()),
-                "RoleCtx for master Node {} is still not closed. TxEntity was not unregistered yet.", deviceContext.getDeviceState().getNodeId());
+                "Role context for master Node {} is still not closed. TxEntity was not unregistered yet.", deviceContext.getDeviceState().getNodeId());
 
         // if the device context gets closed (mostly on connection close), we would need to cleanup
         deviceContext.addDeviceContextClosedHandler(this);
@@ -124,7 +122,7 @@ public class RoleManagerImpl implements RoleManager, EntityOwnershipListener {
     @Override
     public void onDeviceContextClosed(final DeviceContext deviceContext) {
         final NodeId nodeId = deviceContext.getDeviceState().getNodeId();
-        LOG.debug("onDeviceContextClosed for node {}", nodeId);
+        LOG.trace("onDeviceContextClosed for node {}", nodeId);
         final Entity entity = makeEntity(nodeId);
         final RoleContext roleContext = contexts.get(entity);
         if (roleContext != null) {
@@ -148,7 +146,7 @@ public class RoleManagerImpl implements RoleManager, EntityOwnershipListener {
                     // TODO : is there a chance to have TxEntity ?
                 }
             } else {
-                LOG.warn("EntityOwnershipService doesn't return state for entity: {} in close proces", entity);
+                LOG.warn("EntityOwnershipService doesn't return state for entity: {} in close process", entity);
             }
             roleContext.close();
         }
@@ -380,14 +378,14 @@ public class RoleManagerImpl implements RoleManager, EntityOwnershipListener {
         Futures.addCallback(removeDeviceFromOperDS(roleContext), new FutureCallback<Void>() {
             @Override
             public void onSuccess(@Nullable final Void aVoid) {
-                LOG.debug("Freeing roleContext slot for device: {}", roleContext.getDeviceState().getNodeId());
+                LOG.debug("Removing context for device: {}", roleContext.getDeviceState().getNodeId());
                 contexts.remove(ownershipChange.getEntity(), roleContext);
                 roleContext.suspendTxCandidate();
             }
 
             @Override
             public void onFailure(final Throwable throwable) {
-                LOG.warn("NOT freeing roleContext slot for device: {}, {}", roleContext.getDeviceState()
+                LOG.warn("Removing role context for device: {}, but {}", roleContext.getDeviceState()
                         .getNodeId(), throwable.getMessage());
                 contexts.remove(ownershipChange.getEntity(), roleContext);
                 roleContext.suspendTxCandidate();
index ba7d36f4abf255960d5624be8a22117429a1126a..3179038cc87fed1876c270860bf1e67522525079 100644 (file)
@@ -23,7 +23,7 @@ import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
 import org.opendaylight.openflowplugin.api.openflow.device.RequestContext;
 import org.opendaylight.openflowplugin.api.openflow.rpc.RpcContext;
 import org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.MessageSpy;
-import org.opendaylight.openflowplugin.impl.util.MdSalRegistratorUtils;
+import org.opendaylight.openflowplugin.impl.util.MdSalRegistrationUtils;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeContext;
 import org.opendaylight.yangtools.yang.binding.RpcService;
 import org.slf4j.Logger;
@@ -72,7 +72,7 @@ public class RpcContextImpl implements RpcContext {
     @Override
     public void registerStatCompatibilityServices() {
         if (isStatisticsRpcEnabled) {
-            MdSalRegistratorUtils.registerStatCompatibilityServices(RpcContextImpl.this, deviceContext,
+            MdSalRegistrationUtils.registerStatCompatibilityServices(RpcContextImpl.this, deviceContext,
                     notificationPublishService, new AtomicLong());
         }
     }
@@ -105,7 +105,7 @@ public class RpcContextImpl implements RpcContext {
             LOG.trace("Device queue {} at capacity", this);
             return null;
         } else {
-            LOG.info("Acquired semaphore for {}, available permits:{} ", deviceContext.getDeviceState().getNodeId(), tracker.availablePermits());
+            LOG.trace("Acquired semaphore for {}, available permits:{} ", deviceContext.getDeviceState().getNodeId(), tracker.availablePermits());
         }
 
         final Long xid = deviceContext.reservedXidForDeviceMessage();
index 523ccc5aeed58c17d063bbe9034b358b7faf086f..4681d12381d620c65f2612ef87d323523b72cb44 100644 (file)
@@ -19,7 +19,7 @@ import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
 import org.opendaylight.openflowplugin.api.openflow.device.handlers.DeviceInitializationPhaseHandler;
 import org.opendaylight.openflowplugin.api.openflow.rpc.RpcContext;
 import org.opendaylight.openflowplugin.api.openflow.rpc.RpcManager;
-import org.opendaylight.openflowplugin.impl.util.MdSalRegistratorUtils;
+import org.opendaylight.openflowplugin.impl.util.MdSalRegistrationUtils;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.role.service.rev150727.OfpRole;
 import org.slf4j.Logger;
@@ -55,21 +55,21 @@ public class RpcManagerImpl implements RpcManager {
         final RpcContext rpcContext = new RpcContextImpl(deviceContext.getMessageSpy(), rpcProviderRegistry,
                 deviceContext, maxRequestsQuota, isStatisticsRpcEnabled, notificationPublishService);
 
-        Verify.verify(contexts.putIfAbsent(deviceContext, rpcContext) == null, "RpcCtx still not closed for node {}", nodeId);
+        Verify.verify(contexts.putIfAbsent(deviceContext, rpcContext) == null, "RPC context still not closed for node {}", nodeId);
         deviceContext.addDeviceContextClosedHandler(this);
 
         if (OfpRole.BECOMEMASTER.equals(ofpRole)) {
-            LOG.info("Registering Openflow RPCs for node:{}, role:{}", nodeId, ofpRole);
-            MdSalRegistratorUtils.registerMasterServices(rpcContext, deviceContext, ofpRole);
+            LOG.info("Registering Openflow RPCs services for node:{}, role:{}", nodeId, ofpRole);
+            MdSalRegistrationUtils.registerMasterServices(rpcContext, deviceContext, ofpRole);
 
         } else if(OfpRole.BECOMESLAVE.equals(ofpRole)) {
             // if slave, we need to de-register rpcs if any have been registered, in case of master to slave
-            LOG.info("Unregistering RPC registration (if any) for slave role for node:{}", deviceContext.getDeviceState().getNodeId());
-            MdSalRegistratorUtils.registerSlaveServices(rpcContext, ofpRole);
+            LOG.info("Unregister RPC services (if any) for slave role for node:{}", deviceContext.getDeviceState().getNodeId());
+            MdSalRegistrationUtils.registerSlaveServices(rpcContext, ofpRole);
         } else {
             // if we don't know role, we need to unregister rpcs if any have been registered
-            LOG.info("Unregistering RPC registration (if any) for slave role for node:{}", deviceContext.getDeviceState().getNodeId());
-            MdSalRegistratorUtils.unregisterServices(rpcContext);
+            LOG.info("Unregister RPC services (if any) for slave role for node:{}", deviceContext.getDeviceState().getNodeId());
+            MdSalRegistrationUtils.unregisterServices(rpcContext);
         }
 
         // finish device initialization cycle back to DeviceManager
@@ -89,7 +89,7 @@ public class RpcManagerImpl implements RpcManager {
     public void onDeviceContextClosed(final DeviceContext deviceContext) {
         final RpcContext removedContext = contexts.remove(deviceContext);
         if (removedContext != null) {
-            LOG.info("Unregistering rpcs for device context closure");
+            LOG.info("Unregister RPCs services for device context closure");
             removedContext.close();
         }
     }
index 3cb77d0bddad4fb3a6ac6fda6c59d5511791d142..992275175eb9cdbb86a5d6dc1e55f46c4925029e 100644 (file)
@@ -126,7 +126,6 @@ public class StatisticsManagerImpl implements StatisticsManager, StatisticsManag
             public void onSuccess(final Boolean statisticsGathered) {
                 if (statisticsGathered) {
                     //there are some statistics on device worth gathering
-                    contexts.put(deviceContext, statisticsContext);
                     final TimeCounter timeCounter = new TimeCounter();
                     deviceContext.getDeviceState().setStatisticsPollingEnabledProp(true);
                     scheduleNextPolling(deviceContext, statisticsContext, timeCounter);
@@ -140,8 +139,8 @@ public class StatisticsManagerImpl implements StatisticsManager, StatisticsManag
                     }
                     deviceContext.getDeviceState().setDeviceSynchronized(true);
                 } else {
-                    final String deviceAdress = deviceContext.getPrimaryConnectionContext().getConnectionAdapter().getRemoteAddress().toString();
-                    LOG.info("Statistics for device {} could not be gathered. Closing its device context.", deviceAdress);
+                    final String deviceAddress = deviceContext.getPrimaryConnectionContext().getConnectionAdapter().getRemoteAddress().toString();
+                    LOG.info("Statistics for device {} could not be gathered. Closing its device context.", deviceAddress);
                     deviceContext.close();
                 }
             }
similarity index 98%
rename from openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/util/MdSalRegistratorUtils.java
rename to openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/util/MdSalRegistrationUtils.java
index 15310237119be2b8c7bdb461f7893113e8fb13f8..70390535baa8042c31b53b368870badeea7e3172 100644 (file)
@@ -51,7 +51,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.
 import org.opendaylight.yang.gen.v1.urn.opendaylight.role.service.rev150727.OfpRole;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.SalTableService;
 
-public class MdSalRegistratorUtils {
+public class MdSalRegistrationUtils {
 
     //TODO: Make one register and one unregister method for all services
 
@@ -60,7 +60,7 @@ public class MdSalRegistratorUtils {
                 //NOBODY
             };
 
-    private MdSalRegistratorUtils() {
+    private MdSalRegistrationUtils() {
         throw new IllegalStateException();
     }
 
@@ -94,7 +94,7 @@ public class MdSalRegistratorUtils {
     }
 
     /**
-     * Method unregisters all services in first step. So we don't need to call {@link MdSalRegistratorUtils#unregisterServices(RpcContext)}
+     * Method unregisters all services in first step. So we don't need to call {@link MdSalRegistrationUtils#unregisterServices(RpcContext)}
      * directly before by change role from {@link OfpRole#BECOMEMASTER} to {@link OfpRole#BECOMESLAVE}.
      * Method registers {@link SalEchoService} in next step only because we would like to have SalEchoService as local service for all apps
      * to be able actively check connection status for slave connection too.
index 73d2a36709af1ed7e86a333695a473bf180c9917..90d908b6b460ccf609c6ed3ec34107f0b13c3b66 100644 (file)
@@ -74,7 +74,7 @@ public class HandshakeListenerImplTest {
 
     @Test
     public void testOnHandshakeSuccessfull() throws Exception {
-        handshakeListener.onHandshakeSuccessfull(features, version);
+        handshakeListener.onHandshakeSuccessful(features, version);
         Mockito.verify(connectionContextSpy).changeStateToWorking();
         Mockito.verify(connectionContextSpy).setFeatures(Matchers.any(FeaturesReply.class));
         Mockito.verify(connectionContextSpy).setNodeId(nodeIdCaptor.capture());
index 63cdfceb0542d89883356daa198c9265b2911b92..0a4bb06eb13f28659143a8c0ebc2b7d8a24fa994 100644 (file)
@@ -268,7 +268,7 @@ public class DeviceContextImplTest {
 
     private ConnectionContext addDummyAuxiliaryConnectionContext() {
         ConnectionContext mockedConnectionContext = prepareConnectionContext();
-        deviceContext.addAuxiliaryConenctionContext(mockedConnectionContext);
+        deviceContext.addAuxiliaryConnectionContext(mockedConnectionContext);
         return mockedConnectionContext;
     }
 
@@ -392,7 +392,7 @@ public class DeviceContextImplTest {
         when(deviceState.getNodeId()).thenReturn(dummyNodeId);
 
         ConnectionContext mockedAuxiliaryConnectionContext = prepareConnectionContext();
-        deviceContext.addAuxiliaryConenctionContext(mockedAuxiliaryConnectionContext);
+        deviceContext.addAuxiliaryConnectionContext(mockedAuxiliaryConnectionContext);
         DeviceContextClosedHandler mockedDeviceContextClosedHandler = mock(DeviceContextClosedHandler.class);
         deviceContext.addDeviceContextClosedHandler(mockedDeviceContextClosedHandler);
         when(deviceState.isValid()).thenReturn(true);
index 1a854dfc00507660a4a796a151afde437f7d8ee1..8affe98015a81387ca3d0f0879da0f8e0b1ec42e 100644 (file)
@@ -23,6 +23,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesOutputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.features.reply.PhyPort;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.features.reply.PhyPortBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.role.service.rev150727.OfpRole;
 
 /**
  * openflowplugin-impl
@@ -94,4 +95,39 @@ public class DeviceStateImplTest {
         Assert.assertEquals(expetedResult.getPhyPort(), getFeatures.getPhyPort());
     }
 
+    @Test
+    public void testIsValid_initialValue(){
+        Assert.assertFalse(deviceState.isValid());
+    }
+
+    @Test
+    public void testDeviceSynchronized_initialValue(){
+        Assert.assertFalse(deviceState.deviceSynchronized());
+    }
+
+    @Test
+    public void testStatPollEnabled_initialValue(){
+        Assert.assertFalse(deviceState.isStatisticsPollingEnabled());
+    }
+
+    @Test
+    public void testRole_initialValue(){
+        Assert.assertFalse(deviceState.getRole().equals(OfpRole.BECOMEMASTER));
+        Assert.assertFalse(deviceState.getRole().equals(OfpRole.NOCHANGE));
+    }
+
+    @Test
+    public void testStatistics_initialValue(){
+        Assert.assertFalse(deviceState.isFlowStatisticsAvailable());
+        Assert.assertFalse(deviceState.isPortStatisticsAvailable());
+        Assert.assertFalse(deviceState.isQueueStatisticsAvailable());
+        Assert.assertFalse(deviceState.isTableStatisticsAvailable());
+    }
+
+    @Test
+    public void testMeterAndGroupAvailable_initialValue(){
+        Assert.assertFalse(deviceState.isGroupAvailable());
+        Assert.assertFalse(deviceState.isMetersAvailable());
+    }
+
 }
index 4c7aebdcb923c39ce1441ca4af6f6deb7938fcd0..f52a56b54eb64639dc60f3e91dd4360b2ce7020a 100644 (file)
@@ -270,7 +270,7 @@ public class StatisticsGatheringUtilsTest {
         final org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupId storedGroupId = new org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupId(groupIdValue);
         final KeyedInstanceIdentifier<Group, GroupKey> groupPath = dummyNodePath.augmentation(FlowCapableNode.class).child(Group.class, new GroupKey(storedGroupId));
 
-        verify(deviceContext, Mockito.never()).addDeleteToTxChain(Matchers.eq(LogicalDatastoreType.OPERATIONAL), Matchers.any(InstanceIdentifier.class));
+        verify(deviceContext, Mockito.never()).addDeleteToTxChain(Matchers.eq(LogicalDatastoreType.OPERATIONAL), Matchers.<InstanceIdentifier<?>> any());
         verify(deviceGroupRegistry).removeMarked();
         verify(deviceGroupRegistry).store(storedGroupId);
         verify(deviceContext).writeToTransaction(
@@ -434,7 +434,7 @@ public class StatisticsGatheringUtilsTest {
         final KeyedInstanceIdentifier<Flow, FlowKey> flowPath = dummyNodePath.augmentation(FlowCapableNode.class)
                 .child(Table.class, new TableKey((short) 0))
                 .child(Flow.class, new FlowKey(new FlowId("openflow:21")));
-        verify(deviceContext, Mockito.never()).addDeleteToTxChain(Matchers.eq(LogicalDatastoreType.OPERATIONAL), Matchers.any(InstanceIdentifier.class));
+        verify(deviceContext, Mockito.never()).addDeleteToTxChain(Matchers.eq(LogicalDatastoreType.OPERATIONAL), Matchers.<InstanceIdentifier<?>>any());
         verify(deviceFlowRegistry).storeIfNecessary(FlowRegistryKeyFactory.create(flowBld.build()), (short) 0);
         verify(deviceContext).writeToTransaction(Matchers.eq(LogicalDatastoreType.OPERATIONAL), Matchers.eq(flowPath), Matchers.any(Flow.class));
     }
@@ -463,7 +463,7 @@ public class StatisticsGatheringUtilsTest {
                 new org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterId(meterIdValue);
         final KeyedInstanceIdentifier<Meter, MeterKey> meterPath = dummyNodePath.augmentation(FlowCapableNode.class)
                 .child(Meter.class, new MeterKey(meterId));
-        verify(deviceContext, Mockito.never()).addDeleteToTxChain(Matchers.eq(LogicalDatastoreType.OPERATIONAL), Matchers.any(InstanceIdentifier.class));
+        verify(deviceContext, Mockito.never()).addDeleteToTxChain(Matchers.eq(LogicalDatastoreType.OPERATIONAL), Matchers.<InstanceIdentifier<?>>any());
         verify(deviceMeterRegistry).store(meterId);
         verify(deviceContext).writeToTransaction(Matchers.eq(LogicalDatastoreType.OPERATIONAL), Matchers.eq(meterPath), Matchers.any(Meter.class));
     }
index 41e2921358f8a480094a6dea65af81f013b68df6..56850376c181f0803203a55ca16db05121f0cf55 100644 (file)
@@ -14,19 +14,17 @@ import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
-
+import com.google.common.collect.Lists;
+import com.google.common.util.concurrent.CheckedFuture;
+import com.google.common.util.concurrent.FutureCallback;
+import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.ListenableFuture;
 import java.math.BigInteger;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
 import java.util.Set;
-
-import com.google.common.collect.Lists;
-import com.google.common.util.concurrent.CheckedFuture;
-import com.google.common.util.concurrent.FutureCallback;
-import com.google.common.util.concurrent.Futures;
-import com.google.common.util.concurrent.ListenableFuture;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -147,34 +145,34 @@ public class DeviceInitializationUtilsTest {
     }
     @Test
     public void chainTableTrunkWriteOF10Test() {
-        DeviceState mockedDeviceState = mock(DeviceState.class);
+        final DeviceState mockedDeviceState = mock(DeviceState.class);
 
-        GetFeaturesOutput mockedFeatures = mock(GetFeaturesOutput.class);
+        final GetFeaturesOutput mockedFeatures = mock(GetFeaturesOutput.class);
         when(mockedFeatures.getTables()).thenReturn((short) 2);
         when(mockedDeviceState.getFeatures()).thenReturn(mockedFeatures);
 
         when(mockedDeviceState.getNodeInstanceIdentifier()).thenReturn(DUMMY_NODE_II);
         when(mockedDeviceContext.getDeviceState()).thenReturn(mockedDeviceState);
 
-        RpcResult<List<MultipartReply>> mockedRpcResult = mock(RpcResult.class);
+        final RpcResult<List<MultipartReply>> mockedRpcResult = mock(RpcResult.class);
         when(mockedRpcResult.isSuccessful()).thenReturn(true);
-        List<RpcResult<List<MultipartReply>>> data = new ArrayList<RpcResult<List<MultipartReply>>>();
+        final List<RpcResult<List<MultipartReply>>> data = new ArrayList<RpcResult<List<MultipartReply>>>();
         data.add(mockedRpcResult);
         data.add(mockedRpcResult);
 
         DeviceInitializationUtils.chainTableTrunkWriteOF10(mockedDeviceContext, Futures.immediateFuture(data));
-        verify(mockedDeviceContext, times(3))
-                .writeToTransaction(any(LogicalDatastoreType.class), any(InstanceIdentifier.class), any(FlowCapableNode.class));
+        verify(mockedDeviceContext, times(3)).writeToTransaction(any(LogicalDatastoreType.class),
+                Matchers.<InstanceIdentifier<FlowCapableNode>> any(), any(FlowCapableNode.class));
     }
 
     @Test
     public void testTranslateAndWriteReplyTypeDesc() {
         final ConnectionContext connectionContext = buildMockConnectionContext(OFConstants.OFP_VERSION_1_3);
         Mockito.when(mockedDeviceContext.getPrimaryConnectionContext()).thenReturn(connectionContext);
-        DeviceState deviceState = Mockito.mock(DeviceState.class);
+        final DeviceState deviceState = Mockito.mock(DeviceState.class);
         Mockito.when(mockedDeviceContext.getDeviceState()).thenReturn(deviceState);
 
-        Collection<MultipartReply> multipartReplyMessages = prepareDataforTypeDesc(mockedDeviceContext);
+        final Collection<MultipartReply> multipartReplyMessages = prepareDataforTypeDesc(mockedDeviceContext);
 
         DeviceInitializationUtils.translateAndWriteReply(MultipartType.OFPMPDESC, mockedDeviceContext, DUMMY_NODE_II, multipartReplyMessages);
         verify(mockedDeviceContext)
@@ -183,17 +181,17 @@ public class DeviceInitializationUtilsTest {
 
     @Test
     public void translateAndWriteReplyTypeTableFeatures() {
-        TableFeaturesBuilder tableFeature = new TableFeaturesBuilder();
+        final TableFeaturesBuilder tableFeature = new TableFeaturesBuilder();
         tableFeature.setTableId(DUMMY_TABLE_ID);
-        List<TableFeatures> tableFeatures = new ArrayList<>();
+        final List<TableFeatures> tableFeatures = new ArrayList<>();
         tableFeatures.add(tableFeature.build());
 
-        MultipartReplyTableFeatures multipartReplyTableFeatures = new MultipartReplyTableFeaturesBuilder().setTableFeatures(tableFeatures).build();
-        MultipartReplyTableFeaturesCaseBuilder multipartReplyTableFeaturesCaseBuilder = new MultipartReplyTableFeaturesCaseBuilder();
+        final MultipartReplyTableFeatures multipartReplyTableFeatures = new MultipartReplyTableFeaturesBuilder().setTableFeatures(tableFeatures).build();
+        final MultipartReplyTableFeaturesCaseBuilder multipartReplyTableFeaturesCaseBuilder = new MultipartReplyTableFeaturesCaseBuilder();
         multipartReplyTableFeaturesCaseBuilder.setMultipartReplyTableFeatures(multipartReplyTableFeatures);
 
-        MultipartReplyMessage multipartReplyMessage = new MultipartReplyMessageBuilder().setMultipartReplyBody(multipartReplyTableFeaturesCaseBuilder.build()).build();
-        Set<MultipartReply> multipartReplyMessages = Collections.<MultipartReply>singleton(multipartReplyMessage);
+        final MultipartReplyMessage multipartReplyMessage = new MultipartReplyMessageBuilder().setMultipartReplyBody(multipartReplyTableFeaturesCaseBuilder.build()).build();
+        final Set<MultipartReply> multipartReplyMessages = Collections.<MultipartReply>singleton(multipartReplyMessage);
         DeviceInitializationUtils.translateAndWriteReply(MultipartType.OFPMPTABLEFEATURES, mockedDeviceContext, DUMMY_NODE_II, multipartReplyMessages);
         verify(mockedDeviceContext)
                 .writeToTransaction(eq(LogicalDatastoreType.OPERATIONAL),
@@ -203,19 +201,19 @@ public class DeviceInitializationUtilsTest {
 
     @Test
     public void translateAndWriteReplyTypeMeterFeatures() {
-        DeviceState mockedDeviceState = mock(DeviceState.class);
+        final DeviceState mockedDeviceState = mock(DeviceState.class);
         when(mockedDeviceContext.getDeviceState()).thenReturn(mockedDeviceState);
 
-        MultipartReplyMeterFeaturesBuilder multipartReplyMeterFeaturesBuilder = new MultipartReplyMeterFeaturesBuilder();
+        final MultipartReplyMeterFeaturesBuilder multipartReplyMeterFeaturesBuilder = new MultipartReplyMeterFeaturesBuilder();
         multipartReplyMeterFeaturesBuilder.setBandTypes(new MeterBandTypeBitmap(true, true));
         multipartReplyMeterFeaturesBuilder.setCapabilities(new MeterFlags(true, true, true, true));
         multipartReplyMeterFeaturesBuilder.setMaxMeter(DUMMY_MAX_METER);
 
-        MultipartReplyMeterFeaturesCaseBuilder multipartReplyMeterFeaturesCaseBuilder = new MultipartReplyMeterFeaturesCaseBuilder();
+        final MultipartReplyMeterFeaturesCaseBuilder multipartReplyMeterFeaturesCaseBuilder = new MultipartReplyMeterFeaturesCaseBuilder();
         multipartReplyMeterFeaturesCaseBuilder.setMultipartReplyMeterFeatures(multipartReplyMeterFeaturesBuilder.build());
 
-        MultipartReplyMessage multipartReplyMessage = new MultipartReplyMessageBuilder().setMultipartReplyBody(multipartReplyMeterFeaturesCaseBuilder.build()).build();
-        Set<MultipartReply> multipartReplyMessages = Collections.<MultipartReply>singleton(multipartReplyMessage);
+        final MultipartReplyMessage multipartReplyMessage = new MultipartReplyMessageBuilder().setMultipartReplyBody(multipartReplyMeterFeaturesCaseBuilder.build()).build();
+        final Set<MultipartReply> multipartReplyMessages = Collections.<MultipartReply>singleton(multipartReplyMessage);
         DeviceInitializationUtils.translateAndWriteReply(MultipartType.OFPMPMETERFEATURES, mockedDeviceContext, DUMMY_NODE_II, multipartReplyMessages);
         verify(mockedDeviceContext)
                 .writeToTransaction(eq(LogicalDatastoreType.OPERATIONAL), eq(DUMMY_NODE_II.augmentation(NodeMeterFeatures.class)), any(NodeMeterFeatures.class));
@@ -224,19 +222,19 @@ public class DeviceInitializationUtilsTest {
 
     @Test
     public void translateAndWriteReplyTypeGroupFeatures() {
-        MultipartReplyGroupFeaturesBuilder multipartReplyGroupFeaturesBuilder = new MultipartReplyGroupFeaturesBuilder();
+        final MultipartReplyGroupFeaturesBuilder multipartReplyGroupFeaturesBuilder = new MultipartReplyGroupFeaturesBuilder();
         multipartReplyGroupFeaturesBuilder.setTypes(new GroupTypes(true, true, true, true));
         multipartReplyGroupFeaturesBuilder.setCapabilities(new GroupCapabilities(true, true, true, true));
-        ActionType actionType = new ActionType(true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true);
+        final ActionType actionType = new ActionType(true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true);
         multipartReplyGroupFeaturesBuilder.setActionsBitmap(Lists.newArrayList(actionType));
 
-        MultipartReplyGroupFeatures multipartReplyGroupFeatures = multipartReplyGroupFeaturesBuilder.build();
+        final MultipartReplyGroupFeatures multipartReplyGroupFeatures = multipartReplyGroupFeaturesBuilder.build();
 
-        MultipartReplyGroupFeaturesCaseBuilder multipartReplyGroupFeaturesCaseBuilder = new MultipartReplyGroupFeaturesCaseBuilder();
+        final MultipartReplyGroupFeaturesCaseBuilder multipartReplyGroupFeaturesCaseBuilder = new MultipartReplyGroupFeaturesCaseBuilder();
         multipartReplyGroupFeaturesCaseBuilder.setMultipartReplyGroupFeatures(multipartReplyGroupFeatures);
 
-        MultipartReplyMessage multipartReplyMessage = new MultipartReplyMessageBuilder().setMultipartReplyBody(multipartReplyGroupFeaturesCaseBuilder.build()).build();
-        Set<MultipartReply> multipartReplyMessages = Collections.<MultipartReply>singleton(multipartReplyMessage);
+        final MultipartReplyMessage multipartReplyMessage = new MultipartReplyMessageBuilder().setMultipartReplyBody(multipartReplyGroupFeaturesCaseBuilder.build()).build();
+        final Set<MultipartReply> multipartReplyMessages = Collections.<MultipartReply>singleton(multipartReplyMessage);
 
         DeviceInitializationUtils.translateAndWriteReply(MultipartType.OFPMPGROUPFEATURES, mockedDeviceContext, DUMMY_NODE_II, multipartReplyMessages);
         verify(mockedDeviceContext)
@@ -246,74 +244,74 @@ public class DeviceInitializationUtilsTest {
 
     @Test
     public void translateAndWriteReplyTypePortDesc() {
-        ConnectionContext mockedPrimaryConnectionContext = mock(ConnectionContext.class);
-        FeaturesReply mockedFeatures = mock(FeaturesReply.class);
+        final ConnectionContext mockedPrimaryConnectionContext = mock(ConnectionContext.class);
+        final FeaturesReply mockedFeatures = mock(FeaturesReply.class);
         when(mockedFeatures.getDatapathId()).thenReturn(new BigInteger(DUMMY_DATAPATH_ID));
         when(mockedPrimaryConnectionContext.getFeatures()).thenReturn(mockedFeatures);
         when(mockedDeviceContext.getPrimaryConnectionContext()).thenReturn(mockedPrimaryConnectionContext);
-        DeviceState mockedDeviceState = mock(DeviceState.class);
+        final DeviceState mockedDeviceState = mock(DeviceState.class);
         when(mockedDeviceState.getVersion()).thenReturn(OFConstants.OFP_VERSION_1_0);
         when(mockedDeviceContext.getDeviceState()).thenReturn(mockedDeviceState);
-        MessageTranslator mockedTranslator = mock(MessageTranslator.class);
+        final MessageTranslator mockedTranslator = mock(MessageTranslator.class);
         when(translatorLibrary.lookupTranslator(any(TranslatorKey.class))).thenReturn(mockedTranslator);
         when(mockedDeviceContext.oook()).thenReturn(translatorLibrary);
 
-        MultipartReplyPortDescBuilder multipartReplyPortDescBuilder = new MultipartReplyPortDescBuilder();
+        final MultipartReplyPortDescBuilder multipartReplyPortDescBuilder = new MultipartReplyPortDescBuilder();
 
-        PortsBuilder portsBuilder = new PortsBuilder();
+        final PortsBuilder portsBuilder = new PortsBuilder();
         portsBuilder.setPortNo(DUMMY_PORT_NUMBER);
 
         multipartReplyPortDescBuilder.setPorts(Lists.newArrayList(portsBuilder.build()));
 
-        MultipartReplyPortDescCaseBuilder multipartReplyPortDescCaseBuilder = new MultipartReplyPortDescCaseBuilder();
+        final MultipartReplyPortDescCaseBuilder multipartReplyPortDescCaseBuilder = new MultipartReplyPortDescCaseBuilder();
         multipartReplyPortDescCaseBuilder.setMultipartReplyPortDesc(multipartReplyPortDescBuilder.build());
 
-        MultipartReplyMessage multipartReplyMessage = new MultipartReplyMessageBuilder().setMultipartReplyBody(multipartReplyPortDescCaseBuilder.build()).build();
-        Set<MultipartReply> multipartReplyMessages = Collections.<MultipartReply>singleton(multipartReplyMessage);
+        final MultipartReplyMessage multipartReplyMessage = new MultipartReplyMessageBuilder().setMultipartReplyBody(multipartReplyPortDescCaseBuilder.build()).build();
+        final Set<MultipartReply> multipartReplyMessages = Collections.<MultipartReply>singleton(multipartReplyMessage);
 
         OpenflowPortsUtil.init();
         DeviceInitializationUtils.translateAndWriteReply(MultipartType.OFPMPPORTDESC, mockedDeviceContext, DUMMY_NODE_II, multipartReplyMessages);
-        verify(mockedDeviceContext)
-                .writeToTransaction(eq(LogicalDatastoreType.OPERATIONAL), any(InstanceIdentifier.class), any(NodeConnector.class));
+        verify(mockedDeviceContext).writeToTransaction(eq(LogicalDatastoreType.OPERATIONAL),
+                Matchers.<InstanceIdentifier<NodeConnector>> any(), any(NodeConnector.class));
     }
 
     @Test
     public void createSuccessProcessingCallbackTest() {
-        DeviceState mockedDeviceState = mock(DeviceState.class);
+        final DeviceState mockedDeviceState = mock(DeviceState.class);
         when(mockedDeviceContext.getDeviceState()).thenReturn(mockedDeviceState);
 
         final ConnectionContext connectionContext = buildMockConnectionContext(OFConstants.OFP_VERSION_1_3);
 
-        List<MultipartReply> multipartReplies = new ArrayList<>(prepareDataforTypeDesc(mockedDeviceContext));
-        RpcResult<List<MultipartReply>> result = RpcResultBuilder.<List<MultipartReply>>success(multipartReplies).build();
+        final List<MultipartReply> multipartReplies = new ArrayList<>(prepareDataforTypeDesc(mockedDeviceContext));
+        final RpcResult<List<MultipartReply>> result = RpcResultBuilder.<List<MultipartReply>>success(multipartReplies).build();
         ListenableFuture<RpcResult<List<MultipartReply>>> mockedRequestContextFuture = Futures.immediateFuture(result);
 
         DeviceInitializationUtils.createSuccessProcessingCallback(MultipartType.OFPMPDESC, mockedDeviceContext, DUMMY_NODE_II, mockedRequestContextFuture);
         verify(mockedDeviceContext).writeToTransaction(eq(LogicalDatastoreType.OPERATIONAL), eq(DUMMY_NODE_II.augmentation(FlowCapableNode.class)), any(FlowCapableNode.class));
 
-        RpcResult<List<MultipartReply>> rpcResult = RpcResultBuilder.<List<MultipartReply>>failed().withError(RpcError.ErrorType.PROTOCOL, "dummy error").build();
+        final RpcResult<List<MultipartReply>> rpcResult = RpcResultBuilder.<List<MultipartReply>>failed().withError(RpcError.ErrorType.PROTOCOL, "dummy error").build();
         mockedRequestContextFuture = Futures.immediateFuture(rpcResult);
         DeviceInitializationUtils.createSuccessProcessingCallback(MultipartType.OFPMPDESC, mockedDeviceContext, DUMMY_NODE_II, mockedRequestContextFuture);
         verify(mockedDeviceContext).writeToTransaction(eq(LogicalDatastoreType.OPERATIONAL), eq(DUMMY_NODE_II.augmentation(FlowCapableNode.class)), any(FlowCapableNode.class));
     }
 
     private Collection<MultipartReply> prepareDataforTypeDesc(final DeviceContext mockedDeviceContext) {
-        MultipartReplyDesc multipartReplyDesc = new MultipartReplyDescBuilder().build();
+        final MultipartReplyDesc multipartReplyDesc = new MultipartReplyDescBuilder().build();
 
-        MultipartReplyDescCaseBuilder multipartReplyDescCaseBuilder = new MultipartReplyDescCaseBuilder();
+        final MultipartReplyDescCaseBuilder multipartReplyDescCaseBuilder = new MultipartReplyDescCaseBuilder();
         multipartReplyDescCaseBuilder.setMultipartReplyDesc(multipartReplyDesc);
 
-        MultipartReplyMessage multipartReplyMessage = new MultipartReplyMessageBuilder().setMultipartReplyBody(multipartReplyDescCaseBuilder.build()).build();
+        final MultipartReplyMessage multipartReplyMessage = new MultipartReplyMessageBuilder().setMultipartReplyBody(multipartReplyDescCaseBuilder.build()).build();
         return Collections.<MultipartReply>singleton(multipartReplyMessage);
 
     }
 
-    protected ConnectionContext buildMockConnectionContext(short ofpVersion) {
+    protected ConnectionContext buildMockConnectionContext(final short ofpVersion) {
         when(mockFeatures.getVersion()).thenReturn(ofpVersion);
         when(outboundQueueProvider.reserveEntry()).thenReturn(43L);
         Mockito.doAnswer(new Answer<Void>() {
             @Override
-            public Void answer(InvocationOnMock invocation) throws Throwable {
+            public Void answer(final InvocationOnMock invocation) throws Throwable {
                 final FutureCallback<OfHeader> callBack = (FutureCallback<OfHeader>) invocation.getArguments()[2];
                 callBack.onSuccess(null);
                 return null;
@@ -325,8 +323,8 @@ public class DeviceInitializationUtilsTest {
         when(mockedConnectionAdapter.registerOutboundQueueHandler(Matchers.<OutboundQueueHandler>any(), Matchers.anyInt(), Matchers.anyLong()))
                 .thenAnswer(new Answer<OutboundQueueHandlerRegistration<OutboundQueueHandler>>() {
                     @Override
-                    public OutboundQueueHandlerRegistration<OutboundQueueHandler> answer(InvocationOnMock invocation) throws Throwable {
-                        OutboundQueueHandler handler = (OutboundQueueHandler) invocation.getArguments()[0];
+                    public OutboundQueueHandlerRegistration<OutboundQueueHandler> answer(final InvocationOnMock invocation) throws Throwable {
+                        final OutboundQueueHandler handler = (OutboundQueueHandler) invocation.getArguments()[0];
                         handler.onConnectionQueueChanged(outboundQueueProvider);
                         return null;
                     }
similarity index 83%
rename from openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/util/MdSalRegistratorUtilsTest.java
rename to openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/util/MdSalRegistrationUtilsTest.java
index f8f08b6ad38d483cc6956d76d2eee2b4f331ff21..0600c6ba0cadfa56b27bd7c93f696af5be038ec6 100644 (file)
 package org.opendaylight.openflowplugin.impl.util;
 
 
-import static org.mockito.Mockito.any;
+import static org.mockito.Matchers.any;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
-
 import java.math.BigInteger;
 import org.junit.Test;
+import org.mockito.Matchers;
 import org.opendaylight.openflowplugin.api.openflow.connection.ConnectionContext;
 import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
 import org.opendaylight.openflowplugin.api.openflow.rpc.RpcContext;
@@ -27,10 +27,10 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731
 import org.opendaylight.yang.gen.v1.urn.opendaylight.role.service.rev150727.OfpRole;
 import org.opendaylight.yangtools.yang.binding.RpcService;
 
-public class MdSalRegistratorUtilsTest {
+public class MdSalRegistrationUtilsTest {
 
     /**
-     * Number of currently registrated services (can be changed) in {@link MdSalRegistratorUtils#registerMasterServices
+     * Number of currently registrated services (can be changed) in {@link MdSalRegistrationUtils#registerServices
      * (RpcContext, DeviceContext)}
      */
     private static final int NUMBER_OF_RPC_SERVICE_REGISTRATION = 11;
@@ -49,9 +49,9 @@ public class MdSalRegistratorUtilsTest {
         when(mockedFeatures.getDatapathId()).thenReturn(mockedDataPathId);
 
         when(mockedDeviceContext.getPrimaryConnectionContext()).thenReturn(mockedConnectionContext);
-        MdSalRegistratorUtils.registerMasterServices(mockedRpcContext,mockedDeviceContext, OfpRole.BECOMEMASTER);
-        verify(mockedRpcContext, times(NUMBER_OF_RPC_SERVICE_REGISTRATION)).registerRpcServiceImplementation(any
-                        (RpcService.class.getClass()), any(RpcService.class));
+        MdSalRegistrationUtils.registerMasterServices(mockedRpcContext,mockedDeviceContext, OfpRole.BECOMEMASTER);
+        verify(mockedRpcContext, times(NUMBER_OF_RPC_SERVICE_REGISTRATION)).registerRpcServiceImplementation(
+                Matchers.<Class<RpcService>> any(), any(RpcService.class));
     }
 
 }
index e9ad1e3d1ba04e4fb14cdaac51ce850ded1fe204..8c3f2901f01d8ec488eb5b68654d2380155953df 100644 (file)
@@ -456,8 +456,8 @@ public class ConnectionConductorImpl implements OpenflowProtocolListener,
     }
 
     @Override
-    public void onHandshakeSuccessfull(GetFeaturesOutput featureOutput,
-                                       Short negotiatedVersion) {
+    public void onHandshakeSuccessful(GetFeaturesOutput featureOutput,
+                                      Short negotiatedVersion) {
         postHandshakeBasic(featureOutput, negotiatedVersion);
     }
 
index 0a4e98c47d8204b266a72d09db9b5fb6a0ae3cd3..78997ef27cc79f90db13a7a2f1ab0fea9dc7bcf1 100644 (file)
@@ -389,7 +389,7 @@ public class HandshakeManagerImpl implements HandshakeManager {
                                     featureOutput.getAuxiliaryId());
                             LOG.trace("handshake SETTLED: version={}, datapathId={}, auxiliaryId={}",
                                     version, featureOutput.getDatapathId(), featureOutput.getAuxiliaryId());
-                            handshakeListener.onHandshakeSuccessfull(featureOutput, proposedVersion);
+                            handshakeListener.onHandshakeSuccessful(featureOutput, proposedVersion);
                         } else {
                             // handshake failed
                             LOG.warn("issuing disconnect during handshake [{}]", connectionAdapter.getRemoteAddress());
index 8e01cd0877bbb2363e8b641ae1bd0f0e4b279cfe..1558524eccd6c03fbbf19fb8a828be4b8332e64e 100644 (file)
@@ -31,7 +31,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 public final class PacketOutConvertor {
-    private static final Logger LOG = LoggerFactory.getLogger(MeterConvertor.class);
+    private static final Logger LOG = LoggerFactory.getLogger(PacketOutConvertor.class);
 
     private PacketOutConvertor() {
 
index deaa7aa002365073d7494091db7a97fab8fcb082..2b1210bdfce2eefd5a01ffbd3edc818e6e3e6ed4 100644 (file)
@@ -163,7 +163,7 @@ public class HandshakeManagerImplTest {
 
         handshakeManager.shake(createHelloMessage(version, helloXid).build());
 
-        Mockito.verify(handshakeListener).onHandshakeSuccessfull(resultFeatures.getResult(), version);
+        Mockito.verify(handshakeListener).onHandshakeSuccessful(resultFeatures.getResult(), version);
     }
 
     /**
@@ -181,7 +181,7 @@ public class HandshakeManagerImplTest {
 
         handshakeManager.shake(createHelloMessage(version, helloXid).build());
 
-        Mockito.verify(handshakeListener).onHandshakeSuccessfull(resultFeatures.getResult(), version);
+        Mockito.verify(handshakeListener).onHandshakeSuccessful(resultFeatures.getResult(), version);
     }
 
     /**
@@ -197,7 +197,7 @@ public class HandshakeManagerImplTest {
 
         handshakeManager.shake(createHelloMessage(version, helloXid).build());
 
-        Mockito.verify(handshakeListener, Mockito.never()).onHandshakeSuccessfull(
+        Mockito.verify(handshakeListener, Mockito.never()).onHandshakeSuccessful(
                 Matchers.any(GetFeaturesOutput.class), Matchers.anyShort());
     }
 
@@ -216,7 +216,7 @@ public class HandshakeManagerImplTest {
 
         handshakeManager.shake(createHelloMessage(version, helloXid).build());
 
-        Mockito.verify(handshakeListener, Mockito.never()).onHandshakeSuccessfull(
+        Mockito.verify(handshakeListener, Mockito.never()).onHandshakeSuccessful(
                 Matchers.any(GetFeaturesOutput.class), Matchers.anyShort());
     }
 
@@ -238,7 +238,7 @@ public class HandshakeManagerImplTest {
 
         handshakeManager.shake(createHelloMessage(expVersion, helloXid).build());
 
-        Mockito.verify(handshakeListener).onHandshakeSuccessfull(
+        Mockito.verify(handshakeListener).onHandshakeSuccessful(
                 resultFeatures.getResult(), expVersion);
     }
 
@@ -262,7 +262,7 @@ public class HandshakeManagerImplTest {
 
         handshakeManager.shake(createHelloMessage(expVersion, helloXid).build());
 
-        Mockito.verify(handshakeListener).onHandshakeSuccessfull(
+        Mockito.verify(handshakeListener).onHandshakeSuccessful(
                 resultFeatures.getResult(), expVersion);
     }
 
@@ -281,7 +281,7 @@ public class HandshakeManagerImplTest {
 
         handshakeManager.shake(createHelloMessage(version, helloXid).build());
 
-        Mockito.verify(handshakeListener).onHandshakeSuccessfull(
+        Mockito.verify(handshakeListener).onHandshakeSuccessful(
                 resultFeatures.getResult(), version);
     }
 
@@ -302,7 +302,7 @@ public class HandshakeManagerImplTest {
 
         handshakeManager.shake(createHelloMessage(version, helloXid).build());
 
-        Mockito.verify(handshakeListener).onHandshakeSuccessfull(
+        Mockito.verify(handshakeListener).onHandshakeSuccessful(
                 resultFeatures.getResult(), version);
     }
 
@@ -324,7 +324,7 @@ public class HandshakeManagerImplTest {
 
         handshakeManager.shake(createHelloMessage(expVersion, helloXid).build());
 
-        Mockito.verify(handshakeListener).onHandshakeSuccessfull(
+        Mockito.verify(handshakeListener).onHandshakeSuccessful(
                 resultFeatures.getResult(), expVersion);
     }
 
@@ -346,7 +346,7 @@ public class HandshakeManagerImplTest {
 
         handshakeManager.shake(createHelloMessage(expVersion, helloXid).build());
 
-        Mockito.verify(handshakeListener).onHandshakeSuccessfull(
+        Mockito.verify(handshakeListener).onHandshakeSuccessful(
                 resultFeatures.getResult(), expVersion);
     }
 
@@ -365,7 +365,7 @@ public class HandshakeManagerImplTest {
 
         handshakeManager.shake(createHelloMessage(version, helloXid).build());
 
-        Mockito.verify(handshakeListener, Mockito.never()).onHandshakeSuccessfull(
+        Mockito.verify(handshakeListener, Mockito.never()).onHandshakeSuccessful(
                 Matchers.any(GetFeaturesOutput.class), Matchers.anyShort());
     }
 
@@ -386,7 +386,7 @@ public class HandshakeManagerImplTest {
 
         handshakeManager.shake(createHelloMessage(version, helloXid).build());
 
-        Mockito.verify(handshakeListener, Mockito.never()).onHandshakeSuccessfull(
+        Mockito.verify(handshakeListener, Mockito.never()).onHandshakeSuccessful(
                 Matchers.any(GetFeaturesOutput.class), Matchers.anyShort());
     }
 
@@ -409,7 +409,7 @@ public class HandshakeManagerImplTest {
 
         handshakeManager.shake(helloMessage.build());
 
-        Mockito.verify(handshakeListener).onHandshakeSuccessfull(
+        Mockito.verify(handshakeListener).onHandshakeSuccessful(
                 resultFeatures.getResult(), version);
     }
 
@@ -434,7 +434,7 @@ public class HandshakeManagerImplTest {
 
         handshakeManager.shake(helloMessage.build());
 
-        Mockito.verify(handshakeListener).onHandshakeSuccessfull(
+        Mockito.verify(handshakeListener).onHandshakeSuccessful(
                 resultFeatures.getResult(), version);
     }
 
@@ -457,7 +457,7 @@ public class HandshakeManagerImplTest {
 
         handshakeManager.shake(helloMessage.build());
 
-        Mockito.verify(handshakeListener).onHandshakeSuccessfull(
+        Mockito.verify(handshakeListener).onHandshakeSuccessful(
                 resultFeatures.getResult(), version);
     }
 
@@ -482,7 +482,7 @@ public class HandshakeManagerImplTest {
 
         handshakeManager.shake(helloMessage.build());
 
-        Mockito.verify(handshakeListener).onHandshakeSuccessfull(
+        Mockito.verify(handshakeListener).onHandshakeSuccessful(
                 resultFeatures.getResult(), version);
     }
 
@@ -503,7 +503,7 @@ public class HandshakeManagerImplTest {
 
         handshakeManager.shake(helloMessage.build());
 
-        Mockito.verify(handshakeListener, Mockito.never()).onHandshakeSuccessfull(
+        Mockito.verify(handshakeListener, Mockito.never()).onHandshakeSuccessful(
                 Matchers.any(GetFeaturesOutput.class), Matchers.anyShort());
     }
 
@@ -526,7 +526,7 @@ public class HandshakeManagerImplTest {
 
         handshakeManager.shake(helloMessage.build());
 
-        Mockito.verify(handshakeListener, Mockito.never()).onHandshakeSuccessfull(
+        Mockito.verify(handshakeListener, Mockito.never()).onHandshakeSuccessful(
                 Matchers.any(GetFeaturesOutput.class), Matchers.anyShort());
     }
 
index bf0ba5a297a857edc439e8d45d262f75853d035d..351c566e1515eaf5888b82113b241d669bfd83f5 100644 (file)
@@ -110,7 +110,7 @@ public class ConcurrentSalRegistrationManagerTest {
         Mockito.when(connectionConductor.getVersion()).thenReturn(OFConstants.OFP_VERSION_1_3);
 
         // provider context - registration responder
-        Mockito.when(rpcProviderRegistry.addRoutedRpcImplementation(Matchers.any(Class.class), Matchers.any(RpcService.class)))
+        Mockito.when(rpcProviderRegistry.addRoutedRpcImplementation(Matchers.<Class<RpcService>>any(), Matchers.any(RpcService.class)))
         .then(new Answer<RoutedRpcRegistration<?>>() {
             @Override
             public RoutedRpcRegistration<?> answer(InvocationOnMock invocation) {
index 081b3006bda5121d18381e27fc961d06f5d8bdc1..93324e4a6b685d2dcbf14adf3629bf7efbc42a97 100644 (file)
@@ -71,28 +71,28 @@ public class OFRpcTaskUtilTest {
         when(featuresOutput.getVersion()).thenReturn(OFConstants.OFP_VERSION_1_3);
         when(messageDispatchService.barrier(Mockito.any(BarrierInput.class), Mockito.any(SwitchConnectionDistinguisher.class))).thenReturn(resultListenableFuture);
         when(ofRpcTaskContext.getRpcPool()).thenReturn(executorService);
-        when(executorService.submit(Mockito.any(Callable.class))).thenReturn(updateFlowRpcResultListenableFuture);
+        when(executorService.submit(Mockito.<Callable<RpcResult<UpdateFlowOutput>>> any())).thenReturn(updateFlowRpcResultListenableFuture);
     }
 
 
     @Test
     public void testManageBarrier() throws Exception {
-        Collection<RpcError> rpcErrors = OFRpcTaskUtil.manageBarrier(taskContext, true, connectionDistinguisher);
+        final Collection<RpcError> rpcErrors = OFRpcTaskUtil.manageBarrier(taskContext, true, connectionDistinguisher);
         assertNotNull(rpcErrors);
     }
 
     @Test
     public void testHookFutureNotification() throws Exception {
-        AddFlowInputBuilder flowInputBuilder = new AddFlowInputBuilder();
-        OFRpcTask<AddFlowInput, RpcResult<UpdateFlowOutput>> addFlowInputRpcResultOFRpcTask = OFRpcTaskFactory.createAddFlowTask(ofRpcTaskContext, flowInputBuilder.build(), connectionDistinguisher);
+        final AddFlowInputBuilder flowInputBuilder = new AddFlowInputBuilder();
+        final OFRpcTask<AddFlowInput, RpcResult<UpdateFlowOutput>> addFlowInputRpcResultOFRpcTask = OFRpcTaskFactory.createAddFlowTask(ofRpcTaskContext, flowInputBuilder.build(), connectionDistinguisher);
         OFRpcTaskUtil.hookFutureNotification(addFlowInputRpcResultOFRpcTask, updateFlowRpcResultListenableFuture, notificationProviderService, notificationComposer);
     }
 
     @Test
     public void testChainFutureBarrier() throws Exception {
-        AddFlowInputBuilder flowInputBuilder = new AddFlowInputBuilder();
+        final AddFlowInputBuilder flowInputBuilder = new AddFlowInputBuilder();
         flowInputBuilder.setBarrier(true);
-        OFRpcTask<AddFlowInput, RpcResult<UpdateFlowOutput>> addFlowInputRpcResultOFRpcTask = OFRpcTaskFactory.createAddFlowTask(ofRpcTaskContext, flowInputBuilder.build(), connectionDistinguisher);
+        final OFRpcTask<AddFlowInput, RpcResult<UpdateFlowOutput>> addFlowInputRpcResultOFRpcTask = OFRpcTaskFactory.createAddFlowTask(ofRpcTaskContext, flowInputBuilder.build(), connectionDistinguisher);
         OFRpcTaskUtil.chainFutureBarrier(addFlowInputRpcResultOFRpcTask, updateFlowRpcResultListenableFuture);
     }
 }
\ No newline at end of file
index 47951e6e0dd0bcafa1e20b568ea474493d07487b..5e3ab0843eea9a09bcfdeaa9e5fb46796e1db4b4 100644 (file)
@@ -9,12 +9,13 @@
  */
 package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor;
 
+import com.google.common.collect.ImmutableList;
 import java.math.BigInteger;
 import java.util.ArrayList;
 import java.util.List;
-
 import org.junit.Assert;
 import org.junit.Test;
+import org.opendaylight.openflowplugin.openflow.md.util.OpenflowPortsUtil;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Uri;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.CopyTtlInCaseBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.GroupActionCase;
@@ -44,8 +45,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev13
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GroupModInputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.buckets.grouping.BucketsList;
 
-import com.google.common.collect.ImmutableList;
-
 public class GroupConvertorTest {
 
     /**
@@ -54,63 +53,63 @@ public class GroupConvertorTest {
     @Test
     public void testGroupModConvertorwithallParameters() {
 
-        AddGroupInputBuilder addGroupBuilder = new AddGroupInputBuilder();
+        final AddGroupInputBuilder addGroupBuilder = new AddGroupInputBuilder();
 
         addGroupBuilder.setGroupId(new GroupId(10L));
 
         addGroupBuilder.setGroupType(GroupTypes.GroupAll);
-        List<Bucket> bucketList = new ArrayList<Bucket>();
-        List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action> actionsList = new ArrayList<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action>();
-        List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action> actionsList1 = new ArrayList<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action>();
+        final List<Bucket> bucketList = new ArrayList<Bucket>();
+        final List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action> actionsList = new ArrayList<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action>();
+        final List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action> actionsList1 = new ArrayList<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action>();
 
         int actionOrder = 0;
 
         // Action1
-        GroupActionBuilder groupActionBuilder = new GroupActionBuilder();
+        final GroupActionBuilder groupActionBuilder = new GroupActionBuilder();
         groupActionBuilder.setGroup("005");
-        GroupAction groupIdaction = groupActionBuilder.build();
-        ActionBuilder actionsB = new ActionBuilder();
+        final GroupAction groupIdaction = groupActionBuilder.build();
+        final ActionBuilder actionsB = new ActionBuilder();
         actionsB.setOrder(actionOrder++).setAction(new GroupActionCaseBuilder().setGroupAction(groupIdaction).build());
 
         // Action2:
-        GroupActionBuilder groupActionBuilder1 = new GroupActionBuilder();
+        final GroupActionBuilder groupActionBuilder1 = new GroupActionBuilder();
         groupActionBuilder1.setGroup("006");
-        GroupAction groupIdaction1 = groupActionBuilder.build();
-        ActionBuilder actionsB1 = new ActionBuilder();
+        final GroupAction groupIdaction1 = groupActionBuilder.build();
+        final ActionBuilder actionsB1 = new ActionBuilder();
         actionsB1.setOrder(actionOrder++).setAction(new GroupActionCaseBuilder().setGroupAction(groupIdaction1).build());
 
         actionsList.add(actionsB.build());
         actionsList.add(actionsB1.build());
 
 
-        BucketsBuilder bucketsB = new BucketsBuilder();
+        final BucketsBuilder bucketsB = new BucketsBuilder();
 
-        BucketBuilder bucketB = new BucketBuilder();
+        final BucketBuilder bucketB = new BucketBuilder();
         bucketB.setWeight(10);
         bucketB.setWatchPort(20L);
         bucketB.setWatchGroup(22L);
 
         bucketB.setAction(actionsList);
-        Bucket bucket = bucketB.build();
+        final Bucket bucket = bucketB.build();
 
         bucketList.add(bucket); // List of bucket
 
-        BucketBuilder bucketB1 = new BucketBuilder();
+        final BucketBuilder bucketB1 = new BucketBuilder();
         bucketB1.setWeight(50);
         bucketB1.setWatchPort(60L);
         bucketB1.setWatchGroup(70L);
 
         // Action1
-        CopyTtlInBuilder copyTtlB = new CopyTtlInBuilder();
-        CopyTtlIn copyTtl = copyTtlB.build();
-        ActionBuilder actionsB2 = new ActionBuilder();
+        final CopyTtlInBuilder copyTtlB = new CopyTtlInBuilder();
+        final CopyTtlIn copyTtl = copyTtlB.build();
+        final ActionBuilder actionsB2 = new ActionBuilder();
         actionsB2.setOrder(actionOrder++).setAction(new CopyTtlInCaseBuilder().setCopyTtlIn(copyTtl).build());
 
         // Action2:
-        SetMplsTtlActionBuilder setMplsTtlActionBuilder = new SetMplsTtlActionBuilder();
+        final SetMplsTtlActionBuilder setMplsTtlActionBuilder = new SetMplsTtlActionBuilder();
         setMplsTtlActionBuilder.setMplsTtl((short) 0X1);
-        SetMplsTtlAction setMAction = setMplsTtlActionBuilder.build();
-        ActionBuilder actionsB3 = new ActionBuilder();
+        final SetMplsTtlAction setMAction = setMplsTtlActionBuilder.build();
+        final ActionBuilder actionsB3 = new ActionBuilder();
 
         actionsB3.setOrder(actionOrder++).setAction(new SetMplsTtlActionCaseBuilder().setSetMplsTtlAction(setMAction).build());
 
@@ -120,16 +119,16 @@ public class GroupConvertorTest {
 
         bucketB1.setAction(actionsList);
 
-        Bucket bucket1 = bucketB1.build(); // second bucket
+        final Bucket bucket1 = bucketB1.build(); // second bucket
 
         bucketList.add(bucket1);
 
         bucketsB.setBucket(bucketList);// List of bucket added to the Buckets
-        Buckets buckets = bucketsB.build();
+        final Buckets buckets = bucketsB.build();
 
         addGroupBuilder.setBuckets(buckets);
 
-        GroupModInputBuilder outAddGroupInput = GroupConvertor.toGroupModInput(addGroupBuilder.build(), (short) 0X4, BigInteger.valueOf(1));
+        final GroupModInputBuilder outAddGroupInput = GroupConvertor.toGroupModInput(addGroupBuilder.build(), (short) 0X4, BigInteger.valueOf(1));
 
         Assert.assertEquals(GroupModCommand.OFPGCADD, outAddGroupInput.getCommand());
         Assert.assertEquals(GroupType.OFPGTALL, outAddGroupInput.getType());
@@ -139,9 +138,9 @@ public class GroupConvertorTest {
         Assert.assertEquals(20L, (long) outAddGroupInput.getBucketsList().get(0).getWatchPort().getValue());
         Assert.assertEquals((Long) 22L, outAddGroupInput.getBucketsList().get(0).getWatchGroup());
 
-        List<Action> outActionList = outAddGroupInput.getBucketsList().get(0).getAction();
+        final List<Action> outActionList = outAddGroupInput.getBucketsList().get(0).getAction();
         for (int outItem = 0; outItem < outActionList.size(); outItem++) {
-            Action action = outActionList
+            final Action action = outActionList
                     .get(outItem);
             if (action.getActionChoice() instanceof GroupActionCase) {
                 Assert.assertEquals((Long) 5L, ((GroupActionCase) action.getActionChoice()).getGroupAction().getGroupId());
@@ -153,9 +152,9 @@ public class GroupConvertorTest {
         Assert.assertEquals((Integer) 50, outAddGroupInput.getBucketsList().get(1).getWeight());
         Assert.assertEquals((long) 60, (long) outAddGroupInput.getBucketsList().get(1).getWatchPort().getValue());
         Assert.assertEquals((Long) 70L, outAddGroupInput.getBucketsList().get(1).getWatchGroup());
-        List<Action> outActionList1 = outAddGroupInput.getBucketsList().get(1).getAction();
+        final List<Action> outActionList1 = outAddGroupInput.getBucketsList().get(1).getAction();
         for (int outItem = 0; outItem < outActionList1.size(); outItem++) {
-            Action action = outActionList1
+            final Action action = outActionList1
                     .get(outItem);
             if (action.getActionChoice() instanceof GroupActionCase) {
 
@@ -173,13 +172,13 @@ public class GroupConvertorTest {
      */
     @Test
     public void testGroupModConvertorNoBucket() {
-        AddGroupInputBuilder addGroupBuilder = new AddGroupInputBuilder();
+        final AddGroupInputBuilder addGroupBuilder = new AddGroupInputBuilder();
 
         addGroupBuilder.setGroupId(new GroupId(10L));
 
         addGroupBuilder.setGroupType(GroupTypes.GroupAll);
 
-        GroupModInputBuilder outAddGroupInput = GroupConvertor.toGroupModInput(addGroupBuilder.build(), (short) 0X4, BigInteger.valueOf(1));
+        final GroupModInputBuilder outAddGroupInput = GroupConvertor.toGroupModInput(addGroupBuilder.build(), (short) 0X4, BigInteger.valueOf(1));
 
         Assert.assertEquals(GroupModCommand.OFPGCADD, outAddGroupInput.getCommand());
         Assert.assertEquals(GroupType.OFPGTALL, outAddGroupInput.getType());
@@ -193,14 +192,14 @@ public class GroupConvertorTest {
 
         int actionOrder = 0;
 
-        AddGroupInputBuilder addGroupBuilder = new AddGroupInputBuilder();
+        final AddGroupInputBuilder addGroupBuilder = new AddGroupInputBuilder();
 
         addGroupBuilder.setGroupId(new GroupId(10L));
 
         addGroupBuilder.setGroupType(GroupTypes.GroupFf);
-        List<Bucket> bucketList = new ArrayList<Bucket>();
-        List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action> actionsList = new ArrayList<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action>();
-        List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action> actionsList1 = new ArrayList<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action>();
+        final List<Bucket> bucketList = new ArrayList<Bucket>();
+        final List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action> actionsList = new ArrayList<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action>();
+        final List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action> actionsList1 = new ArrayList<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action>();
 
         // Action1: 005
         actionsList.add(assembleActionBuilder("005", actionOrder++).build());
@@ -208,17 +207,17 @@ public class GroupConvertorTest {
         actionsList.add(assembleActionBuilder("006", actionOrder++).build());
         // .. and mr.Bond is not coming today
 
-        BucketsBuilder bucketsB = new BucketsBuilder();
+        final BucketsBuilder bucketsB = new BucketsBuilder();
 
-        BucketBuilder bucketB = new BucketBuilder();
+        final BucketBuilder bucketB = new BucketBuilder();
 
         bucketB.setAction(actionsList);
-        Bucket bucket = bucketB.build();
+        final Bucket bucket = bucketB.build();
 
         bucketList.add(bucket); // List of bucket
 
 
-        BucketBuilder bucketB1 = new BucketBuilder();
+        final BucketBuilder bucketB1 = new BucketBuilder();
 
         // Action1
         actionsList1.add(assembleCopyTtlInBuilder(actionOrder++).build());
@@ -227,34 +226,34 @@ public class GroupConvertorTest {
 
         bucketB1.setAction(actionsList1);
 
-        Bucket bucket1 = bucketB1.build(); // second bucket
+        final Bucket bucket1 = bucketB1.build(); // second bucket
 
         bucketList.add(bucket1);
 
         bucketsB.setBucket(bucketList);// List of bucket added to the Buckets
-        Buckets buckets = bucketsB.build();
+        final Buckets buckets = bucketsB.build();
 
         addGroupBuilder.setBuckets(buckets);
 
-        GroupModInputBuilder outAddGroupInput = GroupConvertor.toGroupModInput(addGroupBuilder.build(), (short) 0X4, BigInteger.valueOf(1));
+        final GroupModInputBuilder outAddGroupInput = GroupConvertor.toGroupModInput(addGroupBuilder.build(), (short) 0X4, BigInteger.valueOf(1));
 
         Assert.assertEquals(GroupModCommand.OFPGCADD, outAddGroupInput.getCommand());
         Assert.assertEquals(GroupType.OFPGTFF, outAddGroupInput.getType());
 
         Assert.assertEquals(10L, outAddGroupInput.getGroupId().getValue().longValue());
 
-        List<Action> outActionList = outAddGroupInput.getBucketsList().get(0).getAction();
+        final List<Action> outActionList = outAddGroupInput.getBucketsList().get(0).getAction();
         for (int outItem = 0; outItem < outActionList.size(); outItem++) {
-            Action action = outActionList
+            final Action action = outActionList
                     .get(outItem);
             if (action.getActionChoice() instanceof GroupActionCase) {
                 Assert.assertEquals((Long) 5L, ((GroupActionCase) action.getActionChoice()).getGroupAction().getGroupId());
             }
         }
 
-        List<Action> outActionList1 = outAddGroupInput.getBucketsList().get(1).getAction();
+        final List<Action> outActionList1 = outAddGroupInput.getBucketsList().get(1).getAction();
         for (int outItem = 0; outItem < outActionList1.size(); outItem++) {
-            Action action = outActionList1
+            final Action action = outActionList1
                     .get(outItem);
             if (action.getActionChoice() instanceof GroupActionCase) {
                 Assert.assertEquals((Long) 6L, ((GroupActionCase) action.getActionChoice()).getGroupAction().getGroupId());
@@ -268,9 +267,9 @@ public class GroupConvertorTest {
     @Test
     public void testGroupModConvertSortedBuckets() {
 
-        int actionOrder = 0;
+        final int actionOrder = 0;
 
-        ArrayList<Bucket> bucket = new ArrayList<Bucket>();
+        final ArrayList<Bucket> bucket = new ArrayList<Bucket>();
 
         bucket.add(new BucketBuilder()
                         .setBucketId(new BucketId((long) 4))
@@ -343,7 +342,7 @@ public class GroupConvertorTest {
                     .build());
 
 
-        AddGroupInput input = new AddGroupInputBuilder()
+        final AddGroupInput input = new AddGroupInputBuilder()
                                     .setGroupId(new GroupId((long) 1))
                                     .setGroupName("Foo")
                                     .setGroupType(GroupTypes.GroupFf)
@@ -352,9 +351,11 @@ public class GroupConvertorTest {
                                                        .build())
                                     .build();
 
-        GroupModInputBuilder outAddGroupInput = GroupConvertor.toGroupModInput(input, (short) 0X4, BigInteger.valueOf(1));
+        OpenflowPortsUtil.init();
+
+        final GroupModInputBuilder outAddGroupInput = GroupConvertor.toGroupModInput(input, (short) 0X4, BigInteger.valueOf(1));
 
-        List<BucketsList> bucketList = outAddGroupInput.getBucketsList();
+        final List<BucketsList> bucketList = outAddGroupInput.getBucketsList();
         Assert.assertEquals( Long.valueOf(1), bucketList.get(0).getWatchGroup());
         Assert.assertEquals( Long.valueOf(3), bucketList.get(0).getWatchPort().getValue());
 
@@ -376,12 +377,12 @@ public class GroupConvertorTest {
     /**
      * @return
      */
-    private static ActionBuilder assembleSetMplsTtlActionBuilder(int actionOrder) {
-        SetMplsTtlActionBuilder setMplsTtlActionBuilder = new SetMplsTtlActionBuilder();
+    private static ActionBuilder assembleSetMplsTtlActionBuilder(final int actionOrder) {
+        final SetMplsTtlActionBuilder setMplsTtlActionBuilder = new SetMplsTtlActionBuilder();
         setMplsTtlActionBuilder.setMplsTtl((short) 0X1);
-        SetMplsTtlActionCaseBuilder setMplsTtlActionCaseBuilder = new SetMplsTtlActionCaseBuilder();
+        final SetMplsTtlActionCaseBuilder setMplsTtlActionCaseBuilder = new SetMplsTtlActionCaseBuilder();
         setMplsTtlActionCaseBuilder.setSetMplsTtlAction(setMplsTtlActionBuilder.build());
-        ActionBuilder actionsB3 = new ActionBuilder();
+        final ActionBuilder actionsB3 = new ActionBuilder();
         actionsB3.setOrder(actionOrder).setAction(setMplsTtlActionCaseBuilder.build());
         return actionsB3;
     }
@@ -389,11 +390,11 @@ public class GroupConvertorTest {
     /**
      * @return
      */
-    private static ActionBuilder assembleCopyTtlInBuilder(int actionOrder) {
-        CopyTtlInBuilder copyTtlB = new CopyTtlInBuilder();
-        CopyTtlInCaseBuilder copyTtlInCaseBuilder = new CopyTtlInCaseBuilder();
+    private static ActionBuilder assembleCopyTtlInBuilder(final int actionOrder) {
+        final CopyTtlInBuilder copyTtlB = new CopyTtlInBuilder();
+        final CopyTtlInCaseBuilder copyTtlInCaseBuilder = new CopyTtlInCaseBuilder();
         copyTtlInCaseBuilder.setCopyTtlIn(copyTtlB.build());
-        ActionBuilder actionsB2 = new ActionBuilder();
+        final ActionBuilder actionsB2 = new ActionBuilder();
         actionsB2.setOrder(actionOrder).setAction(copyTtlInCaseBuilder.build());
         return actionsB2;
     }
@@ -402,12 +403,12 @@ public class GroupConvertorTest {
      * @param groupName name of group
      * @return
      */
-    private static ActionBuilder assembleActionBuilder(String groupName, int actionOrder) {
-        GroupActionBuilder groupActionBuilder = new GroupActionBuilder();
+    private static ActionBuilder assembleActionBuilder(final String groupName, final int actionOrder) {
+        final GroupActionBuilder groupActionBuilder = new GroupActionBuilder();
         groupActionBuilder.setGroup(groupName);
-        GroupActionCaseBuilder groupActionCaseBuilder = new GroupActionCaseBuilder();
+        final GroupActionCaseBuilder groupActionCaseBuilder = new GroupActionCaseBuilder();
         groupActionCaseBuilder.setGroupAction(groupActionBuilder.build());
-        ActionBuilder actionsBld = new ActionBuilder();
+        final ActionBuilder actionsBld = new ActionBuilder();
         actionsBld.setOrder(actionOrder).setAction(groupActionCaseBuilder.build());
         return actionsBld;
     }
@@ -420,30 +421,30 @@ public class GroupConvertorTest {
 
         int actionOrder = 0;
 
-        AddGroupInputBuilder addGroupBuilder = new AddGroupInputBuilder();
+        final AddGroupInputBuilder addGroupBuilder = new AddGroupInputBuilder();
 
         addGroupBuilder.setGroupId(new GroupId(10L));
 
         addGroupBuilder.setGroupType(GroupTypes.GroupAll);
-        List<Bucket> bucketList = new ArrayList<Bucket>();
-        List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action> actionsList = new ArrayList<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action>();
-        List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action> actionsList1 = new ArrayList<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action>();
+        final List<Bucket> bucketList = new ArrayList<Bucket>();
+        final List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action> actionsList = new ArrayList<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action>();
+        final List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action> actionsList1 = new ArrayList<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action>();
 
         // Action1
         actionsList.add(assembleActionBuilder("005", actionOrder++).build());
         // Action2:
         actionsList.add(assembleActionBuilder("006", actionOrder++).build());
 
-        BucketsBuilder bucketsB = new BucketsBuilder();
+        final BucketsBuilder bucketsB = new BucketsBuilder();
 
-        BucketBuilder bucketB = new BucketBuilder();
+        final BucketBuilder bucketB = new BucketBuilder();
 
         bucketB.setAction(actionsList);
-        Bucket bucket = bucketB.build();
+        final Bucket bucket = bucketB.build();
 
         bucketList.add(bucket); // List of bucket
 
-        BucketBuilder bucketB1 = new BucketBuilder();
+        final BucketBuilder bucketB1 = new BucketBuilder();
 
         // Action1
         actionsList1.add(assembleCopyTtlInBuilder(actionOrder++).build());
@@ -452,25 +453,25 @@ public class GroupConvertorTest {
 
         bucketB1.setAction(actionsList);
 
-        Bucket bucket1 = bucketB1.build(); // second bucket
+        final Bucket bucket1 = bucketB1.build(); // second bucket
 
         bucketList.add(bucket1);
 
         bucketsB.setBucket(bucketList);// List of bucket added to the Buckets
-        Buckets buckets = bucketsB.build();
+        final Buckets buckets = bucketsB.build();
 
         addGroupBuilder.setBuckets(buckets);
 
-        GroupModInputBuilder outAddGroupInput = GroupConvertor.toGroupModInput(addGroupBuilder.build(), (short) 0X4, BigInteger.valueOf(1));
+        final GroupModInputBuilder outAddGroupInput = GroupConvertor.toGroupModInput(addGroupBuilder.build(), (short) 0X4, BigInteger.valueOf(1));
 
         Assert.assertEquals(GroupModCommand.OFPGCADD, outAddGroupInput.getCommand());
         Assert.assertEquals(GroupType.OFPGTALL, outAddGroupInput.getType());
 
         Assert.assertEquals(10L, outAddGroupInput.getGroupId().getValue().longValue());
 
-        List<Action> outActionList = outAddGroupInput.getBucketsList().get(0).getAction();
+        final List<Action> outActionList = outAddGroupInput.getBucketsList().get(0).getAction();
         for (int outItem = 0; outItem < outActionList.size(); outItem++) {
-            Action action = outActionList
+            final Action action = outActionList
                     .get(outItem);
             if (action.getActionChoice() instanceof GroupActionCase) {
                 Assert.assertEquals((Long) 5L, ((GroupActionCase) action.getActionChoice()).getGroupAction().getGroupId());
@@ -479,9 +480,9 @@ public class GroupConvertorTest {
 
         }
 
-        List<Action> outActionList1 = outAddGroupInput.getBucketsList().get(1).getAction();
+        final List<Action> outActionList1 = outAddGroupInput.getBucketsList().get(1).getAction();
         for (int outItem = 0; outItem < outActionList1.size(); outItem++) {
-            Action action = outActionList1
+            final Action action = outActionList1
                     .get(outItem);
             if (action.getActionChoice() instanceof GroupActionCase) {
 
index f26afc70d45a47497db1073ed55e27524b23662c..4deaf1281279a7fb70bc5fbf42767eace2ab5590 100644 (file)
@@ -7,15 +7,14 @@
  */
 package org.opendaylight.openflowplugin.openflow.md.core.session;
 
+import static org.mockito.Matchers.any;
 import com.google.common.util.concurrent.ListeningExecutorService;
 import java.math.BigInteger;
 import java.net.InetSocketAddress;
 import org.junit.After;
-import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
-import org.mockito.ArgumentCaptor;
 import org.mockito.Matchers;
 import org.mockito.Mock;
 import org.mockito.Mockito;
@@ -29,22 +28,15 @@ import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
 import org.opendaylight.openflowjava.protocol.api.connection.ConnectionAdapter;
 import org.opendaylight.openflowplugin.api.openflow.md.core.ConnectionConductor;
 import org.opendaylight.openflowplugin.api.openflow.md.core.NotificationEnqueuer;
-import org.opendaylight.openflowplugin.api.openflow.md.core.NotificationQueueWrapper;
 import org.opendaylight.openflowplugin.api.openflow.md.core.session.SessionContext;
 import org.opendaylight.openflowplugin.api.openflow.md.core.session.SessionManager;
 import org.opendaylight.openflowplugin.api.openflow.md.core.session.SwitchSessionKeyOF;
 import org.opendaylight.openflowplugin.openflow.md.core.role.OfEntityManager;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.ModelDrivenSwitchImpl;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.SalRegistrationManager;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeUpdated;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeUpdated;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesOutputBuilder;
-import org.opendaylight.yangtools.yang.binding.Notification;
 import org.opendaylight.yangtools.yang.binding.RpcService;
 
-import static org.mockito.Matchers.any;
-
 /**
  * test of {@link SessionManagerOFImpl}
  */
@@ -87,19 +79,19 @@ public class SessionManagerOFImplTest {
         Mockito.when(context.getNotificationEnqueuer()).thenReturn(notificationEnqueuer);
 
         // provider context - registration responder
-        Mockito.when(rpcProviderRegistry.addRoutedRpcImplementation(any(Class.class), any(RpcService.class)))
+        Mockito.when(rpcProviderRegistry.addRoutedRpcImplementation(Matchers.<Class<RpcService>> any(), any(RpcService.class)))
         .then(new Answer<RoutedRpcRegistration<?>>() {
             @Override
-            public RoutedRpcRegistration<?> answer(InvocationOnMock invocation) {
-                Object[] args = invocation.getArguments();
-                RoutedRpcRegistration<RpcService> registration = Mockito.mock(RoutedRpcRegistration.class);
+            public RoutedRpcRegistration<?> answer(final InvocationOnMock invocation) {
+                final Object[] args = invocation.getArguments();
+                final RoutedRpcRegistration<RpcService> registration = Mockito.mock(RoutedRpcRegistration.class);
                 Mockito.when(registration.getInstance()).thenReturn((RpcService) args[1]);
                 return registration;
             }
         });
 
         // session listener - prepare registration and notification mockery
-        SalRegistrationManager sessionListener = new SalRegistrationManager();
+        final SalRegistrationManager sessionListener = new SalRegistrationManager();
         sessionListener.setPublishService(notificationProviderService);
         sessionListener.setRpcProviderRegistry(rpcProviderRegistry);
         sessionListener.setDataService(dataService);
@@ -131,7 +123,7 @@ public class SessionManagerOFImplTest {
     @Test
     public void testAddSessionContext() {
         // prepare mocks and values
-        GetFeaturesOutputBuilder featuresBld = new GetFeaturesOutputBuilder().setDatapathId(BigInteger.valueOf(42));
+        final GetFeaturesOutputBuilder featuresBld = new GetFeaturesOutputBuilder().setDatapathId(BigInteger.valueOf(42));
         featuresBld.setVersion((short) 123);
         Mockito.when(context.getFeatures()).thenReturn(featuresBld.build());
         Mockito.when(primaryConductor.getConnectionAdapter()).thenReturn(connectionAdapter);
index 043811a68cf16800f6dabe72f2c2e264b9687fec..a31d89fd89b51cd0027b82705381602ab08e265f 100644 (file)
@@ -273,6 +273,6 @@ public class PacketInV10TranslatorTest {
         connectionConductor.setQueueProcessor(queueProcessor);\r
         connectionConductor.init();\r
         connectionConductor\r
-                .onHandshakeSuccessfull(featuresOutput, (short) 0x01);\r
+                .onHandshakeSuccessful(featuresOutput, (short) 0x01);\r
     }\r
 }\r
index bb6964a971880265e16a135e054cfe9234f4bd56..24e3a829e8d847bbc4aa2f20086316c40144d060 100644 (file)
@@ -64,7 +64,7 @@ public class InventoryDataServiceUtilTest {
     @Before
     public void setupEnvironment() {
         when(dataBroker.newReadOnlyTransaction()).thenReturn(readOnlyTransaction);
-        when(readOnlyTransaction.read(Mockito.any(LogicalDatastoreType.class), Mockito.any(InstanceIdentifier.class))).thenReturn(Futures.immediateCheckedFuture(Optional.of(nodes)));
+        when(readOnlyTransaction.read(Mockito.any(LogicalDatastoreType.class), Mockito.<InstanceIdentifier<Nodes>>any())).thenReturn(Futures.immediateCheckedFuture(Optional.of(nodes)));
 
         OpenflowPortsUtil.init();
         OFSessionUtil.getSessionManager().setDataBroker(dataBroker);
@@ -91,7 +91,7 @@ public class InventoryDataServiceUtilTest {
      */
     @Test
     public void testReadNode(){
-        when(readOnlyTransaction.read(Mockito.any(LogicalDatastoreType.class), Mockito.any(InstanceIdentifier.class))).thenReturn(Futures.immediateCheckedFuture(Optional.of(node)));
+        when(readOnlyTransaction.read(Mockito.any(LogicalDatastoreType.class), Mockito.<InstanceIdentifier<Node>>any())).thenReturn(Futures.immediateCheckedFuture(Optional.of(node)));
         InstanceIdentifier<Node> instanceId = InstanceIdentifier.create(Node.class);
         Node node = InventoryDataServiceUtil.readNode(instanceId);
         assertNotNull(node);
index 83ac6ad3ffb6c78c6c19bf5b1a1436b81856167a..90fd99510e02ec91bc54164bce061694ef97e6e3 100644 (file)
@@ -47,7 +47,7 @@ import org.slf4j.LoggerFactory;
  */
 public class LearningSwitchHandlerSimpleImpl implements LearningSwitchHandler, PacketProcessingListener {
 
-    private static final Logger LOG = LoggerFactory.getLogger(LearningSwitchHandler.class);
+    private static final Logger LOG = LoggerFactory.getLogger(LearningSwitchHandlerSimpleImpl.class);
 
     private static final byte[] ETH_TYPE_IPV4 = new byte[] { 0x08, 0x00 };
 
index 24b04b55df4ffade695880a9833d5e524271ac58..348d653fe4ab4085d4a51ebb57d10068bb7efb1c 100644 (file)
@@ -16,7 +16,7 @@ import org.slf4j.LoggerFactory;
  * provides activation and deactivation of drop responder service - responds on packetIn
  */
 public class DropTestRpcProvider implements AutoCloseable {
-    private static final Logger LOG = LoggerFactory.getLogger(DropTestDsProvider.class);
+    private static final Logger LOG = LoggerFactory.getLogger(DropTestRpcProvider.class);
 
     private SalFlowService flowService;
     private NotificationService notificationService;
index 34f7bca624339f22cb02ce04be33f30f99d7fe32..c8629b6e87a5cb8fa2c6c6c03662bcccc7dcaf93 100644 (file)
@@ -121,7 +121,7 @@ import org.slf4j.LoggerFactory;
 
 public class OpenflowPluginBulkTransactionProvider implements CommandProvider {
 
-    private static final Logger LOG = LoggerFactory.getLogger(OpenflowpluginTestCommandProvider.class);
+    private static final Logger LOG = LoggerFactory.getLogger(OpenflowPluginBulkTransactionProvider.class);
     private DataBroker dataBroker;
     private final BundleContext ctx;
     private NodeBuilder testNode;
index 55378517de3f257ee19897ad5fe3bccd693e0560..e0ed0513c4dce2499d8059c6be3a794dffe09342 100644 (file)
@@ -25,7 +25,7 @@ import org.slf4j.LoggerFactory;
 
 public class OpenflowpluginTestNodeConnectorNotification {
 
-    private static final Logger LOG = LoggerFactory.getLogger(OpenflowpluginTestCommandProvider.class);
+    private static final Logger LOG = LoggerFactory.getLogger(OpenflowpluginTestNodeConnectorNotification.class);
 
     private DataBroker dataBroker;
     private ProviderContext pc;
index 125655abe22eed381eebca73bcfc95d3a34b9dd1..c4116a899e0bee21b68252f2aa1ab69ba23e8775 100644 (file)
@@ -25,7 +25,7 @@ import org.slf4j.LoggerFactory;
 
 public class OpenflowpluginTestTopologyNotification {
 
-    private static final Logger LOG = LoggerFactory.getLogger(OpenflowpluginTestCommandProvider.class);
+    private static final Logger LOG = LoggerFactory.getLogger(OpenflowpluginTestTopologyNotification.class);
 
     private DataBroker dataBroker;
     private ProviderContext pc;