From b4f4b4b702e2ccd8a7c62fd2a5c184c5b1cbe665 Mon Sep 17 00:00:00 2001 From: gobinath Date: Wed, 19 Sep 2018 11:35:49 +0530 Subject: [PATCH] OPNFLWPLUG-1032: Neon-MRI: Bump odlparent, yangtools, mdsal This patch bumps: - odlparent to 4.0.0 - mdsal to 3.0.1 It also deals with: - odl-guava-23 to odl-guava - xmlunit upgrade via xmlunit-legacy - adjust dependencies to account for ietf-{inet,yang}-types movement Change-Id: I3936130b75afe804195ecb87c46aef46c39a7ed5 Signed-off-by: Michael Vorburger Signed-off-by: Robert Varga Signed-off-by: gobinath Signed-off-by: Daniel Farrell Signed-off-by: gobinath Signed-off-by: Daniel Farrell --- .../arbitratorreconciliation/api/pom.xml | 6 +- .../arbitratorreconciliation/impl/pom.xml | 6 +- .../ArbitratorReconciliationManagerImpl.java | 2 +- applications/arbitratorreconciliation/pom.xml | 6 +- applications/bulk-o-matic/pom.xml | 4 +- .../applications/bulk/o/matic/FlowReader.java | 2 +- .../bulk/o/matic/FlowWriterDirectOFRpc.java | 2 +- .../bulk/o/matic/FlowWriterTxChain.java | 2 +- .../bulk/o/matic/SalBulkFlowServiceImpl.java | 2 +- .../o/matic/FlowWriterConcurrentTest.java | 14 +- .../o/matic/FlowWriterDirectOFRpcTest.java | 6 +- .../o/matic/FlowWriterSequentialTest.java | 14 +- .../bulk/o/matic/FlowWriterTxChainTest.java | 17 +- .../o/matic/SalBulkFlowServiceImplTest.java | 19 +- .../bulk/o/matic/TableWriterTest.java | 15 +- applications/device-ownership-service/pom.xml | 6 +- .../impl/DeviceOwnershipServiceImpl.java | 5 +- applications/forwardingrules-manager/pom.xml | 3 +- .../frm/impl/BundleFlowForwarder.java | 3 +- .../applications/frm/impl/FlowForwarder.java | 8 +- ...wNodeConnectorInventoryTranslatorImpl.java | 5 +- .../frm/impl/FlowNodeReconciliationImpl.java | 7 +- .../applications/frm/util/FrmUtil.java | 7 +- .../frm/impl/DeviceMastershipManagerTest.java | 5 +- .../src/test/java/test/mock/util/FRMTest.java | 12 +- .../frsync/impl/strategy/FlowForwarder.java | 6 +- .../applications/frsync/util/PathUtil.java | 3 +- .../impl/ForwardingRulesSyncProviderTest.java | 8 +- .../impl/SimplifiedConfigListenerTest.java | 6 +- .../SimplifiedOperationalListenerTest.java | 6 +- .../SyncReactorFutureZipDecoratorTest.java | 10 +- .../impl/SyncReactorGuardDecoratorTest.java | 10 +- .../frsync/impl/SyncReactorImplTest.java | 12 +- .../impl/SyncReactorRetryDecoratorTest.java | 10 +- .../DeviceMastershipManagerTest.java | 5 +- .../impl/strategy/FlowForwarderTest.java | 8 +- .../impl/strategy/GroupForwarderTest.java | 8 +- .../impl/strategy/MeterForwarderTest.java | 8 +- ...SyncPlanPushStrategyFlatBatchImplTest.java | 4 +- ...ncPlanPushStrategyIncrementalImplTest.java | 232 ++++---- .../impl/strategy/TableForwarderTest.java | 4 +- .../frsync/util/ReconcileUtilTest.java | 6 +- applications/lldp-speaker/pom.xml | 4 +- .../applications/lldpspeaker/LLDPSpeaker.java | 5 +- .../lldpspeaker/LLDPSpeakerTest.java | 4 +- applications/notification-supplier/pom.xml | 4 +- .../AbstractNotificationSupplierBase.java | 4 +- ...NodeConnectorNotificationSupplierImpl.java | 3 +- .../impl/NodeNotificationSupplierImpl.java | 3 +- .../item/GroupNotificationSupplierImpl.java | 3 +- .../item/MeterNotificationSupplierImpl.java | 3 +- .../FlowStatNotificationSupplierImpl.java | 3 +- ...FlowTableStatNotificationSupplierImpl.java | 3 +- ...ConnectorStatNotificationSupplierImpl.java | 2 +- .../QueueStatNotificationSupplierImpl.java | 2 +- ...ConnectorNotificationSupplierImplTest.java | 14 +- .../NodeNotificationSupplierImplTest.java | 10 +- .../impl/helper/TestSupplierVerifyHelper.java | 6 +- .../FlowNotificationSupplierImplTest.java | 26 +- .../GroupNotificationSupplierImplTest.java | 20 +- .../MeterNotificationSupplierImplTest.java | 20 +- .../FlowStatNotificationSupplierImplTest.java | 4 +- ...TableStatNotificationSupplierImplTest.java | 4 +- ...GroupStatNotificationSupplierImplTest.java | 4 +- ...MeterStatNotificationSupplierImplTest.java | 4 +- ...ectorStatNotificationSupplierImplTest.java | 4 +- ...QueueStatNotificationSupplierImplTest.java | 4 +- applications/of-switch-config-pusher/pom.xml | 4 +- .../ofswitch/config/DefaultConfigPusher.java | 3 +- .../config/DefaultConfigPusherTest.java | 2 +- applications/reconciliation-framework/pom.xml | 3 +- applications/southbound-cli/pom.xml | 3 +- .../ReconciliationServiceImpl.java | 2 +- .../southboundcli/util/ShellUtil.java | 8 +- applications/table-miss-enforcer/pom.xml | 3 +- .../LLDPPacketPuntEnforcer.java | 3 +- .../LLDPDataTreeChangeListenerTest.java | 2 +- .../lldp/utils/LLDPDiscoveryUtils.java | 3 +- .../topology/lldp/LLDPLinkAgerTest.java | 15 +- .../lldp/utils/LLDPDiscoveryUtilsTest.java | 5 +- .../manager/FlowCapableNodeMapping.java | 6 +- .../manager/DataTreeChangeListenerBase.java | 2 +- .../manager/NodeChangeListenerImplTest.java | 2 +- ...erminationPointChangeListenerImplTest.java | 4 +- .../topology/manager/TestUtils.java | 4 +- artifacts/pom.xml | 2 +- distribution/karaf/pom.xml | 2 +- drop-test-karaf/pom.xml | 4 +- .../features-openflowplugin-extension/pom.xml | 2 +- .../odl-openflowplugin-nxm-extensions/pom.xml | 2 +- .../odl-openflowplugin-onf-extensions/pom.xml | 2 +- .../features-extension-aggregator/pom.xml | 2 +- .../openflowjava-extension-nicira-api/pom.xml | 4 +- .../openflowjava-extension-nicira/pom.xml | 3 +- .../nx/codec/action/LearnCodecUtil.java | 4 +- ...ciraExtensionCodecRegistratorImplTest.java | 17 +- .../nx/NiciraExtensionsRegistratorTest.java | 508 +++++++++--------- .../nx/codec/action/RegLoad2CodecTest.java | 4 +- .../openflowplugin-extension-api/pom.xml | 3 +- .../nicira/convertor/match/RegConvertor.java | 2 +- .../nicira/NiciraExtensionProviderTest.java | 6 +- .../action/CtClearConvertorTest.java | 5 - .../action/DecNshTtlConvertorTest.java | 5 - .../action/RegMoveConvertorTest.java | 1 - .../convertor/match/ArpOpConvertorTest.java | 4 +- .../convertor/match/ArpShaConvertorTest.java | 4 +- .../convertor/match/ArpSpaConvertorTest.java | 4 +- .../convertor/match/ArpThaConvertorTest.java | 4 +- .../convertor/match/ArpTpaConvertorTest.java | 4 +- .../convertor/match/CtStateConvertorTest.java | 4 +- .../convertor/match/CtZoneConvertorTest.java | 4 +- .../convertor/match/EthDstConvertorTest.java | 4 +- .../convertor/match/EthSrcConvertorTest.java | 4 +- .../convertor/match/EthTypeConvertorTest.java | 4 +- .../match/NshFlagsConvertorTest.java | 4 +- .../match/NshMdtypeConvertorTest.java | 4 +- .../convertor/match/NshNpConvertorTest.java | 4 +- .../convertor/match/NshTtlConvertorTest.java | 4 +- .../convertor/match/Nshc1ConvertorTest.java | 4 +- .../convertor/match/Nshc2ConvertorTest.java | 4 +- .../convertor/match/Nshc3ConvertorTest.java | 4 +- .../convertor/match/Nshc4ConvertorTest.java | 4 +- .../convertor/match/NsiConvertorTest.java | 4 +- .../convertor/match/NspConvertorTest.java | 4 +- .../convertor/match/TcpDstConvertorTest.java | 4 +- .../convertor/match/TcpSrcConvertorTest.java | 4 +- .../match/TunIPv4DstConvertorTest.java | 4 +- .../match/TunIPv4SrcConvertorTest.java | 4 +- .../convertor/match/TunIdConvertorTest.java | 4 +- .../convertor/match/UdpDstConvertorTest.java | 4 +- .../convertor/match/UdpSrcConvertorTest.java | 4 +- .../openflowplugin-extension-onf/pom.xml | 6 +- .../BundleControlFactoryTest.java | 5 +- .../BundleAddMessageFactoryTest.java | 9 +- .../serializer/BundleControlFactoryTest.java | 5 +- extension/pom.xml | 3 +- extension/test-extension/pom.xml | 3 +- .../features-openflowplugin/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../odl-openflowplugin-app-topology/pom.xml | 2 +- .../odl-openflowplugin-drop-test/pom.xml | 2 +- .../pom.xml | 2 +- .../odl-openflowplugin-flow-services/pom.xml | 2 +- .../odl-openflowplugin-libraries/pom.xml | 4 +- .../src/main/feature/feature.xml | 2 +- .../odl-openflowplugin-nsf-model/pom.xml | 4 +- .../odl-openflowplugin-southbound/pom.xml | 2 +- features-aggregator/pom.xml | 2 +- libraries/liblldp/pom.xml | 2 +- .../libraries/liblldp/BitBufferHelper.java | 2 +- .../libraries/liblldp/LLDP.java | 3 + .../libraries/liblldp/LLDPTLV.java | 3 + .../libraries/liblldp/NetUtils.java | 2 +- .../libraries/liblldp/Packet.java | 4 +- model/pom.xml | 4 +- .../features-openflowjava/pom.xml | 2 +- .../odl-openflowjava-protocol/pom.xml | 4 +- .../features-openflowjava-aggregator/pom.xml | 2 +- openflowjava/openflow-protocol-api/pom.xml | 12 +- openflowjava/openflow-protocol-impl/pom.xml | 1 + .../factories/ErrorMessageFactory.java | 42 +- .../factories/OF10ErrorMessageFactory.java | 18 +- .../core/DelegatingInboundHandlerTest.java | 2 +- .../protocol/impl/core/IdleHandlerTest.java | 5 +- .../impl/core/OFDecoderStatisticsTest.java | 4 +- .../protocol/impl/core/OFDecoderTest.java | 4 +- .../impl/core/OFEncoderStatisticsTest.java | 4 +- .../protocol/impl/core/OFEncoderTest.java | 4 +- .../PublishingChannelInitializerTest.java | 4 +- .../connection/ConnectionAdapterImplTest.java | 2 +- .../BarrierReplyMessageFactoryTest.java | 2 +- .../factories/ErrorMessageFactoryTest.java | 5 +- .../ExperimenterMessageFactoryTest.java | 2 +- .../factories/VendorMessageFactoryTest.java | 4 +- .../MultipartReplyExperimenterTest.java | 4 +- .../OF10StatsReplyExperimenterTest.java | 4 +- .../ExperimenterInputMessageFactoryTest.java | 7 +- .../VendorInputMessageFactoryTest.java | 7 +- .../MultipartRequestExperimenterTest.java | 5 +- .../MultipartRequestTableFeaturesTest.java | 9 +- .../OF10StatsRequestExperimenterTest.java | 5 +- openflowjava/openflow-protocol-it/pom.xml | 1 + openflowjava/openflow-protocol-spi/pom.xml | 1 + .../openflowjava-blueprint-config/pom.xml | 3 +- openflowjava/openflowjava-util/pom.xml | 4 +- openflowplugin-blueprint-config/pom.xml | 3 +- openflowplugin-common/pom.xml | 4 +- openflowplugin-impl/pom.xml | 8 +- .../impl/services/sal/SalFlowServiceImpl.java | 3 +- .../statistics/StatisticsContextImpl.java | 3 +- .../impl/OpenFlowPluginProviderImplTest.java | 10 +- .../ConfigurationServiceFactoryImplTest.java | 2 +- .../OpenFlowProviderConfigImplTest.java | 4 +- .../connection/ConnectionManagerImplTest.java | 18 +- .../connection/HandshakeManagerImplTest.java | 44 +- .../listener/HandshakeListenerImplTest.java | 8 +- ...enflowProtocolListenerInitialImplTest.java | 6 +- .../SystemNotificationsListenerImplTest.java | 22 +- .../impl/device/DeviceContextImplTest.java | 75 +-- .../impl/device/DeviceManagerImplTest.java | 14 +- .../impl/device/PacketInRateLimiterTest.java | 11 +- .../device/TransactionChainManagerTest.java | 12 +- .../OF10DeviceInitializerTest.java | 4 +- .../OF13DeviceInitializerTest.java | 5 +- .../OpenflowProtocolListenerFullImplTest.java | 18 +- .../karaf/ClearStatsCommandProviderTest.java | 5 +- .../ResetEventTimesComandProviderTest.java | 5 +- .../ResetSessionStatsComandProviderTest.java | 5 +- .../ShowEventTimesComandProviderTest.java | 5 +- .../ShowSessionStatsCommandProviderTest.java | 5 +- .../karaf/ShowStatsCommandProviderTest.java | 5 +- .../lifecycle/ContextChainHolderImplTest.java | 7 - .../impl/lifecycle/ContextChainImplTest.java | 1 - .../flow/DeviceFlowRegistryImplTest.java | 2 +- .../flow/FlowRegistryKeyFactoryTest.java | 1 - .../impl/role/RoleContextImplTest.java | 2 +- .../impl/rpc/RpcContextImplTest.java | 1 - .../impl/rpc/RpcManagerImplTest.java | 9 - .../MultipartRequestCallbackTest.java | 8 +- .../MultipartRequestOnTheFlyCallbackTest.java | 32 +- .../impl/services/ServiceMocking.java | 36 +- .../sal/SalAsyncConfigServiceImplTest.java | 7 +- .../sal/SalBundleServiceImplTest.java | 7 +- .../services/sal/SalEchoServiceImplTest.java | 6 +- ...SalExperimenterMessageServiceImplTest.java | 9 +- ...lExperimenterMpMessageServiceImplTest.java | 4 - .../sal/SalFlatBatchServiceImplTest.java | 92 ++-- .../services/sal/SalFlowServiceImplTest.java | 11 +- .../sal/SalFlowsBatchServiceImplTest.java | 28 +- .../services/sal/SalGroupServiceImplTest.java | 3 - .../sal/SalGroupsBatchServiceImplTest.java | 16 +- .../services/sal/SalMeterServiceImplTest.java | 2 - .../sal/SalMetersBatchServiceImplTest.java | 18 +- .../services/sal/SalTableServiceImplTest.java | 11 +- .../services/util/RequestContextUtilTest.java | 2 +- .../StatisticsContextImpMockInitiation.java | 2 - .../StatisticsContextImplParamTest.java | 7 +- .../statistics/StatisticsContextImplTest.java | 10 +- .../StatisticsGatheringUtilsTest.java | 68 ++- .../statistics/StatisticsManagerImplTest.java | 38 +- .../AbstractSingleStatsServiceTest.java | 4 - .../services/AbstractStatsServiceTest.java | 27 +- ...aylightFlowStatisticsServiceImpl1Test.java | 3 +- ...aylightFlowStatisticsServiceImpl2Test.java | 13 +- ...ghtFlowTableStatisticsServiceImplTest.java | 9 +- ...aylightGroupStatisticsServiceImplTest.java | 9 +- ...aylightMeterStatisticsServiceImplTest.java | 9 +- ...daylightPortStatisticsServiceImplTest.java | 9 +- ...aylightQueueStatisticsServiceImplTest.java | 13 +- .../AbstractCompatibleStatServiceTest.java | 20 +- ...FlowStatisticsServiceDelegateImplTest.java | 19 +- ...tatisticsGatheringOnTheFlyServiceTest.java | 1 - .../AbstractDirectStatisticsServiceTest.java | 27 +- .../FlowDirectStatisticsServiceTest.java | 5 +- .../GroupDirectStatisticsServiceTest.java | 7 +- .../MeterDirectStatisticsServiceTest.java | 5 +- ...eConnectorDirectStatisticsServiceTest.java | 7 +- .../QueueDirectStatisticsServiceTest.java | 7 +- .../FlowDirectStatisticsServiceTest.java | 5 +- .../GroupDirectStatisticsServiceTest.java | 7 +- .../MeterDirectStatisticsServiceTest.java | 7 +- ...eConnectorDirectStatisticsServiceTest.java | 7 +- .../QueueDirectStatisticsServiceTest.java | 7 +- .../translator/FlowRemovedTranslatorTest.java | 2 - .../PacketReceivedTranslatorTest.java | 13 +- .../translator/PortUpdateTranslatorTest.java | 1 - .../impl/util/BarrierUtilTest.java | 6 +- .../util/DeviceInitializationUtilTest.java | 4 +- .../impl/util/MdSalRegistrationUtilsTest.java | 9 +- openflowplugin-it/pom.xml | 3 +- openflowplugin/pom.xml | 1 - .../md/core/sal/convertor/MeterConvertor.java | 2 +- .../TableFeaturesResponseConvertor.java | 2 +- .../action/ActionResponseConvertor.java | 2 +- .../extension/ActionExtensionHelperTest.java | 2 +- parent/pom.xml | 2 +- samples/learning-switch/pom.xml | 1 - .../learningswitch/FlowUtils.java | 3 +- .../InstanceIdentifierUtils.java | 4 +- .../LearningSwitchHandlerSimpleImpl.java | 6 +- samples/pom.xml | 3 +- samples/sample-bundles/pom.xml | 2 - samples/sample-consumer/pom.xml | 1 - samples/simple-client/pom.xml | 1 + .../protocol/impl/clients/CallableClient.java | 2 +- .../impl/clients/ListeningSimpleClient.java | 4 +- .../impl/clients/ScenarioHandler.java | 6 +- .../protocol/impl/clients/SendEvent.java | 2 +- .../protocol/impl/clients/SimpleClient.java | 4 +- .../impl/clients/SimpleClientHandler.java | 2 +- .../protocol/impl/clients/SleepEvent.java | 2 +- .../impl/clients/UdpSimpleClient.java | 4 +- test-common/pom.xml | 4 +- .../testcommon/AbstractDropTest.java | 2 +- test-provider/pom.xml | 1 + .../test/FlowEventListenerLoggingImpl.java | 19 +- .../test/NodeErrorListenerLoggingImpl.java | 60 +-- ...OpenflowPluginBulkTransactionProvider.java | 4 +- ...penflowpluginGroupTestServiceProvider.java | 9 +- ...penflowpluginMeterTestCommandProvider.java | 15 +- ...penflowpluginMeterTestServiceProvider.java | 9 +- ...luginTableFeaturesTestServiceProvider.java | 3 +- .../OpenflowpluginTestCommandProvider.java | 4 +- ...owpluginTestNodeConnectorNotification.java | 20 +- .../OpenflowpluginTestServiceProvider.java | 9 +- 316 files changed, 1403 insertions(+), 1542 deletions(-) diff --git a/applications/arbitratorreconciliation/api/pom.xml b/applications/arbitratorreconciliation/api/pom.xml index be36b8c671..849aea841e 100644 --- a/applications/arbitratorreconciliation/api/pom.xml +++ b/applications/arbitratorreconciliation/api/pom.xml @@ -1,7 +1,5 @@ - + applications org.opendaylight.openflowplugin @@ -43,4 +41,4 @@ - \ No newline at end of file + diff --git a/applications/arbitratorreconciliation/impl/pom.xml b/applications/arbitratorreconciliation/impl/pom.xml index 35bac9f93c..014ab20c95 100644 --- a/applications/arbitratorreconciliation/impl/pom.xml +++ b/applications/arbitratorreconciliation/impl/pom.xml @@ -1,7 +1,5 @@ - + applications org.opendaylight.openflowplugin @@ -40,4 +38,4 @@ - \ No newline at end of file + diff --git a/applications/arbitratorreconciliation/impl/src/main/java/org/opendaylight/openflowplugin/applications/arbitratorreconciliation/impl/ArbitratorReconciliationManagerImpl.java b/applications/arbitratorreconciliation/impl/src/main/java/org/opendaylight/openflowplugin/applications/arbitratorreconciliation/impl/ArbitratorReconciliationManagerImpl.java index cbf75d6f8a..17e1cecf6a 100644 --- a/applications/arbitratorreconciliation/impl/src/main/java/org/opendaylight/openflowplugin/applications/arbitratorreconciliation/impl/ArbitratorReconciliationManagerImpl.java +++ b/applications/arbitratorreconciliation/impl/src/main/java/org/opendaylight/openflowplugin/applications/arbitratorreconciliation/impl/ArbitratorReconciliationManagerImpl.java @@ -258,7 +258,7 @@ public class ArbitratorReconciliationManagerImpl implements ArbitratorReconcileS public Boolean call() { InstanceIdentifier nodeIdentity = deviceInfo.getNodeInstanceIdentifier() .augmentation(FlowCapableNode.class); - String node = nodeIdentity.firstKeyOf(Node.class, NodeKey.class).getId().getValue(); + String node = nodeIdentity.firstKeyOf(Node.class).getId().getValue(); BundleId bundleIdValue = new BundleId(BUNDLE_ID.getAndIncrement()); LOG.debug("Triggering arbitrator reconciliation for device :{}", node); final NodeRef nodeRef = new NodeRef(nodeIdentity.firstIdentifierOf(Node.class)); diff --git a/applications/arbitratorreconciliation/pom.xml b/applications/arbitratorreconciliation/pom.xml index b42138fb3c..8ed0eb76c5 100644 --- a/applications/arbitratorreconciliation/pom.xml +++ b/applications/arbitratorreconciliation/pom.xml @@ -1,7 +1,5 @@ - + applications org.opendaylight.openflowplugin @@ -39,4 +37,4 @@ - \ No newline at end of file + diff --git a/applications/bulk-o-matic/pom.xml b/applications/bulk-o-matic/pom.xml index 90bf9b2b01..49e840866d 100644 --- a/applications/bulk-o-matic/pom.xml +++ b/applications/bulk-o-matic/pom.xml @@ -1,7 +1,5 @@ - + 4.0.0 org.opendaylight.openflowplugin diff --git a/applications/bulk-o-matic/src/main/java/org/opendaylight/openflowplugin/applications/bulk/o/matic/FlowReader.java b/applications/bulk-o-matic/src/main/java/org/opendaylight/openflowplugin/applications/bulk/o/matic/FlowReader.java index 9968f4e0b1..4b9ff5761f 100644 --- a/applications/bulk-o-matic/src/main/java/org/opendaylight/openflowplugin/applications/bulk/o/matic/FlowReader.java +++ b/applications/bulk-o-matic/src/main/java/org/opendaylight/openflowplugin/applications/bulk/o/matic/FlowReader.java @@ -101,7 +101,7 @@ public final class FlowReader implements Runnable, FlowCounterMBean { } } catch (ReadFailedException e) { readOpStatus.set(FlowCounter.OperationStatus.FAILURE.status()); - LOG.error(e.getMessage(), e); + LOG.error("Error {}", e); } } } diff --git a/applications/bulk-o-matic/src/main/java/org/opendaylight/openflowplugin/applications/bulk/o/matic/FlowWriterDirectOFRpc.java b/applications/bulk-o-matic/src/main/java/org/opendaylight/openflowplugin/applications/bulk/o/matic/FlowWriterDirectOFRpc.java index ab68cf9555..b3471d4b8c 100644 --- a/applications/bulk-o-matic/src/main/java/org/opendaylight/openflowplugin/applications/bulk/o/matic/FlowWriterDirectOFRpc.java +++ b/applications/bulk-o-matic/src/main/java/org/opendaylight/openflowplugin/applications/bulk/o/matic/FlowWriterDirectOFRpc.java @@ -148,7 +148,7 @@ public class FlowWriterDirectOFRpc { TimeUnit.MILLISECONDS.sleep(PAUSE_BETWEEN_BATCH_MILLIS); } catch (InterruptedException iEx) { - LOG.error("Interrupted while pausing after batched push upto {}. Ex {}", i, iEx); + LOG.error("Interrupted while pausing after batched push upto {} Ex ", i, iEx); } } } diff --git a/applications/bulk-o-matic/src/main/java/org/opendaylight/openflowplugin/applications/bulk/o/matic/FlowWriterTxChain.java b/applications/bulk-o-matic/src/main/java/org/opendaylight/openflowplugin/applications/bulk/o/matic/FlowWriterTxChain.java index b7fa18230c..09a0329a9d 100644 --- a/applications/bulk-o-matic/src/main/java/org/opendaylight/openflowplugin/applications/bulk/o/matic/FlowWriterTxChain.java +++ b/applications/bulk-o-matic/src/main/java/org/opendaylight/openflowplugin/applications/bulk/o/matic/FlowWriterTxChain.java @@ -164,7 +164,7 @@ public class FlowWriterTxChain implements FlowCounterMBean { @Override public void onTransactionChainFailed(TransactionChain transactionChain, AsyncTransaction asyncTransaction, Throwable throwable) { - LOG.error("Transaction chain: {} FAILED at asyncTransaction: {} due to: {}", transactionChain, + LOG.error("Transaction chain: {} FAILED at asyncTransaction: {} due to: ", transactionChain, asyncTransaction.getIdentifier(), throwable); transactionChain.close(); } diff --git a/applications/bulk-o-matic/src/main/java/org/opendaylight/openflowplugin/applications/bulk/o/matic/SalBulkFlowServiceImpl.java b/applications/bulk-o-matic/src/main/java/org/opendaylight/openflowplugin/applications/bulk/o/matic/SalBulkFlowServiceImpl.java index 8a6a629e21..70c259a399 100644 --- a/applications/bulk-o-matic/src/main/java/org/opendaylight/openflowplugin/applications/bulk/o/matic/SalBulkFlowServiceImpl.java +++ b/applications/bulk-o-matic/src/main/java/org/opendaylight/openflowplugin/applications/bulk/o/matic/SalBulkFlowServiceImpl.java @@ -216,7 +216,7 @@ public class SalBulkFlowServiceImpl implements SalBulkFlowService { } catch (MalformedObjectNameException | InstanceAlreadyExistsException | MBeanRegistrationException | NotCompliantMBeanException e) { rpcResultBuilder = RpcResultBuilder.failed(); - LOG.warn("Exception occurred: {} ", e.getMessage(), e); + LOG.warn("Exception occurred: {} ", e); } return Futures.immediateFuture(rpcResultBuilder.build()); } diff --git a/applications/bulk-o-matic/src/test/java/org/opendaylight/openflowplugin/applications/bulk/o/matic/FlowWriterConcurrentTest.java b/applications/bulk-o-matic/src/test/java/org/opendaylight/openflowplugin/applications/bulk/o/matic/FlowWriterConcurrentTest.java index b1370385f2..124a98c0b4 100644 --- a/applications/bulk-o-matic/src/test/java/org/opendaylight/openflowplugin/applications/bulk/o/matic/FlowWriterConcurrentTest.java +++ b/applications/bulk-o-matic/src/test/java/org/opendaylight/openflowplugin/applications/bulk/o/matic/FlowWriterConcurrentTest.java @@ -15,7 +15,7 @@ import java.util.concurrent.ExecutorService; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.Matchers; +import org.mockito.ArgumentMatchers; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.runners.MockitoJUnitRunner; @@ -57,7 +57,7 @@ public class FlowWriterConcurrentTest { Mockito.doAnswer(invocation -> { ((Runnable) invocation.getArguments()[0]).run(); return null; - }).when(mockFlowPusher).execute(Matchers.any()); + }).when(mockFlowPusher).execute(ArgumentMatchers.any()); flowWriterConcurrent = new FlowWriterConcurrent(mockDataBroker, mockFlowPusher); } @@ -65,14 +65,16 @@ public class FlowWriterConcurrentTest { @Test public void testAddFlows() throws Exception { flowWriterConcurrent.addFlows(1, FLOWS_PER_DPN, 10, 10, 10, (short) 0, (short) 1, true); - Mockito.verify(writeTransaction, Mockito.times(FLOWS_PER_DPN)).put(Matchers.any(), - Matchers.>any(), Matchers.any(), Matchers.anyBoolean()); + Mockito.verify(writeTransaction, Mockito.times(FLOWS_PER_DPN)).put(ArgumentMatchers.any(), + ArgumentMatchers.>any(), ArgumentMatchers.any(), + ArgumentMatchers.anyBoolean()); } @Test public void testDeleteFlows() throws Exception { flowWriterConcurrent.deleteFlows(1, FLOWS_PER_DPN, 10, (short) 0, (short) 1); - Mockito.verify(writeTransaction, Mockito.times(FLOWS_PER_DPN)).delete(Matchers.any(), - Matchers.>any()); + Mockito.verify(writeTransaction, Mockito.times(FLOWS_PER_DPN)) + .delete(ArgumentMatchers.any(), + ArgumentMatchers.>any()); } } diff --git a/applications/bulk-o-matic/src/test/java/org/opendaylight/openflowplugin/applications/bulk/o/matic/FlowWriterDirectOFRpcTest.java b/applications/bulk-o-matic/src/test/java/org/opendaylight/openflowplugin/applications/bulk/o/matic/FlowWriterDirectOFRpcTest.java index 4c0cd56967..2cda1ad5b2 100644 --- a/applications/bulk-o-matic/src/test/java/org/opendaylight/openflowplugin/applications/bulk/o/matic/FlowWriterDirectOFRpcTest.java +++ b/applications/bulk-o-matic/src/test/java/org/opendaylight/openflowplugin/applications/bulk/o/matic/FlowWriterDirectOFRpcTest.java @@ -8,7 +8,7 @@ package org.opendaylight.openflowplugin.applications.bulk.o.matic; -import static org.mockito.Matchers.any; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.when; @@ -20,7 +20,7 @@ import java.util.concurrent.ExecutorService; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.Matchers; +import org.mockito.ArgumentMatchers; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.runners.MockitoJUnitRunner; @@ -81,7 +81,7 @@ public class FlowWriterDirectOFRpcTest { Mockito.doAnswer(invocation -> { ((Runnable)invocation.getArguments()[0]).run(); return null; - }).when(mockFlowPusher).execute(Matchers.any()); + }).when(mockFlowPusher).execute(ArgumentMatchers.any()); flowWriterDirectOFRpc = new FlowWriterDirectOFRpc(mockDataBroker, mockSalFlowService, mockFlowPusher); } diff --git a/applications/bulk-o-matic/src/test/java/org/opendaylight/openflowplugin/applications/bulk/o/matic/FlowWriterSequentialTest.java b/applications/bulk-o-matic/src/test/java/org/opendaylight/openflowplugin/applications/bulk/o/matic/FlowWriterSequentialTest.java index 8fa73e9365..780fc4adb0 100644 --- a/applications/bulk-o-matic/src/test/java/org/opendaylight/openflowplugin/applications/bulk/o/matic/FlowWriterSequentialTest.java +++ b/applications/bulk-o-matic/src/test/java/org/opendaylight/openflowplugin/applications/bulk/o/matic/FlowWriterSequentialTest.java @@ -15,7 +15,7 @@ import java.util.concurrent.ExecutorService; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.Matchers; +import org.mockito.ArgumentMatchers; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.runners.MockitoJUnitRunner; @@ -54,7 +54,7 @@ public class FlowWriterSequentialTest { Mockito.doAnswer(invocation -> { ((Runnable) invocation.getArguments()[0]).run(); return null; - }).when(mockFlowPusher).execute(Matchers.any()); + }).when(mockFlowPusher).execute(ArgumentMatchers.any()); flowWriterSequential = new FlowWriterSequential(mockDataBroker, mockFlowPusher); } @@ -62,14 +62,16 @@ public class FlowWriterSequentialTest { @Test public void testAddFlows() throws Exception { flowWriterSequential.addFlows(1, FLOWS_PER_DPN, 10, 10, (short) 0, (short) 1, true); - Mockito.verify(writeTransaction, Mockito.times(FLOWS_PER_DPN)).put(Matchers.any(), - Matchers.>any(), Matchers.any(), Matchers.anyBoolean()); + Mockito.verify(writeTransaction, Mockito.times(FLOWS_PER_DPN)).put(ArgumentMatchers.any(), + ArgumentMatchers.>any(), ArgumentMatchers.any(), + ArgumentMatchers.anyBoolean()); } @Test public void testDeleteFlows() throws Exception { flowWriterSequential.deleteFlows(1, FLOWS_PER_DPN, 10, (short) 0, (short) 1); - Mockito.verify(writeTransaction, Mockito.times(FLOWS_PER_DPN)).delete(Matchers.any(), - Matchers.>any()); + Mockito.verify(writeTransaction, Mockito.times(FLOWS_PER_DPN)) + .delete(ArgumentMatchers.any(), + ArgumentMatchers.>any()); } } diff --git a/applications/bulk-o-matic/src/test/java/org/opendaylight/openflowplugin/applications/bulk/o/matic/FlowWriterTxChainTest.java b/applications/bulk-o-matic/src/test/java/org/opendaylight/openflowplugin/applications/bulk/o/matic/FlowWriterTxChainTest.java index 0bda86c799..d1cd249c87 100644 --- a/applications/bulk-o-matic/src/test/java/org/opendaylight/openflowplugin/applications/bulk/o/matic/FlowWriterTxChainTest.java +++ b/applications/bulk-o-matic/src/test/java/org/opendaylight/openflowplugin/applications/bulk/o/matic/FlowWriterTxChainTest.java @@ -17,7 +17,7 @@ import java.util.concurrent.ExecutorService; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.Matchers; +import org.mockito.ArgumentMatchers; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.runners.MockitoJUnitRunner; @@ -55,11 +55,12 @@ public class FlowWriterTxChainTest { Mockito.doAnswer(invocation -> { ((Runnable) invocation.getArguments()[0]).run(); return null; - }).when(mockFlowPusher).execute(Matchers.any()); + }).when(mockFlowPusher).execute(ArgumentMatchers.any()); final BindingTransactionChain mockedTxChain = mock(BindingTransactionChain.class); when(mockedTxChain.newWriteOnlyTransaction()).thenReturn(writeTransaction); - doReturn(mockedTxChain).when(mockDataBroker).createTransactionChain(Matchers.any()); + doReturn(mockedTxChain).when(mockDataBroker) + .createTransactionChain(ArgumentMatchers.any()); when(writeTransaction.submit()).thenReturn(Futures.immediateCheckedFuture(null)); @@ -69,14 +70,16 @@ public class FlowWriterTxChainTest { @Test public void testAddFlows() throws Exception { flowWriterTxChain.addFlows(1, FLOWS_PER_DPN, 10, 10, 10, (short) 0, (short) 1, true); - Mockito.verify(writeTransaction, Mockito.times(FLOWS_PER_DPN)).put(Matchers.any(), - Matchers.>any(), Matchers.any(), Matchers.anyBoolean()); + Mockito.verify(writeTransaction, Mockito.times(FLOWS_PER_DPN)).put(ArgumentMatchers.any(), + ArgumentMatchers.>any(), ArgumentMatchers.any(), + ArgumentMatchers.anyBoolean()); } @Test public void testDeleteFlows() throws Exception { flowWriterTxChain.deleteFlows(1, FLOWS_PER_DPN, 10, (short) 0, (short) 1); - Mockito.verify(writeTransaction, Mockito.times(FLOWS_PER_DPN)).delete(Matchers.any(), - Matchers.>any()); + Mockito.verify(writeTransaction, Mockito.times(FLOWS_PER_DPN)) + .delete(ArgumentMatchers.any(), + ArgumentMatchers.>any()); } } diff --git a/applications/bulk-o-matic/src/test/java/org/opendaylight/openflowplugin/applications/bulk/o/matic/SalBulkFlowServiceImplTest.java b/applications/bulk-o-matic/src/test/java/org/opendaylight/openflowplugin/applications/bulk/o/matic/SalBulkFlowServiceImplTest.java index f1491ed29c..f68501acdf 100644 --- a/applications/bulk-o-matic/src/test/java/org/opendaylight/openflowplugin/applications/bulk/o/matic/SalBulkFlowServiceImplTest.java +++ b/applications/bulk-o-matic/src/test/java/org/opendaylight/openflowplugin/applications/bulk/o/matic/SalBulkFlowServiceImplTest.java @@ -22,8 +22,8 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; +import org.mockito.ArgumentMatchers; import org.mockito.Captor; -import org.mockito.Matchers; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.runners.MockitoJUnitRunner; @@ -101,7 +101,8 @@ public class SalBulkFlowServiceImplTest { public void setUp() throws Exception { when(mockDataBroker.newWriteOnlyTransaction()).thenReturn(writeTransaction); when(mockDataBroker.newReadOnlyTransaction()).thenReturn(readOnlyTransaction); - when(readOnlyTransaction.read(Mockito.any(LogicalDatastoreType.class), Mockito.>any())) + Mockito.lenient().when(readOnlyTransaction.read(Mockito.any(LogicalDatastoreType.class), + Mockito.>any())) .thenReturn(Futures.immediateCheckedFuture(Optional.of(mockNode))); salBulkFlowService = new SalBulkFlowServiceImpl(mockSalFlowService, mockDataBroker); } @@ -127,7 +128,8 @@ public class SalBulkFlowServiceImplTest { salBulkFlowService.addFlowsDs(addFlowsDsInput); verify(writeTransaction).submit(); - verify(writeTransaction).put(Matchers.any(), Matchers.>any(), + verify(writeTransaction).put(ArgumentMatchers.any(), + ArgumentMatchers.>any(), flowArgumentCaptor.capture(), Mockito.anyBoolean()); Flow flow = flowArgumentCaptor.getValue(); @@ -140,16 +142,17 @@ public class SalBulkFlowServiceImplTest { final RemoveFlowsDsInput removeFlowsDsInput = removeFlowsDsInputBuilder.build(); salBulkFlowService.removeFlowsDs(removeFlowsDsInput); - verify(writeTransaction).delete(Matchers.any(), Matchers.>any()); + verify(writeTransaction).delete(ArgumentMatchers.any(), + ArgumentMatchers.>any()); verify(writeTransaction, times(2)).submit(); } @Test public void testAddRemoveFlowsRpc() throws Exception { - Mockito.when(mockSalFlowService.addFlow(Matchers.any())) + Mockito.when(mockSalFlowService.addFlow(ArgumentMatchers.any())) .thenReturn(RpcResultBuilder.success(new AddFlowOutputBuilder().build()).buildFuture()); - Mockito.when(mockSalFlowService.removeFlow(Matchers.any())) + Mockito.when(mockSalFlowService.removeFlow(ArgumentMatchers.any())) .thenReturn(RpcResultBuilder.success(new RemoveFlowOutputBuilder().build()).buildFuture()); final BulkFlowItemBuilder bulkFlowItemBuilder = new BulkFlowItemBuilder(); @@ -166,7 +169,7 @@ public class SalBulkFlowServiceImplTest { final AddFlowsRpcInput addFlowsRpcInput = addFlowsRpcInputBuilder.build(); salBulkFlowService.addFlowsRpc(addFlowsRpcInput); - verify(mockSalFlowService).addFlow(Matchers.any()); + verify(mockSalFlowService).addFlow(ArgumentMatchers.any()); final RemoveFlowsRpcInputBuilder removeFlowsRpcInputBuilder = new RemoveFlowsRpcInputBuilder(); removeFlowsRpcInputBuilder.setBulkFlowItem(bulkFlowItems); @@ -174,7 +177,7 @@ public class SalBulkFlowServiceImplTest { final RemoveFlowsRpcInput removeFlowsRpcInput = removeFlowsRpcInputBuilder.build(); salBulkFlowService.removeFlowsRpc(removeFlowsRpcInput); - verify(mockSalFlowService).removeFlow(Matchers.any()); + verify(mockSalFlowService).removeFlow(ArgumentMatchers.any()); } @Test diff --git a/applications/bulk-o-matic/src/test/java/org/opendaylight/openflowplugin/applications/bulk/o/matic/TableWriterTest.java b/applications/bulk-o-matic/src/test/java/org/opendaylight/openflowplugin/applications/bulk/o/matic/TableWriterTest.java index 2192ba4ba6..5ca5a58206 100644 --- a/applications/bulk-o-matic/src/test/java/org/opendaylight/openflowplugin/applications/bulk/o/matic/TableWriterTest.java +++ b/applications/bulk-o-matic/src/test/java/org/opendaylight/openflowplugin/applications/bulk/o/matic/TableWriterTest.java @@ -15,7 +15,7 @@ import java.util.concurrent.ExecutorService; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.Matchers; +import org.mockito.ArgumentMatchers; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.runners.MockitoJUnitRunner; @@ -57,7 +57,7 @@ public class TableWriterTest { Mockito.doAnswer(invocation -> { ((Runnable) invocation.getArguments()[0]).run(); return null; - }).when(mockTablePusher).execute(Matchers.any()); + }).when(mockTablePusher).execute(ArgumentMatchers.any()); tableWriter = new TableWriter(mockDataBroker, mockTablePusher); } @@ -65,14 +65,17 @@ public class TableWriterTest { @Test public void testAddTables() throws Exception { tableWriter.addTables(DPN_COUNT, START_TABLE_ID, END_TABLE_ID); - Mockito.verify(writeTransaction, Mockito.times(TABLES_PER_DPN)).put(Matchers.any(), - Matchers.>any(), Matchers.any(), Matchers.anyBoolean()); + Mockito.verify(writeTransaction, Mockito.times(TABLES_PER_DPN)) + .put(ArgumentMatchers.any(), + ArgumentMatchers.>any(), ArgumentMatchers.any(), + ArgumentMatchers.anyBoolean()); } @Test public void testDeleteTables() throws Exception { tableWriter.deleteTables(DPN_COUNT, START_TABLE_ID, END_TABLE_ID); - Mockito.verify(writeTransaction, Mockito.times(TABLES_PER_DPN)).delete(Matchers.any(), - Matchers.>any()); + Mockito.verify(writeTransaction, Mockito.times(TABLES_PER_DPN)) + .delete(ArgumentMatchers.any(), + ArgumentMatchers.>any()); } } diff --git a/applications/device-ownership-service/pom.xml b/applications/device-ownership-service/pom.xml index 7c37972e17..cfaf5729c4 100644 --- a/applications/device-ownership-service/pom.xml +++ b/applications/device-ownership-service/pom.xml @@ -1,7 +1,5 @@ - + applications org.opendaylight.openflowplugin @@ -19,4 +17,4 @@ mdsal-eos-binding-api - \ No newline at end of file + diff --git a/applications/device-ownership-service/src/main/java/org/opendaylight/openflowplugin/applications/deviceownershipservice/impl/DeviceOwnershipServiceImpl.java b/applications/device-ownership-service/src/main/java/org/opendaylight/openflowplugin/applications/deviceownershipservice/impl/DeviceOwnershipServiceImpl.java index 33111d5902..e58c91134f 100644 --- a/applications/device-ownership-service/src/main/java/org/opendaylight/openflowplugin/applications/deviceownershipservice/impl/DeviceOwnershipServiceImpl.java +++ b/applications/device-ownership-service/src/main/java/org/opendaylight/openflowplugin/applications/deviceownershipservice/impl/DeviceOwnershipServiceImpl.java @@ -7,8 +7,9 @@ */ package org.opendaylight.openflowplugin.applications.deviceownershipservice.impl; -import com.google.common.base.Optional; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; + +import java.util.Optional; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; import java.util.regex.Pattern; @@ -22,7 +23,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class DeviceOwnershipServiceImpl implements DeviceOwnershipService, EntityOwnershipListener { - private static final Logger LOG = LoggerFactory.getLogger(DeviceOwnershipService.class); + private static final Logger LOG = LoggerFactory.getLogger(DeviceOwnershipServiceImpl.class); private static final String SERVICE_ENTITY_TYPE = "org.opendaylight.mdsal.ServiceEntityType"; private static final Pattern NODE_ID_PATTERN = Pattern.compile("^openflow:\\d+"); diff --git a/applications/forwardingrules-manager/pom.xml b/applications/forwardingrules-manager/pom.xml index 57f253a0cb..aabf9e4274 100644 --- a/applications/forwardingrules-manager/pom.xml +++ b/applications/forwardingrules-manager/pom.xml @@ -1,6 +1,5 @@ - + 4.0.0 org.opendaylight.openflowplugin diff --git a/applications/forwardingrules-manager/src/main/java/org/opendaylight/openflowplugin/applications/frm/impl/BundleFlowForwarder.java b/applications/forwardingrules-manager/src/main/java/org/opendaylight/openflowplugin/applications/frm/impl/BundleFlowForwarder.java index a3cca7e575..2a9ce1041b 100644 --- a/applications/forwardingrules-manager/src/main/java/org/opendaylight/openflowplugin/applications/frm/impl/BundleFlowForwarder.java +++ b/applications/forwardingrules-manager/src/main/java/org/opendaylight/openflowplugin/applications/frm/impl/BundleFlowForwarder.java @@ -40,7 +40,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId; import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef; import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node; -import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.AddBundleMessagesInput; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.AddBundleMessagesInputBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.AddBundleMessagesOutput; @@ -81,7 +80,7 @@ public class BundleFlowForwarder { public void remove(final InstanceIdentifier identifier, final Flow flow, final InstanceIdentifier nodeIdent, final BundleId bundleId) { final List messages = new ArrayList<>(1); - String node = nodeIdent.firstKeyOf(Node.class, NodeKey.class).getId().getValue(); + String node = nodeIdent.firstKeyOf(Node.class).getId().getValue(); BundleInnerMessage bundleInnerMessage = new BundleRemoveFlowCaseBuilder() .setRemoveFlowCaseData(new RemoveFlowCaseDataBuilder(flow).build()).build(); Message message = new MessageBuilder().setNode(new NodeRef(nodeIdent.firstIdentifierOf(Node.class))) diff --git a/applications/forwardingrules-manager/src/main/java/org/opendaylight/openflowplugin/applications/frm/impl/FlowForwarder.java b/applications/forwardingrules-manager/src/main/java/org/opendaylight/openflowplugin/applications/frm/impl/FlowForwarder.java index b9ac9d3d15..8c7009a0fb 100644 --- a/applications/forwardingrules-manager/src/main/java/org/opendaylight/openflowplugin/applications/frm/impl/FlowForwarder.java +++ b/applications/forwardingrules-manager/src/main/java/org/opendaylight/openflowplugin/applications/frm/impl/FlowForwarder.java @@ -121,7 +121,7 @@ public class FlowForwarder extends AbstractListeningCommiter { public void remove(final InstanceIdentifier identifier, final Flow removeDataObj, final InstanceIdentifier nodeIdent) { - final TableKey tableKey = identifier.firstKeyOf(Table.class, TableKey.class); + final TableKey tableKey = identifier.firstKeyOf(Table.class); if (tableIdValidationPrecondition(tableKey, removeDataObj)) { BundleId bundleId = getActiveBundle(nodeIdent, provider); if (bundleId != null) { @@ -151,7 +151,7 @@ public class FlowForwarder extends AbstractListeningCommiter { final Flow removeDataObj, final InstanceIdentifier nodeIdent) { Future> resultFuture = SettableFuture.create(); - final TableKey tableKey = identifier.firstKeyOf(Table.class, TableKey.class); + final TableKey tableKey = identifier.firstKeyOf(Table.class); if (tableIdValidationPrecondition(tableKey, removeDataObj)) { final RemoveFlowInputBuilder builder = new RemoveFlowInputBuilder(removeDataObj); builder.setFlowRef(new FlowRef(identifier)); @@ -173,7 +173,7 @@ public class FlowForwarder extends AbstractListeningCommiter { public void update(final InstanceIdentifier identifier, final Flow original, final Flow update, final InstanceIdentifier nodeIdent) { - final TableKey tableKey = identifier.firstKeyOf(Table.class, TableKey.class); + final TableKey tableKey = identifier.firstKeyOf(Table.class); if (tableIdValidationPrecondition(tableKey, update)) { BundleId bundleId = getActiveBundle(nodeIdent, provider); if (bundleId != null) { @@ -227,7 +227,7 @@ public class FlowForwarder extends AbstractListeningCommiter { public Future> add(final InstanceIdentifier identifier, final Flow addDataObj, final InstanceIdentifier nodeIdent) { - final TableKey tableKey = identifier.firstKeyOf(Table.class, TableKey.class); + final TableKey tableKey = identifier.firstKeyOf(Table.class); if (tableIdValidationPrecondition(tableKey, addDataObj)) { BundleId bundleId = getActiveBundle(nodeIdent, provider); if (bundleId != null) { diff --git a/applications/forwardingrules-manager/src/main/java/org/opendaylight/openflowplugin/applications/frm/impl/FlowNodeConnectorInventoryTranslatorImpl.java b/applications/forwardingrules-manager/src/main/java/org/opendaylight/openflowplugin/applications/frm/impl/FlowNodeConnectorInventoryTranslatorImpl.java index affc74c8c9..811fdfc367 100644 --- a/applications/forwardingrules-manager/src/main/java/org/opendaylight/openflowplugin/applications/frm/impl/FlowNodeConnectorInventoryTranslatorImpl.java +++ b/applications/forwardingrules-manager/src/main/java/org/opendaylight/openflowplugin/applications/frm/impl/FlowNodeConnectorInventoryTranslatorImpl.java @@ -22,7 +22,6 @@ import org.opendaylight.openflowplugin.common.wait.SimpleTaskRetryLooper; import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector; import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes; import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector; -import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorKey; import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node; import org.opendaylight.yangtools.concepts.ListenerRegistration; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; @@ -88,7 +87,7 @@ public class FlowNodeConnectorInventoryTranslatorImpl extends AbstractNodeConnec InstanceIdentifier nodeConnIdent) { if (compareInstanceIdentifierTail(identifier, II_TO_FLOW_CAPABLE_NODE_CONNECTOR)) { LOG.debug("Node Connector removed"); - String nodeConnectorIdentifier = nodeConnIdent.firstKeyOf(NodeConnector.class, NodeConnectorKey.class) + String nodeConnectorIdentifier = nodeConnIdent.firstKeyOf(NodeConnector.class) .getId().getValue(); BigInteger dpId = getDpIdFromPortName(nodeConnectorIdentifier); @@ -111,7 +110,7 @@ public class FlowNodeConnectorInventoryTranslatorImpl extends AbstractNodeConnec if (compareInstanceIdentifierTail(identifier, II_TO_FLOW_CAPABLE_NODE_CONNECTOR)) { LOG.debug("Node Connector added"); String nodeConnectorIdentifier = nodeConnIdent - .firstKeyOf(NodeConnector.class, NodeConnectorKey.class).getId().getValue(); + .firstKeyOf(NodeConnector.class).getId().getValue(); BigInteger dpId = getDpIdFromPortName(nodeConnectorIdentifier); if (!dpnToPortMultiMap.containsEntry(dpId, nodeConnectorIdentifier)) { diff --git a/applications/forwardingrules-manager/src/main/java/org/opendaylight/openflowplugin/applications/frm/impl/FlowNodeReconciliationImpl.java b/applications/forwardingrules-manager/src/main/java/org/opendaylight/openflowplugin/applications/frm/impl/FlowNodeReconciliationImpl.java index 51838769c7..c4e9ad8b72 100644 --- a/applications/forwardingrules-manager/src/main/java/org/opendaylight/openflowplugin/applications/frm/impl/FlowNodeReconciliationImpl.java +++ b/applications/forwardingrules-manager/src/main/java/org/opendaylight/openflowplugin/applications/frm/impl/FlowNodeReconciliationImpl.java @@ -68,7 +68,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId; import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef; import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node; -import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey; import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterId; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.AddBundleMessagesInput; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.AddBundleMessagesInputBuilder; @@ -176,7 +175,7 @@ public class FlowNodeReconciliationImpl implements FlowNodeReconciliation { @Override public Boolean call() { - String node = nodeIdentity.firstKeyOf(Node.class, NodeKey.class).getId().getValue(); + String node = nodeIdentity.firstKeyOf(Node.class).getId().getValue(); Optional flowNode = Optional.absent(); BundleId bundleIdValue = new BundleId(BUNDLE_ID.getAndIncrement()); BigInteger dpnId = getDpnIdFromNodeName(node); @@ -310,7 +309,7 @@ public class FlowNodeReconciliationImpl implements FlowNodeReconciliation { @Override public Boolean call() { - String node = nodeIdentity.firstKeyOf(Node.class, NodeKey.class).getId().getValue(); + String node = nodeIdentity.firstKeyOf(Node.class).getId().getValue(); BigInteger dpnId = getDpnIdFromNodeName(node); ReadOnlyTransaction trans = provider.getReadTranaction(); @@ -734,7 +733,7 @@ public class FlowNodeReconciliationImpl implements FlowNodeReconciliation { if (flowNode.get().getGroup() != null) { for (Group gr : flowNode.get().getGroup()) { - NodeId nodeId = nodeRef.getValue().firstKeyOf(Node.class, NodeKey.class).getId(); + NodeId nodeId = nodeRef.getValue().firstKeyOf(Node.class).getId(); provider.getDevicesGroupRegistry().storeGroup(nodeId,gr.getGroupId().getValue()); messages.add(new MessageBuilder().setNode(nodeRef).setBundleInnerMessage(new BundleAddGroupCaseBuilder() .setAddGroupCaseData(new AddGroupCaseDataBuilder(gr).build()).build()).build()); diff --git a/applications/forwardingrules-manager/src/main/java/org/opendaylight/openflowplugin/applications/frm/util/FrmUtil.java b/applications/forwardingrules-manager/src/main/java/org/opendaylight/openflowplugin/applications/frm/util/FrmUtil.java index cf79da8a73..6a89273799 100644 --- a/applications/forwardingrules-manager/src/main/java/org/opendaylight/openflowplugin/applications/frm/util/FrmUtil.java +++ b/applications/forwardingrules-manager/src/main/java/org/opendaylight/openflowplugin/applications/frm/util/FrmUtil.java @@ -20,7 +20,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.acti import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action; import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode; import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow; -import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowKey; import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowRef; import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ApplyActionsCase; import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction; @@ -50,15 +49,15 @@ public final class FrmUtil { } public static NodeId getNodeIdFromNodeIdentifier(final InstanceIdentifier nodeIdent) { - return nodeIdent.firstKeyOf(Node.class, NodeKey.class).getId(); + return nodeIdent.firstKeyOf(Node.class).getId(); } public static String getFlowId(final FlowRef flowRef) { - return flowRef.getValue().firstKeyOf(Flow.class, FlowKey.class).getId().getValue(); + return flowRef.getValue().firstKeyOf(Flow.class).getId().getValue(); } public static BigInteger getDpnIdFromNodeName(final InstanceIdentifier nodeIdent) { - String nodeId = nodeIdent.firstKeyOf(Node.class, NodeKey.class).getId().getValue(); + String nodeId = nodeIdent.firstKeyOf(Node.class).getId().getValue(); String dpId = nodeId.substring(nodeId.lastIndexOf(SEPARATOR) + 1); return new BigInteger(dpId); } diff --git a/applications/forwardingrules-manager/src/test/java/org/opendaylight/openflowplugin/applications/frm/impl/DeviceMastershipManagerTest.java b/applications/forwardingrules-manager/src/test/java/org/opendaylight/openflowplugin/applications/frm/impl/DeviceMastershipManagerTest.java index c4d509d6bd..55de43760c 100644 --- a/applications/forwardingrules-manager/src/test/java/org/opendaylight/openflowplugin/applications/frm/impl/DeviceMastershipManagerTest.java +++ b/applications/forwardingrules-manager/src/test/java/org/opendaylight/openflowplugin/applications/frm/impl/DeviceMastershipManagerTest.java @@ -12,7 +12,7 @@ import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.Matchers; +import org.mockito.ArgumentMatchers; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.runners.MockitoJUnitRunner; @@ -54,7 +54,8 @@ public class DeviceMastershipManagerTest { deviceMastershipManager = new DeviceMastershipManager(clusterSingletonService, reconciliationAgent, dataBroker, mastershipChangeServiceManager); deviceMastershipManager.setRoutedRpcReg(routedRpcReg); - Mockito.when(clusterSingletonService.registerClusterSingletonService(Matchers.any())) + Mockito.lenient().when(clusterSingletonService + .registerClusterSingletonService(ArgumentMatchers.any())) .thenReturn(registration); Mockito.when(deviceInfo.getNodeId()).thenReturn(nodeId); Mockito.when(nodeId.getValue()).thenReturn("dummyValue"); diff --git a/applications/forwardingrules-manager/src/test/java/test/mock/util/FRMTest.java b/applications/forwardingrules-manager/src/test/java/test/mock/util/FRMTest.java index acaf9fe1e0..02bcd1ee54 100644 --- a/applications/forwardingrules-manager/src/test/java/test/mock/util/FRMTest.java +++ b/applications/forwardingrules-manager/src/test/java/test/mock/util/FRMTest.java @@ -84,17 +84,17 @@ public abstract class FRMTest extends AbstractDataBrokerTest { Mockito.when(configurationService.registerListener(Mockito.any())).thenReturn(() -> { }); - Mockito.when(configurationService.getProperty(Mockito.eq("disable-reconciliation"), Mockito.any())) + Mockito.lenient().when(configurationService.getProperty(Mockito.eq("disable-reconciliation"), Mockito.any())) .thenReturn(config.isDisableReconciliation()); - Mockito.when(configurationService.getProperty(Mockito.eq("stale-marking-enabled"), Mockito.any())) + Mockito.lenient().when(configurationService.getProperty(Mockito.eq("stale-marking-enabled"), Mockito.any())) .thenReturn(config.isStaleMarkingEnabled()); - Mockito.when(configurationService.getProperty(Mockito.eq("reconciliation-retry-count"), Mockito.any())) - .thenReturn(config.getReconciliationRetryCount()); + Mockito.lenient().when(configurationService.getProperty(Mockito.eq("reconciliation-retry-count"), + Mockito.any())).thenReturn(config.getReconciliationRetryCount()); - Mockito.when(configurationService.getProperty(Mockito.eq("bundle-based-reconciliation-enabled"), Mockito.any())) - .thenReturn(config.isBundleBasedReconciliationEnabled()); + Mockito.lenient().when(configurationService.getProperty(Mockito.eq("bundle-based-reconciliation-enabled"), + Mockito.any())).thenReturn(config.isBundleBasedReconciliationEnabled()); return configurationService; } diff --git a/applications/forwardingrules-sync/src/main/java/org/opendaylight/openflowplugin/applications/frsync/impl/strategy/FlowForwarder.java b/applications/forwardingrules-sync/src/main/java/org/opendaylight/openflowplugin/applications/frsync/impl/strategy/FlowForwarder.java index 3381b0ac2c..e97d83587c 100644 --- a/applications/forwardingrules-sync/src/main/java/org/opendaylight/openflowplugin/applications/frsync/impl/strategy/FlowForwarder.java +++ b/applications/forwardingrules-sync/src/main/java/org/opendaylight/openflowplugin/applications/frsync/impl/strategy/FlowForwarder.java @@ -56,7 +56,7 @@ public class FlowForwarder implements ForwardingRulesCommitter> output; - final TableKey tableKey = identifier.firstKeyOf(Table.class, TableKey.class); + final TableKey tableKey = identifier.firstKeyOf(Table.class); if (tableIdValidationPrecondition(tableKey, update)) { final UpdateFlowInputBuilder builder = new UpdateFlowInputBuilder(); @@ -110,7 +110,7 @@ public class FlowForwarder implements ForwardingRulesCommitter> output; - final TableKey tableKey = identifier.firstKeyOf(Table.class, TableKey.class); + final TableKey tableKey = identifier.firstKeyOf(Table.class); if (tableIdValidationPrecondition(tableKey, addDataObj)) { final AddFlowInputBuilder builder = new AddFlowInputBuilder(addDataObj); diff --git a/applications/forwardingrules-sync/src/main/java/org/opendaylight/openflowplugin/applications/frsync/util/PathUtil.java b/applications/forwardingrules-sync/src/main/java/org/opendaylight/openflowplugin/applications/frsync/util/PathUtil.java index b6e984229f..73db39c900 100644 --- a/applications/forwardingrules-sync/src/main/java/org/opendaylight/openflowplugin/applications/frsync/util/PathUtil.java +++ b/applications/forwardingrules-sync/src/main/java/org/opendaylight/openflowplugin/applications/frsync/util/PathUtil.java @@ -11,7 +11,6 @@ package org.opendaylight.openflowplugin.applications.frsync.util; import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode; import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId; import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node; -import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; /** @@ -24,7 +23,7 @@ public final class PathUtil { } public static NodeId digNodeId(final InstanceIdentifier nodeIdent) { - return nodeIdent.firstKeyOf(Node.class, NodeKey.class).getId(); + return nodeIdent.firstKeyOf(Node.class).getId(); } public static InstanceIdentifier digNodePath(final InstanceIdentifier nodeIdent) { diff --git a/applications/forwardingrules-sync/src/test/java/org/opendaylight/openflowplugin/applications/frsync/impl/ForwardingRulesSyncProviderTest.java b/applications/forwardingrules-sync/src/test/java/org/opendaylight/openflowplugin/applications/frsync/impl/ForwardingRulesSyncProviderTest.java index e771a54d29..ff9f903ec3 100644 --- a/applications/forwardingrules-sync/src/test/java/org/opendaylight/openflowplugin/applications/frsync/impl/ForwardingRulesSyncProviderTest.java +++ b/applications/forwardingrules-sync/src/test/java/org/opendaylight/openflowplugin/applications/frsync/impl/ForwardingRulesSyncProviderTest.java @@ -11,7 +11,7 @@ import org.junit.After; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.Matchers; +import org.mockito.ArgumentMatchers; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.runners.MockitoJUnitRunner; @@ -41,7 +41,7 @@ public class ForwardingRulesSyncProviderTest { @Before public void setUp() throws Exception { - Mockito.when(rpcRegistry.getRpcService(Matchers.>any())) + Mockito.when(rpcRegistry.getRpcService(ArgumentMatchers.>any())) .thenAnswer(invocation -> { Class serviceType = (Class) invocation.getArguments()[0]; @@ -58,8 +58,8 @@ public class ForwardingRulesSyncProviderTest { provider.init(); Mockito.verify(dataBroker, Mockito.times(2)).registerDataTreeChangeListener( - Matchers.>any(), - Matchers.>any()); + ArgumentMatchers.>any(), + ArgumentMatchers.>any()); } @After diff --git a/applications/forwardingrules-sync/src/test/java/org/opendaylight/openflowplugin/applications/frsync/impl/SimplifiedConfigListenerTest.java b/applications/forwardingrules-sync/src/test/java/org/opendaylight/openflowplugin/applications/frsync/impl/SimplifiedConfigListenerTest.java index ebea7768ee..6c7c4b3fba 100644 --- a/applications/forwardingrules-sync/src/test/java/org/opendaylight/openflowplugin/applications/frsync/impl/SimplifiedConfigListenerTest.java +++ b/applications/forwardingrules-sync/src/test/java/org/opendaylight/openflowplugin/applications/frsync/impl/SimplifiedConfigListenerTest.java @@ -15,7 +15,7 @@ import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.Matchers; +import org.mockito.ArgumentMatchers; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.runners.MockitoJUnitRunner; @@ -145,8 +145,8 @@ public class SimplifiedConfigListenerTest { Mockito.when(roTx.read(LogicalDatastoreType.OPERATIONAL, fcNodePath)) .thenReturn(Futures.immediateCheckedFuture(Optional.of(dataBefore))); final SyncupEntry syncupEntry = new SyncupEntry(after, dsTypeAfter, before, dsTypeBefore); - Mockito.when(reactor.syncup(Matchers.>any(), Mockito.eq(syncupEntry))) - .thenReturn(Futures.immediateFuture(Boolean.TRUE)); + Mockito.when(reactor.syncup(ArgumentMatchers.>any(), + Mockito.eq(syncupEntry))).thenReturn(Futures.immediateFuture(Boolean.TRUE)); return syncupEntry; } diff --git a/applications/forwardingrules-sync/src/test/java/org/opendaylight/openflowplugin/applications/frsync/impl/SimplifiedOperationalListenerTest.java b/applications/forwardingrules-sync/src/test/java/org/opendaylight/openflowplugin/applications/frsync/impl/SimplifiedOperationalListenerTest.java index 9ba97bfa13..fec3204045 100644 --- a/applications/forwardingrules-sync/src/test/java/org/opendaylight/openflowplugin/applications/frsync/impl/SimplifiedOperationalListenerTest.java +++ b/applications/forwardingrules-sync/src/test/java/org/opendaylight/openflowplugin/applications/frsync/impl/SimplifiedOperationalListenerTest.java @@ -18,7 +18,7 @@ import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.Matchers; +import org.mockito.ArgumentMatchers; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.runners.MockitoJUnitRunner; @@ -289,8 +289,8 @@ public class SimplifiedOperationalListenerTest { Mockito.when(roTx.read(LogicalDatastoreType.CONFIGURATION, fcNodePath)) .thenReturn(Futures.immediateCheckedFuture(Optional.of(configNode))); final SyncupEntry syncupEntry = new SyncupEntry(after, dsTypeAfter, before, dsTypeBefore); - Mockito.when(reactor.syncup(Matchers.>any(), Mockito.eq(syncupEntry))) - .thenReturn(Futures.immediateFuture(Boolean.TRUE)); + Mockito.when(reactor.syncup(ArgumentMatchers.>any(), + Mockito.eq(syncupEntry))).thenReturn(Futures.immediateFuture(Boolean.TRUE)); return syncupEntry; } } diff --git a/applications/forwardingrules-sync/src/test/java/org/opendaylight/openflowplugin/applications/frsync/impl/SyncReactorFutureZipDecoratorTest.java b/applications/forwardingrules-sync/src/test/java/org/opendaylight/openflowplugin/applications/frsync/impl/SyncReactorFutureZipDecoratorTest.java index 77505176d1..875aaf9284 100644 --- a/applications/forwardingrules-sync/src/test/java/org/opendaylight/openflowplugin/applications/frsync/impl/SyncReactorFutureZipDecoratorTest.java +++ b/applications/forwardingrules-sync/src/test/java/org/opendaylight/openflowplugin/applications/frsync/impl/SyncReactorFutureZipDecoratorTest.java @@ -23,8 +23,8 @@ import org.junit.After; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; +import org.mockito.ArgumentMatchers; import org.mockito.InOrder; -import org.mockito.Matchers; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.runners.MockitoJUnitRunner; @@ -87,7 +87,7 @@ public class SyncReactorFutureZipDecoratorTest { final SyncupEntry zipped = new SyncupEntry(dataAfter2, configDS, dataBefore, configDS); final List> allResults = new ArrayList<>(); - Mockito.when(delegate.syncup(Matchers.>any(), Mockito.eq(first))) + Mockito.when(delegate.syncup(ArgumentMatchers.>any(), Mockito.eq(first))) .thenAnswer(invocationOnMock -> { LOG.info("unlocking next configs"); latchForNext.countDown(); @@ -131,7 +131,7 @@ public class SyncReactorFutureZipDecoratorTest { final SyncupEntry first = new SyncupEntry(dataBefore, configDS, null, configDS); final SyncupEntry second = new SyncupEntry(dataAfter, configDS, dataBefore, configDS); - Mockito.when(delegate.syncup(Matchers.>any(), Mockito.eq(first))) + Mockito.when(delegate.syncup(ArgumentMatchers.>any(), Mockito.eq(first))) .thenAnswer(invocationOnMock -> { LOG.info("unlocking next config"); latchForNext.countDown(); @@ -166,7 +166,7 @@ public class SyncReactorFutureZipDecoratorTest { final SyncupEntry first = new SyncupEntry(configAfter, configDS, configBefore, configDS); final SyncupEntry second = new SyncupEntry(configActual, configDS, freshOperational, operationalDS); - Mockito.when(delegate.syncup(Matchers.>any(), Mockito.eq(first))) + Mockito.when(delegate.syncup(ArgumentMatchers.>any(), Mockito.eq(first))) .thenAnswer(invocationOnMock -> { LOG.info("unlocking for fresh operational"); latchForNext.countDown(); @@ -192,7 +192,7 @@ public class SyncReactorFutureZipDecoratorTest { } private void mockSyncupWithEntry(final SyncupEntry entry) { - Mockito.when(delegate.syncup(Matchers.any(), Mockito.eq(entry))) + Mockito.when(delegate.syncup(ArgumentMatchers.any(), Mockito.eq(entry))) .thenReturn(Futures.immediateFuture(Boolean.TRUE)); } diff --git a/applications/forwardingrules-sync/src/test/java/org/opendaylight/openflowplugin/applications/frsync/impl/SyncReactorGuardDecoratorTest.java b/applications/forwardingrules-sync/src/test/java/org/opendaylight/openflowplugin/applications/frsync/impl/SyncReactorGuardDecoratorTest.java index 54609323e4..8724c53174 100644 --- a/applications/forwardingrules-sync/src/test/java/org/opendaylight/openflowplugin/applications/frsync/impl/SyncReactorGuardDecoratorTest.java +++ b/applications/forwardingrules-sync/src/test/java/org/opendaylight/openflowplugin/applications/frsync/impl/SyncReactorGuardDecoratorTest.java @@ -12,7 +12,7 @@ import com.google.common.util.concurrent.Futures; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.Matchers; +import org.mockito.ArgumentMatchers; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.runners.MockitoJUnitRunner; @@ -52,13 +52,13 @@ public class SyncReactorGuardDecoratorTest { fcNodePath = nodePath.augmentation(FlowCapableNode.class); final Node operationalNode = Mockito.mock(Node.class); - Mockito.when(operationalNode.getId()).thenReturn(NODE_ID); - Mockito.when(operationalNode.augmentation(FlowCapableNode.class)).thenReturn(fcOperationalNode); + Mockito.lenient().when(operationalNode.getId()).thenReturn(NODE_ID); + Mockito.lenient().when(operationalNode.augmentation(FlowCapableNode.class)).thenReturn(fcOperationalNode); } @Test public void testSyncupSuccess() { - Mockito.when(delegate.syncup(Matchers.any(), Matchers.any())) + Mockito.when(delegate.syncup(ArgumentMatchers.any(), ArgumentMatchers.any())) .thenReturn(Futures.immediateFuture(Boolean.TRUE)); reactor.syncup(fcNodePath, syncupEntry); @@ -69,7 +69,7 @@ public class SyncReactorGuardDecoratorTest { @Test public void testSyncupFail() { - Mockito.when(delegate.syncup(Matchers.any(), Matchers.any())) + Mockito.when(delegate.syncup(ArgumentMatchers.any(), ArgumentMatchers.any())) .thenReturn(Futures.immediateFailedFuture(new Exception())); reactor.syncup(fcNodePath, syncupEntry); diff --git a/applications/forwardingrules-sync/src/test/java/org/opendaylight/openflowplugin/applications/frsync/impl/SyncReactorImplTest.java b/applications/forwardingrules-sync/src/test/java/org/opendaylight/openflowplugin/applications/frsync/impl/SyncReactorImplTest.java index dd0886a793..48a43a2e46 100644 --- a/applications/forwardingrules-sync/src/test/java/org/opendaylight/openflowplugin/applications/frsync/impl/SyncReactorImplTest.java +++ b/applications/forwardingrules-sync/src/test/java/org/opendaylight/openflowplugin/applications/frsync/impl/SyncReactorImplTest.java @@ -16,8 +16,8 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; +import org.mockito.ArgumentMatchers; import org.mockito.Captor; -import org.mockito.Matchers; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.runners.MockitoJUnitRunner; @@ -106,9 +106,9 @@ public class SyncReactorImplTest { operationalFcn, LogicalDatastoreType.OPERATIONAL); Mockito.when(syncPlanPushStrategy.executeSyncStrategy( - Matchers.>>any(), - Matchers.any(), - Matchers.any())) + ArgumentMatchers.>>any(), + ArgumentMatchers.any(), + ArgumentMatchers.any())) .thenReturn(RpcResultBuilder.success().buildFuture()); final ListenableFuture syncupResult = reactor.syncup(NODE_IDENT, syncupEntry); @@ -117,9 +117,9 @@ public class SyncReactorImplTest { Assert.assertTrue(voidRpcResult); Mockito.verify(syncPlanPushStrategy).executeSyncStrategy( - Matchers.>>any(), + ArgumentMatchers.>>any(), syncDiffInputCaptor.capture(), - Matchers.any()); + ArgumentMatchers.any()); final SynchronizationDiffInput diffInput = syncDiffInputCaptor.getValue(); Assert.assertEquals(1, ReconcileUtil.countTotalPushed(diffInput.getFlowsToAddOrUpdate().values())); diff --git a/applications/forwardingrules-sync/src/test/java/org/opendaylight/openflowplugin/applications/frsync/impl/SyncReactorRetryDecoratorTest.java b/applications/forwardingrules-sync/src/test/java/org/opendaylight/openflowplugin/applications/frsync/impl/SyncReactorRetryDecoratorTest.java index 70147bc3da..78ad230402 100644 --- a/applications/forwardingrules-sync/src/test/java/org/opendaylight/openflowplugin/applications/frsync/impl/SyncReactorRetryDecoratorTest.java +++ b/applications/forwardingrules-sync/src/test/java/org/opendaylight/openflowplugin/applications/frsync/impl/SyncReactorRetryDecoratorTest.java @@ -12,7 +12,7 @@ import com.google.common.util.concurrent.Futures; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.Matchers; +import org.mockito.ArgumentMatchers; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.runners.MockitoJUnitRunner; @@ -53,8 +53,8 @@ public class SyncReactorRetryDecoratorTest { @Test public void testSyncupSuccess() { - Mockito.when(delegate.syncup(Matchers.>any(), Matchers.any())) - .thenReturn(Futures.immediateFuture(Boolean.TRUE)); + Mockito.when(delegate.syncup(ArgumentMatchers.>any(), + ArgumentMatchers.any())).thenReturn(Futures.immediateFuture(Boolean.TRUE)); reactor.syncup(fcNodePath, syncupEntry); @@ -65,8 +65,8 @@ public class SyncReactorRetryDecoratorTest { @Test public void testSyncupFail() { - Mockito.when(delegate.syncup(Matchers.>any(), Matchers.any())) - .thenReturn(Futures.immediateFuture(Boolean.FALSE)); + Mockito.when(delegate.syncup(ArgumentMatchers.>any(), + ArgumentMatchers.any())).thenReturn(Futures.immediateFuture(Boolean.FALSE)); reactor.syncup(fcNodePath, syncupEntry); diff --git a/applications/forwardingrules-sync/src/test/java/org/opendaylight/openflowplugin/applications/frsync/impl/clustering/DeviceMastershipManagerTest.java b/applications/forwardingrules-sync/src/test/java/org/opendaylight/openflowplugin/applications/frsync/impl/clustering/DeviceMastershipManagerTest.java index bf0096ebe7..11a4da7c8a 100644 --- a/applications/forwardingrules-sync/src/test/java/org/opendaylight/openflowplugin/applications/frsync/impl/clustering/DeviceMastershipManagerTest.java +++ b/applications/forwardingrules-sync/src/test/java/org/opendaylight/openflowplugin/applications/frsync/impl/clustering/DeviceMastershipManagerTest.java @@ -12,7 +12,7 @@ import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.Matchers; +import org.mockito.ArgumentMatchers; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.runners.MockitoJUnitRunner; @@ -37,7 +37,8 @@ public class DeviceMastershipManagerTest { @Before public void setUp() throws Exception { deviceMastershipManager = new DeviceMastershipManager(clusterSingletonService, new ReconciliationRegistry()); - Mockito.when(clusterSingletonService.registerClusterSingletonService(Matchers.any())) + Mockito.when(clusterSingletonService + .registerClusterSingletonService(ArgumentMatchers.any())) .thenReturn(registration); } diff --git a/applications/forwardingrules-sync/src/test/java/org/opendaylight/openflowplugin/applications/frsync/impl/strategy/FlowForwarderTest.java b/applications/forwardingrules-sync/src/test/java/org/opendaylight/openflowplugin/applications/frsync/impl/strategy/FlowForwarderTest.java index 61ce84ee9d..1fb2ed5122 100644 --- a/applications/forwardingrules-sync/src/test/java/org/opendaylight/openflowplugin/applications/frsync/impl/strategy/FlowForwarderTest.java +++ b/applications/forwardingrules-sync/src/test/java/org/opendaylight/openflowplugin/applications/frsync/impl/strategy/FlowForwarderTest.java @@ -17,8 +17,8 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; +import org.mockito.ArgumentMatchers; import org.mockito.Captor; -import org.mockito.Matchers; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.runners.MockitoJUnitRunner; @@ -110,7 +110,7 @@ public class FlowForwarderTest { final Future> addResult = flowForwarder.add(flowPath, flow, flowCapableNodePath); - Mockito.verify(salFlowService).addFlow(Matchers.any()); + Mockito.verify(salFlowService).addFlow(ArgumentMatchers.any()); final AddFlowInput flowInput = addFlowInputCpt.getValue(); Assert.assertEquals(2, flowInput.getTableId().shortValue()); Assert.assertEquals(emptyMatch, flowInput.getMatch()); @@ -155,7 +155,7 @@ public class FlowForwarderTest { final Future> updateResult = flowForwarder.update(flowPath, flow, flowUpdated, flowCapableNodePath); - Mockito.verify(salFlowService).updateFlow(Matchers.any()); + Mockito.verify(salFlowService).updateFlow(ArgumentMatchers.any()); final UpdateFlowInput updateFlowInput = updateFlowInputCpt.getValue(); final OriginalFlow flowOrigInput = updateFlowInput.getOriginalFlow(); final UpdatedFlow flowInput = updateFlowInput.getUpdatedFlow(); @@ -192,7 +192,7 @@ public class FlowForwarderTest { final Future> removeResult = flowForwarder.remove(flowPath, removeFlow, flowCapableNodePath); - Mockito.verify(salFlowService).removeFlow(Matchers.any()); + Mockito.verify(salFlowService).removeFlow(ArgumentMatchers.any()); final RemoveFlowInput flowInput = removeFlowInputCpt.getValue(); Assert.assertEquals(2, flowInput.getTableId().shortValue()); Assert.assertEquals(emptyMatch, flowInput.getMatch()); diff --git a/applications/forwardingrules-sync/src/test/java/org/opendaylight/openflowplugin/applications/frsync/impl/strategy/GroupForwarderTest.java b/applications/forwardingrules-sync/src/test/java/org/opendaylight/openflowplugin/applications/frsync/impl/strategy/GroupForwarderTest.java index 1d26c584c9..3a5bc5dae1 100644 --- a/applications/forwardingrules-sync/src/test/java/org/opendaylight/openflowplugin/applications/frsync/impl/strategy/GroupForwarderTest.java +++ b/applications/forwardingrules-sync/src/test/java/org/opendaylight/openflowplugin/applications/frsync/impl/strategy/GroupForwarderTest.java @@ -16,8 +16,8 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; +import org.mockito.ArgumentMatchers; import org.mockito.Captor; -import org.mockito.Matchers; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.runners.MockitoJUnitRunner; @@ -100,7 +100,7 @@ public class GroupForwarderTest { final Future> addResult = groupForwarder.remove(groupPath, group, flowCapableNodePath); - Mockito.verify(salGroupService).removeGroup(Matchers.any()); + Mockito.verify(salGroupService).removeGroup(ArgumentMatchers.any()); Assert.assertTrue(addResult.isDone()); final RpcResult result = addResult.get(2, TimeUnit.SECONDS); @@ -133,7 +133,7 @@ public class GroupForwarderTest { final Future> addResult = groupForwarder.update(groupPath, groupOriginal, groupUpdate, flowCapableNodePath); - Mockito.verify(salGroupService).updateGroup(Matchers.any()); + Mockito.verify(salGroupService).updateGroup(ArgumentMatchers.any()); Assert.assertTrue(addResult.isDone()); final RpcResult result = addResult.get(2, TimeUnit.SECONDS); @@ -163,7 +163,7 @@ public class GroupForwarderTest { final Future> addResult = groupForwarder.add(groupPath, group, flowCapableNodePath); - Mockito.verify(salGroupService).addGroup(Matchers.any()); + Mockito.verify(salGroupService).addGroup(ArgumentMatchers.any()); Assert.assertTrue(addResult.isDone()); final RpcResult result = addResult.get(2, TimeUnit.SECONDS); diff --git a/applications/forwardingrules-sync/src/test/java/org/opendaylight/openflowplugin/applications/frsync/impl/strategy/MeterForwarderTest.java b/applications/forwardingrules-sync/src/test/java/org/opendaylight/openflowplugin/applications/frsync/impl/strategy/MeterForwarderTest.java index 0109aa13f3..31f6dd51f5 100644 --- a/applications/forwardingrules-sync/src/test/java/org/opendaylight/openflowplugin/applications/frsync/impl/strategy/MeterForwarderTest.java +++ b/applications/forwardingrules-sync/src/test/java/org/opendaylight/openflowplugin/applications/frsync/impl/strategy/MeterForwarderTest.java @@ -16,8 +16,8 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; +import org.mockito.ArgumentMatchers; import org.mockito.Captor; -import org.mockito.Matchers; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.runners.MockitoJUnitRunner; @@ -97,7 +97,7 @@ public class MeterForwarderTest { final Future> removeResult = meterForwarder.remove(meterPath, removeMeter, flowCapableNodePath); - Mockito.verify(salMeterService).removeMeter(Matchers.any()); + Mockito.verify(salMeterService).removeMeter(ArgumentMatchers.any()); Assert.assertTrue(removeResult.isDone()); final RpcResult meterResult = removeResult.get(2, TimeUnit.SECONDS); @@ -127,7 +127,7 @@ public class MeterForwarderTest { final Future> updateResult = meterForwarder.update(meterPath, meterOriginal, meterUpdate, flowCapableNodePath); - Mockito.verify(salMeterService).updateMeter(Matchers.any()); + Mockito.verify(salMeterService).updateMeter(ArgumentMatchers.any()); Assert.assertTrue(updateResult.isDone()); final RpcResult meterResult = updateResult.get(2, TimeUnit.SECONDS); @@ -152,7 +152,7 @@ public class MeterForwarderTest { ); final Future> addResult = meterForwarder.add(meterPath, meter, flowCapableNodePath); - Mockito.verify(salMeterService).addMeter(Matchers.any()); + Mockito.verify(salMeterService).addMeter(ArgumentMatchers.any()); Assert.assertTrue(addResult.isDone()); final RpcResult meterResult = addResult.get(2, TimeUnit.SECONDS); diff --git a/applications/forwardingrules-sync/src/test/java/org/opendaylight/openflowplugin/applications/frsync/impl/strategy/SyncPlanPushStrategyFlatBatchImplTest.java b/applications/forwardingrules-sync/src/test/java/org/opendaylight/openflowplugin/applications/frsync/impl/strategy/SyncPlanPushStrategyFlatBatchImplTest.java index fef5aa02eb..82c750c3fb 100644 --- a/applications/forwardingrules-sync/src/test/java/org/opendaylight/openflowplugin/applications/frsync/impl/strategy/SyncPlanPushStrategyFlatBatchImplTest.java +++ b/applications/forwardingrules-sync/src/test/java/org/opendaylight/openflowplugin/applications/frsync/impl/strategy/SyncPlanPushStrategyFlatBatchImplTest.java @@ -20,8 +20,8 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; +import org.mockito.ArgumentMatchers; import org.mockito.Captor; -import org.mockito.Matchers; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.runners.MockitoJUnitRunner; @@ -123,7 +123,7 @@ public class SyncPlanPushStrategyFlatBatchImplTest { groupsToAddOrUpdate, metersToAddOrUpdate, flowsToAddOrUpdate, flowsToRemove, metersToRemove, groupsToRemove); - Mockito.when(flatBatchService.processFlatBatch(Matchers.any())) + Mockito.when(flatBatchService.processFlatBatch(ArgumentMatchers.any())) .thenReturn(RpcResultBuilder.success(new ProcessFlatBatchOutputBuilder().build()).buildFuture()); final SyncCrudCounters counters = new SyncCrudCounters(); diff --git a/applications/forwardingrules-sync/src/test/java/org/opendaylight/openflowplugin/applications/frsync/impl/strategy/SyncPlanPushStrategyIncrementalImplTest.java b/applications/forwardingrules-sync/src/test/java/org/opendaylight/openflowplugin/applications/frsync/impl/strategy/SyncPlanPushStrategyIncrementalImplTest.java index 346cb9e0fc..12cb05445c 100644 --- a/applications/forwardingrules-sync/src/test/java/org/opendaylight/openflowplugin/applications/frsync/impl/strategy/SyncPlanPushStrategyIncrementalImplTest.java +++ b/applications/forwardingrules-sync/src/test/java/org/opendaylight/openflowplugin/applications/frsync/impl/strategy/SyncPlanPushStrategyIncrementalImplTest.java @@ -21,9 +21,9 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; +import org.mockito.ArgumentMatchers; import org.mockito.Captor; import org.mockito.InOrder; -import org.mockito.Matchers; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.runners.MockitoJUnitRunner; @@ -138,24 +138,27 @@ public class SyncPlanPushStrategyIncrementalImplTest { final ListenableFuture> rpcResult = syncPlanPushStrategy.executeSyncStrategy( RpcResultBuilder.success().buildFuture(), diffInput, syncCounters); - Mockito.verify(groupCommitter, Mockito.times(6)).add(Matchers.>any(), - Matchers.any(), Matchers.>any()); - Mockito.verify(groupCommitter, Mockito.times(3)).update(Matchers.>any(), - Matchers.any(), Matchers.any(), Matchers.>any()); - Mockito.verify(groupCommitter, Mockito.times(6)).remove(Matchers.>any(), - Matchers.any(), Matchers.>any()); - Mockito.verify(flowCommitter, Mockito.times(6)).add(Matchers.>any(), - Matchers.any(), Matchers.>any()); - Mockito.verify(flowCommitter, Mockito.times(3)).update(Matchers.>any(), - Matchers.any(), Matchers.any(), Matchers.>any()); - Mockito.verify(flowCommitter, Mockito.times(6)).remove(Matchers.>any(), - Matchers.any(), Matchers.>any()); - Mockito.verify(meterCommitter, Mockito.times(3)).add(Matchers.>any(), - Matchers.any(), Matchers.>any()); - Mockito.verify(meterCommitter, Mockito.times(3)).update(Matchers.>any(), - Matchers.any(), Matchers.any(), Matchers.>any()); - Mockito.verify(meterCommitter, Mockito.times(3)).remove(Matchers.>any(), - Matchers.any(), Matchers.>any()); + Mockito.verify(groupCommitter, Mockito.times(6)).add(ArgumentMatchers.>any(), + ArgumentMatchers.any(), ArgumentMatchers.>any()); + Mockito.verify(groupCommitter, Mockito.times(3)).update(ArgumentMatchers.>any(), + ArgumentMatchers.any(), ArgumentMatchers.any(), + ArgumentMatchers.>any()); + Mockito.verify(groupCommitter, Mockito.times(6)).remove(ArgumentMatchers.>any(), + ArgumentMatchers.any(), ArgumentMatchers.>any()); + Mockito.verify(flowCommitter, Mockito.times(6)).add(ArgumentMatchers.>any(), + ArgumentMatchers.any(), ArgumentMatchers.>any()); + Mockito.verify(flowCommitter, Mockito.times(3)).update(ArgumentMatchers.>any(), + ArgumentMatchers.any(), ArgumentMatchers.any(), + ArgumentMatchers.>any()); + Mockito.verify(flowCommitter, Mockito.times(6)).remove(ArgumentMatchers.>any(), + ArgumentMatchers.any(), ArgumentMatchers.>any()); + Mockito.verify(meterCommitter, Mockito.times(3)).add(ArgumentMatchers.>any(), + ArgumentMatchers.any(), ArgumentMatchers.>any()); + Mockito.verify(meterCommitter, Mockito.times(3)).update(ArgumentMatchers.>any(), + ArgumentMatchers.any(), ArgumentMatchers.any(), + ArgumentMatchers.>any()); + Mockito.verify(meterCommitter, Mockito.times(3)).remove(ArgumentMatchers.>any(), + ArgumentMatchers.any(), ArgumentMatchers.>any()); Assert.assertTrue(rpcResult.isDone()); Assert.assertTrue(rpcResult.get().isSuccessful()); @@ -175,42 +178,43 @@ public class SyncPlanPushStrategyIncrementalImplTest { @Before public void setUp() throws Exception { - Mockito.when(flowCapableTxService.sendBarrier(Matchers.any())) + Mockito.when(flowCapableTxService.sendBarrier(ArgumentMatchers.any())) .thenReturn(RpcResultBuilder.success((SendBarrierOutput) null).buildFuture()); Mockito.doAnswer(createSalServiceFutureAnswer()).when(groupCommitter).add( - Matchers.>any(), Matchers.any(), - Matchers.>any()); + ArgumentMatchers.>any(), ArgumentMatchers.any(), + ArgumentMatchers.>any()); Mockito.doAnswer(createSalServiceFutureAnswer()).when(groupCommitter).update( - Matchers.>any(), Matchers.any(), Matchers.any(), - Matchers.>any()); + ArgumentMatchers.>any(), ArgumentMatchers.any(), + ArgumentMatchers.any(), + ArgumentMatchers.>any()); Mockito.doAnswer(createSalServiceFutureAnswer()).when(groupCommitter).remove( - Matchers.>any(), Matchers.any(), - Matchers.>any()); + ArgumentMatchers.>any(), ArgumentMatchers.any(), + ArgumentMatchers.>any()); Mockito.doAnswer(createSalServiceFutureAnswer()).when(flowCommitter).add( - Matchers.>any(), Matchers.any(), - Matchers.>any()); + ArgumentMatchers.>any(), ArgumentMatchers.any(), + ArgumentMatchers.>any()); Mockito.doAnswer(createSalServiceFutureAnswer()).when(flowCommitter).update( - Matchers.>any(), Matchers.any(), Matchers.any(), - Matchers.>any()); + ArgumentMatchers.>any(), ArgumentMatchers.any(), + ArgumentMatchers.any(), ArgumentMatchers.>any()); Mockito.doAnswer(createSalServiceFutureAnswer()).when(flowCommitter).remove( - Matchers.>any(), Matchers.any(), - Matchers.>any()); + ArgumentMatchers.>any(), ArgumentMatchers.any(), + ArgumentMatchers.>any()); Mockito.doAnswer(createSalServiceFutureAnswer()).when(meterCommitter).add( - Matchers.>any(), Matchers.any(), - Matchers.>any()); + ArgumentMatchers.>any(), ArgumentMatchers.any(), + ArgumentMatchers.>any()); Mockito.doAnswer(createSalServiceFutureAnswer()).when(meterCommitter).update( - Matchers.>any(), Matchers.any(), Matchers.any(), - Matchers.>any()); + ArgumentMatchers.>any(), ArgumentMatchers.any(), + ArgumentMatchers.any(), ArgumentMatchers.>any()); Mockito.doAnswer(createSalServiceFutureAnswer()).when(meterCommitter).remove( - Matchers.>any(), Matchers.any(), - Matchers.>any()); + ArgumentMatchers.>any(), ArgumentMatchers.any(), + ArgumentMatchers.>any()); Mockito.doAnswer(createSalServiceFutureAnswer()).when(tableCommitter).update( - Matchers.>any(), Matchers.any(), - Matchers.any(), Matchers.>any()); + ArgumentMatchers.>any(), ArgumentMatchers.any(), + ArgumentMatchers.any(), ArgumentMatchers.>any()); syncPlanPushStrategy = new SyncPlanPushStrategyIncrementalImpl() .setMeterForwarder(meterCommitter) @@ -228,8 +232,8 @@ public class SyncPlanPushStrategyIncrementalImplTest { @Test public void testAddMissingFlows() throws Exception { - Mockito.when(flowCommitter.add(Matchers.>any(), flowCaptor.capture(), - Matchers.same(NODE_IDENT))) + Mockito.when(flowCommitter.add(ArgumentMatchers.>any(), flowCaptor.capture(), + ArgumentMatchers.same(NODE_IDENT))) .thenReturn(RpcResultBuilder.success(new AddFlowOutputBuilder().build()).buildFuture()); final ItemSyncBox flowBox = new ItemSyncBox<>(); @@ -251,8 +255,8 @@ public class SyncPlanPushStrategyIncrementalImplTest { Assert.assertEquals("f4", flowCaptorAllValues.get(1).getId().getValue()); final InOrder inOrderFlow = Mockito.inOrder(flowCapableTxService, flowCommitter); - inOrderFlow.verify(flowCommitter, Mockito.times(2)).add(Matchers.>any(), - Matchers.any(), Matchers.eq(NODE_IDENT)); + inOrderFlow.verify(flowCommitter, Mockito.times(2)).add(ArgumentMatchers.>any(), + ArgumentMatchers.any(), ArgumentMatchers.eq(NODE_IDENT)); //TODO: uncomment when enabled in impl // inOrderFlow.verify(flowCapableTxService).sendBarrier(Matchers.any()); inOrderFlow.verifyNoMoreInteractions(); @@ -260,8 +264,8 @@ public class SyncPlanPushStrategyIncrementalImplTest { @Test public void testRemoveRedundantFlows() throws Exception { - Mockito.when(flowCommitter.remove(Matchers.>any(), flowCaptor.capture(), - Matchers.same(NODE_IDENT))) + Mockito.when(flowCommitter.remove(ArgumentMatchers.>any(), flowCaptor.capture(), + ArgumentMatchers.same(NODE_IDENT))) .thenReturn(RpcResultBuilder.success(new RemoveFlowOutputBuilder().build()).buildFuture()); final ItemSyncBox flowBox = new ItemSyncBox<>(); @@ -283,22 +287,22 @@ public class SyncPlanPushStrategyIncrementalImplTest { Assert.assertEquals("f4", flowCaptorAllValues.get(1).getId().getValue()); final InOrder inOrderFlow = Mockito.inOrder(flowCapableTxService, flowCommitter); - inOrderFlow.verify(flowCommitter, Mockito.times(2)).remove(Matchers.>any(), - Matchers.any(), Matchers.eq(NODE_IDENT)); - inOrderFlow.verify(flowCapableTxService).sendBarrier(Matchers.any()); + inOrderFlow.verify(flowCommitter, Mockito.times(2)).remove(ArgumentMatchers.>any(), + ArgumentMatchers.any(), ArgumentMatchers.eq(NODE_IDENT)); + inOrderFlow.verify(flowCapableTxService).sendBarrier(ArgumentMatchers.any()); inOrderFlow.verifyNoMoreInteractions(); } @Test public void testAddMissingFlows_withUpdate() throws Exception { - Mockito.when(flowCommitter.add(Matchers.>any(), flowCaptor.capture(), - Matchers.same(NODE_IDENT))) + Mockito.when(flowCommitter.add(ArgumentMatchers.>any(), flowCaptor.capture(), + ArgumentMatchers.same(NODE_IDENT))) .thenReturn(RpcResultBuilder.success(new AddFlowOutputBuilder().build()).buildFuture()); - Mockito.when(flowCommitter.update(Matchers.>any(), + Mockito.when(flowCommitter.update(ArgumentMatchers.>any(), flowUpdateCaptor.capture(), flowUpdateCaptor.capture(), - Matchers.same(NODE_IDENT))) + ArgumentMatchers.same(NODE_IDENT))) .thenReturn(RpcResultBuilder.success(new UpdateFlowOutputBuilder().build()).buildFuture()); final ItemSyncBox flowBox = new ItemSyncBox<>(); @@ -330,11 +334,11 @@ public class SyncPlanPushStrategyIncrementalImplTest { final InOrder inOrderFlow = Mockito.inOrder(flowCapableTxService, flowCommitter); // add f3, f4 - inOrderFlow.verify(flowCommitter, Mockito.times(2)).add(Matchers.>any(), - Matchers.any(), Matchers.eq(NODE_IDENT)); + inOrderFlow.verify(flowCommitter, Mockito.times(2)).add(ArgumentMatchers.>any(), + ArgumentMatchers.any(), ArgumentMatchers.eq(NODE_IDENT)); // update f1 - inOrderFlow.verify(flowCommitter).update(Matchers.>any(), - Matchers.any(), Matchers.any(), Matchers.eq(NODE_IDENT)); + inOrderFlow.verify(flowCommitter).update(ArgumentMatchers.>any(), + ArgumentMatchers.any(), ArgumentMatchers.any(), ArgumentMatchers.eq(NODE_IDENT)); //TODO: uncomment when enabled in impl // inOrderFlow.verify(flowCapableTxService).sendBarrier(Matchers.any()); @@ -343,8 +347,8 @@ public class SyncPlanPushStrategyIncrementalImplTest { @Test public void testAddMissingMeters() throws Exception { - Mockito.when(meterCommitter.add(Matchers.>any(), meterCaptor.capture(), - Matchers.same(NODE_IDENT))) + Mockito.when(meterCommitter.add(ArgumentMatchers.>any(), meterCaptor.capture(), + ArgumentMatchers.same(NODE_IDENT))) .thenReturn(RpcResultBuilder.success(new AddMeterOutputBuilder().build()).buildFuture()); final ItemSyncBox meterSyncBox = new ItemSyncBox<>(); @@ -363,8 +367,8 @@ public class SyncPlanPushStrategyIncrementalImplTest { Assert.assertEquals(4L, metercaptorAllValues.get(1).getMeterId().getValue().longValue()); final InOrder inOrderMeter = Mockito.inOrder(flowCapableTxService, meterCommitter); - inOrderMeter.verify(meterCommitter, Mockito.times(2)).add(Matchers.>any(), - Matchers.any(), Matchers.eq(NODE_IDENT)); + inOrderMeter.verify(meterCommitter, Mockito.times(2)).add(ArgumentMatchers.>any(), + ArgumentMatchers.any(), ArgumentMatchers.eq(NODE_IDENT)); //TODO: uncomment when enabled in impl // inOrderMeter.verify(flowCapableTxService).sendBarrier(Matchers.any()); inOrderMeter.verifyNoMoreInteractions(); @@ -372,12 +376,12 @@ public class SyncPlanPushStrategyIncrementalImplTest { @Test public void testAddMissingMeters_withUpdate() throws Exception { - Mockito.when(meterCommitter.add(Matchers.>any(), meterCaptor.capture(), - Matchers.same(NODE_IDENT))) + Mockito.when(meterCommitter.add(ArgumentMatchers.>any(), meterCaptor.capture(), + ArgumentMatchers.same(NODE_IDENT))) .thenReturn(RpcResultBuilder.success(new AddMeterOutputBuilder().build()).buildFuture()); - Mockito.when(meterCommitter.update(Matchers.>any(), - meterUpdateCaptor.capture(), meterUpdateCaptor.capture(), Matchers.same(NODE_IDENT))) + Mockito.when(meterCommitter.update(ArgumentMatchers.>any(), + meterUpdateCaptor.capture(), meterUpdateCaptor.capture(), ArgumentMatchers.same(NODE_IDENT))) .thenReturn(RpcResultBuilder.success(new UpdateMeterOutputBuilder().build()).buildFuture()); final ItemSyncBox meterSyncBox = new ItemSyncBox<>(); @@ -404,10 +408,10 @@ public class SyncPlanPushStrategyIncrementalImplTest { Assert.assertEquals(1L, meterUpdateCaptorAllValues.get(1).getMeterId().getValue().longValue()); final InOrder inOrderMeters = Mockito.inOrder(flowCapableTxService, meterCommitter); - inOrderMeters.verify(meterCommitter, Mockito.times(2)).add(Matchers.>any(), - Matchers.any(), Matchers.eq(NODE_IDENT)); - inOrderMeters.verify(meterCommitter).update(Matchers.>any(), - Matchers.any(), Matchers.any(), Matchers.eq(NODE_IDENT)); + inOrderMeters.verify(meterCommitter, Mockito.times(2)).add(ArgumentMatchers.>any(), + ArgumentMatchers.any(), ArgumentMatchers.eq(NODE_IDENT)); + inOrderMeters.verify(meterCommitter).update(ArgumentMatchers.>any(), + ArgumentMatchers.any(), ArgumentMatchers.any(), ArgumentMatchers.eq(NODE_IDENT)); //TODO: uncomment when enabled in impl // inOrderMeters.verify(flowCapableTxService).sendBarrier(Matchers.any()); @@ -416,8 +420,8 @@ public class SyncPlanPushStrategyIncrementalImplTest { @Test public void testRemoveRedundantMeters() throws Exception { - Mockito.when(meterCommitter.remove(Matchers.>any(), meterCaptor.capture(), - Matchers.same(NODE_IDENT))) + Mockito.when(meterCommitter.remove(ArgumentMatchers.>any(), meterCaptor.capture(), + ArgumentMatchers.same(NODE_IDENT))) .thenReturn(RpcResultBuilder.success(new RemoveMeterOutputBuilder().build()).buildFuture()); final ItemSyncBox meterSyncBox = new ItemSyncBox<>(); @@ -438,8 +442,8 @@ public class SyncPlanPushStrategyIncrementalImplTest { Assert.assertEquals(4L, metercaptorAllValues.get(1).getMeterId().getValue().longValue()); final InOrder inOrderMeter = Mockito.inOrder(flowCapableTxService, meterCommitter); - inOrderMeter.verify(meterCommitter, Mockito.times(2)).remove(Matchers.>any(), - Matchers.any(), Matchers.eq(NODE_IDENT)); + inOrderMeter.verify(meterCommitter, Mockito.times(2)).remove(ArgumentMatchers.>any(), + ArgumentMatchers.any(), ArgumentMatchers.eq(NODE_IDENT)); //TODO: uncomment when enabled in impl // inOrderMeter.verify(flowCapableTxService).sendBarrier(Matchers.any()); inOrderMeter.verifyNoMoreInteractions(); @@ -447,8 +451,8 @@ public class SyncPlanPushStrategyIncrementalImplTest { @Test public void testAddMissingGroups() throws Exception { - Mockito.when(groupCommitter.add(Matchers.>any(), groupCaptor.capture(), - Matchers.same(NODE_IDENT))) + Mockito.when(groupCommitter.add(ArgumentMatchers.>any(), groupCaptor.capture(), + ArgumentMatchers.same(NODE_IDENT))) .thenReturn(RpcResultBuilder.success(new AddGroupOutputBuilder().build()).buildFuture()); ItemSyncBox groupBox1 = new ItemSyncBox<>(); @@ -478,30 +482,30 @@ public class SyncPlanPushStrategyIncrementalImplTest { final InOrder inOrderGroups = Mockito.inOrder(flowCapableTxService, groupCommitter); // add 2 - inOrderGroups.verify(groupCommitter).add(Matchers.>any(), - Matchers.any(), Matchers.eq(NODE_IDENT)); - inOrderGroups.verify(flowCapableTxService).sendBarrier(Matchers.any()); + inOrderGroups.verify(groupCommitter).add(ArgumentMatchers.>any(), + ArgumentMatchers.any(), ArgumentMatchers.eq(NODE_IDENT)); + inOrderGroups.verify(flowCapableTxService).sendBarrier(ArgumentMatchers.any()); // add 3, 4 - inOrderGroups.verify(groupCommitter, Mockito.times(2)).add(Matchers.>any(), - Matchers.any(), Matchers.eq(NODE_IDENT)); - inOrderGroups.verify(flowCapableTxService).sendBarrier(Matchers.any()); + inOrderGroups.verify(groupCommitter, Mockito.times(2)).add(ArgumentMatchers.>any(), + ArgumentMatchers.any(), ArgumentMatchers.eq(NODE_IDENT)); + inOrderGroups.verify(flowCapableTxService).sendBarrier(ArgumentMatchers.any()); // add 5 - inOrderGroups.verify(groupCommitter).add(Matchers.>any(), - Matchers.any(), Matchers.eq(NODE_IDENT)); - inOrderGroups.verify(flowCapableTxService).sendBarrier(Matchers.any()); + inOrderGroups.verify(groupCommitter).add(ArgumentMatchers.>any(), + ArgumentMatchers.any(), ArgumentMatchers.eq(NODE_IDENT)); + inOrderGroups.verify(flowCapableTxService).sendBarrier(ArgumentMatchers.any()); inOrderGroups.verifyNoMoreInteractions(); } @Test public void testAddMissingGroups_withUpdate() throws Exception { - Mockito.when(groupCommitter.add(Matchers.>any(), groupCaptor.capture(), - Matchers.same(NODE_IDENT))) + Mockito.when(groupCommitter.add(ArgumentMatchers.>any(), groupCaptor.capture(), + ArgumentMatchers.same(NODE_IDENT))) .thenReturn(RpcResultBuilder.success(new AddGroupOutputBuilder().build()).buildFuture()); - Mockito.when(groupCommitter.update(Matchers.>any(), + Mockito.when(groupCommitter.update(ArgumentMatchers.>any(), groupUpdateCaptor.capture(), groupUpdateCaptor.capture(), - Matchers.same(NODE_IDENT))) + ArgumentMatchers.same(NODE_IDENT))) .thenReturn(RpcResultBuilder.success(new UpdateGroupOutputBuilder().build()).buildFuture()); ItemSyncBox groupBox1 = new ItemSyncBox<>(); @@ -538,28 +542,28 @@ public class SyncPlanPushStrategyIncrementalImplTest { final InOrder inOrderGroups = Mockito.inOrder(flowCapableTxService, groupCommitter); // add 2, update 1 - inOrderGroups.verify(groupCommitter).add(Matchers.>any(), - Matchers.any(), Matchers.eq(NODE_IDENT)); - inOrderGroups.verify(groupCommitter).update(Matchers.>any(), - Matchers.any(), Matchers.any(), Matchers.eq(NODE_IDENT)); - inOrderGroups.verify(flowCapableTxService).sendBarrier(Matchers.any()); + inOrderGroups.verify(groupCommitter).add(ArgumentMatchers.>any(), + ArgumentMatchers.any(), ArgumentMatchers.eq(NODE_IDENT)); + inOrderGroups.verify(groupCommitter).update(ArgumentMatchers.>any(), + ArgumentMatchers.any(), ArgumentMatchers.any(), ArgumentMatchers.eq(NODE_IDENT)); + inOrderGroups.verify(flowCapableTxService).sendBarrier(ArgumentMatchers.any()); // add 3, 4 - inOrderGroups.verify(groupCommitter, Mockito.times(2)).add(Matchers.>any(), - Matchers.any(), Matchers.eq(NODE_IDENT)); - inOrderGroups.verify(flowCapableTxService).sendBarrier(Matchers.any()); + inOrderGroups.verify(groupCommitter, Mockito.times(2)).add(ArgumentMatchers.>any(), + ArgumentMatchers.any(), ArgumentMatchers.eq(NODE_IDENT)); + inOrderGroups.verify(flowCapableTxService).sendBarrier(ArgumentMatchers.any()); // add 5 - inOrderGroups.verify(groupCommitter).add(Matchers.>any(), - Matchers.any(), Matchers.eq(NODE_IDENT)); - inOrderGroups.verify(flowCapableTxService).sendBarrier(Matchers.any()); + inOrderGroups.verify(groupCommitter).add(ArgumentMatchers.>any(), + ArgumentMatchers.any(), ArgumentMatchers.eq(NODE_IDENT)); + inOrderGroups.verify(flowCapableTxService).sendBarrier(ArgumentMatchers.any()); inOrderGroups.verifyNoMoreInteractions(); } @Test public void testRemoveRedundantGroups() throws Exception { - Mockito.when(groupCommitter.remove(Matchers.>any(), groupCaptor.capture(), - Matchers.same(NODE_IDENT))) + Mockito.when(groupCommitter.remove(ArgumentMatchers.>any(), groupCaptor.capture(), + ArgumentMatchers.same(NODE_IDENT))) .thenReturn(RpcResultBuilder.success(new RemoveGroupOutputBuilder().build()).buildFuture()); ItemSyncBox groupBox1 = new ItemSyncBox<>(); @@ -590,26 +594,26 @@ public class SyncPlanPushStrategyIncrementalImplTest { final InOrder inOrderGroup = Mockito.inOrder(flowCapableTxService, groupCommitter); // remove 5 - inOrderGroup.verify(groupCommitter).remove(Matchers.>any(), - Matchers.any(), Matchers.eq(NODE_IDENT)); - inOrderGroup.verify(flowCapableTxService).sendBarrier(Matchers.any()); + inOrderGroup.verify(groupCommitter).remove(ArgumentMatchers.>any(), + ArgumentMatchers.any(), ArgumentMatchers.eq(NODE_IDENT)); + inOrderGroup.verify(flowCapableTxService).sendBarrier(ArgumentMatchers.any()); // remove 3, 4 - inOrderGroup.verify(groupCommitter, Mockito.times(2)).remove(Matchers.>any(), - Matchers.any(), Matchers.eq(NODE_IDENT)); - inOrderGroup.verify(flowCapableTxService).sendBarrier(Matchers.any()); + inOrderGroup.verify(groupCommitter, Mockito.times(2)).remove(ArgumentMatchers.>any(), + ArgumentMatchers.any(), ArgumentMatchers.eq(NODE_IDENT)); + inOrderGroup.verify(flowCapableTxService).sendBarrier(ArgumentMatchers.any()); // remove 2 - inOrderGroup.verify(groupCommitter).remove(Matchers.>any(), - Matchers.any(), Matchers.eq(NODE_IDENT)); - inOrderGroup.verify(flowCapableTxService).sendBarrier(Matchers.any()); + inOrderGroup.verify(groupCommitter).remove(ArgumentMatchers.>any(), + ArgumentMatchers.any(), ArgumentMatchers.eq(NODE_IDENT)); + inOrderGroup.verify(flowCapableTxService).sendBarrier(ArgumentMatchers.any()); inOrderGroup.verifyNoMoreInteractions(); } @Test public void testUpdateTableFeatures() throws Exception { - Mockito.when(tableCommitter.update(Matchers.>any(), - Matchers.isNull(TableFeatures.class), tableFeaturesCaptor.capture(), - Matchers.same(NODE_IDENT))) + Mockito.lenient().when(tableCommitter.update(ArgumentMatchers.>any(), + ArgumentMatchers.isNull(TableFeatures.class), tableFeaturesCaptor.capture(), + ArgumentMatchers.same(NODE_IDENT))) .thenReturn(RpcResultBuilder.success(new UpdateTableOutputBuilder().build()).buildFuture()); final FlowCapableNode operational = new FlowCapableNodeBuilder() @@ -634,6 +638,6 @@ public class SyncPlanPushStrategyIncrementalImplTest { // Assert.assertEquals("test table features", groupCaptorAllValues.get(0).getName()); // Assert.assertEquals(1, groupCaptorAllValues.get(0).getTableId().intValue()); - Mockito.verify(flowCapableTxService).sendBarrier(Matchers.any()); + Mockito.verify(flowCapableTxService).sendBarrier(ArgumentMatchers.any()); } } diff --git a/applications/forwardingrules-sync/src/test/java/org/opendaylight/openflowplugin/applications/frsync/impl/strategy/TableForwarderTest.java b/applications/forwardingrules-sync/src/test/java/org/opendaylight/openflowplugin/applications/frsync/impl/strategy/TableForwarderTest.java index 31c472c64f..e4a9a10fbc 100644 --- a/applications/forwardingrules-sync/src/test/java/org/opendaylight/openflowplugin/applications/frsync/impl/strategy/TableForwarderTest.java +++ b/applications/forwardingrules-sync/src/test/java/org/opendaylight/openflowplugin/applications/frsync/impl/strategy/TableForwarderTest.java @@ -16,8 +16,8 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; +import org.mockito.ArgumentMatchers; import org.mockito.Captor; -import org.mockito.Matchers; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.runners.MockitoJUnitRunner; @@ -97,7 +97,7 @@ public class TableForwarderTest { final Future> updateResult = tableForwarder.update( tableFeaturesPath, tableFeatures, tableFeaturesUpdate, flowCapableNodePath); - Mockito.verify(salTableService).updateTable(Matchers.any()); + Mockito.verify(salTableService).updateTable(ArgumentMatchers.any()); Assert.assertTrue(updateResult.isDone()); final RpcResult updateTableResult = updateResult.get(2, TimeUnit.SECONDS); diff --git a/applications/forwardingrules-sync/src/test/java/org/opendaylight/openflowplugin/applications/frsync/util/ReconcileUtilTest.java b/applications/forwardingrules-sync/src/test/java/org/opendaylight/openflowplugin/applications/frsync/util/ReconcileUtilTest.java index 379eb257b8..183d1c0ecc 100644 --- a/applications/forwardingrules-sync/src/test/java/org/opendaylight/openflowplugin/applications/frsync/util/ReconcileUtilTest.java +++ b/applications/forwardingrules-sync/src/test/java/org/opendaylight/openflowplugin/applications/frsync/util/ReconcileUtilTest.java @@ -27,8 +27,8 @@ import org.junit.Test; import org.junit.rules.ExpectedException; import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; +import org.mockito.ArgumentMatchers; import org.mockito.Captor; -import org.mockito.Matchers; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.runners.MockitoJUnitRunner; @@ -83,11 +83,11 @@ public class ReconcileUtilTest { Mockito.when(flowCapableService.sendBarrier(barrierInputCaptor.capture())) .thenReturn(RpcResultBuilder.success().buildFuture()); - Mockito.verify(flowCapableService, Mockito.never()).sendBarrier(Matchers.any()); + Mockito.verify(flowCapableService, Mockito.never()).sendBarrier(ArgumentMatchers.any()); Assert.assertFalse(vehicle.isDone()); testRabbit.set(RpcResultBuilder.success().build()); - Mockito.verify(flowCapableService).sendBarrier(Matchers.any()); + Mockito.verify(flowCapableService).sendBarrier(ArgumentMatchers.any()); Assert.assertTrue(vehicle.isDone()); Assert.assertTrue(vehicle.get().isSuccessful()); } diff --git a/applications/lldp-speaker/pom.xml b/applications/lldp-speaker/pom.xml index 49b35bdb0b..a718e5280c 100644 --- a/applications/lldp-speaker/pom.xml +++ b/applications/lldp-speaker/pom.xml @@ -1,7 +1,5 @@ - + 4.0.0 org.opendaylight.openflowplugin diff --git a/applications/lldp-speaker/src/main/java/org/opendaylight/openflowplugin/applications/lldpspeaker/LLDPSpeaker.java b/applications/lldp-speaker/src/main/java/org/opendaylight/openflowplugin/applications/lldpspeaker/LLDPSpeaker.java index 7d8fc78fa3..aa653bf649 100644 --- a/applications/lldp-speaker/src/main/java/org/opendaylight/openflowplugin/applications/lldpspeaker/LLDPSpeaker.java +++ b/applications/lldp-speaker/src/main/java/org/opendaylight/openflowplugin/applications/lldpspeaker/LLDPSpeaker.java @@ -31,7 +31,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId; import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef; import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector; import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node; -import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey; import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.PacketProcessingService; import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.TransmitPacketInput; import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.TransmitPacketInputBuilder; @@ -129,7 +128,7 @@ public class LLDPSpeaker implements NodeConnectorEventsObserver, Runnable, AutoC LOG.debug("Sending LLDP frames to total {} ports", getOwnedPorts()); nodeConnectorMap.keySet().forEach(ncIID -> { NodeConnectorId nodeConnectorId = InstanceIdentifier.keyOf(ncIID).getId(); - NodeId nodeId = ncIID.firstKeyOf(Node.class, NodeKey.class).getId(); + NodeId nodeId = ncIID.firstKeyOf(Node.class).getId(); if (deviceOwnershipService.isEntityOwned(nodeId.getValue())) { LOG.debug("Node is owned by this controller, sending LLDP packet through port {}", nodeConnectorId.getValue()); @@ -205,7 +204,7 @@ public class LLDPSpeaker implements NodeConnectorEventsObserver, Runnable, AutoC private int getOwnedPorts() { AtomicInteger ownedPorts = new AtomicInteger(); nodeConnectorMap.keySet().forEach(ncIID -> { - NodeId nodeId = ncIID.firstKeyOf(Node.class, NodeKey.class).getId(); + NodeId nodeId = ncIID.firstKeyOf(Node.class).getId(); if (deviceOwnershipService.isEntityOwned(nodeId.getValue())) { ownedPorts.incrementAndGet(); } diff --git a/applications/lldp-speaker/src/test/java/org/opendaylight/openflowplugin/applications/lldpspeaker/LLDPSpeakerTest.java b/applications/lldp-speaker/src/test/java/org/opendaylight/openflowplugin/applications/lldpspeaker/LLDPSpeakerTest.java index 8adf0f54a7..f464ca7293 100644 --- a/applications/lldp-speaker/src/test/java/org/opendaylight/openflowplugin/applications/lldpspeaker/LLDPSpeakerTest.java +++ b/applications/lldp-speaker/src/test/java/org/opendaylight/openflowplugin/applications/lldpspeaker/LLDPSpeakerTest.java @@ -8,8 +8,8 @@ package org.opendaylight.openflowplugin.applications.lldpspeaker; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyLong; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyLong; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.never; import static org.mockito.Mockito.times; diff --git a/applications/notification-supplier/pom.xml b/applications/notification-supplier/pom.xml index 4c15d47ae3..494665f033 100644 --- a/applications/notification-supplier/pom.xml +++ b/applications/notification-supplier/pom.xml @@ -1,7 +1,5 @@ - + 4.0.0 org.opendaylight.openflowplugin diff --git a/applications/notification-supplier/src/main/java/org/opendaylight/openflowplugin/applications/notification/supplier/impl/AbstractNotificationSupplierBase.java b/applications/notification-supplier/src/main/java/org/opendaylight/openflowplugin/applications/notification/supplier/impl/AbstractNotificationSupplierBase.java index 6b5263dd3a..b6faa26f4c 100644 --- a/applications/notification-supplier/src/main/java/org/opendaylight/openflowplugin/applications/notification/supplier/impl/AbstractNotificationSupplierBase.java +++ b/applications/notification-supplier/src/main/java/org/opendaylight/openflowplugin/applications/notification/supplier/impl/AbstractNotificationSupplierBase.java @@ -101,7 +101,7 @@ public abstract class AbstractNotificationSupplierBase imp * @return Keyed InstanceIdentifier for Node */ protected static KeyedInstanceIdentifier getNodeII(final InstanceIdentifier ii) { - final NodeKey key = ii.firstKeyOf(Node.class, NodeKey.class); + final NodeKey key = ii.firstKeyOf(Node.class); Preconditions.checkArgument(key != null); return InstanceIdentifier.create(Nodes.class).child(Node.class, key); } @@ -124,7 +124,7 @@ public abstract class AbstractNotificationSupplierBase imp * @return extracted {@link NodeId} */ public static NodeId getNodeId(InstanceIdentifier path) { - final NodeKey nodeKey = Preconditions.checkNotNull(path.firstKeyOf(Node.class, NodeKey.class)); + final NodeKey nodeKey = Preconditions.checkNotNull(path.firstKeyOf(Node.class)); return nodeKey.getId(); } } diff --git a/applications/notification-supplier/src/main/java/org/opendaylight/openflowplugin/applications/notification/supplier/impl/NodeConnectorNotificationSupplierImpl.java b/applications/notification-supplier/src/main/java/org/opendaylight/openflowplugin/applications/notification/supplier/impl/NodeConnectorNotificationSupplierImpl.java index 77c4a05696..a855408bea 100644 --- a/applications/notification-supplier/src/main/java/org/opendaylight/openflowplugin/applications/notification/supplier/impl/NodeConnectorNotificationSupplierImpl.java +++ b/applications/notification-supplier/src/main/java/org/opendaylight/openflowplugin/applications/notification/supplier/impl/NodeConnectorNotificationSupplierImpl.java @@ -20,7 +20,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeCon import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorUpdated; import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorUpdatedBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector; -import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorKey; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; /** @@ -57,7 +56,7 @@ public class NodeConnectorNotificationSupplierImpl extends final NodeConnectorUpdatedBuilder notifBuilder = new NodeConnectorUpdatedBuilder(); final FlowCapableNodeConnectorUpdatedBuilder connNotifBuilder = new FlowCapableNodeConnectorUpdatedBuilder( flowCapableNodeConnector); - notifBuilder.setId(path.firstKeyOf(NodeConnector.class, NodeConnectorKey.class).getId()); + notifBuilder.setId(path.firstKeyOf(NodeConnector.class).getId()); notifBuilder.setNodeConnectorRef(new NodeConnectorRef(path)); notifBuilder.addAugmentation(FlowCapableNodeConnectorUpdated.class, connNotifBuilder.build()); return notifBuilder.build(); diff --git a/applications/notification-supplier/src/main/java/org/opendaylight/openflowplugin/applications/notification/supplier/impl/NodeNotificationSupplierImpl.java b/applications/notification-supplier/src/main/java/org/opendaylight/openflowplugin/applications/notification/supplier/impl/NodeNotificationSupplierImpl.java index 0c0da35c97..f86a7dc17c 100644 --- a/applications/notification-supplier/src/main/java/org/opendaylight/openflowplugin/applications/notification/supplier/impl/NodeNotificationSupplierImpl.java +++ b/applications/notification-supplier/src/main/java/org/opendaylight/openflowplugin/applications/notification/supplier/impl/NodeNotificationSupplierImpl.java @@ -20,7 +20,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRem import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeUpdated; import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeUpdatedBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node; -import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; /** @@ -55,7 +54,7 @@ public class NodeNotificationSupplierImpl extends AbstractNotificationSupplierFo Preconditions.checkArgument(ii != null); final FlowCapableNodeUpdatedBuilder flowNodeNotifBuilder = new FlowCapableNodeUpdatedBuilder(flowCapableNode); final NodeUpdatedBuilder notifBuilder = new NodeUpdatedBuilder(); - notifBuilder.setId(ii.firstKeyOf(Node.class, NodeKey.class).getId()); + notifBuilder.setId(ii.firstKeyOf(Node.class).getId()); notifBuilder.setNodeRef(new NodeRef(getNodeII(ii))); notifBuilder.addAugmentation(FlowCapableNodeUpdated.class, flowNodeNotifBuilder.build()); return notifBuilder.build(); diff --git a/applications/notification-supplier/src/main/java/org/opendaylight/openflowplugin/applications/notification/supplier/impl/item/GroupNotificationSupplierImpl.java b/applications/notification-supplier/src/main/java/org/opendaylight/openflowplugin/applications/notification/supplier/impl/item/GroupNotificationSupplierImpl.java index 877ceb1ba0..a8b05a6c00 100644 --- a/applications/notification-supplier/src/main/java/org/opendaylight/openflowplugin/applications/notification/supplier/impl/item/GroupNotificationSupplierImpl.java +++ b/applications/notification-supplier/src/main/java/org/opendaylight/openflowplugin/applications/notification/supplier/impl/item/GroupNotificationSupplierImpl.java @@ -20,7 +20,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.Gro import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.GroupUpdatedBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupRef; import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.Group; -import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.GroupKey; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; /** @@ -72,7 +71,7 @@ public class GroupNotificationSupplierImpl extends AbstractNotificationSupplierF public GroupRemoved deleteNotification(final InstanceIdentifier path) { Preconditions.checkArgument(path != null); final GroupRemovedBuilder builder = new GroupRemovedBuilder(); - builder.setGroupId(path.firstKeyOf(Group.class, GroupKey.class).getGroupId()); + builder.setGroupId(path.firstKeyOf(Group.class).getGroupId()); builder.setGroupRef(new GroupRef(path)); builder.setNode(createNodeRef(path)); return builder.build(); diff --git a/applications/notification-supplier/src/main/java/org/opendaylight/openflowplugin/applications/notification/supplier/impl/item/MeterNotificationSupplierImpl.java b/applications/notification-supplier/src/main/java/org/opendaylight/openflowplugin/applications/notification/supplier/impl/item/MeterNotificationSupplierImpl.java index 95d0333a85..51af021b08 100644 --- a/applications/notification-supplier/src/main/java/org/opendaylight/openflowplugin/applications/notification/supplier/impl/item/MeterNotificationSupplierImpl.java +++ b/applications/notification-supplier/src/main/java/org/opendaylight/openflowplugin/applications/notification/supplier/impl/item/MeterNotificationSupplierImpl.java @@ -13,7 +13,6 @@ import org.opendaylight.controller.md.sal.binding.api.DataBroker; import org.opendaylight.controller.sal.binding.api.NotificationProviderService; import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode; import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.meters.Meter; -import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.meters.MeterKey; import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.MeterAdded; import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.MeterAddedBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.MeterRemoved; @@ -72,7 +71,7 @@ public class MeterNotificationSupplierImpl extends public MeterRemoved deleteNotification(final InstanceIdentifier path) { Preconditions.checkArgument(path != null); final MeterRemovedBuilder builder = new MeterRemovedBuilder(); - builder.setMeterId(path.firstKeyOf(Meter.class, MeterKey.class).getMeterId()); + builder.setMeterId(path.firstKeyOf(Meter.class).getMeterId()); builder.setMeterRef(new MeterRef(path)); builder.setNode(createNodeRef(path)); return builder.build(); diff --git a/applications/notification-supplier/src/main/java/org/opendaylight/openflowplugin/applications/notification/supplier/impl/item/stat/FlowStatNotificationSupplierImpl.java b/applications/notification-supplier/src/main/java/org/opendaylight/openflowplugin/applications/notification/supplier/impl/item/stat/FlowStatNotificationSupplierImpl.java index 35fe61cee7..01d4f62da8 100644 --- a/applications/notification-supplier/src/main/java/org/opendaylight/openflowplugin/applications/notification/supplier/impl/item/stat/FlowStatNotificationSupplierImpl.java +++ b/applications/notification-supplier/src/main/java/org/opendaylight/openflowplugin/applications/notification/supplier/impl/item/stat/FlowStatNotificationSupplierImpl.java @@ -15,7 +15,6 @@ import org.opendaylight.controller.sal.binding.api.NotificationProviderService; import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode; import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.Table; import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow; -import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowKey; import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.FlowId; import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.FlowStatisticsData; import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.FlowsStatisticsUpdate; @@ -59,7 +58,7 @@ public class FlowStatNotificationSupplierImpl extends AbstractNotificationSuppli Preconditions.checkArgument(path != null); final FlowAndStatisticsMapListBuilder fsmlBuilder = new FlowAndStatisticsMapListBuilder(flowStatistics); - fsmlBuilder.setFlowId(new FlowId(path.firstKeyOf(Flow.class, FlowKey.class).getId().getValue())); + fsmlBuilder.setFlowId(new FlowId(path.firstKeyOf(Flow.class).getId().getValue())); final FlowsStatisticsUpdateBuilder builder = new FlowsStatisticsUpdateBuilder(); builder.setId(getNodeId(path)); diff --git a/applications/notification-supplier/src/main/java/org/opendaylight/openflowplugin/applications/notification/supplier/impl/item/stat/FlowTableStatNotificationSupplierImpl.java b/applications/notification-supplier/src/main/java/org/opendaylight/openflowplugin/applications/notification/supplier/impl/item/stat/FlowTableStatNotificationSupplierImpl.java index 755fb29ceb..971547c434 100644 --- a/applications/notification-supplier/src/main/java/org/opendaylight/openflowplugin/applications/notification/supplier/impl/item/stat/FlowTableStatNotificationSupplierImpl.java +++ b/applications/notification-supplier/src/main/java/org/opendaylight/openflowplugin/applications/notification/supplier/impl/item/stat/FlowTableStatNotificationSupplierImpl.java @@ -14,7 +14,6 @@ import org.opendaylight.controller.md.sal.binding.api.DataBroker; import org.opendaylight.controller.sal.binding.api.NotificationProviderService; import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode; import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.Table; -import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.TableKey; import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.FlowTableStatisticsData; import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.FlowTableStatisticsUpdate; import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.FlowTableStatisticsUpdateBuilder; @@ -60,7 +59,7 @@ public class FlowTableStatNotificationSupplierImpl extends final FlowTableAndStatisticsMapBuilder ftsmBuilder = new FlowTableAndStatisticsMapBuilder(flowTableStatistics); ftsmBuilder.withKey(new FlowTableAndStatisticsMapKey( - new TableId(path.firstKeyOf(Table.class, TableKey.class).getId()))); + new TableId(path.firstKeyOf(Table.class).getId()))); final FlowTableStatisticsUpdateBuilder builder = new FlowTableStatisticsUpdateBuilder(); builder.setId(getNodeId(path)); diff --git a/applications/notification-supplier/src/main/java/org/opendaylight/openflowplugin/applications/notification/supplier/impl/item/stat/NodeConnectorStatNotificationSupplierImpl.java b/applications/notification-supplier/src/main/java/org/opendaylight/openflowplugin/applications/notification/supplier/impl/item/stat/NodeConnectorStatNotificationSupplierImpl.java index c12b9b9833..f9bd34d2f8 100644 --- a/applications/notification-supplier/src/main/java/org/opendaylight/openflowplugin/applications/notification/supplier/impl/item/stat/NodeConnectorStatNotificationSupplierImpl.java +++ b/applications/notification-supplier/src/main/java/org/opendaylight/openflowplugin/applications/notification/supplier/impl/item/stat/NodeConnectorStatNotificationSupplierImpl.java @@ -57,7 +57,7 @@ public class NodeConnectorStatNotificationSupplierImpl extends Preconditions.checkArgument(path != null); final NodeConnectorBuilder ncBuilder = new NodeConnectorBuilder(); - final NodeConnectorKey ncKey = path.firstKeyOf(NodeConnector.class, NodeConnectorKey.class); + final NodeConnectorKey ncKey = path.firstKeyOf(NodeConnector.class); ncBuilder.setId(ncKey.getId()); ncBuilder.withKey(ncKey); diff --git a/applications/notification-supplier/src/main/java/org/opendaylight/openflowplugin/applications/notification/supplier/impl/item/stat/QueueStatNotificationSupplierImpl.java b/applications/notification-supplier/src/main/java/org/opendaylight/openflowplugin/applications/notification/supplier/impl/item/stat/QueueStatNotificationSupplierImpl.java index 67c27cd732..c626a0d7a1 100644 --- a/applications/notification-supplier/src/main/java/org/opendaylight/openflowplugin/applications/notification/supplier/impl/item/stat/QueueStatNotificationSupplierImpl.java +++ b/applications/notification-supplier/src/main/java/org/opendaylight/openflowplugin/applications/notification/supplier/impl/item/stat/QueueStatNotificationSupplierImpl.java @@ -59,7 +59,7 @@ public class QueueStatNotificationSupplierImpl extends Preconditions.checkArgument(path != null); final NodeConnectorBuilder connBuilder = new NodeConnectorBuilder(); - final NodeConnectorKey key = path.firstKeyOf(NodeConnector.class, NodeConnectorKey.class); + final NodeConnectorKey key = path.firstKeyOf(NodeConnector.class); connBuilder.setId(key.getId()); connBuilder.withKey(key); diff --git a/applications/notification-supplier/src/test/java/org/opendaylight/openflowplugin/applications/notification/supplier/impl/NodeConnectorNotificationSupplierImplTest.java b/applications/notification-supplier/src/test/java/org/opendaylight/openflowplugin/applications/notification/supplier/impl/NodeConnectorNotificationSupplierImplTest.java index 8995b1fa38..a75c5858c1 100644 --- a/applications/notification-supplier/src/test/java/org/opendaylight/openflowplugin/applications/notification/supplier/impl/NodeConnectorNotificationSupplierImplTest.java +++ b/applications/notification-supplier/src/test/java/org/opendaylight/openflowplugin/applications/notification/supplier/impl/NodeConnectorNotificationSupplierImplTest.java @@ -10,6 +10,7 @@ package org.opendaylight.openflowplugin.applications.notification.supplier.impl; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; @@ -18,7 +19,6 @@ import java.util.ArrayList; import java.util.Collection; import org.junit.Before; import org.junit.Test; -import org.mockito.Matchers; import org.opendaylight.controller.md.sal.binding.api.DataBroker; import org.opendaylight.controller.md.sal.binding.api.DataObjectModification; import org.opendaylight.controller.md.sal.binding.api.DataTreeModification; @@ -77,9 +77,9 @@ public class NodeConnectorNotificationSupplierImplTest { assertNotNull(notification); assertEquals(FLOW_CODE_CONNECTOR_ID, notification.getId().getValue()); assertEquals(FLOW_CODE_CONNECTOR_ID, notification.getNodeConnectorRef().getValue() - .firstKeyOf(NodeConnector.class, NodeConnectorKey.class).getId().getValue()); + .firstKeyOf(NodeConnector.class).getId().getValue()); assertEquals(FLOW_NODE_ID, - notification.getNodeConnectorRef().getValue().firstKeyOf(Node.class, NodeKey.class).getId() + notification.getNodeConnectorRef().getValue().firstKeyOf(Node.class).getId() .getValue()); } @@ -91,7 +91,7 @@ public class NodeConnectorNotificationSupplierImplTest { Collection> collection = new ArrayList<>(); collection.add(testData); notifSupplierImpl.onDataTreeChanged(collection); - verify(notifProviderService, times(1)).publish(Matchers.any(NodeConnectorUpdated.class)); + verify(notifProviderService, times(1)).publish(any(NodeConnectorUpdated.class)); } @Test(expected = IllegalArgumentException.class) @@ -110,9 +110,9 @@ public class NodeConnectorNotificationSupplierImplTest { .deleteNotification(createTestFlowCapableConnectorNodePath()); assertNotNull(notification); assertEquals(FLOW_CODE_CONNECTOR_ID, notification.getNodeConnectorRef().getValue() - .firstKeyOf(NodeConnector.class, NodeConnectorKey.class).getId().getValue()); + .firstKeyOf(NodeConnector.class).getId().getValue()); assertEquals(FLOW_NODE_ID, - notification.getNodeConnectorRef().getValue().firstKeyOf(Node.class, NodeKey.class).getId() + notification.getNodeConnectorRef().getValue().firstKeyOf(Node.class).getId() .getValue()); } @@ -124,7 +124,7 @@ public class NodeConnectorNotificationSupplierImplTest { Collection> collection = new ArrayList<>(); collection.add(testData); notifSupplierImpl.onDataTreeChanged(collection); - verify(notifProviderService, times(1)).publish(Matchers.any(NodeConnectorRemoved.class)); + verify(notifProviderService, times(1)).publish(any(NodeConnectorRemoved.class)); } @Test(expected = IllegalArgumentException.class) diff --git a/applications/notification-supplier/src/test/java/org/opendaylight/openflowplugin/applications/notification/supplier/impl/NodeNotificationSupplierImplTest.java b/applications/notification-supplier/src/test/java/org/opendaylight/openflowplugin/applications/notification/supplier/impl/NodeNotificationSupplierImplTest.java index 3a93b9cc22..1b3e2665f1 100644 --- a/applications/notification-supplier/src/test/java/org/opendaylight/openflowplugin/applications/notification/supplier/impl/NodeNotificationSupplierImplTest.java +++ b/applications/notification-supplier/src/test/java/org/opendaylight/openflowplugin/applications/notification/supplier/impl/NodeNotificationSupplierImplTest.java @@ -10,6 +10,7 @@ package org.opendaylight.openflowplugin.applications.notification.supplier.impl; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; @@ -18,7 +19,6 @@ import java.util.ArrayList; import java.util.Collection; import org.junit.Before; import org.junit.Test; -import org.mockito.Matchers; import org.opendaylight.controller.md.sal.binding.api.DataBroker; import org.opendaylight.controller.md.sal.binding.api.DataObjectModification; import org.opendaylight.controller.md.sal.binding.api.DataTreeModification; @@ -73,7 +73,7 @@ public class NodeNotificationSupplierImplTest { assertNotNull(notification); assertEquals(FLOW_NODE_ID, notification.getId().getValue()); assertEquals(FLOW_NODE_ID, - notification.getNodeRef().getValue().firstKeyOf(Node.class, NodeKey.class).getId().getValue()); + notification.getNodeRef().getValue().firstKeyOf(Node.class).getId().getValue()); } @Test @@ -83,7 +83,7 @@ public class NodeNotificationSupplierImplTest { Collection> collection = new ArrayList<>(); collection.add(testData); notifSupplierImpl.onDataTreeChanged(collection); - verify(notifProviderService, times(1)).publish(Matchers.any(NodeUpdated.class)); + verify(notifProviderService, times(1)).publish(any(NodeUpdated.class)); } @Test(expected = IllegalArgumentException.class) @@ -101,7 +101,7 @@ public class NodeNotificationSupplierImplTest { final NodeRemoved notification = notifSupplierImpl.deleteNotification(createTestFlowCapableNodePath()); assertNotNull(notification); assertEquals(FLOW_NODE_ID, - notification.getNodeRef().getValue().firstKeyOf(Node.class, NodeKey.class).getId().getValue()); + notification.getNodeRef().getValue().firstKeyOf(Node.class).getId().getValue()); } @Test @@ -111,7 +111,7 @@ public class NodeNotificationSupplierImplTest { Collection> collection = new ArrayList<>(); collection.add(testData); notifSupplierImpl.onDataTreeChanged(collection); - verify(notifProviderService, times(1)).publish(Matchers.any(NodeRemoved.class)); + verify(notifProviderService, times(1)).publish(any(NodeRemoved.class)); } @Test(expected = IllegalArgumentException.class) diff --git a/applications/notification-supplier/src/test/java/org/opendaylight/openflowplugin/applications/notification/supplier/impl/helper/TestSupplierVerifyHelper.java b/applications/notification-supplier/src/test/java/org/opendaylight/openflowplugin/applications/notification/supplier/impl/helper/TestSupplierVerifyHelper.java index adba9bf4fc..662d78d292 100644 --- a/applications/notification-supplier/src/test/java/org/opendaylight/openflowplugin/applications/notification/supplier/impl/helper/TestSupplierVerifyHelper.java +++ b/applications/notification-supplier/src/test/java/org/opendaylight/openflowplugin/applications/notification/supplier/impl/helper/TestSupplierVerifyHelper.java @@ -8,7 +8,7 @@ package org.opendaylight.openflowplugin.applications.notification.supplier.impl.helper; -import org.mockito.Matchers; +import org.mockito.ArgumentMatchers; import org.mockito.Mockito; import org.opendaylight.controller.md.sal.binding.api.DataBroker; import org.opendaylight.controller.md.sal.binding.api.DataTreeChangeListener; @@ -23,7 +23,7 @@ public final class TestSupplierVerifyHelper { public static void verifyDataTreeChangeListenerRegistration(DataBroker dataBroker) { Mockito.verify(dataBroker).registerDataTreeChangeListener( - Matchers.any(), - Matchers.any()); + ArgumentMatchers.any(), + ArgumentMatchers.any()); } } diff --git a/applications/notification-supplier/src/test/java/org/opendaylight/openflowplugin/applications/notification/supplier/impl/item/FlowNotificationSupplierImplTest.java b/applications/notification-supplier/src/test/java/org/opendaylight/openflowplugin/applications/notification/supplier/impl/item/FlowNotificationSupplierImplTest.java index 43a167d09d..103d13f200 100644 --- a/applications/notification-supplier/src/test/java/org/opendaylight/openflowplugin/applications/notification/supplier/impl/item/FlowNotificationSupplierImplTest.java +++ b/applications/notification-supplier/src/test/java/org/opendaylight/openflowplugin/applications/notification/supplier/impl/item/FlowNotificationSupplierImplTest.java @@ -10,6 +10,7 @@ package org.opendaylight.openflowplugin.applications.notification.supplier.impl. import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; @@ -18,7 +19,6 @@ import java.util.ArrayList; import java.util.Collection; import org.junit.Before; import org.junit.Test; -import org.mockito.Matchers; import org.opendaylight.controller.md.sal.binding.api.DataBroker; import org.opendaylight.controller.md.sal.binding.api.DataObjectModification; import org.opendaylight.controller.md.sal.binding.api.DataTreeModification; @@ -85,11 +85,11 @@ public class FlowNotificationSupplierImplTest { final FlowAdded notification = notifSupplierImpl.createNotification(createTestFlow(), createTestFlowPath()); assertNotNull(notification); assertEquals(FLOW_ID, - notification.getFlowRef().getValue().firstKeyOf(Flow.class, FlowKey.class).getId().getValue()); + notification.getFlowRef().getValue().firstKeyOf(Flow.class).getId().getValue()); assertEquals(FLOW_TABLE_ID, - notification.getFlowRef().getValue().firstKeyOf(Table.class, TableKey.class).getId()); + notification.getFlowRef().getValue().firstKeyOf(Table.class).getId()); assertEquals(FLOW_NODE_ID, - notification.getNode().getValue().firstKeyOf(Node.class, NodeKey.class).getId().getValue()); + notification.getNode().getValue().firstKeyOf(Node.class).getId().getValue()); } @Test @@ -99,7 +99,7 @@ public class FlowNotificationSupplierImplTest { Collection> collection = new ArrayList<>(); collection.add(testData); notifSupplierImpl.onDataTreeChanged(collection); - verify(notifProviderService, times(1)).publish(Matchers.any(FlowAdded.class)); + verify(notifProviderService, times(1)).publish(any(FlowAdded.class)); } @Test(expected = IllegalArgumentException.class) @@ -117,11 +117,11 @@ public class FlowNotificationSupplierImplTest { final FlowUpdated notification = notifSupplierImpl.updateNotification(createTestFlow(), createTestFlowPath()); assertNotNull(notification); assertEquals(FLOW_ID, - notification.getFlowRef().getValue().firstKeyOf(Flow.class, FlowKey.class).getId().getValue()); + notification.getFlowRef().getValue().firstKeyOf(Flow.class).getId().getValue()); assertEquals(FLOW_TABLE_ID, - notification.getFlowRef().getValue().firstKeyOf(Table.class, TableKey.class).getId()); + notification.getFlowRef().getValue().firstKeyOf(Table.class).getId()); assertEquals(FLOW_NODE_ID, - notification.getNode().getValue().firstKeyOf(Node.class, NodeKey.class).getId().getValue()); + notification.getNode().getValue().firstKeyOf(Node.class).getId().getValue()); } @Test @@ -131,7 +131,7 @@ public class FlowNotificationSupplierImplTest { Collection> collection = new ArrayList<>(); collection.add(testData); notifSupplierImpl.onDataTreeChanged(collection); - verify(notifProviderService, times(1)).publish(Matchers.any(FlowUpdated.class)); + verify(notifProviderService, times(1)).publish(any(FlowUpdated.class)); } @Test(expected = IllegalArgumentException.class) @@ -149,11 +149,11 @@ public class FlowNotificationSupplierImplTest { final FlowRemoved notification = notifSupplierImpl.deleteNotification(createTestFlowPath()); assertNotNull(notification); assertEquals(FLOW_ID, - notification.getFlowRef().getValue().firstKeyOf(Flow.class, FlowKey.class).getId().getValue()); + notification.getFlowRef().getValue().firstKeyOf(Flow.class).getId().getValue()); assertEquals(FLOW_TABLE_ID, - notification.getFlowRef().getValue().firstKeyOf(Table.class, TableKey.class).getId()); + notification.getFlowRef().getValue().firstKeyOf(Table.class).getId()); assertEquals(FLOW_NODE_ID, - notification.getNode().getValue().firstKeyOf(Node.class, NodeKey.class).getId().getValue()); + notification.getNode().getValue().firstKeyOf(Node.class).getId().getValue()); } @Test @@ -163,7 +163,7 @@ public class FlowNotificationSupplierImplTest { Collection> collection = new ArrayList<>(); collection.add(testData); notifSupplierImpl.onDataTreeChanged(collection); - verify(notifProviderService, times(1)).publish(Matchers.any(FlowRemoved.class)); + verify(notifProviderService, times(1)).publish(any(FlowRemoved.class)); } @Test(expected = IllegalArgumentException.class) diff --git a/applications/notification-supplier/src/test/java/org/opendaylight/openflowplugin/applications/notification/supplier/impl/item/GroupNotificationSupplierImplTest.java b/applications/notification-supplier/src/test/java/org/opendaylight/openflowplugin/applications/notification/supplier/impl/item/GroupNotificationSupplierImplTest.java index ce54af8f7f..bef02498ed 100644 --- a/applications/notification-supplier/src/test/java/org/opendaylight/openflowplugin/applications/notification/supplier/impl/item/GroupNotificationSupplierImplTest.java +++ b/applications/notification-supplier/src/test/java/org/opendaylight/openflowplugin/applications/notification/supplier/impl/item/GroupNotificationSupplierImplTest.java @@ -10,6 +10,7 @@ package org.opendaylight.openflowplugin.applications.notification.supplier.impl. import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; @@ -18,7 +19,6 @@ import java.util.ArrayList; import java.util.Collection; import org.junit.Before; import org.junit.Test; -import org.mockito.Matchers; import org.opendaylight.controller.md.sal.binding.api.DataBroker; import org.opendaylight.controller.md.sal.binding.api.DataObjectModification; import org.opendaylight.controller.md.sal.binding.api.DataTreeModification; @@ -82,10 +82,10 @@ public class GroupNotificationSupplierImplTest { assertNotNull(notification); assertEquals(GROUP_ID, notification.getGroupId().getValue()); assertEquals(GROUP_ID, - notification.getGroupRef().getValue().firstKeyOf(Group.class, GroupKey.class).getGroupId() + notification.getGroupRef().getValue().firstKeyOf(Group.class).getGroupId() .getValue()); assertEquals(FLOW_NODE_ID, - notification.getNode().getValue().firstKeyOf(Node.class, NodeKey.class).getId().getValue()); + notification.getNode().getValue().firstKeyOf(Node.class).getId().getValue()); } @Test @@ -95,7 +95,7 @@ public class GroupNotificationSupplierImplTest { Collection> collection = new ArrayList<>(); collection.add(testData); notifSupplierImpl.onDataTreeChanged(collection); - verify(notifProviderService, times(1)).publish(Matchers.any(GroupAdded.class)); + verify(notifProviderService, times(1)).publish(any(GroupAdded.class)); } @Test(expected = IllegalArgumentException.class) @@ -115,10 +115,10 @@ public class GroupNotificationSupplierImplTest { assertNotNull(notification); assertEquals(GROUP_ID, notification.getGroupId().getValue()); assertEquals(GROUP_ID, - notification.getGroupRef().getValue().firstKeyOf(Group.class, GroupKey.class).getGroupId() + notification.getGroupRef().getValue().firstKeyOf(Group.class).getGroupId() .getValue()); assertEquals(FLOW_NODE_ID, - notification.getNode().getValue().firstKeyOf(Node.class, NodeKey.class).getId().getValue()); + notification.getNode().getValue().firstKeyOf(Node.class).getId().getValue()); } @Test @@ -128,7 +128,7 @@ public class GroupNotificationSupplierImplTest { Collection> collection = new ArrayList<>(); collection.add(testData); notifSupplierImpl.onDataTreeChanged(collection); - verify(notifProviderService, times(1)).publish(Matchers.any(GroupUpdated.class)); + verify(notifProviderService, times(1)).publish(any(GroupUpdated.class)); } @Test(expected = IllegalArgumentException.class) @@ -147,10 +147,10 @@ public class GroupNotificationSupplierImplTest { assertNotNull(notification); assertEquals(GROUP_ID, notification.getGroupId().getValue()); assertEquals(GROUP_ID, - notification.getGroupRef().getValue().firstKeyOf(Group.class, GroupKey.class).getGroupId() + notification.getGroupRef().getValue().firstKeyOf(Group.class).getGroupId() .getValue()); assertEquals(FLOW_NODE_ID, - notification.getNode().getValue().firstKeyOf(Node.class, NodeKey.class).getId().getValue()); + notification.getNode().getValue().firstKeyOf(Node.class).getId().getValue()); } @Test @@ -160,7 +160,7 @@ public class GroupNotificationSupplierImplTest { Collection> collection = new ArrayList<>(); collection.add(testData); notifSupplierImpl.onDataTreeChanged(collection); - verify(notifProviderService, times(1)).publish(Matchers.any(GroupRemoved.class)); + verify(notifProviderService, times(1)).publish(any(GroupRemoved.class)); } @Test(expected = IllegalArgumentException.class) diff --git a/applications/notification-supplier/src/test/java/org/opendaylight/openflowplugin/applications/notification/supplier/impl/item/MeterNotificationSupplierImplTest.java b/applications/notification-supplier/src/test/java/org/opendaylight/openflowplugin/applications/notification/supplier/impl/item/MeterNotificationSupplierImplTest.java index 3ca4e09d6e..c5bdd1a41d 100644 --- a/applications/notification-supplier/src/test/java/org/opendaylight/openflowplugin/applications/notification/supplier/impl/item/MeterNotificationSupplierImplTest.java +++ b/applications/notification-supplier/src/test/java/org/opendaylight/openflowplugin/applications/notification/supplier/impl/item/MeterNotificationSupplierImplTest.java @@ -10,6 +10,7 @@ package org.opendaylight.openflowplugin.applications.notification.supplier.impl. import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; @@ -18,7 +19,6 @@ import java.util.ArrayList; import java.util.Collection; import org.junit.Before; import org.junit.Test; -import org.mockito.Matchers; import org.opendaylight.controller.md.sal.binding.api.DataBroker; import org.opendaylight.controller.md.sal.binding.api.DataObjectModification; import org.opendaylight.controller.md.sal.binding.api.DataTreeModification; @@ -83,10 +83,10 @@ public class MeterNotificationSupplierImplTest { assertNotNull(notification); assertEquals(METER_ID, notification.getMeterId().getValue()); assertEquals(METER_ID, - notification.getMeterRef().getValue().firstKeyOf(Meter.class, MeterKey.class).getMeterId() + notification.getMeterRef().getValue().firstKeyOf(Meter.class).getMeterId() .getValue()); assertEquals(FLOW_NODE_ID, - notification.getNode().getValue().firstKeyOf(Node.class, NodeKey.class).getId().getValue()); + notification.getNode().getValue().firstKeyOf(Node.class).getId().getValue()); } @Test @@ -96,7 +96,7 @@ public class MeterNotificationSupplierImplTest { Collection> collection = new ArrayList<>(); collection.add(testData); notifSupplierImpl.onDataTreeChanged(collection); - verify(notifProviderService, times(1)).publish(Matchers.any(MeterAdded.class)); + verify(notifProviderService, times(1)).publish(any(MeterAdded.class)); } @Test(expected = IllegalArgumentException.class) @@ -116,10 +116,10 @@ public class MeterNotificationSupplierImplTest { assertNotNull(notification); assertEquals(METER_ID, notification.getMeterId().getValue()); assertEquals(METER_ID, - notification.getMeterRef().getValue().firstKeyOf(Meter.class, MeterKey.class).getMeterId() + notification.getMeterRef().getValue().firstKeyOf(Meter.class).getMeterId() .getValue()); assertEquals(FLOW_NODE_ID, - notification.getNode().getValue().firstKeyOf(Node.class, NodeKey.class).getId().getValue()); + notification.getNode().getValue().firstKeyOf(Node.class).getId().getValue()); } @Test @@ -129,7 +129,7 @@ public class MeterNotificationSupplierImplTest { Collection> collection = new ArrayList<>(); collection.add(testData); notifSupplierImpl.onDataTreeChanged(collection); - verify(notifProviderService, times(1)).publish(Matchers.any(MeterUpdated.class)); + verify(notifProviderService, times(1)).publish(any(MeterUpdated.class)); } @Test(expected = IllegalArgumentException.class) @@ -148,10 +148,10 @@ public class MeterNotificationSupplierImplTest { assertNotNull(notification); assertEquals(METER_ID, notification.getMeterId().getValue()); assertEquals(METER_ID, - notification.getMeterRef().getValue().firstKeyOf(Meter.class, MeterKey.class).getMeterId() + notification.getMeterRef().getValue().firstKeyOf(Meter.class).getMeterId() .getValue()); assertEquals(FLOW_NODE_ID, - notification.getNode().getValue().firstKeyOf(Node.class, NodeKey.class).getId().getValue()); + notification.getNode().getValue().firstKeyOf(Node.class).getId().getValue()); } @Test @@ -161,7 +161,7 @@ public class MeterNotificationSupplierImplTest { Collection> collection = new ArrayList<>(); collection.add(testData); notifSupplierImpl.onDataTreeChanged(collection); - verify(notifProviderService, times(1)).publish(Matchers.any(MeterRemoved.class)); + verify(notifProviderService, times(1)).publish(any(MeterRemoved.class)); } @Test(expected = IllegalArgumentException.class) diff --git a/applications/notification-supplier/src/test/java/org/opendaylight/openflowplugin/applications/notification/supplier/impl/item/stat/FlowStatNotificationSupplierImplTest.java b/applications/notification-supplier/src/test/java/org/opendaylight/openflowplugin/applications/notification/supplier/impl/item/stat/FlowStatNotificationSupplierImplTest.java index c737426c1d..02deebd592 100644 --- a/applications/notification-supplier/src/test/java/org/opendaylight/openflowplugin/applications/notification/supplier/impl/item/stat/FlowStatNotificationSupplierImplTest.java +++ b/applications/notification-supplier/src/test/java/org/opendaylight/openflowplugin/applications/notification/supplier/impl/item/stat/FlowStatNotificationSupplierImplTest.java @@ -10,6 +10,7 @@ package org.opendaylight.openflowplugin.applications.notification.supplier.impl. import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; @@ -18,7 +19,6 @@ import java.util.ArrayList; import java.util.Collection; import org.junit.Before; import org.junit.Test; -import org.mockito.Matchers; import org.opendaylight.controller.md.sal.binding.api.DataBroker; import org.opendaylight.controller.md.sal.binding.api.DataObjectModification; import org.opendaylight.controller.md.sal.binding.api.DataTreeModification; @@ -89,7 +89,7 @@ public class FlowStatNotificationSupplierImplTest { Collection> collection = new ArrayList<>(); collection.add(testData); notifSupplierImpl.onDataTreeChanged(collection); - verify(notifProviderService, times(1)).publish(Matchers.any(FlowsStatisticsUpdate.class)); + verify(notifProviderService, times(1)).publish(any(FlowsStatisticsUpdate.class)); } @Test(expected = IllegalArgumentException.class) diff --git a/applications/notification-supplier/src/test/java/org/opendaylight/openflowplugin/applications/notification/supplier/impl/item/stat/FlowTableStatNotificationSupplierImplTest.java b/applications/notification-supplier/src/test/java/org/opendaylight/openflowplugin/applications/notification/supplier/impl/item/stat/FlowTableStatNotificationSupplierImplTest.java index d3c836867c..30871057ff 100644 --- a/applications/notification-supplier/src/test/java/org/opendaylight/openflowplugin/applications/notification/supplier/impl/item/stat/FlowTableStatNotificationSupplierImplTest.java +++ b/applications/notification-supplier/src/test/java/org/opendaylight/openflowplugin/applications/notification/supplier/impl/item/stat/FlowTableStatNotificationSupplierImplTest.java @@ -10,6 +10,7 @@ package org.opendaylight.openflowplugin.applications.notification.supplier.impl. import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; @@ -18,7 +19,6 @@ import java.util.ArrayList; import java.util.Collection; import org.junit.Before; import org.junit.Test; -import org.mockito.Matchers; import org.opendaylight.controller.md.sal.binding.api.DataBroker; import org.opendaylight.controller.md.sal.binding.api.DataObjectModification; import org.opendaylight.controller.md.sal.binding.api.DataTreeModification; @@ -86,7 +86,7 @@ public class FlowTableStatNotificationSupplierImplTest { Collection> collection = new ArrayList<>(); collection.add(testData); notifSupplierImpl.onDataTreeChanged(collection); - verify(notifProviderService, times(1)).publish(Matchers.any(FlowTableStatisticsUpdate.class)); + verify(notifProviderService, times(1)).publish(any(FlowTableStatisticsUpdate.class)); } @Test(expected = IllegalArgumentException.class) diff --git a/applications/notification-supplier/src/test/java/org/opendaylight/openflowplugin/applications/notification/supplier/impl/item/stat/GroupStatNotificationSupplierImplTest.java b/applications/notification-supplier/src/test/java/org/opendaylight/openflowplugin/applications/notification/supplier/impl/item/stat/GroupStatNotificationSupplierImplTest.java index 2b0e9b3787..aeafe292ee 100644 --- a/applications/notification-supplier/src/test/java/org/opendaylight/openflowplugin/applications/notification/supplier/impl/item/stat/GroupStatNotificationSupplierImplTest.java +++ b/applications/notification-supplier/src/test/java/org/opendaylight/openflowplugin/applications/notification/supplier/impl/item/stat/GroupStatNotificationSupplierImplTest.java @@ -10,6 +10,7 @@ package org.opendaylight.openflowplugin.applications.notification.supplier.impl. import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; @@ -18,7 +19,6 @@ import java.util.ArrayList; import java.util.Collection; import org.junit.Before; import org.junit.Test; -import org.mockito.Matchers; import org.opendaylight.controller.md.sal.binding.api.DataBroker; import org.opendaylight.controller.md.sal.binding.api.DataObjectModification; import org.opendaylight.controller.md.sal.binding.api.DataTreeModification; @@ -86,7 +86,7 @@ public class GroupStatNotificationSupplierImplTest { Collection> collection = new ArrayList<>(); collection.add(testData); notifSupplierImpl.onDataTreeChanged(collection); - verify(notifProviderService, times(1)).publish(Matchers.any(GroupStatisticsUpdated.class)); + verify(notifProviderService, times(1)).publish(any(GroupStatisticsUpdated.class)); } @Test(expected = IllegalArgumentException.class) diff --git a/applications/notification-supplier/src/test/java/org/opendaylight/openflowplugin/applications/notification/supplier/impl/item/stat/MeterStatNotificationSupplierImplTest.java b/applications/notification-supplier/src/test/java/org/opendaylight/openflowplugin/applications/notification/supplier/impl/item/stat/MeterStatNotificationSupplierImplTest.java index ad86ad455c..6d6ea50751 100644 --- a/applications/notification-supplier/src/test/java/org/opendaylight/openflowplugin/applications/notification/supplier/impl/item/stat/MeterStatNotificationSupplierImplTest.java +++ b/applications/notification-supplier/src/test/java/org/opendaylight/openflowplugin/applications/notification/supplier/impl/item/stat/MeterStatNotificationSupplierImplTest.java @@ -10,6 +10,7 @@ package org.opendaylight.openflowplugin.applications.notification.supplier.impl. import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; @@ -18,7 +19,6 @@ import java.util.ArrayList; import java.util.Collection; import org.junit.Before; import org.junit.Test; -import org.mockito.Matchers; import org.opendaylight.controller.md.sal.binding.api.DataBroker; import org.opendaylight.controller.md.sal.binding.api.DataObjectModification; import org.opendaylight.controller.md.sal.binding.api.DataTreeModification; @@ -86,7 +86,7 @@ public class MeterStatNotificationSupplierImplTest { Collection> collection = new ArrayList<>(); collection.add(testData); notifSupplierImpl.onDataTreeChanged(collection); - verify(notifProviderService, times(1)).publish(Matchers.any(MeterStatisticsUpdated.class)); + verify(notifProviderService, times(1)).publish(any(MeterStatisticsUpdated.class)); } @Test(expected = IllegalArgumentException.class) diff --git a/applications/notification-supplier/src/test/java/org/opendaylight/openflowplugin/applications/notification/supplier/impl/item/stat/NodeConnectorStatNotificationSupplierImplTest.java b/applications/notification-supplier/src/test/java/org/opendaylight/openflowplugin/applications/notification/supplier/impl/item/stat/NodeConnectorStatNotificationSupplierImplTest.java index 59ecad7abd..cd765c4f51 100644 --- a/applications/notification-supplier/src/test/java/org/opendaylight/openflowplugin/applications/notification/supplier/impl/item/stat/NodeConnectorStatNotificationSupplierImplTest.java +++ b/applications/notification-supplier/src/test/java/org/opendaylight/openflowplugin/applications/notification/supplier/impl/item/stat/NodeConnectorStatNotificationSupplierImplTest.java @@ -10,6 +10,7 @@ package org.opendaylight.openflowplugin.applications.notification.supplier.impl. import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; @@ -18,7 +19,6 @@ import java.util.ArrayList; import java.util.Collection; import org.junit.Before; import org.junit.Test; -import org.mockito.Matchers; import org.opendaylight.controller.md.sal.binding.api.DataBroker; import org.opendaylight.controller.md.sal.binding.api.DataObjectModification; import org.opendaylight.controller.md.sal.binding.api.DataTreeModification; @@ -86,7 +86,7 @@ public class NodeConnectorStatNotificationSupplierImplTest { Collection> collection = new ArrayList<>(); collection.add(testData); notifSupplierImpl.onDataTreeChanged(collection); - verify(notifProviderService, times(1)).publish(Matchers.any(NodeConnectorStatisticsUpdate.class)); + verify(notifProviderService, times(1)).publish(any(NodeConnectorStatisticsUpdate.class)); } @Test(expected = IllegalArgumentException.class) diff --git a/applications/notification-supplier/src/test/java/org/opendaylight/openflowplugin/applications/notification/supplier/impl/item/stat/QueueStatNotificationSupplierImplTest.java b/applications/notification-supplier/src/test/java/org/opendaylight/openflowplugin/applications/notification/supplier/impl/item/stat/QueueStatNotificationSupplierImplTest.java index a28ae1a8a3..6604b31c57 100644 --- a/applications/notification-supplier/src/test/java/org/opendaylight/openflowplugin/applications/notification/supplier/impl/item/stat/QueueStatNotificationSupplierImplTest.java +++ b/applications/notification-supplier/src/test/java/org/opendaylight/openflowplugin/applications/notification/supplier/impl/item/stat/QueueStatNotificationSupplierImplTest.java @@ -10,6 +10,7 @@ package org.opendaylight.openflowplugin.applications.notification.supplier.impl. import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; @@ -18,7 +19,6 @@ import java.util.ArrayList; import java.util.Collection; import org.junit.Before; import org.junit.Test; -import org.mockito.Matchers; import org.opendaylight.controller.md.sal.binding.api.DataBroker; import org.opendaylight.controller.md.sal.binding.api.DataObjectModification; import org.opendaylight.controller.md.sal.binding.api.DataTreeModification; @@ -88,7 +88,7 @@ public class QueueStatNotificationSupplierImplTest { Collection> collection = new ArrayList<>(); collection.add(testData); notifSupplierImpl.onDataTreeChanged(collection); - verify(notifProviderService, times(1)).publish(Matchers.any(QueueStatisticsUpdate.class)); + verify(notifProviderService, times(1)).publish(any(QueueStatisticsUpdate.class)); } @Test(expected = IllegalArgumentException.class) diff --git a/applications/of-switch-config-pusher/pom.xml b/applications/of-switch-config-pusher/pom.xml index 86eb8d5202..73caa58f5c 100644 --- a/applications/of-switch-config-pusher/pom.xml +++ b/applications/of-switch-config-pusher/pom.xml @@ -1,7 +1,5 @@ - + 4.0.0 org.opendaylight.openflowplugin diff --git a/applications/of-switch-config-pusher/src/main/java/org/opendaylight/openflowplugin/openflow/ofswitch/config/DefaultConfigPusher.java b/applications/of-switch-config-pusher/src/main/java/org/opendaylight/openflowplugin/openflow/ofswitch/config/DefaultConfigPusher.java index 08331f135a..6a2bfe8964 100644 --- a/applications/of-switch-config-pusher/src/main/java/org/opendaylight/openflowplugin/openflow/ofswitch/config/DefaultConfigPusher.java +++ b/applications/of-switch-config-pusher/src/main/java/org/opendaylight/openflowplugin/openflow/ofswitch/config/DefaultConfigPusher.java @@ -26,7 +26,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.Fl import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef; import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes; import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node; -import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey; import org.opendaylight.yang.gen.v1.urn.opendaylight.module.config.rev141015.NodeConfigService; import org.opendaylight.yang.gen.v1.urn.opendaylight.module.config.rev141015.SetConfigInputBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.module.config.rev141015.SetConfigOutput; @@ -83,7 +82,7 @@ public class DefaultConfigPusher implements AutoCloseable, ClusteredDataTreeChan for (DataTreeModification modification : modifications) { if (modification.getRootNode().getModificationType() == ModificationType.WRITE) { String nodeId = modification.getRootPath().getRootIdentifier() - .firstKeyOf(Node.class, NodeKey.class).getId().getValue(); + .firstKeyOf(Node.class).getId().getValue(); if (deviceOwnershipService.isEntityOwned(nodeId)) { SetConfigInputBuilder setConfigInputBuilder = new SetConfigInputBuilder(); setConfigInputBuilder.setFlag(SwitchConfigFlag.FRAGNORMAL.toString()); diff --git a/applications/of-switch-config-pusher/src/test/java/org/opendaylight/openflowplugin/openflow/ofswitch/config/DefaultConfigPusherTest.java b/applications/of-switch-config-pusher/src/test/java/org/opendaylight/openflowplugin/openflow/ofswitch/config/DefaultConfigPusherTest.java index 8b746ed353..48958ec855 100644 --- a/applications/of-switch-config-pusher/src/test/java/org/opendaylight/openflowplugin/openflow/ofswitch/config/DefaultConfigPusherTest.java +++ b/applications/of-switch-config-pusher/src/test/java/org/opendaylight/openflowplugin/openflow/ofswitch/config/DefaultConfigPusherTest.java @@ -8,7 +8,7 @@ package org.opendaylight.openflowplugin.openflow.ofswitch.config; -import static org.mockito.Matchers.any; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.when; diff --git a/applications/reconciliation-framework/pom.xml b/applications/reconciliation-framework/pom.xml index 396f967037..9de2f9efdc 100644 --- a/applications/reconciliation-framework/pom.xml +++ b/applications/reconciliation-framework/pom.xml @@ -1,6 +1,5 @@ - + 4.0.0 org.opendaylight.openflowplugin diff --git a/applications/southbound-cli/pom.xml b/applications/southbound-cli/pom.xml index a531a35c59..fd2d3fb670 100644 --- a/applications/southbound-cli/pom.xml +++ b/applications/southbound-cli/pom.xml @@ -1,6 +1,5 @@ - + 4.0.0 org.opendaylight.openflowplugin diff --git a/applications/southbound-cli/src/main/java/org/opendaylight/openflowplugin/applications/southboundcli/ReconciliationServiceImpl.java b/applications/southbound-cli/src/main/java/org/opendaylight/openflowplugin/applications/southboundcli/ReconciliationServiceImpl.java index cab6b27b8c..dbd01f196e 100644 --- a/applications/southbound-cli/src/main/java/org/opendaylight/openflowplugin/applications/southboundcli/ReconciliationServiceImpl.java +++ b/applications/southbound-cli/src/main/java/org/opendaylight/openflowplugin/applications/southboundcli/ReconciliationServiceImpl.java @@ -155,7 +155,7 @@ public class ReconciliationServiceImpl implements ReconciliationService, AutoClo private ListenableFuture> buildErrorResponse(String msg) { SettableFuture> result = SettableFuture.create(); - LOG.error(msg); + LOG.error("Error {}", msg); RpcError error = RpcResultBuilder.newError(RpcError.ErrorType.PROTOCOL, "reconcile", msg); result.set(RpcResultBuilder.failed().withRpcError(error).build()); return result; diff --git a/applications/southbound-cli/src/main/java/org/opendaylight/openflowplugin/applications/southboundcli/util/ShellUtil.java b/applications/southbound-cli/src/main/java/org/opendaylight/openflowplugin/applications/southboundcli/util/ShellUtil.java index bce3846293..f3dc9cada8 100644 --- a/applications/southbound-cli/src/main/java/org/opendaylight/openflowplugin/applications/southboundcli/util/ShellUtil.java +++ b/applications/southbound-cli/src/main/java/org/opendaylight/openflowplugin/applications/southboundcli/util/ShellUtil.java @@ -110,7 +110,7 @@ public final class ShellUtil { if (flowCapableNode != null) { name = node.augmentation(FlowCapableNode.class).getDescription(); } else { - LOG.error("Error while converting OFNode:{} to FlowCapableNode: {}", node.getId()); + LOG.error("Error while converting OFNode:{} to FlowCapableNode", node.getId()); return null; } nodeConnectors = node.getNodeConnector(); @@ -118,7 +118,7 @@ public final class ShellUtil { FlowCapableNodeConnector flowCapableNodeConnector = nodeConnector.augmentation(FlowCapableNodeConnector.class); if (flowCapableNodeConnector == null) { - LOG.error("Error for OFNode:{} while reading nodeConnectors {}", node.getId()); + LOG.error("Error for OFNode:{} while reading nodeConnectors", node.getId()); return null; } else { String portName = flowCapableNodeConnector.getName(); @@ -127,11 +127,11 @@ public final class ShellUtil { } ofNode = new OFNode(nodeId, name, portList); } else { - LOG.error("OFNode with nodeId {} not present Inventory DS: {}", nodeId); + LOG.error("OFNode with nodeId {} not present Inventory DS", nodeId); return null; } } catch (ExecutionException | InterruptedException e) { - LOG.error("Error reading node {} from Inventory DS: {}", nodeId, e); + LOG.error("Error reading node {} from Inventory DS", nodeId, e); } return ofNode; } diff --git a/applications/table-miss-enforcer/pom.xml b/applications/table-miss-enforcer/pom.xml index 8d11717481..db30b753eb 100644 --- a/applications/table-miss-enforcer/pom.xml +++ b/applications/table-miss-enforcer/pom.xml @@ -1,6 +1,5 @@ - + 4.0.0 org.opendaylight.openflowplugin diff --git a/applications/table-miss-enforcer/src/main/java/org/opendaylight/openflowplugin/applications/tablemissenforcer/LLDPPacketPuntEnforcer.java b/applications/table-miss-enforcer/src/main/java/org/opendaylight/openflowplugin/applications/tablemissenforcer/LLDPPacketPuntEnforcer.java index 74e264a104..4ff687b063 100644 --- a/applications/table-miss-enforcer/src/main/java/org/opendaylight/openflowplugin/applications/tablemissenforcer/LLDPPacketPuntEnforcer.java +++ b/applications/table-miss-enforcer/src/main/java/org/opendaylight/openflowplugin/applications/tablemissenforcer/LLDPPacketPuntEnforcer.java @@ -52,7 +52,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instru import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef; import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes; import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node; -import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey; import org.opendaylight.yangtools.concepts.ListenerRegistration; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.opendaylight.yangtools.yang.common.RpcResult; @@ -106,7 +105,7 @@ public class LLDPPacketPuntEnforcer implements AutoCloseable, ClusteredDataTreeC for (DataTreeModification modification : modifications) { if (modification.getRootNode().getModificationType() == ModificationType.WRITE) { String nodeId = modification.getRootPath().getRootIdentifier() - .firstKeyOf(Node.class, NodeKey.class).getId().getValue(); + .firstKeyOf(Node.class).getId().getValue(); if (deviceOwnershipService.isEntityOwned(nodeId)) { AddFlowInputBuilder addFlowInput = new AddFlowInputBuilder(createFlow()); addFlowInput.setNode(new NodeRef(modification.getRootPath() diff --git a/applications/table-miss-enforcer/src/test/java/org/opendaylight/openflowplugin/applications/tablemissenforcer/LLDPDataTreeChangeListenerTest.java b/applications/table-miss-enforcer/src/test/java/org/opendaylight/openflowplugin/applications/tablemissenforcer/LLDPDataTreeChangeListenerTest.java index aba225f8af..3ba16ab8c5 100644 --- a/applications/table-miss-enforcer/src/test/java/org/opendaylight/openflowplugin/applications/tablemissenforcer/LLDPDataTreeChangeListenerTest.java +++ b/applications/table-miss-enforcer/src/test/java/org/opendaylight/openflowplugin/applications/tablemissenforcer/LLDPDataTreeChangeListenerTest.java @@ -10,7 +10,7 @@ package org.opendaylight.openflowplugin.applications.tablemissenforcer; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; -import static org.mockito.Matchers.any; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.when; diff --git a/applications/topology-lldp-discovery/src/main/java/org/opendaylight/openflowplugin/applications/topology/lldp/utils/LLDPDiscoveryUtils.java b/applications/topology-lldp-discovery/src/main/java/org/opendaylight/openflowplugin/applications/topology/lldp/utils/LLDPDiscoveryUtils.java index 39288e64ba..485926a9da 100644 --- a/applications/topology-lldp-discovery/src/main/java/org/opendaylight/openflowplugin/applications/topology/lldp/utils/LLDPDiscoveryUtils.java +++ b/applications/topology-lldp-discovery/src/main/java/org/opendaylight/openflowplugin/applications/topology/lldp/utils/LLDPDiscoveryUtils.java @@ -7,7 +7,6 @@ */ package org.opendaylight.openflowplugin.applications.topology.lldp.utils; -import com.google.common.base.Optional; import com.google.common.base.Preconditions; import com.google.common.hash.HashCode; import com.google.common.hash.HashFunction; @@ -20,6 +19,8 @@ import java.nio.charset.StandardCharsets; import java.security.NoSuchAlgorithmException; import java.util.Arrays; import java.util.Objects; +import java.util.Optional; + import org.apache.commons.lang3.ArrayUtils; import org.opendaylight.mdsal.eos.binding.api.Entity; import org.opendaylight.mdsal.eos.binding.api.EntityOwnershipService; diff --git a/applications/topology-lldp-discovery/src/test/java/org/opendaylight/openflowplugin/applications/topology/lldp/LLDPLinkAgerTest.java b/applications/topology-lldp-discovery/src/test/java/org/opendaylight/openflowplugin/applications/topology/lldp/LLDPLinkAgerTest.java index 2645cefde9..5b91031d29 100644 --- a/applications/topology-lldp-discovery/src/test/java/org/opendaylight/openflowplugin/applications/topology/lldp/LLDPLinkAgerTest.java +++ b/applications/topology-lldp-discovery/src/test/java/org/opendaylight/openflowplugin/applications/topology/lldp/LLDPLinkAgerTest.java @@ -10,13 +10,14 @@ package org.opendaylight.openflowplugin.applications.topology.lldp; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.verify; -import com.google.common.base.Optional; +import java.util.Optional; + import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.Matchers; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.runners.MockitoJUnitRunner; @@ -71,7 +72,7 @@ public class LLDPLinkAgerTest { lldpLinkAger = new LLDPLinkAger(getConfig(), notificationService, getConfigurationService(), eos); Mockito.when(link.getDestination()).thenReturn(new NodeConnectorRef( InstanceIdentifier.create(Nodes.class).child(Node.class, new NodeKey(new NodeId("openflow:1"))))); - Mockito.when(eos.getOwnershipState(Mockito.any(Entity.class))).thenReturn( + Mockito.when(eos.getOwnershipState(any(Entity.class))).thenReturn( Optional.of(EntityOwnershipState.IS_OWNER)); } @@ -95,7 +96,7 @@ public class LLDPLinkAgerTest { public void testLLDPAgingTask() throws InterruptedException { lldpLinkAger.put(link); Thread.sleep(SLEEP); - verify(notificationService).publish(Matchers.any(LinkRemoved.class)); + verify(notificationService).publish(any(LinkRemoved.class)); } private TopologyLldpDiscoveryConfig getConfig() { @@ -109,13 +110,13 @@ public class LLDPLinkAgerTest { final ConfigurationService configurationService = Mockito.mock(ConfigurationService.class); final TopologyLldpDiscoveryConfig config = getConfig(); - Mockito.when(configurationService.registerListener(Mockito.any())).thenReturn(() -> { + Mockito.when(configurationService.registerListener(any())).thenReturn(() -> { }); - Mockito.when(configurationService.getProperty(Mockito.eq("topology-lldp-interval"), Mockito.any())) + Mockito.lenient().when(configurationService.getProperty(Mockito.eq("topology-lldp-interval"), any())) .thenReturn(config.getTopologyLldpInterval()); - Mockito.when(configurationService.getProperty(Mockito.eq("topology-lldp-expiration-interval"), Mockito.any())) + Mockito.lenient().when(configurationService.getProperty(Mockito.eq("topology-lldp-expiration-interval"), any())) .thenReturn(config.getTopologyLldpExpirationInterval()); return configurationService; diff --git a/applications/topology-lldp-discovery/src/test/java/org/opendaylight/openflowplugin/applications/topology/lldp/utils/LLDPDiscoveryUtilsTest.java b/applications/topology-lldp-discovery/src/test/java/org/opendaylight/openflowplugin/applications/topology/lldp/utils/LLDPDiscoveryUtilsTest.java index 8b99250f4d..3ee30561bc 100644 --- a/applications/topology-lldp-discovery/src/test/java/org/opendaylight/openflowplugin/applications/topology/lldp/utils/LLDPDiscoveryUtilsTest.java +++ b/applications/topology-lldp-discovery/src/test/java/org/opendaylight/openflowplugin/applications/topology/lldp/utils/LLDPDiscoveryUtilsTest.java @@ -48,9 +48,8 @@ public class LLDPDiscoveryUtilsTest { NodeConnectorRef nodeConnectorRef = LLDPDiscoveryUtils.lldpToNodeConnectorRef(packetLLDP, false); - NodeKey nodeKey = nodeConnectorRef.getValue().firstKeyOf(Node.class, NodeKey.class); - NodeConnectorKey nodeConnectorKey = nodeConnectorRef.getValue().firstKeyOf(NodeConnector.class, - NodeConnectorKey.class); + NodeKey nodeKey = nodeConnectorRef.getValue().firstKeyOf(Node.class); + NodeConnectorKey nodeConnectorKey = nodeConnectorRef.getValue().firstKeyOf(NodeConnector.class); assertEquals(nodeKey.getId().getValue(), "openflow:2"); assertEquals(nodeConnectorKey.getId().getValue(), "openflow:2:2"); diff --git a/applications/topology-manager/src/main/java/org/opendaylight/openflowplugin/applications/topology/manager/FlowCapableNodeMapping.java b/applications/topology-manager/src/main/java/org/opendaylight/openflowplugin/applications/topology/manager/FlowCapableNodeMapping.java index 1d86b798fd..d79cebb1e6 100644 --- a/applications/topology-manager/src/main/java/org/opendaylight/openflowplugin/applications/topology/manager/FlowCapableNodeMapping.java +++ b/applications/topology-manager/src/main/java/org/opendaylight/openflowplugin/applications/topology/manager/FlowCapableNodeMapping.java @@ -36,15 +36,15 @@ public final class FlowCapableNodeMapping { } public static NodeKey getNodeKey(final NodeRef ref) { - return ref.getValue().firstKeyOf(Node.class, NodeKey.class); + return ref.getValue().firstKeyOf(Node.class); } public static NodeKey getNodeKey(final NodeConnectorRef ref) { - return ref.getValue().firstKeyOf(Node.class, NodeKey.class); + return ref.getValue().firstKeyOf(Node.class); } public static NodeConnectorKey getNodeConnectorKey(final NodeConnectorRef ref) { - return ref.getValue().firstKeyOf(NodeConnector.class, NodeConnectorKey.class); + return ref.getValue().firstKeyOf(NodeConnector.class); } public static NodeId toTopologyNodeId( diff --git a/applications/topology-manager/src/test/java/org/opendaylight/openflowplugin/applications/topology/manager/DataTreeChangeListenerBase.java b/applications/topology-manager/src/test/java/org/opendaylight/openflowplugin/applications/topology/manager/DataTreeChangeListenerBase.java index 87ab94102e..db653707c3 100644 --- a/applications/topology-manager/src/test/java/org/opendaylight/openflowplugin/applications/topology/manager/DataTreeChangeListenerBase.java +++ b/applications/topology-manager/src/test/java/org/opendaylight/openflowplugin/applications/topology/manager/DataTreeChangeListenerBase.java @@ -7,7 +7,7 @@ */ package org.opendaylight.openflowplugin.applications.topology.manager; -import static org.mockito.Matchers.any; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; diff --git a/applications/topology-manager/src/test/java/org/opendaylight/openflowplugin/applications/topology/manager/NodeChangeListenerImplTest.java b/applications/topology-manager/src/test/java/org/opendaylight/openflowplugin/applications/topology/manager/NodeChangeListenerImplTest.java index fa6a2b284e..dd0848d755 100644 --- a/applications/topology-manager/src/test/java/org/opendaylight/openflowplugin/applications/topology/manager/NodeChangeListenerImplTest.java +++ b/applications/topology-manager/src/test/java/org/opendaylight/openflowplugin/applications/topology/manager/NodeChangeListenerImplTest.java @@ -9,7 +9,7 @@ package org.opendaylight.openflowplugin.applications.topology.manager; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; -import static org.mockito.Matchers.eq; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; diff --git a/applications/topology-manager/src/test/java/org/opendaylight/openflowplugin/applications/topology/manager/TerminationPointChangeListenerImplTest.java b/applications/topology-manager/src/test/java/org/opendaylight/openflowplugin/applications/topology/manager/TerminationPointChangeListenerImplTest.java index c13514fe21..f471e66b66 100644 --- a/applications/topology-manager/src/test/java/org/opendaylight/openflowplugin/applications/topology/manager/TerminationPointChangeListenerImplTest.java +++ b/applications/topology-manager/src/test/java/org/opendaylight/openflowplugin/applications/topology/manager/TerminationPointChangeListenerImplTest.java @@ -9,8 +9,8 @@ package org.opendaylight.openflowplugin.applications.topology.manager; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.eq; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; diff --git a/applications/topology-manager/src/test/java/org/opendaylight/openflowplugin/applications/topology/manager/TestUtils.java b/applications/topology-manager/src/test/java/org/opendaylight/openflowplugin/applications/topology/manager/TestUtils.java index 38e8b72afb..103320303d 100644 --- a/applications/topology-manager/src/test/java/org/opendaylight/openflowplugin/applications/topology/manager/TestUtils.java +++ b/applications/topology-manager/src/test/java/org/opendaylight/openflowplugin/applications/topology/manager/TestUtils.java @@ -10,8 +10,8 @@ package org.opendaylight.openflowplugin.applications.topology.manager; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.eq; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.atLeast; import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.inOrder; diff --git a/artifacts/pom.xml b/artifacts/pom.xml index 90b2d3a8f1..78eac87b65 100644 --- a/artifacts/pom.xml +++ b/artifacts/pom.xml @@ -13,7 +13,7 @@ org.opendaylight.odlparent odlparent-lite - 3.1.3 + 4.0.2 diff --git a/distribution/karaf/pom.xml b/distribution/karaf/pom.xml index 4855da9106..af4367830d 100644 --- a/distribution/karaf/pom.xml +++ b/distribution/karaf/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.odlparent karaf4-parent - 3.1.3 + 4.0.2 org.opendaylight.openflowplugin openflowplugin-karaf diff --git a/drop-test-karaf/pom.xml b/drop-test-karaf/pom.xml index c3e7958466..c38dd8e10e 100644 --- a/drop-test-karaf/pom.xml +++ b/drop-test-karaf/pom.xml @@ -1,5 +1,5 @@ - + + 4.0.0 org.opendaylight.openflowplugin diff --git a/extension/features-extension-aggregator/features-openflowplugin-extension/pom.xml b/extension/features-extension-aggregator/features-openflowplugin-extension/pom.xml index 960961f061..b0067fd36d 100644 --- a/extension/features-extension-aggregator/features-openflowplugin-extension/pom.xml +++ b/extension/features-extension-aggregator/features-openflowplugin-extension/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.odlparent feature-repo-parent - 3.1.3 + 4.0.2 diff --git a/extension/features-extension-aggregator/odl-openflowplugin-nxm-extensions/pom.xml b/extension/features-extension-aggregator/odl-openflowplugin-nxm-extensions/pom.xml index ac32ce433f..42fd7a0325 100644 --- a/extension/features-extension-aggregator/odl-openflowplugin-nxm-extensions/pom.xml +++ b/extension/features-extension-aggregator/odl-openflowplugin-nxm-extensions/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.odlparent single-feature-parent - 3.1.3 + 4.0.2 diff --git a/extension/features-extension-aggregator/odl-openflowplugin-onf-extensions/pom.xml b/extension/features-extension-aggregator/odl-openflowplugin-onf-extensions/pom.xml index 6c5bd742cb..8ded366708 100644 --- a/extension/features-extension-aggregator/odl-openflowplugin-onf-extensions/pom.xml +++ b/extension/features-extension-aggregator/odl-openflowplugin-onf-extensions/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.odlparent single-feature-parent - 3.1.3 + 4.0.2 diff --git a/extension/features-extension-aggregator/pom.xml b/extension/features-extension-aggregator/pom.xml index aeea734e8f..7957825f34 100644 --- a/extension/features-extension-aggregator/pom.xml +++ b/extension/features-extension-aggregator/pom.xml @@ -3,7 +3,7 @@ org.opendaylight.odlparent odlparent-lite - 3.1.3 + 4.0.2 4.0.0 diff --git a/extension/openflowjava-extension-nicira-api/pom.xml b/extension/openflowjava-extension-nicira-api/pom.xml index 95ed1f8587..ccf96b213d 100644 --- a/extension/openflowjava-extension-nicira-api/pom.xml +++ b/extension/openflowjava-extension-nicira-api/pom.xml @@ -1,7 +1,5 @@ - + 4.0.0 org.opendaylight.openflowplugin diff --git a/extension/openflowjava-extension-nicira/pom.xml b/extension/openflowjava-extension-nicira/pom.xml index a1f1c7a659..e6957d6caf 100644 --- a/extension/openflowjava-extension-nicira/pom.xml +++ b/extension/openflowjava-extension-nicira/pom.xml @@ -1,6 +1,5 @@ - + 4.0.0 org.opendaylight.openflowplugin diff --git a/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/action/LearnCodecUtil.java b/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/action/LearnCodecUtil.java index a453440a20..03cb99afe4 100644 --- a/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/action/LearnCodecUtil.java +++ b/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/action/LearnCodecUtil.java @@ -214,8 +214,8 @@ public final class LearnCodecUtil { } if (LearnCodecUtil.length != 0) { - LOG.error("Learn Codec read " + Math.abs(messageLength) - + " bytes more than needed from stream. Packet might be corrupted"); + LOG.error("Learn Codec read {} bytes more than needed from stream. Packet might be corrupted", + Math.abs(messageLength)); } nxActionLearnBuilder.setFlowMods(flowModeList); } diff --git a/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/NiciraExtensionCodecRegistratorImplTest.java b/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/NiciraExtensionCodecRegistratorImplTest.java index 5bb12dbe2f..764142b090 100644 --- a/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/NiciraExtensionCodecRegistratorImplTest.java +++ b/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/NiciraExtensionCodecRegistratorImplTest.java @@ -10,13 +10,14 @@ package org.opendaylight.openflowjava.nx; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; import java.util.LinkedList; import java.util.List; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.Matchers; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.runners.MockitoJUnitRunner; @@ -84,17 +85,17 @@ public class NiciraExtensionCodecRegistratorImplTest { @Test public void niciraExtensionsCodecRegistratorImplTest() { - Mockito.verify(provider).registerActionDeserializer(Matchers.eq(ActionDeserializer.OF10_DESERIALIZER_KEY), - Matchers.any(ActionDeserializer.class)); - Mockito.verify(provider).registerActionDeserializer(Matchers.eq(ActionDeserializer.OF13_DESERIALIZER_KEY), - Matchers.any(ActionDeserializer.class)); + Mockito.verify(provider).registerActionDeserializer(eq(ActionDeserializer.OF10_DESERIALIZER_KEY), + any(ActionDeserializer.class)); + Mockito.verify(provider).registerActionDeserializer(eq(ActionDeserializer.OF13_DESERIALIZER_KEY), + any(ActionDeserializer.class)); } @Test public void registerActionSerializerTest() { niciraExtensionCodecRegistrator.registerActionSerializer(actionSerializerKey, actionSerializer); ActionSerializerKey key1 = NiciraUtil.createOfJavaKeyFrom(actionSerializerKey); - Mockito.verify(provider).registerActionSerializer(Matchers.eq(key1), Matchers.any(OFGeneralSerializer.class)); + Mockito.verify(provider).registerActionSerializer(eq(key1), any(OFGeneralSerializer.class)); } @Test @@ -102,7 +103,7 @@ public class NiciraExtensionCodecRegistratorImplTest { niciraExtensionCodecRegistrator.registerActionSerializer(actionSerializerKey, actionSerializer); ActionSerializerKey key1 = NiciraUtil.createOfJavaKeyFrom(actionSerializerKey); niciraExtensionCodecRegistrator.unregisterActionSerializer(actionSerializerKey); - Mockito.verify(provider).unregisterSerializer(Matchers.eq(key1)); + Mockito.verify(provider).unregisterSerializer(eq(key1)); } @Test @@ -111,7 +112,7 @@ public class NiciraExtensionCodecRegistratorImplTest { niciraExtensionCodecRegistrator.registerActionDeserializer(actionDeserializerKey, actionDeserializer); assertFalse(niciraExtensionCodecRegistrator.isEmptyActionDeserializers()); Mockito.verify((DeserializerRegistryInjector) actionDeserializer) - .injectDeserializerRegistry(Matchers.any()); + .injectDeserializerRegistry(any()); } @Test diff --git a/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/NiciraExtensionsRegistratorTest.java b/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/NiciraExtensionsRegistratorTest.java index e1de303946..18d0bd25fa 100644 --- a/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/NiciraExtensionsRegistratorTest.java +++ b/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/NiciraExtensionsRegistratorTest.java @@ -7,10 +7,12 @@ */ package org.opendaylight.openflowjava.nx; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; + import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.Matchers; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.runners.MockitoJUnitRunner; @@ -141,242 +143,242 @@ public class NiciraExtensionsRegistratorTest { @Test public void registerNiciraExtensionsTest() { Mockito.verify(registrator).registerActionDeserializer( - Matchers.eq(new NiciraActionDeserializerKey(EncodeConstants.OF13_VERSION_ID, 7)), - Matchers.any(RegLoadCodec.class)); + eq(new NiciraActionDeserializerKey(EncodeConstants.OF13_VERSION_ID, 7)), + any(RegLoadCodec.class)); Mockito.verify(registrator).registerActionSerializer( - Matchers.eq(new NiciraActionSerializerKey(EncodeConstants.OF13_VERSION_ID, ActionRegLoad.class)), - Matchers.any(RegLoadCodec.class)); + eq(new NiciraActionSerializerKey(EncodeConstants.OF13_VERSION_ID, ActionRegLoad.class)), + any(RegLoadCodec.class)); Mockito.verify(registrator).registerActionDeserializer( - Matchers.eq(new NiciraActionDeserializerKey(EncodeConstants.OF13_VERSION_ID, 33)), - Matchers.any(RegLoad2Codec.class)); + eq(new NiciraActionDeserializerKey(EncodeConstants.OF13_VERSION_ID, 33)), + any(RegLoad2Codec.class)); Mockito.verify(registrator).registerActionSerializer( - Matchers.eq(new NiciraActionSerializerKey(EncodeConstants.OF13_VERSION_ID, ActionRegLoad2.class)), - Matchers.any(RegLoad2Codec.class)); + eq(new NiciraActionSerializerKey(EncodeConstants.OF13_VERSION_ID, ActionRegLoad2.class)), + any(RegLoad2Codec.class)); Mockito.verify(registrator).registerActionDeserializer( - Matchers.eq(new NiciraActionDeserializerKey(EncodeConstants.OF13_VERSION_ID, 6)), - Matchers.any(RegMoveCodec.class)); + eq(new NiciraActionDeserializerKey(EncodeConstants.OF13_VERSION_ID, 6)), + any(RegMoveCodec.class)); Mockito.verify(registrator).registerActionSerializer( - Matchers.eq(new NiciraActionSerializerKey(EncodeConstants.OF13_VERSION_ID, ActionRegMove.class)), - Matchers.any(RegMoveCodec.class)); + eq(new NiciraActionSerializerKey(EncodeConstants.OF13_VERSION_ID, ActionRegMove.class)), + any(RegMoveCodec.class)); Mockito.verify(registrator).registerActionDeserializer( - Matchers.eq(new NiciraActionDeserializerKey(EncodeConstants.OF13_VERSION_ID, 15)), - Matchers.any(OutputRegCodec.class)); + eq(new NiciraActionDeserializerKey(EncodeConstants.OF13_VERSION_ID, 15)), + any(OutputRegCodec.class)); Mockito.verify(registrator).registerActionSerializer( - Matchers.eq(new NiciraActionSerializerKey(EncodeConstants.OF13_VERSION_ID, ActionOutputReg.class)), - Matchers.any(OutputRegCodec.class)); + eq(new NiciraActionSerializerKey(EncodeConstants.OF13_VERSION_ID, ActionOutputReg.class)), + any(OutputRegCodec.class)); Mockito.verify(registrator).registerActionDeserializer( - Matchers.eq(new NiciraActionDeserializerKey(EncodeConstants.OF13_VERSION_ID, 32)), - Matchers.any(OutputReg2Codec.class)); + eq(new NiciraActionDeserializerKey(EncodeConstants.OF13_VERSION_ID, 32)), + any(OutputReg2Codec.class)); Mockito.verify(registrator).registerActionSerializer( - Matchers.eq(new NiciraActionSerializerKey(EncodeConstants.OF13_VERSION_ID, ActionOutputReg2.class)), - Matchers.any(OutputReg2Codec.class)); + eq(new NiciraActionSerializerKey(EncodeConstants.OF13_VERSION_ID, ActionOutputReg2.class)), + any(OutputReg2Codec.class)); Mockito.verify(registrator).registerActionSerializer( - Matchers.eq(new NiciraActionSerializerKey(EncodeConstants.OF13_VERSION_ID, ActionResubmit.class)), - Matchers.any(ResubmitCodec.class)); + eq(new NiciraActionSerializerKey(EncodeConstants.OF13_VERSION_ID, ActionResubmit.class)), + any(ResubmitCodec.class)); Mockito.verify(registrator).registerActionDeserializer( - Matchers.eq(new NiciraActionDeserializerKey(EncodeConstants.OF13_VERSION_ID, 1)), - Matchers.any(ResubmitCodec.class)); + eq(new NiciraActionDeserializerKey(EncodeConstants.OF13_VERSION_ID, 1)), + any(ResubmitCodec.class)); Mockito.verify(registrator).registerActionDeserializer( - Matchers.eq(new NiciraActionDeserializerKey(EncodeConstants.OF13_VERSION_ID, 14)), - Matchers.any(ResubmitCodec.class)); + eq(new NiciraActionDeserializerKey(EncodeConstants.OF13_VERSION_ID, 14)), + any(ResubmitCodec.class)); Mockito.verify(registrator).registerActionSerializer( - Matchers.eq(new NiciraActionSerializerKey(EncodeConstants.OF13_VERSION_ID, ActionMultipath.class)), - Matchers.any(MultipathCodec.class)); + eq(new NiciraActionSerializerKey(EncodeConstants.OF13_VERSION_ID, ActionMultipath.class)), + any(MultipathCodec.class)); Mockito.verify(registrator).registerActionDeserializer( - Matchers.eq(new NiciraActionDeserializerKey(EncodeConstants.OF13_VERSION_ID, 10)), - Matchers.any(MultipathCodec.class)); + eq(new NiciraActionDeserializerKey(EncodeConstants.OF13_VERSION_ID, 10)), + any(MultipathCodec.class)); Mockito.verify(registrator).registerActionDeserializer( - Matchers.eq(new NiciraActionDeserializerKey(EncodeConstants.OF13_VERSION_ID, 46)), - Matchers.any(EncapCodec.class)); + eq(new NiciraActionDeserializerKey(EncodeConstants.OF13_VERSION_ID, 46)), + any(EncapCodec.class)); Mockito.verify(registrator).registerActionSerializer( - Matchers.eq(new NiciraActionSerializerKey(EncodeConstants.OF13_VERSION_ID, ActionEncap.class)), - Matchers.any(EncapCodec.class)); + eq(new NiciraActionSerializerKey(EncodeConstants.OF13_VERSION_ID, ActionEncap.class)), + any(EncapCodec.class)); Mockito.verify(registrator).registerActionDeserializer( - Matchers.eq(new NiciraActionDeserializerKey(EncodeConstants.OF13_VERSION_ID, 47)), - Matchers.any(DecapCodec.class)); + eq(new NiciraActionDeserializerKey(EncodeConstants.OF13_VERSION_ID, 47)), + any(DecapCodec.class)); Mockito.verify(registrator).registerActionSerializer( - Matchers.eq(new NiciraActionSerializerKey(EncodeConstants.OF13_VERSION_ID, ActionDecap.class)), - Matchers.any(DecapCodec.class)); - Mockito.verify(registrator).registerMatchEntrySerializer(Matchers - .eq(new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID, Nxm1Class.class, NxmNxReg0.class)), - Matchers.any(Reg0Codec.class)); - Mockito.verify(registrator).registerMatchEntryDeserializer(Matchers - .eq(new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID, OxmMatchConstants.NXM_1_CLASS, 0)), - Matchers.any(Reg0Codec.class)); - Mockito.verify(registrator).registerMatchEntrySerializer(Matchers - .eq(new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID, Nxm1Class.class, NxmNxReg1.class)), - Matchers.any(Reg1Codec.class)); - Mockito.verify(registrator).registerMatchEntryDeserializer(Matchers - .eq(new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID, OxmMatchConstants.NXM_1_CLASS, 1)), - Matchers.any(Reg1Codec.class)); - Mockito.verify(registrator).registerMatchEntrySerializer(Matchers - .eq(new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID, Nxm1Class.class, NxmNxReg2.class)), - Matchers.any(Reg2Codec.class)); - Mockito.verify(registrator).registerMatchEntryDeserializer(Matchers - .eq(new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID, OxmMatchConstants.NXM_1_CLASS, 2)), - Matchers.any(Reg2Codec.class)); - Mockito.verify(registrator).registerMatchEntrySerializer(Matchers - .eq(new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID, Nxm1Class.class, NxmNxReg3.class)), - Matchers.any(Reg3Codec.class)); - Mockito.verify(registrator).registerMatchEntryDeserializer(Matchers - .eq(new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID, OxmMatchConstants.NXM_1_CLASS, 3)), - Matchers.any(Reg3Codec.class)); - Mockito.verify(registrator).registerMatchEntrySerializer(Matchers - .eq(new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID, Nxm1Class.class, NxmNxReg4.class)), - Matchers.any(Reg4Codec.class)); - Mockito.verify(registrator).registerMatchEntryDeserializer(Matchers - .eq(new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID, OxmMatchConstants.NXM_1_CLASS, 4)), - Matchers.any(Reg4Codec.class)); - Mockito.verify(registrator).registerMatchEntrySerializer(Matchers - .eq(new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID, Nxm1Class.class, NxmNxReg5.class)), - Matchers.any(Reg5Codec.class)); - Mockito.verify(registrator).registerMatchEntryDeserializer(Matchers - .eq(new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID, OxmMatchConstants.NXM_1_CLASS, 5)), - Matchers.any(Reg5Codec.class)); - Mockito.verify(registrator).registerMatchEntrySerializer(Matchers - .eq(new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID, Nxm1Class.class, NxmNxReg6.class)), - Matchers.any(Reg6Codec.class)); - Mockito.verify(registrator).registerMatchEntryDeserializer(Matchers - .eq(new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID, OxmMatchConstants.NXM_1_CLASS, 6)), - Matchers.any(Reg6Codec.class)); - Mockito.verify(registrator).registerMatchEntrySerializer(Matchers - .eq(new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID, Nxm1Class.class, NxmNxReg7.class)), - Matchers.any(Reg7Codec.class)); - Mockito.verify(registrator).registerMatchEntryDeserializer(Matchers - .eq(new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID, OxmMatchConstants.NXM_1_CLASS, 7)), - Matchers.any(Reg7Codec.class)); - Mockito.verify(registrator).registerMatchEntrySerializer(Matchers - .eq(new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID, Nxm1Class.class, NxmNxTunId.class)), - Matchers.any(TunIdCodec.class)); - Mockito.verify(registrator).registerMatchEntryDeserializer(Matchers - .eq(new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID, OxmMatchConstants.NXM_1_CLASS, 16)), - Matchers.any(TunIdCodec.class)); - Mockito.verify(registrator).registerMatchEntrySerializer(Matchers - .eq(new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID, Nxm0Class.class, NxmOfArpOp.class)), - Matchers.any(ArpOpCodec.class)); - Mockito.verify(registrator).registerMatchEntryDeserializer(Matchers - .eq(new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID, OxmMatchConstants.NXM_0_CLASS, 15)), - Matchers.any(ArpOpCodec.class)); - Mockito.verify(registrator).registerMatchEntrySerializer(Matchers - .eq(new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID, Nxm1Class.class, NxmNxArpSha.class)), - Matchers.any(ArpShaCodec.class)); - Mockito.verify(registrator).registerMatchEntryDeserializer(Matchers - .eq(new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID, OxmMatchConstants.NXM_1_CLASS, 17)), - Matchers.any(ArpShaCodec.class)); - Mockito.verify(registrator).registerMatchEntrySerializer(Matchers - .eq(new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID, Nxm0Class.class, NxmOfArpSpa.class)), - Matchers.any(ArpSpaCodec.class)); - Mockito.verify(registrator).registerMatchEntryDeserializer(Matchers - .eq(new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID, OxmMatchConstants.NXM_0_CLASS, 16)), - Matchers.any(ArpSpaCodec.class)); - Mockito.verify(registrator).registerMatchEntrySerializer(Matchers - .eq(new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID, Nxm1Class.class, NxmNxArpTha.class)), - Matchers.any(ArpThaCodec.class)); - Mockito.verify(registrator).registerMatchEntryDeserializer(Matchers - .eq(new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID, OxmMatchConstants.NXM_1_CLASS, 18)), - Matchers.any(ArpThaCodec.class)); - Mockito.verify(registrator).registerMatchEntrySerializer(Matchers - .eq(new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID, Nxm0Class.class, NxmOfArpTpa.class)), - Matchers.any(ArpTpaCodec.class)); - Mockito.verify(registrator).registerMatchEntryDeserializer(Matchers - .eq(new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID, OxmMatchConstants.NXM_0_CLASS, 17)), - Matchers.any(ArpTpaCodec.class)); - Mockito.verify(registrator).registerMatchEntrySerializer(Matchers - .eq(new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID, Nxm0Class.class, NxmOfEthDst.class)), - Matchers.any(EthDstCodec.class)); - Mockito.verify(registrator).registerMatchEntryDeserializer(Matchers - .eq(new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID, OxmMatchConstants.NXM_0_CLASS, 1)), - Matchers.any(EthDstCodec.class)); - Mockito.verify(registrator).registerMatchEntrySerializer(Matchers - .eq(new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID, Nxm0Class.class, NxmOfEthSrc.class)), - Matchers.any(EthSrcCodec.class)); - Mockito.verify(registrator).registerMatchEntryDeserializer(Matchers - .eq(new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID, OxmMatchConstants.NXM_0_CLASS, 2)), - Matchers.any(EthSrcCodec.class)); - Mockito.verify(registrator).registerMatchEntrySerializer(Matchers.eq( + eq(new NiciraActionSerializerKey(EncodeConstants.OF13_VERSION_ID, ActionDecap.class)), + any(DecapCodec.class)); + Mockito.verify(registrator).registerMatchEntrySerializer(eq( + new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID, Nxm1Class.class, NxmNxReg0.class)), + any(Reg0Codec.class)); + Mockito.verify(registrator).registerMatchEntryDeserializer(eq( + new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID, OxmMatchConstants.NXM_1_CLASS, 0)), + any(Reg0Codec.class)); + Mockito.verify(registrator).registerMatchEntrySerializer(eq( + new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID, Nxm1Class.class, NxmNxReg1.class)), + any(Reg1Codec.class)); + Mockito.verify(registrator).registerMatchEntryDeserializer(eq( + new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID, OxmMatchConstants.NXM_1_CLASS, 1)), + any(Reg1Codec.class)); + Mockito.verify(registrator).registerMatchEntrySerializer(eq( + new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID, Nxm1Class.class, NxmNxReg2.class)), + any(Reg2Codec.class)); + Mockito.verify(registrator).registerMatchEntryDeserializer(eq( + new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID, OxmMatchConstants.NXM_1_CLASS, 2)), + any(Reg2Codec.class)); + Mockito.verify(registrator).registerMatchEntrySerializer(eq( + new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID, Nxm1Class.class, NxmNxReg3.class)), + any(Reg3Codec.class)); + Mockito.verify(registrator).registerMatchEntryDeserializer(eq( + new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID, OxmMatchConstants.NXM_1_CLASS, 3)), + any(Reg3Codec.class)); + Mockito.verify(registrator).registerMatchEntrySerializer(eq( + new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID, Nxm1Class.class, NxmNxReg4.class)), + any(Reg4Codec.class)); + Mockito.verify(registrator).registerMatchEntryDeserializer(eq( + new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID, OxmMatchConstants.NXM_1_CLASS, 4)), + any(Reg4Codec.class)); + Mockito.verify(registrator).registerMatchEntrySerializer(eq( + new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID, Nxm1Class.class, NxmNxReg5.class)), + any(Reg5Codec.class)); + Mockito.verify(registrator).registerMatchEntryDeserializer(eq( + new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID, OxmMatchConstants.NXM_1_CLASS, 5)), + any(Reg5Codec.class)); + Mockito.verify(registrator).registerMatchEntrySerializer(eq( + new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID, Nxm1Class.class, NxmNxReg6.class)), + any(Reg6Codec.class)); + Mockito.verify(registrator).registerMatchEntryDeserializer(eq( + new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID, OxmMatchConstants.NXM_1_CLASS, 6)), + any(Reg6Codec.class)); + Mockito.verify(registrator).registerMatchEntrySerializer(eq( + new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID, Nxm1Class.class, NxmNxReg7.class)), + any(Reg7Codec.class)); + Mockito.verify(registrator).registerMatchEntryDeserializer(eq( + new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID, OxmMatchConstants.NXM_1_CLASS, 7)), + any(Reg7Codec.class)); + Mockito.verify(registrator).registerMatchEntrySerializer(eq( + new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID, Nxm1Class.class, NxmNxTunId.class)), + any(TunIdCodec.class)); + Mockito.verify(registrator).registerMatchEntryDeserializer(eq( + new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID, OxmMatchConstants.NXM_1_CLASS, 16)), + any(TunIdCodec.class)); + Mockito.verify(registrator).registerMatchEntrySerializer(eq( + new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID, Nxm0Class.class, NxmOfArpOp.class)), + any(ArpOpCodec.class)); + Mockito.verify(registrator).registerMatchEntryDeserializer(eq( + new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID, OxmMatchConstants.NXM_0_CLASS, 15)), + any(ArpOpCodec.class)); + Mockito.verify(registrator).registerMatchEntrySerializer(eq( + new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID, Nxm1Class.class, NxmNxArpSha.class)), + any(ArpShaCodec.class)); + Mockito.verify(registrator).registerMatchEntryDeserializer(eq( + new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID, OxmMatchConstants.NXM_1_CLASS, 17)), + any(ArpShaCodec.class)); + Mockito.verify(registrator).registerMatchEntrySerializer(eq( + new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID, Nxm0Class.class, NxmOfArpSpa.class)), + any(ArpSpaCodec.class)); + Mockito.verify(registrator).registerMatchEntryDeserializer(eq( + new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID, OxmMatchConstants.NXM_0_CLASS, 16)), + any(ArpSpaCodec.class)); + Mockito.verify(registrator).registerMatchEntrySerializer(eq( + new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID, Nxm1Class.class, NxmNxArpTha.class)), + any(ArpThaCodec.class)); + Mockito.verify(registrator).registerMatchEntryDeserializer(eq( + new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID, OxmMatchConstants.NXM_1_CLASS, 18)), + any(ArpThaCodec.class)); + Mockito.verify(registrator).registerMatchEntrySerializer(eq( + new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID, Nxm0Class.class, NxmOfArpTpa.class)), + any(ArpTpaCodec.class)); + Mockito.verify(registrator).registerMatchEntryDeserializer(eq( + new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID, OxmMatchConstants.NXM_0_CLASS, 17)), + any(ArpTpaCodec.class)); + Mockito.verify(registrator).registerMatchEntrySerializer(eq( + new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID, Nxm0Class.class, NxmOfEthDst.class)), + any(EthDstCodec.class)); + Mockito.verify(registrator).registerMatchEntryDeserializer(eq( + new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID, OxmMatchConstants.NXM_0_CLASS, 1)), + any(EthDstCodec.class)); + Mockito.verify(registrator).registerMatchEntrySerializer( + eq(new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID, Nxm0Class.class, NxmOfEthSrc.class)), + any(EthSrcCodec.class)); + Mockito.verify(registrator).registerMatchEntryDeserializer(eq( + new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID, OxmMatchConstants.NXM_0_CLASS, 2)), + any(EthSrcCodec.class)); + Mockito.verify(registrator).registerMatchEntrySerializer(eq( new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID, Nxm0Class.class, NxmOfEthType.class)), - Matchers.any(EthTypeCodec.class)); - Mockito.verify(registrator).registerMatchEntryDeserializer(Matchers - .eq(new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID, OxmMatchConstants.NXM_0_CLASS, 3)), - Matchers.any(EthTypeCodec.class)); - Mockito.verify(registrator).registerMatchEntrySerializer(Matchers.eq( + any(EthTypeCodec.class)); + Mockito.verify(registrator).registerMatchEntryDeserializer(eq( + new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID, OxmMatchConstants.NXM_0_CLASS, 3)), + any(EthTypeCodec.class)); + Mockito.verify(registrator).registerMatchEntrySerializer(eq( new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID, Nxm1Class.class, NxmNxTunIpv4Dst.class)), - Matchers.any(TunIpv4DstCodec.class)); - Mockito.verify(registrator).registerMatchEntryDeserializer(Matchers - .eq(new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID, OxmMatchConstants.NXM_1_CLASS, 32)), - Matchers.any(TunIpv4DstCodec.class)); - Mockito.verify(registrator).registerMatchEntrySerializer(Matchers.eq( + any(TunIpv4DstCodec.class)); + Mockito.verify(registrator).registerMatchEntryDeserializer(eq( + new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID, OxmMatchConstants.NXM_1_CLASS, 32)), + any(TunIpv4DstCodec.class)); + Mockito.verify(registrator).registerMatchEntrySerializer(eq( new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID, Nxm1Class.class, NxmNxTunIpv4Src.class)), - Matchers.any(TunIpv4SrcCodec.class)); - Mockito.verify(registrator).registerMatchEntryDeserializer(Matchers - .eq(new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID, OxmMatchConstants.NXM_1_CLASS, 31)), - Matchers.any(TunIpv4SrcCodec.class)); - Mockito.verify(registrator).registerMatchEntrySerializer(Matchers - .eq(new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID, Nxm0Class.class, NxmOfTcpSrc.class)), - Matchers.any(TcpSrcCodec.class)); - Mockito.verify(registrator).registerMatchEntryDeserializer(Matchers - .eq(new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID, OxmMatchConstants.NXM_0_CLASS, 9)), - Matchers.any(TcpSrcCodec.class)); - Mockito.verify(registrator).registerMatchEntrySerializer(Matchers - .eq(new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID, Nxm0Class.class, NxmOfTcpDst.class)), - Matchers.any(TcpDstCodec.class)); - Mockito.verify(registrator).registerMatchEntryDeserializer(Matchers - .eq(new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID, OxmMatchConstants.NXM_0_CLASS, 10)), - Matchers.any(TcpDstCodec.class)); - Mockito.verify(registrator).registerMatchEntrySerializer(Matchers - .eq(new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID, Nxm0Class.class, NxmOfUdpSrc.class)), - Matchers.any(UdpSrcCodec.class)); - Mockito.verify(registrator).registerMatchEntryDeserializer(Matchers - .eq(new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID, OxmMatchConstants.NXM_0_CLASS, 11)), - Matchers.any(UdpSrcCodec.class)); - Mockito.verify(registrator).registerMatchEntrySerializer(Matchers - .eq(new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID, Nxm0Class.class, NxmOfUdpDst.class)), - Matchers.any(UdpDstCodec.class)); - Mockito.verify(registrator).registerMatchEntryDeserializer(Matchers - .eq(new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID, OxmMatchConstants.NXM_0_CLASS, 12)), - Matchers.any(UdpDstCodec.class)); - Mockito.verify(registrator).registerMatchEntrySerializer(Matchers.eq( + any(TunIpv4SrcCodec.class)); + Mockito.verify(registrator).registerMatchEntryDeserializer(eq( + new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID, OxmMatchConstants.NXM_1_CLASS, 31)), + any(TunIpv4SrcCodec.class)); + Mockito.verify(registrator).registerMatchEntrySerializer(eq( + new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID, Nxm0Class.class, NxmOfTcpSrc.class)), + any(TcpSrcCodec.class)); + Mockito.verify(registrator).registerMatchEntryDeserializer(eq( + new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID, OxmMatchConstants.NXM_0_CLASS, 9)), + any(TcpSrcCodec.class)); + Mockito.verify(registrator).registerMatchEntrySerializer(eq( + new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID, Nxm0Class.class, NxmOfTcpDst.class)), + any(TcpDstCodec.class)); + Mockito.verify(registrator).registerMatchEntryDeserializer(eq( + new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID, OxmMatchConstants.NXM_0_CLASS, 10)), + any(TcpDstCodec.class)); + Mockito.verify(registrator).registerMatchEntrySerializer(eq( + new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID, Nxm0Class.class, NxmOfUdpSrc.class)), + any(UdpSrcCodec.class)); + Mockito.verify(registrator).registerMatchEntryDeserializer(eq( + new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID, OxmMatchConstants.NXM_0_CLASS, 11)), + any(UdpSrcCodec.class)); + Mockito.verify(registrator).registerMatchEntrySerializer(eq( + new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID, Nxm0Class.class, NxmOfUdpDst.class)), + any(UdpDstCodec.class)); + Mockito.verify(registrator).registerMatchEntryDeserializer(eq( + new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID, OxmMatchConstants.NXM_0_CLASS, 12)), + any(UdpDstCodec.class)); + Mockito.verify(registrator).registerMatchEntrySerializer(eq( new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID, Nxm1Class.class, NxmNxCtState.class)), - Matchers.any(CtStateCodec.class)); - Mockito.verify(registrator).registerMatchEntryDeserializer(Matchers - .eq(new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID, OxmMatchConstants.NXM_1_CLASS, 105)), - Matchers.any(CtStateCodec.class)); - Mockito.verify(registrator).registerMatchEntrySerializer(Matchers - .eq(new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID, Nxm1Class.class, NxmNxCtZone.class)), - Matchers.any(CtZoneCodec.class)); - Mockito.verify(registrator).registerMatchEntryDeserializer(Matchers - .eq(new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID, OxmMatchConstants.NXM_1_CLASS, 106)), - Matchers.any(CtZoneCodec.class)); - Mockito.verify(registrator).registerMatchEntrySerializer(Matchers - .eq(new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID, Nxm1Class.class, NxmNxCtMark.class)), - Matchers.any(CtMarkCodec.class)); - Mockito.verify(registrator).registerMatchEntryDeserializer(Matchers - .eq(new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID, OxmMatchConstants.NXM_1_CLASS, 107)), - Matchers.any(CtMarkCodec.class)); - Mockito.verify(registrator).registerMatchEntrySerializer(Matchers - .eq(new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID, Nxm1Class.class, - NxmNxCtTpSrc.class)), Matchers.any(CtTpSrcCodec.class)); - Mockito.verify(registrator).registerMatchEntryDeserializer(Matchers - .eq(new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID, - OxmMatchConstants.NXM_1_CLASS, 124)), Matchers.any(CtTpSrcCodec.class)); - Mockito.verify(registrator).registerMatchEntrySerializer(Matchers - .eq(new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID, Nxm1Class.class, - NxmNxCtTpDst.class)), Matchers.any(CtTpDstCodec.class)); - Mockito.verify(registrator).registerMatchEntryDeserializer(Matchers - .eq(new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID, - OxmMatchConstants.NXM_1_CLASS, 125)), Matchers.any(CtTpDstCodec.class)); - Mockito.verify(registrator).registerMatchEntrySerializer(Matchers - .eq(new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID, Nxm1Class.class, - NxmNxPktMark.class)), Matchers.any(PktMarkCodec.class)); - Mockito.verify(registrator).registerMatchEntryDeserializer(Matchers - .eq(new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID, - OxmMatchConstants.NXM_1_CLASS, 33)), Matchers.any(PktMarkCodec.class)); + any(CtStateCodec.class)); + Mockito.verify(registrator).registerMatchEntryDeserializer(eq( + new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID, OxmMatchConstants.NXM_1_CLASS, 105)), + any(CtStateCodec.class)); + Mockito.verify(registrator).registerMatchEntrySerializer(eq( + new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID, Nxm1Class.class, NxmNxCtZone.class)), + any(CtZoneCodec.class)); + Mockito.verify(registrator).registerMatchEntryDeserializer(eq( + new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID, OxmMatchConstants.NXM_1_CLASS, 106)), + any(CtZoneCodec.class)); + Mockito.verify(registrator).registerMatchEntrySerializer(eq( + new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID, Nxm1Class.class, NxmNxCtMark.class)), + any(CtMarkCodec.class)); + Mockito.verify(registrator).registerMatchEntryDeserializer(eq( + new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID, OxmMatchConstants.NXM_1_CLASS, 107)), + any(CtMarkCodec.class)); + Mockito.verify(registrator).registerMatchEntrySerializer(eq( + new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID, Nxm1Class.class, + NxmNxCtTpSrc.class)), any(CtTpSrcCodec.class)); + Mockito.verify(registrator).registerMatchEntryDeserializer(eq( + new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID, + OxmMatchConstants.NXM_1_CLASS, 124)), any(CtTpSrcCodec.class)); + Mockito.verify(registrator).registerMatchEntrySerializer(eq( + new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID, Nxm1Class.class, + NxmNxCtTpDst.class)), any(CtTpDstCodec.class)); + Mockito.verify(registrator).registerMatchEntryDeserializer(eq( + new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID, + OxmMatchConstants.NXM_1_CLASS, 125)), any(CtTpDstCodec.class)); + Mockito.verify(registrator).registerMatchEntrySerializer(eq( + new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID, Nxm1Class.class, + NxmNxPktMark.class)), any(PktMarkCodec.class)); + Mockito.verify(registrator).registerMatchEntryDeserializer(eq( + new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID, + OxmMatchConstants.NXM_1_CLASS, 33)), any(PktMarkCodec.class)); Mockito.verify(registrator).registerActionDeserializer( - Matchers.eq(new NiciraActionDeserializerKey(EncodeConstants.OF13_VERSION_ID, 48)), - Matchers.any(DecNshTtlCodec.class)); + eq(new NiciraActionDeserializerKey(EncodeConstants.OF13_VERSION_ID, 48)), + any(DecNshTtlCodec.class)); Mockito.verify(registrator).registerActionSerializer( - Matchers.eq(new NiciraActionSerializerKey(EncodeConstants.OF13_VERSION_ID, ActionDecNshTtl.class)), - Matchers.any(DecNshTtlCodec.class)); + eq(new NiciraActionSerializerKey(EncodeConstants.OF13_VERSION_ID, ActionDecNshTtl.class)), + any(DecNshTtlCodec.class)); // experimenters MatchEntrySerializerKey nshFlagsSerializerKey = new MatchEntrySerializerKey<>( @@ -385,160 +387,160 @@ public class NiciraExtensionsRegistratorTest { NxmNxNshFlags.class); nshFlagsSerializerKey.setExperimenterId(NiciraConstants.NX_NSH_VENDOR_ID); Mockito.verify(registrator).registerMatchEntrySerializer( - Matchers.eq(nshFlagsSerializerKey), - Matchers.any(NshFlagsCodec.class)); + eq(nshFlagsSerializerKey), + any(NshFlagsCodec.class)); MatchEntryDeserializerKey nshFlagsDeserializerKey = new MatchEntryDeserializerKey( EncodeConstants.OF13_VERSION_ID, OxmMatchConstants.EXPERIMENTER_CLASS, 1); nshFlagsDeserializerKey.setExperimenterId(NiciraConstants.NX_NSH_VENDOR_ID); Mockito.verify(registrator).registerMatchEntryDeserializer( - Matchers.eq(nshFlagsDeserializerKey), - Matchers.any(NshFlagsCodec.class)); + eq(nshFlagsDeserializerKey), + any(NshFlagsCodec.class)); MatchEntrySerializerKey mdtypeSerializerKey = new MatchEntrySerializerKey<>( EncodeConstants.OF13_VERSION_ID, ExperimenterClass.class, NxmNxNshMdtype.class); mdtypeSerializerKey.setExperimenterId(NiciraConstants.NX_NSH_VENDOR_ID); Mockito.verify(registrator).registerMatchEntrySerializer( - Matchers.eq(mdtypeSerializerKey), - Matchers.any(NshMdtypeCodec.class)); + eq(mdtypeSerializerKey), + any(NshMdtypeCodec.class)); MatchEntryDeserializerKey mdtypeDeserializerKey = new MatchEntryDeserializerKey( EncodeConstants.OF13_VERSION_ID, OxmMatchConstants.EXPERIMENTER_CLASS, 2); mdtypeDeserializerKey.setExperimenterId(NiciraConstants.NX_NSH_VENDOR_ID); Mockito.verify(registrator).registerMatchEntryDeserializer( - Matchers.eq(mdtypeDeserializerKey), - Matchers.any(NshMdtypeCodec.class)); + eq(mdtypeDeserializerKey), + any(NshMdtypeCodec.class)); MatchEntrySerializerKey nshNpSerializerKey = new MatchEntrySerializerKey<>( EncodeConstants.OF13_VERSION_ID, ExperimenterClass.class, NxmNxNshNp.class); nshNpSerializerKey.setExperimenterId(NiciraConstants.NX_NSH_VENDOR_ID); Mockito.verify(registrator).registerMatchEntrySerializer( - Matchers.eq(nshNpSerializerKey), - Matchers.any(NshNpCodec.class)); + eq(nshNpSerializerKey), + any(NshNpCodec.class)); MatchEntryDeserializerKey nshNpDeserializerKey = new MatchEntryDeserializerKey( EncodeConstants.OF13_VERSION_ID, OxmMatchConstants.EXPERIMENTER_CLASS, 3); nshNpDeserializerKey.setExperimenterId(NiciraConstants.NX_NSH_VENDOR_ID); Mockito.verify(registrator).registerMatchEntryDeserializer( - Matchers.eq(nshNpDeserializerKey), - Matchers.any(NshNpCodec.class)); + eq(nshNpDeserializerKey), + any(NshNpCodec.class)); MatchEntrySerializerKey nspSerializerKey = new MatchEntrySerializerKey<>( EncodeConstants.OF13_VERSION_ID, ExperimenterClass.class, NxmNxNsp.class); nspSerializerKey.setExperimenterId(NiciraConstants.NX_NSH_VENDOR_ID); Mockito.verify(registrator).registerMatchEntrySerializer( - Matchers.eq(nspSerializerKey), - Matchers.any(NspCodec.class)); + eq(nspSerializerKey), + any(NspCodec.class)); MatchEntryDeserializerKey nspDeserializerKey = new MatchEntryDeserializerKey( EncodeConstants.OF13_VERSION_ID, OxmMatchConstants.EXPERIMENTER_CLASS, 4); nspDeserializerKey.setExperimenterId(NiciraConstants.NX_NSH_VENDOR_ID); Mockito.verify(registrator).registerMatchEntryDeserializer( - Matchers.eq(nspDeserializerKey), - Matchers.any(NspCodec.class)); + eq(nspDeserializerKey), + any(NspCodec.class)); MatchEntrySerializerKey nsiSerializerKey = new MatchEntrySerializerKey<>( EncodeConstants.OF13_VERSION_ID, ExperimenterClass.class, NxmNxNsi.class); nsiSerializerKey.setExperimenterId(NiciraConstants.NX_NSH_VENDOR_ID); Mockito.verify(registrator).registerMatchEntrySerializer( - Matchers.eq(nsiSerializerKey), - Matchers.any(NsiCodec.class)); + eq(nsiSerializerKey), + any(NsiCodec.class)); MatchEntryDeserializerKey nsiDeserializerKey = new MatchEntryDeserializerKey( EncodeConstants.OF13_VERSION_ID, OxmMatchConstants.EXPERIMENTER_CLASS, 5); nsiDeserializerKey.setExperimenterId(NiciraConstants.NX_NSH_VENDOR_ID); Mockito.verify(registrator).registerMatchEntryDeserializer( - Matchers.eq(nsiDeserializerKey), - Matchers.any(NsiCodec.class)); + eq(nsiDeserializerKey), + any(NsiCodec.class)); MatchEntrySerializerKey nshc1SerializerKey = new MatchEntrySerializerKey<>( EncodeConstants.OF13_VERSION_ID, ExperimenterClass.class, NxmNxNshc1.class); nshc1SerializerKey.setExperimenterId(NiciraConstants.NX_NSH_VENDOR_ID); Mockito.verify(registrator).registerMatchEntrySerializer( - Matchers.eq(nshc1SerializerKey), - Matchers.any(Nshc1Codec.class)); + eq(nshc1SerializerKey), + any(Nshc1Codec.class)); MatchEntryDeserializerKey nshc1DeserializerKey = new MatchEntryDeserializerKey( EncodeConstants.OF13_VERSION_ID, OxmMatchConstants.EXPERIMENTER_CLASS, 6); nshc1DeserializerKey.setExperimenterId(NiciraConstants.NX_NSH_VENDOR_ID); Mockito.verify(registrator).registerMatchEntryDeserializer( - Matchers.eq(nshc1DeserializerKey), - Matchers.any(Nshc1Codec.class)); + eq(nshc1DeserializerKey), + any(Nshc1Codec.class)); MatchEntrySerializerKey nshc2SerializerKey = new MatchEntrySerializerKey<>( EncodeConstants.OF13_VERSION_ID, ExperimenterClass.class, NxmNxNshc2.class); nshc2SerializerKey.setExperimenterId(NiciraConstants.NX_NSH_VENDOR_ID); Mockito.verify(registrator).registerMatchEntrySerializer( - Matchers.eq(nshc2SerializerKey), - Matchers.any(Nshc2Codec.class)); + eq(nshc2SerializerKey), + any(Nshc2Codec.class)); MatchEntryDeserializerKey nshc2DeserializerKey = new MatchEntryDeserializerKey( EncodeConstants.OF13_VERSION_ID, OxmMatchConstants.EXPERIMENTER_CLASS, 7); nshc2DeserializerKey.setExperimenterId(NiciraConstants.NX_NSH_VENDOR_ID); Mockito.verify(registrator).registerMatchEntryDeserializer( - Matchers.eq(nshc2DeserializerKey), - Matchers.any(Nshc2Codec.class)); + eq(nshc2DeserializerKey), + any(Nshc2Codec.class)); MatchEntrySerializerKey nshc3SerializerKey = new MatchEntrySerializerKey<>( EncodeConstants.OF13_VERSION_ID, ExperimenterClass.class, NxmNxNshc3.class); nshc3SerializerKey.setExperimenterId(NiciraConstants.NX_NSH_VENDOR_ID); Mockito.verify(registrator).registerMatchEntrySerializer( - Matchers.eq(nshc3SerializerKey), - Matchers.any(Nshc3Codec.class)); + eq(nshc3SerializerKey), + any(Nshc3Codec.class)); MatchEntryDeserializerKey nshc3DeserializerKey = new MatchEntryDeserializerKey( EncodeConstants.OF13_VERSION_ID, OxmMatchConstants.EXPERIMENTER_CLASS, 8); nshc3DeserializerKey.setExperimenterId(NiciraConstants.NX_NSH_VENDOR_ID); Mockito.verify(registrator).registerMatchEntryDeserializer( - Matchers.eq(nshc3DeserializerKey), - Matchers.any(Nshc3Codec.class)); + eq(nshc3DeserializerKey), + any(Nshc3Codec.class)); MatchEntrySerializerKey nshc4SerializerKey = new MatchEntrySerializerKey<>( EncodeConstants.OF13_VERSION_ID, ExperimenterClass.class, NxmNxNshc4.class); nshc4SerializerKey.setExperimenterId(NiciraConstants.NX_NSH_VENDOR_ID); Mockito.verify(registrator).registerMatchEntrySerializer( - Matchers.eq(nshc4SerializerKey), - Matchers.any(Nshc4Codec.class)); + eq(nshc4SerializerKey), + any(Nshc4Codec.class)); MatchEntryDeserializerKey nshc4DeserializerKey = new MatchEntryDeserializerKey( EncodeConstants.OF13_VERSION_ID, OxmMatchConstants.EXPERIMENTER_CLASS, 9); nshc4DeserializerKey.setExperimenterId(NiciraConstants.NX_NSH_VENDOR_ID); Mockito.verify(registrator).registerMatchEntryDeserializer( - Matchers.eq(nshc4DeserializerKey), - Matchers.any(Nshc4Codec.class)); + eq(nshc4DeserializerKey), + any(Nshc4Codec.class)); MatchEntrySerializerKey nshTtlSerializerKey = new MatchEntrySerializerKey<>( EncodeConstants.OF13_VERSION_ID, ExperimenterClass.class, NxmNxNshTtl.class); nshTtlSerializerKey.setExperimenterId(NiciraConstants.NX_NSH_VENDOR_ID); Mockito.verify(registrator).registerMatchEntrySerializer( - Matchers.eq(nshTtlSerializerKey), - Matchers.any(NshTtlCodec.class)); + eq(nshTtlSerializerKey), + any(NshTtlCodec.class)); MatchEntryDeserializerKey nshTtlDeserializerKey = new MatchEntryDeserializerKey( EncodeConstants.OF13_VERSION_ID, OxmMatchConstants.EXPERIMENTER_CLASS, 10); nshTtlDeserializerKey.setExperimenterId(NiciraConstants.NX_NSH_VENDOR_ID); Mockito.verify(registrator).registerMatchEntryDeserializer( - Matchers.eq(nshTtlDeserializerKey), - Matchers.any(NshTtlCodec.class)); + eq(nshTtlDeserializerKey), + any(NshTtlCodec.class)); } @Test diff --git a/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/action/RegLoad2CodecTest.java b/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/action/RegLoad2CodecTest.java index ec07c1f836..3d4f1d79a9 100644 --- a/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/action/RegLoad2CodecTest.java +++ b/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/action/RegLoad2CodecTest.java @@ -10,7 +10,7 @@ package org.opendaylight.openflowjava.nx.codec.action; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertSame; -import static org.mockito.Matchers.any; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.when; @@ -80,7 +80,7 @@ public class RegLoad2CodecTest { final MatchEntry matchEntry = new MatchEntryBuilder().build(); when(deserializerRegistry.getDeserializer(key)).thenReturn(ofDeserializer); when(ofDeserializer.deserialize(byteBuf)).thenAnswer(invocationOnMock -> { - invocationOnMock.getArgumentAt(0, ByteBuf.class).skipBytes(8); + invocationOnMock.getArgument(0).skipBytes(8); return matchEntry; }); diff --git a/extension/openflowplugin-extension-api/pom.xml b/extension/openflowplugin-extension-api/pom.xml index 82847197e2..071c998142 100644 --- a/extension/openflowplugin-extension-api/pom.xml +++ b/extension/openflowplugin-extension-api/pom.xml @@ -1,6 +1,5 @@ - + 4.0.0 diff --git a/extension/openflowplugin-extension-nicira/src/main/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/RegConvertor.java b/extension/openflowplugin-extension-nicira/src/main/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/RegConvertor.java index 42320ce536..dfd68766cd 100644 --- a/extension/openflowplugin-extension-nicira/src/main/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/RegConvertor.java +++ b/extension/openflowplugin-extension-nicira/src/main/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/RegConvertor.java @@ -66,7 +66,7 @@ public class RegConvertor implements ConvertorToOFJava, ConvertorFro String msg = input.getOxmMatchField() + " does not implement " + org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxReg.class; - LOG.warn(msg); + LOG.warn("Warning {}",msg); throw new IllegalStateException(msg); } nxRegBuilder.setReg((Class>any(), - Matchers.>any(), + ArgumentMatchers.>any()); } } diff --git a/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/action/CtClearConvertorTest.java b/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/action/CtClearConvertorTest.java index 7793a271f8..d1087596fe 100644 --- a/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/action/CtClearConvertorTest.java +++ b/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/action/CtClearConvertorTest.java @@ -8,8 +8,6 @@ package org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.action; -import static org.mockito.Mockito.when; - import org.junit.Assert; import org.junit.Before; import org.junit.Test; @@ -45,12 +43,9 @@ public class CtClearConvertorTest { @Before public void setUp() throws Exception { final NxCtClear nxCtClear = Mockito.mock(NxCtClear.class); - when(actionsCase.getNxCtClear()).thenReturn(nxCtClear); final ActionCtClear actionCtClear = Mockito.mock(ActionCtClear.class); final NxActionCtClear nxActionCtClear = Mockito.mock(NxActionCtClear.class); - when(actionCtClear.getNxActionCtClear()).thenReturn(nxActionCtClear); - when(action.getActionChoice()).thenReturn(actionCtClear); ctClearConvertor = new CtClearConvertor(); } diff --git a/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/action/DecNshTtlConvertorTest.java b/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/action/DecNshTtlConvertorTest.java index aaa9390d1d..003c64eacd 100644 --- a/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/action/DecNshTtlConvertorTest.java +++ b/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/action/DecNshTtlConvertorTest.java @@ -8,8 +8,6 @@ package org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.action; -import static org.mockito.Mockito.when; - import org.junit.Assert; import org.junit.Before; import org.junit.Test; @@ -38,12 +36,9 @@ public class DecNshTtlConvertorTest { @Before public void setUp() throws Exception { NxDecNshTtl nxDecNshTtl = Mockito.mock(NxDecNshTtl.class); - when(actionsCase.getNxDecNshTtl()).thenReturn(nxDecNshTtl); NxActionDecNshTtl nxActionDecNshTtl = Mockito.mock(NxActionDecNshTtl.class); ActionDecNshTtl actionDecNshTtl = Mockito.mock(ActionDecNshTtl.class); - when(actionDecNshTtl.getNxActionDecNshTtl()).thenReturn(nxActionDecNshTtl); - when(action.getActionChoice()).thenReturn(actionDecNshTtl); decNshTtlConvertor = new DecNshTtlConvertor(); } diff --git a/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/action/RegMoveConvertorTest.java b/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/action/RegMoveConvertorTest.java index f6d9a96776..1966331af4 100644 --- a/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/action/RegMoveConvertorTest.java +++ b/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/action/RegMoveConvertorTest.java @@ -63,7 +63,6 @@ public class RegMoveConvertorTest { when(nxRegMove.getSrc()).thenReturn(src); when(nxRegMove.getDst()).thenReturn(dst); when(nxRegMove.getSrc().getStart()).thenReturn(1); - when(nxRegMove.getSrc().getEnd()).thenReturn(2); when(nxRegMove.getDst().getStart()).thenReturn(3); when(nxRegMove.getDst().getEnd()).thenReturn(4); when(nxRegMove.getDst().getDstChoice()).thenReturn(new DstNxTunIdCaseBuilder().build()); diff --git a/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/ArpOpConvertorTest.java b/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/ArpOpConvertorTest.java index 16b5ad4902..9a73c93ec2 100644 --- a/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/ArpOpConvertorTest.java +++ b/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/ArpOpConvertorTest.java @@ -14,7 +14,7 @@ import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.Matchers; +import org.mockito.ArgumentMatchers; import org.mockito.Mock; import org.mockito.runners.MockitoJUnitRunner; import org.opendaylight.openflowplugin.extension.api.ExtensionAugment; @@ -64,7 +64,7 @@ public class ArpOpConvertorTest { nxAugMatchRpcAddFlowBuilder.setNxmOfArpOp(nxmOfArpOpBuilder.build()); final Augmentation extensionAugmentation = nxAugMatchRpcAddFlowBuilder.build(); - when(extension.augmentation(Matchers.>>any())) + when(extension.augmentation(ArgumentMatchers.>>any())) .thenReturn(extensionAugmentation); final MatchEntry converted = arpOpConvertor.convert(extension); diff --git a/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/ArpShaConvertorTest.java b/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/ArpShaConvertorTest.java index 572af61937..691962727b 100644 --- a/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/ArpShaConvertorTest.java +++ b/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/ArpShaConvertorTest.java @@ -14,7 +14,7 @@ import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.Matchers; +import org.mockito.ArgumentMatchers; import org.mockito.Mock; import org.mockito.runners.MockitoJUnitRunner; import org.opendaylight.openflowplugin.extension.api.ExtensionAugment; @@ -61,7 +61,7 @@ public class ArpShaConvertorTest { .setNxmNxArpSha(nxmNxArpShaBuilder.build()); final Augmentation extensionAugmentation = nxAugMatchRpcAddFlowBuilder.build(); - when(extension.augmentation(Matchers.>>any())) + when(extension.augmentation(ArgumentMatchers.>>any())) .thenReturn(extensionAugmentation); arpShaConvertor = new ArpShaConvertor(); diff --git a/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/ArpSpaConvertorTest.java b/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/ArpSpaConvertorTest.java index d862b0b2ad..8edc67b547 100644 --- a/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/ArpSpaConvertorTest.java +++ b/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/ArpSpaConvertorTest.java @@ -14,7 +14,7 @@ import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.Matchers; +import org.mockito.ArgumentMatchers; import org.mockito.Mock; import org.mockito.runners.MockitoJUnitRunner; import org.opendaylight.openflowplugin.extension.api.ExtensionAugment; @@ -63,7 +63,7 @@ public class ArpSpaConvertorTest { nxAugMatchRpcAddFlowBuilder.setNxmOfArpSpa(nxmOfArpSpaBuilder.build()); final Augmentation extensionAugmentation = nxAugMatchRpcAddFlowBuilder.build(); - when(extension.augmentation(Matchers.>>any())) + when(extension.augmentation(ArgumentMatchers.>>any())) .thenReturn(extensionAugmentation); final MatchEntry converted = arpSpaConvertor.convert(extension); diff --git a/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/ArpThaConvertorTest.java b/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/ArpThaConvertorTest.java index 7e13f66cbc..b12ddf6e0b 100644 --- a/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/ArpThaConvertorTest.java +++ b/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/ArpThaConvertorTest.java @@ -14,7 +14,7 @@ import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.Matchers; +import org.mockito.ArgumentMatchers; import org.mockito.Mock; import org.mockito.runners.MockitoJUnitRunner; import org.opendaylight.openflowplugin.extension.api.ExtensionAugment; @@ -58,7 +58,7 @@ public class ArpThaConvertorTest { .setNxmNxArpTha(nxArpThaBuilder.build()); final Augmentation extensionAugmentation = nxAugMatchRpcAddFlowBuilder.build(); - when(extension.augmentation(Matchers.>>any())) + when(extension.augmentation(ArgumentMatchers.>>any())) .thenReturn(extensionAugmentation); arpThaConvertor = new ArpThaConvertor(); diff --git a/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/ArpTpaConvertorTest.java b/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/ArpTpaConvertorTest.java index 2627186e27..54ab65f895 100644 --- a/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/ArpTpaConvertorTest.java +++ b/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/ArpTpaConvertorTest.java @@ -14,7 +14,7 @@ import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.Matchers; +import org.mockito.ArgumentMatchers; import org.mockito.Mock; import org.mockito.runners.MockitoJUnitRunner; import org.opendaylight.openflowplugin.extension.api.ExtensionAugment; @@ -59,7 +59,7 @@ public class ArpTpaConvertorTest { nxAugMatchRpcAddFlowBuilder.setNxmOfArpTpa(nxmOfArpTpaBuilder.build()); final Augmentation extensionAugmentation = nxAugMatchRpcAddFlowBuilder.build(); - when(extension.augmentation(Matchers.>>any())) + when(extension.augmentation(ArgumentMatchers.>>any())) .thenReturn(extensionAugmentation); arpTpaConvertor = new ArpTpaConvertor(); diff --git a/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/CtStateConvertorTest.java b/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/CtStateConvertorTest.java index 5e6f651aa4..74bc6092d8 100644 --- a/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/CtStateConvertorTest.java +++ b/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/CtStateConvertorTest.java @@ -14,7 +14,7 @@ import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.Matchers; +import org.mockito.ArgumentMatchers; import org.mockito.Mock; import org.mockito.runners.MockitoJUnitRunner; import org.opendaylight.openflowplugin.extension.api.ExtensionAugment; @@ -57,7 +57,7 @@ public class CtStateConvertorTest { nxAugMatchNotifUpdateFlowStatsBuilder.setNxmNxCtState(nxmNxCtStateBuilder.build()); final Augmentation extensionAugmentation = nxAugMatchNotifUpdateFlowStatsBuilder.build(); - when(extension.augmentation(Matchers.>>any())) + when(extension.augmentation(ArgumentMatchers.>>any())) .thenReturn(extensionAugmentation); ctStateConvertor = new CtStateConvertor(); diff --git a/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/CtZoneConvertorTest.java b/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/CtZoneConvertorTest.java index 91a5c39186..91de7ef96a 100644 --- a/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/CtZoneConvertorTest.java +++ b/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/CtZoneConvertorTest.java @@ -14,7 +14,7 @@ import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.Matchers; +import org.mockito.ArgumentMatchers; import org.mockito.Mock; import org.mockito.runners.MockitoJUnitRunner; import org.opendaylight.openflowplugin.extension.api.ExtensionAugment; @@ -56,7 +56,7 @@ public class CtZoneConvertorTest { nxAugMatchNotifUpdateFlowStatsBuilder.setNxmNxCtZone(nxmNxCtZoneBuilder.build()); final Augmentation extensionAugmentation = nxAugMatchNotifUpdateFlowStatsBuilder.build(); - when(extension.augmentation(Matchers.>>any())) + when(extension.augmentation(ArgumentMatchers.>>any())) .thenReturn(extensionAugmentation); ctZoneConvertor = new CtZoneConvertor(); diff --git a/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/EthDstConvertorTest.java b/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/EthDstConvertorTest.java index f9c1a8c985..a22f935ce2 100644 --- a/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/EthDstConvertorTest.java +++ b/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/EthDstConvertorTest.java @@ -14,7 +14,7 @@ import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.Matchers; +import org.mockito.ArgumentMatchers; import org.mockito.Mock; import org.mockito.runners.MockitoJUnitRunner; import org.opendaylight.openflowplugin.extension.api.ExtensionAugment; @@ -59,7 +59,7 @@ public class EthDstConvertorTest { nxAugMatchNotifUpdateFlowStatsBuilder.setNxmOfEthDst(nxmOfEthDstBuilder.build()); final Augmentation extensionAugmentation = nxAugMatchNotifUpdateFlowStatsBuilder.build(); - when(extension.augmentation(Matchers.>>any())) + when(extension.augmentation(ArgumentMatchers.>>any())) .thenReturn(extensionAugmentation); ethDstConvertor = new EthDstConvertor(); diff --git a/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/EthSrcConvertorTest.java b/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/EthSrcConvertorTest.java index 7c1461a380..5bbd43602f 100644 --- a/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/EthSrcConvertorTest.java +++ b/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/EthSrcConvertorTest.java @@ -14,7 +14,7 @@ import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.Matchers; +import org.mockito.ArgumentMatchers; import org.mockito.Mock; import org.mockito.runners.MockitoJUnitRunner; import org.opendaylight.openflowplugin.extension.api.ExtensionAugment; @@ -58,7 +58,7 @@ public class EthSrcConvertorTest { nxAugMatchNotifUpdateFlowStatsBuilder.setNxmOfEthSrc(nxmOfEthSrcBuilder.build()); final Augmentation extensionAugmentation = nxAugMatchNotifUpdateFlowStatsBuilder.build(); - when(extension.augmentation(Matchers.>>any())) + when(extension.augmentation(ArgumentMatchers.>>any())) .thenReturn(extensionAugmentation); ethSrcConvertor = new EthSrcConvertor(); diff --git a/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/EthTypeConvertorTest.java b/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/EthTypeConvertorTest.java index 6e4e3a37f2..cf79ad901d 100644 --- a/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/EthTypeConvertorTest.java +++ b/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/EthTypeConvertorTest.java @@ -14,7 +14,7 @@ import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.Matchers; +import org.mockito.ArgumentMatchers; import org.mockito.Mock; import org.mockito.runners.MockitoJUnitRunner; import org.opendaylight.openflowplugin.extension.api.ExtensionAugment; @@ -56,7 +56,7 @@ public class EthTypeConvertorTest { nxAugMatchNotifUpdateFlowStatsBuilder.setNxmOfEthType(nxmOfEthTypeBuilder.build()); final Augmentation extensionAugmentation = nxAugMatchNotifUpdateFlowStatsBuilder.build(); - when(extension.augmentation(Matchers.>>any())) + when(extension.augmentation(ArgumentMatchers.>>any())) .thenReturn(extensionAugmentation); ethTypeConvertor = new EthTypeConvertor(); diff --git a/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/NshFlagsConvertorTest.java b/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/NshFlagsConvertorTest.java index fe94f6857b..24c821ee56 100644 --- a/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/NshFlagsConvertorTest.java +++ b/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/NshFlagsConvertorTest.java @@ -14,7 +14,7 @@ import static org.mockito.Mockito.when; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.Matchers; +import org.mockito.ArgumentMatchers; import org.mockito.Mock; import org.mockito.runners.MockitoJUnitRunner; import org.opendaylight.openflowjava.nx.api.NiciraConstants; @@ -53,7 +53,7 @@ public class NshFlagsConvertorTest { NxAugMatchNodesNodeTableFlow nxAugMatchNotifUpdateFlowStats = new NxAugMatchNodesNodeTableFlowBuilder() .setNxmNxNshFlags(nxmNxNshFlags) .build(); - when(extension.augmentation(Matchers.>>any())) + when(extension.augmentation(ArgumentMatchers.>>any())) .thenReturn(nxAugMatchNotifUpdateFlowStats); convertor = new NshFlagsConvertor(); diff --git a/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/NshMdtypeConvertorTest.java b/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/NshMdtypeConvertorTest.java index bfc2f5cee8..53589832cf 100644 --- a/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/NshMdtypeConvertorTest.java +++ b/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/NshMdtypeConvertorTest.java @@ -14,7 +14,7 @@ import static org.mockito.Mockito.when; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.Matchers; +import org.mockito.ArgumentMatchers; import org.mockito.Mock; import org.mockito.runners.MockitoJUnitRunner; import org.opendaylight.openflowjava.nx.api.NiciraConstants; @@ -52,7 +52,7 @@ public class NshMdtypeConvertorTest { NxAugMatchNodesNodeTableFlow nxAugMatchNotifUpdateFlowStats = new NxAugMatchNodesNodeTableFlowBuilder() .setNxmNxNshMdtype(nxmNxNshMdtype) .build(); - when(extension.augmentation(Matchers.>>any())) + when(extension.augmentation(ArgumentMatchers.>>any())) .thenReturn(nxAugMatchNotifUpdateFlowStats); convertor = new NshMdtypeConvertor(); diff --git a/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/NshNpConvertorTest.java b/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/NshNpConvertorTest.java index 17f78a9fa1..accbe716f4 100644 --- a/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/NshNpConvertorTest.java +++ b/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/NshNpConvertorTest.java @@ -14,7 +14,7 @@ import static org.mockito.Mockito.when; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.Matchers; +import org.mockito.ArgumentMatchers; import org.mockito.Mock; import org.mockito.runners.MockitoJUnitRunner; import org.opendaylight.openflowjava.nx.api.NiciraConstants; @@ -52,7 +52,7 @@ public class NshNpConvertorTest { NxAugMatchNodesNodeTableFlow nxAugMatchNotifUpdateFlowStats = new NxAugMatchNodesNodeTableFlowBuilder() .setNxmNxNshNp(nxmNxNshNp) .build(); - when(extension.augmentation(Matchers.>>any())) + when(extension.augmentation(ArgumentMatchers.>>any())) .thenReturn(nxAugMatchNotifUpdateFlowStats); convertor = new NshNpConvertor(); diff --git a/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/NshTtlConvertorTest.java b/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/NshTtlConvertorTest.java index a2a3047c4c..9e77190cce 100644 --- a/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/NshTtlConvertorTest.java +++ b/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/NshTtlConvertorTest.java @@ -14,7 +14,7 @@ import static org.mockito.Mockito.when; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.Matchers; +import org.mockito.ArgumentMatchers; import org.mockito.Mock; import org.mockito.runners.MockitoJUnitRunner; import org.opendaylight.openflowjava.nx.api.NiciraConstants; @@ -51,7 +51,7 @@ public class NshTtlConvertorTest { NxAugMatchNodesNodeTableFlow nxAugMatchNotifUpdateFlowStats = new NxAugMatchNodesNodeTableFlowBuilder() .setNxmNxNshTtl(nxmNxNshTtl) .build(); - when(extension.augmentation(Matchers.>>any())) + when(extension.augmentation(ArgumentMatchers.>>any())) .thenReturn(nxAugMatchNotifUpdateFlowStats); convertor = new NshTtlConvertor(); diff --git a/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/Nshc1ConvertorTest.java b/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/Nshc1ConvertorTest.java index 2cff7c0984..bf38808704 100644 --- a/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/Nshc1ConvertorTest.java +++ b/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/Nshc1ConvertorTest.java @@ -14,7 +14,7 @@ import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.Matchers; +import org.mockito.ArgumentMatchers; import org.mockito.Mock; import org.mockito.runners.MockitoJUnitRunner; import org.opendaylight.openflowjava.nx.api.NiciraConstants; @@ -54,7 +54,7 @@ public class Nshc1ConvertorTest { NxAugMatchNodesNodeTableFlow nxAugMatchNotifUpdateFlowStats = new NxAugMatchNodesNodeTableFlowBuilder() .setNxmNxNshc1(nxmNxNshc1) .build(); - when(extension.augmentation(Matchers.>>any())) + when(extension.augmentation(ArgumentMatchers.>>any())) .thenReturn(nxAugMatchNotifUpdateFlowStats); nshc1Convertor = new Nshc1Convertor(); diff --git a/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/Nshc2ConvertorTest.java b/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/Nshc2ConvertorTest.java index 513c36c342..6ebdcc54b5 100644 --- a/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/Nshc2ConvertorTest.java +++ b/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/Nshc2ConvertorTest.java @@ -14,7 +14,7 @@ import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.Matchers; +import org.mockito.ArgumentMatchers; import org.mockito.Mock; import org.mockito.runners.MockitoJUnitRunner; import org.opendaylight.openflowjava.nx.api.NiciraConstants; @@ -54,7 +54,7 @@ public class Nshc2ConvertorTest { NxAugMatchNodesNodeTableFlow nxAugMatchNotifUpdateFlowStats = new NxAugMatchNodesNodeTableFlowBuilder() .setNxmNxNshc2(nxmNxNshc2) .build(); - when(extension.augmentation(Matchers.>>any())) + when(extension.augmentation(ArgumentMatchers.>>any())) .thenReturn(nxAugMatchNotifUpdateFlowStats); nshc2Convertor = new Nshc2Convertor(); diff --git a/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/Nshc3ConvertorTest.java b/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/Nshc3ConvertorTest.java index 84de5bc836..c799268697 100644 --- a/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/Nshc3ConvertorTest.java +++ b/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/Nshc3ConvertorTest.java @@ -14,7 +14,7 @@ import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.Matchers; +import org.mockito.ArgumentMatchers; import org.mockito.Mock; import org.mockito.runners.MockitoJUnitRunner; import org.opendaylight.openflowjava.nx.api.NiciraConstants; @@ -54,7 +54,7 @@ public class Nshc3ConvertorTest { NxAugMatchNodesNodeTableFlow nxAugMatchNotifUpdateFlowStats = new NxAugMatchNodesNodeTableFlowBuilder() .setNxmNxNshc3(nxmNxNshc3) .build(); - when(extension.augmentation(Matchers.>>any())) + when(extension.augmentation(ArgumentMatchers.>>any())) .thenReturn(nxAugMatchNotifUpdateFlowStats); nshc3Convertor = new Nshc3Convertor(); diff --git a/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/Nshc4ConvertorTest.java b/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/Nshc4ConvertorTest.java index aa369ba4db..6ffc7077c9 100644 --- a/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/Nshc4ConvertorTest.java +++ b/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/Nshc4ConvertorTest.java @@ -14,7 +14,7 @@ import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.Matchers; +import org.mockito.ArgumentMatchers; import org.mockito.Mock; import org.mockito.runners.MockitoJUnitRunner; import org.opendaylight.openflowjava.nx.api.NiciraConstants; @@ -54,7 +54,7 @@ public class Nshc4ConvertorTest { NxAugMatchNodesNodeTableFlow nxAugMatchNotifUpdateFlowStats = new NxAugMatchNodesNodeTableFlowBuilder() .setNxmNxNshc4(nxmNxNshc4) .build(); - when(extension.augmentation(Matchers.>>any())) + when(extension.augmentation(ArgumentMatchers.>>any())) .thenReturn(nxAugMatchNotifUpdateFlowStats); nshc4Convertor = new Nshc4Convertor(); diff --git a/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/NsiConvertorTest.java b/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/NsiConvertorTest.java index eb5bdac235..1bfdff2fe3 100644 --- a/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/NsiConvertorTest.java +++ b/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/NsiConvertorTest.java @@ -14,7 +14,7 @@ import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.Matchers; +import org.mockito.ArgumentMatchers; import org.mockito.Mock; import org.mockito.runners.MockitoJUnitRunner; import org.opendaylight.openflowjava.nx.api.NiciraConstants; @@ -53,7 +53,7 @@ public class NsiConvertorTest { NxAugMatchNodesNodeTableFlow nxAugMatchNotifUpdateFlowStats = new NxAugMatchNodesNodeTableFlowBuilder() .setNxmNxNsi(nxmNxNsi) .build(); - when(extension.augmentation(Matchers.>>any())) + when(extension.augmentation(ArgumentMatchers.>>any())) .thenReturn(nxAugMatchNotifUpdateFlowStats); nsiConvertor = new NsiConvertor(); diff --git a/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/NspConvertorTest.java b/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/NspConvertorTest.java index b611a2165e..655bb70d52 100644 --- a/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/NspConvertorTest.java +++ b/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/NspConvertorTest.java @@ -14,7 +14,7 @@ import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.Matchers; +import org.mockito.ArgumentMatchers; import org.mockito.Mock; import org.mockito.runners.MockitoJUnitRunner; import org.opendaylight.openflowjava.nx.api.NiciraConstants; @@ -53,7 +53,7 @@ public class NspConvertorTest { NxAugMatchNodesNodeTableFlow nxAugMatchNotifUpdateFlowStats = new NxAugMatchNodesNodeTableFlowBuilder() .setNxmNxNsp(nxmNxNsp) .build(); - when(extension.augmentation(Matchers.>>any())) + when(extension.augmentation(ArgumentMatchers.>>any())) .thenReturn(nxAugMatchNotifUpdateFlowStats); nspConvertor = new NspConvertor(); diff --git a/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/TcpDstConvertorTest.java b/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/TcpDstConvertorTest.java index ea49b245a7..ba3410d7f9 100644 --- a/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/TcpDstConvertorTest.java +++ b/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/TcpDstConvertorTest.java @@ -14,7 +14,7 @@ import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.Matchers; +import org.mockito.ArgumentMatchers; import org.mockito.Mock; import org.mockito.runners.MockitoJUnitRunner; import org.opendaylight.openflowplugin.extension.api.ExtensionAugment; @@ -58,7 +58,7 @@ public class TcpDstConvertorTest { nxAugMatchNotifUpdateFlowStatsBuilder.setNxmOfTcpDst(nxmOfTcpDstBuilder.build()); final Augmentation extensionAugmentation = nxAugMatchNotifUpdateFlowStatsBuilder.build(); - when(extension.augmentation(Matchers.>>any())) + when(extension.augmentation(ArgumentMatchers.>>any())) .thenReturn(extensionAugmentation); tcpDstConvertor = new TcpDstConvertor(); diff --git a/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/TcpSrcConvertorTest.java b/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/TcpSrcConvertorTest.java index 3cb536215a..db7682b5c8 100644 --- a/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/TcpSrcConvertorTest.java +++ b/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/TcpSrcConvertorTest.java @@ -14,7 +14,7 @@ import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.Matchers; +import org.mockito.ArgumentMatchers; import org.mockito.Mock; import org.mockito.runners.MockitoJUnitRunner; import org.opendaylight.openflowplugin.extension.api.ExtensionAugment; @@ -58,7 +58,7 @@ public class TcpSrcConvertorTest { nxAugMatchNotifUpdateFlowStatsBuilder.setNxmOfTcpSrc(nxmOfTcpSrcBuilder.build()); final Augmentation extensionAugmentation = nxAugMatchNotifUpdateFlowStatsBuilder.build(); - when(extension.augmentation(Matchers.>>any())) + when(extension.augmentation(ArgumentMatchers.>>any())) .thenReturn(extensionAugmentation); tcpSrcConvertor = new TcpSrcConvertor(); diff --git a/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/TunIPv4DstConvertorTest.java b/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/TunIPv4DstConvertorTest.java index 12e6ec2a41..8c040a0c73 100644 --- a/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/TunIPv4DstConvertorTest.java +++ b/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/TunIPv4DstConvertorTest.java @@ -14,7 +14,7 @@ import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.Matchers; +import org.mockito.ArgumentMatchers; import org.mockito.Mock; import org.mockito.runners.MockitoJUnitRunner; import org.opendaylight.openflowplugin.extension.api.ExtensionAugment; @@ -58,7 +58,7 @@ public class TunIPv4DstConvertorTest { nxAugMatchNotifUpdateFlowStatsBuilder.setNxmNxTunIpv4Dst(nxmNxTunIpv4DstBuilder.build()); final Augmentation extensionAugmentation = nxAugMatchNotifUpdateFlowStatsBuilder.build(); - when(extension.augmentation(Matchers.>>any())) + when(extension.augmentation(ArgumentMatchers.>>any())) .thenReturn(extensionAugmentation); tunIPv4DstConvertor = new TunIPv4DstConvertor(); diff --git a/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/TunIPv4SrcConvertorTest.java b/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/TunIPv4SrcConvertorTest.java index bd370c1ef1..e650aae40d 100644 --- a/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/TunIPv4SrcConvertorTest.java +++ b/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/TunIPv4SrcConvertorTest.java @@ -14,7 +14,7 @@ import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.Matchers; +import org.mockito.ArgumentMatchers; import org.mockito.Mock; import org.mockito.runners.MockitoJUnitRunner; import org.opendaylight.openflowplugin.extension.api.ExtensionAugment; @@ -58,7 +58,7 @@ public class TunIPv4SrcConvertorTest { nxAugMatchNotifUpdateFlowStatsBuilder.setNxmNxTunIpv4Src(nxmNxTunIpv4SrcBuilder.build()); final Augmentation extensionAugmentation = nxAugMatchNotifUpdateFlowStatsBuilder.build(); - when(extension.augmentation(Matchers.>>any())) + when(extension.augmentation(ArgumentMatchers.>>any())) .thenReturn(extensionAugmentation); tunIPv4DstConvertor = new TunIPv4SrcConvertor(); diff --git a/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/TunIdConvertorTest.java b/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/TunIdConvertorTest.java index 4fde6b6173..45e7b4cb8a 100644 --- a/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/TunIdConvertorTest.java +++ b/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/TunIdConvertorTest.java @@ -15,7 +15,7 @@ import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.Matchers; +import org.mockito.ArgumentMatchers; import org.mockito.Mock; import org.mockito.runners.MockitoJUnitRunner; import org.opendaylight.openflowplugin.extension.api.ExtensionAugment; @@ -55,7 +55,7 @@ public class TunIdConvertorTest { nxAugMatchNotifUpdateFlowStatsBuilder.setNxmNxTunId(nxmNxTunIdBuilder.build()); final Augmentation extensionAugmentation = nxAugMatchNotifUpdateFlowStatsBuilder.build(); - when(extension.augmentation(Matchers.>>any())) + when(extension.augmentation(ArgumentMatchers.>>any())) .thenReturn(extensionAugmentation); tunIdConvertor = new TunIdConvertor(); diff --git a/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/UdpDstConvertorTest.java b/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/UdpDstConvertorTest.java index 08b8734900..d6a914bc96 100644 --- a/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/UdpDstConvertorTest.java +++ b/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/UdpDstConvertorTest.java @@ -14,7 +14,7 @@ import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.Matchers; +import org.mockito.ArgumentMatchers; import org.mockito.Mock; import org.mockito.runners.MockitoJUnitRunner; import org.opendaylight.openflowplugin.extension.api.ExtensionAugment; @@ -58,7 +58,7 @@ public class UdpDstConvertorTest { nxAugMatchNotifUpdateFlowStatsBuilder.setNxmOfUdpDst(nxmOfUdpDstBuilder.build()); final Augmentation extensionAugmentation = nxAugMatchNotifUpdateFlowStatsBuilder.build(); - when(extension.augmentation(Matchers.>>any())) + when(extension.augmentation(ArgumentMatchers.>>any())) .thenReturn(extensionAugmentation); udpDstConvertor = new UdpDstConvertor(); diff --git a/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/UdpSrcConvertorTest.java b/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/UdpSrcConvertorTest.java index ed5e149de2..a73ec77162 100644 --- a/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/UdpSrcConvertorTest.java +++ b/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/UdpSrcConvertorTest.java @@ -14,7 +14,7 @@ import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.Matchers; +import org.mockito.ArgumentMatchers; import org.mockito.Mock; import org.mockito.runners.MockitoJUnitRunner; import org.opendaylight.openflowplugin.extension.api.ExtensionAugment; @@ -58,7 +58,7 @@ public class UdpSrcConvertorTest { nxAugMatchNotifUpdateFlowStatsBuilder.setNxmOfUdpSrc(nxmOfUdpSrcBuilder.build()); final Augmentation extensionAugmentation = nxAugMatchNotifUpdateFlowStatsBuilder.build(); - when(extension.augmentation(Matchers.>>any())) + when(extension.augmentation(ArgumentMatchers.>>any())) .thenReturn(extensionAugmentation); udpSrcConvertor = new UdpSrcConvertor(); diff --git a/extension/openflowplugin-extension-onf/pom.xml b/extension/openflowplugin-extension-onf/pom.xml index d3fbcfab7a..d5049645c5 100644 --- a/extension/openflowplugin-extension-onf/pom.xml +++ b/extension/openflowplugin-extension-onf/pom.xml @@ -6,9 +6,7 @@ terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html --> - + org.opendaylight.openflowplugin openflowplugin-extension-parent @@ -62,4 +60,4 @@ - \ No newline at end of file + diff --git a/extension/openflowplugin-extension-onf/src/test/java/org/opendaylight/openflowplugin/extension/onf/deserializer/BundleControlFactoryTest.java b/extension/openflowplugin-extension-onf/src/test/java/org/opendaylight/openflowplugin/extension/onf/deserializer/BundleControlFactoryTest.java index 554b2d6035..14eeae14d1 100644 --- a/extension/openflowplugin-extension-onf/src/test/java/org/opendaylight/openflowplugin/extension/onf/deserializer/BundleControlFactoryTest.java +++ b/extension/openflowplugin-extension-onf/src/test/java/org/opendaylight/openflowplugin/extension/onf/deserializer/BundleControlFactoryTest.java @@ -8,11 +8,12 @@ package org.opendaylight.openflowplugin.extension.onf.deserializer; +import static org.mockito.ArgumentMatchers.any; + import io.netty.buffer.ByteBuf; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.Matchers; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.runners.MockitoJUnitRunner; @@ -72,7 +73,7 @@ public class BundleControlFactoryTest { + "00 00 " // type 2 + "00 04 " // length 2 + "00 00 00 00"); // data 2 - Mockito.when(registry.getDeserializer(Matchers.any(MessageCodeKey.class))) + Mockito.when(registry.getDeserializer(any(MessageCodeKey.class))) .thenReturn(experimenterPropertyDeserializer); ((DeserializerRegistryInjector)factory).injectDeserializerRegistry(registry); BundleControlOnf builtByFactory = factory.deserialize(buffer); diff --git a/extension/openflowplugin-extension-onf/src/test/java/org/opendaylight/openflowplugin/extension/onf/serializer/BundleAddMessageFactoryTest.java b/extension/openflowplugin-extension-onf/src/test/java/org/opendaylight/openflowplugin/extension/onf/serializer/BundleAddMessageFactoryTest.java index 03e65735dd..7b117b26e2 100644 --- a/extension/openflowplugin-extension-onf/src/test/java/org/opendaylight/openflowplugin/extension/onf/serializer/BundleAddMessageFactoryTest.java +++ b/extension/openflowplugin-extension-onf/src/test/java/org/opendaylight/openflowplugin/extension/onf/serializer/BundleAddMessageFactoryTest.java @@ -8,6 +8,8 @@ package org.opendaylight.openflowplugin.extension.onf.serializer; +import static org.mockito.ArgumentMatchers.any; + import io.netty.buffer.ByteBuf; import io.netty.buffer.UnpooledByteBufAllocator; import java.util.ArrayList; @@ -15,7 +17,6 @@ import java.util.Collections; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.Matchers; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.runners.MockitoJUnitRunner; @@ -86,11 +87,11 @@ public class BundleAddMessageFactoryTest extends AbstractBundleMessageFactoryTes if (withProperty) { dataBuilder.setBundleProperty(new ArrayList<>(Collections.singleton( BundleTestUtils.createExperimenterProperty(propertyExperimenterData)))); - Mockito.when(registry.getSerializer(Matchers.any())) + Mockito.when(registry.getSerializer(any())) .thenReturn(caseSerializer) .thenReturn(propertySerializer); } else { - Mockito.when(registry.getSerializer(Matchers.any())).thenReturn(caseSerializer); + Mockito.when(registry.getSerializer(any())).thenReturn(caseSerializer); } builder.setOnfAddMessageGroupingData(dataBuilder.build()); @@ -102,7 +103,7 @@ public class BundleAddMessageFactoryTest extends AbstractBundleMessageFactoryTes Assert.assertEquals("Wrong bundle ID", 1L, out.readUnsignedInt()); long padding = out.readUnsignedShort(); Assert.assertEquals("Wrong flags", 1, out.readUnsignedShort()); - Mockito.verify(caseSerializer).serialize(Mockito.any(), Mockito.any()); + Mockito.verify(caseSerializer).serialize(any(), any()); if (withProperty) { Mockito.verify(propertySerializer).serialize(propertyExperimenterData, out); diff --git a/extension/openflowplugin-extension-onf/src/test/java/org/opendaylight/openflowplugin/extension/onf/serializer/BundleControlFactoryTest.java b/extension/openflowplugin-extension-onf/src/test/java/org/opendaylight/openflowplugin/extension/onf/serializer/BundleControlFactoryTest.java index ae87396271..15210b600b 100644 --- a/extension/openflowplugin-extension-onf/src/test/java/org/opendaylight/openflowplugin/extension/onf/serializer/BundleControlFactoryTest.java +++ b/extension/openflowplugin-extension-onf/src/test/java/org/opendaylight/openflowplugin/extension/onf/serializer/BundleControlFactoryTest.java @@ -8,6 +8,8 @@ package org.opendaylight.openflowplugin.extension.onf.serializer; +import static org.mockito.ArgumentMatchers.any; + import io.netty.buffer.ByteBuf; import io.netty.buffer.UnpooledByteBufAllocator; import java.util.ArrayList; @@ -15,7 +17,6 @@ import java.util.Collections; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.Matchers; import org.mockito.Mockito; import org.mockito.runners.MockitoJUnitRunner; import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer; @@ -56,7 +57,7 @@ public class BundleControlFactoryTest extends AbstractBundleMessageFactoryTest { if (withProperty) { dataBuilder.setBundleProperty(new ArrayList<>(Collections.singleton( BundleTestUtils.createExperimenterProperty(propertyExperimenterData)))); - Mockito.when(registry.getSerializer(Matchers.any())).thenReturn(propertySerializer); + Mockito.when(registry.getSerializer(any())).thenReturn(propertySerializer); ((SerializerRegistryInjector) factory).injectSerializerRegistry(registry); } diff --git a/extension/pom.xml b/extension/pom.xml index 55d114861d..61b2e1795c 100644 --- a/extension/pom.xml +++ b/extension/pom.xml @@ -1,6 +1,5 @@ - + 4.0.0 diff --git a/extension/test-extension/pom.xml b/extension/test-extension/pom.xml index 7e3eab2822..47cfc2f0ab 100644 --- a/extension/test-extension/pom.xml +++ b/extension/test-extension/pom.xml @@ -1,6 +1,5 @@ - + 4.0.0 org.opendaylight.openflowplugin diff --git a/features-aggregator/features-openflowplugin/pom.xml b/features-aggregator/features-openflowplugin/pom.xml index d263e18fe7..b8c9dde450 100644 --- a/features-aggregator/features-openflowplugin/pom.xml +++ b/features-aggregator/features-openflowplugin/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.odlparent feature-repo-parent - 3.1.3 + 4.0.2 diff --git a/features-aggregator/odl-openflowplugin-app-arbitratorreconciliation/pom.xml b/features-aggregator/odl-openflowplugin-app-arbitratorreconciliation/pom.xml index 20171a8f4e..d553ee062f 100644 --- a/features-aggregator/odl-openflowplugin-app-arbitratorreconciliation/pom.xml +++ b/features-aggregator/odl-openflowplugin-app-arbitratorreconciliation/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.odlparent single-feature-parent - 3.1.3 + 4.0.2 diff --git a/features-aggregator/odl-openflowplugin-app-bulk-o-matic/pom.xml b/features-aggregator/odl-openflowplugin-app-bulk-o-matic/pom.xml index 2220becbd1..0bd6bdd357 100644 --- a/features-aggregator/odl-openflowplugin-app-bulk-o-matic/pom.xml +++ b/features-aggregator/odl-openflowplugin-app-bulk-o-matic/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.odlparent single-feature-parent - 3.1.3 + 4.0.2 diff --git a/features-aggregator/odl-openflowplugin-app-config-pusher/pom.xml b/features-aggregator/odl-openflowplugin-app-config-pusher/pom.xml index 710e09e642..9a6369e92a 100644 --- a/features-aggregator/odl-openflowplugin-app-config-pusher/pom.xml +++ b/features-aggregator/odl-openflowplugin-app-config-pusher/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.odlparent single-feature-parent - 3.1.3 + 4.0.2 diff --git a/features-aggregator/odl-openflowplugin-app-forwardingrules-manager/pom.xml b/features-aggregator/odl-openflowplugin-app-forwardingrules-manager/pom.xml index 37a1fe84e2..92d14fcc71 100644 --- a/features-aggregator/odl-openflowplugin-app-forwardingrules-manager/pom.xml +++ b/features-aggregator/odl-openflowplugin-app-forwardingrules-manager/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.odlparent single-feature-parent - 3.1.3 + 4.0.2 diff --git a/features-aggregator/odl-openflowplugin-app-forwardingrules-sync/pom.xml b/features-aggregator/odl-openflowplugin-app-forwardingrules-sync/pom.xml index 2a74460c1f..97d6fd45b3 100644 --- a/features-aggregator/odl-openflowplugin-app-forwardingrules-sync/pom.xml +++ b/features-aggregator/odl-openflowplugin-app-forwardingrules-sync/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.odlparent single-feature-parent - 3.1.3 + 4.0.2 diff --git a/features-aggregator/odl-openflowplugin-app-lldp-speaker/pom.xml b/features-aggregator/odl-openflowplugin-app-lldp-speaker/pom.xml index ab7d07cb60..782440e2ba 100644 --- a/features-aggregator/odl-openflowplugin-app-lldp-speaker/pom.xml +++ b/features-aggregator/odl-openflowplugin-app-lldp-speaker/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.odlparent single-feature-parent - 3.1.3 + 4.0.2 diff --git a/features-aggregator/odl-openflowplugin-app-notifications/pom.xml b/features-aggregator/odl-openflowplugin-app-notifications/pom.xml index d1ff8168bc..ae79eca340 100644 --- a/features-aggregator/odl-openflowplugin-app-notifications/pom.xml +++ b/features-aggregator/odl-openflowplugin-app-notifications/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.odlparent single-feature-parent - 3.1.3 + 4.0.2 diff --git a/features-aggregator/odl-openflowplugin-app-reconciliation-framework/pom.xml b/features-aggregator/odl-openflowplugin-app-reconciliation-framework/pom.xml index 2bc2445259..ec65f66ce7 100644 --- a/features-aggregator/odl-openflowplugin-app-reconciliation-framework/pom.xml +++ b/features-aggregator/odl-openflowplugin-app-reconciliation-framework/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.odlparent single-feature-parent - 3.1.3 + 4.0.2 diff --git a/features-aggregator/odl-openflowplugin-app-southbound-cli/pom.xml b/features-aggregator/odl-openflowplugin-app-southbound-cli/pom.xml index 5fe179cf23..ddd56e564c 100644 --- a/features-aggregator/odl-openflowplugin-app-southbound-cli/pom.xml +++ b/features-aggregator/odl-openflowplugin-app-southbound-cli/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.odlparent single-feature-parent - 3.1.3 + 4.0.2 diff --git a/features-aggregator/odl-openflowplugin-app-table-miss-enforcer/pom.xml b/features-aggregator/odl-openflowplugin-app-table-miss-enforcer/pom.xml index 5f7cc99f4b..fb0d043ad1 100644 --- a/features-aggregator/odl-openflowplugin-app-table-miss-enforcer/pom.xml +++ b/features-aggregator/odl-openflowplugin-app-table-miss-enforcer/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.odlparent single-feature-parent - 3.1.3 + 4.0.2 diff --git a/features-aggregator/odl-openflowplugin-app-topology-lldp-discovery/pom.xml b/features-aggregator/odl-openflowplugin-app-topology-lldp-discovery/pom.xml index 42a6197220..551bff49a7 100644 --- a/features-aggregator/odl-openflowplugin-app-topology-lldp-discovery/pom.xml +++ b/features-aggregator/odl-openflowplugin-app-topology-lldp-discovery/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.odlparent single-feature-parent - 3.1.3 + 4.0.2 diff --git a/features-aggregator/odl-openflowplugin-app-topology-manager/pom.xml b/features-aggregator/odl-openflowplugin-app-topology-manager/pom.xml index 6d92e46aa1..962d494cad 100644 --- a/features-aggregator/odl-openflowplugin-app-topology-manager/pom.xml +++ b/features-aggregator/odl-openflowplugin-app-topology-manager/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.odlparent single-feature-parent - 3.1.3 + 4.0.2 diff --git a/features-aggregator/odl-openflowplugin-app-topology/pom.xml b/features-aggregator/odl-openflowplugin-app-topology/pom.xml index eacdd8b69d..e5262b148c 100644 --- a/features-aggregator/odl-openflowplugin-app-topology/pom.xml +++ b/features-aggregator/odl-openflowplugin-app-topology/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.odlparent single-feature-parent - 3.1.3 + 4.0.2 diff --git a/features-aggregator/odl-openflowplugin-drop-test/pom.xml b/features-aggregator/odl-openflowplugin-drop-test/pom.xml index a89974d249..422b223ac0 100644 --- a/features-aggregator/odl-openflowplugin-drop-test/pom.xml +++ b/features-aggregator/odl-openflowplugin-drop-test/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.odlparent single-feature-parent - 3.1.3 + 4.0.2 diff --git a/features-aggregator/odl-openflowplugin-flow-services-rest/pom.xml b/features-aggregator/odl-openflowplugin-flow-services-rest/pom.xml index ea06ff2c25..731f4ae9b0 100644 --- a/features-aggregator/odl-openflowplugin-flow-services-rest/pom.xml +++ b/features-aggregator/odl-openflowplugin-flow-services-rest/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.odlparent single-feature-parent - 3.1.3 + 4.0.2 diff --git a/features-aggregator/odl-openflowplugin-flow-services/pom.xml b/features-aggregator/odl-openflowplugin-flow-services/pom.xml index 2ffd89927b..2cd84f0c5a 100644 --- a/features-aggregator/odl-openflowplugin-flow-services/pom.xml +++ b/features-aggregator/odl-openflowplugin-flow-services/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.odlparent single-feature-parent - 3.1.3 + 4.0.2 diff --git a/features-aggregator/odl-openflowplugin-libraries/pom.xml b/features-aggregator/odl-openflowplugin-libraries/pom.xml index ea5447210b..0a42c4c281 100644 --- a/features-aggregator/odl-openflowplugin-libraries/pom.xml +++ b/features-aggregator/odl-openflowplugin-libraries/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.odlparent single-feature-parent - 3.1.3 + 4.0.2 @@ -18,7 +18,7 @@ org.opendaylight.odlparent - odl-guava-23 + odl-guava xml features diff --git a/features-aggregator/odl-openflowplugin-libraries/src/main/feature/feature.xml b/features-aggregator/odl-openflowplugin-libraries/src/main/feature/feature.xml index cbf030d579..caa5966092 100644 --- a/features-aggregator/odl-openflowplugin-libraries/src/main/feature/feature.xml +++ b/features-aggregator/odl-openflowplugin-libraries/src/main/feature/feature.xml @@ -1,6 +1,6 @@ - odl-guava-23 + odl-guava diff --git a/features-aggregator/odl-openflowplugin-nsf-model/pom.xml b/features-aggregator/odl-openflowplugin-nsf-model/pom.xml index 8bdd5a5e6d..94f9252c35 100644 --- a/features-aggregator/odl-openflowplugin-nsf-model/pom.xml +++ b/features-aggregator/odl-openflowplugin-nsf-model/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.odlparent single-feature-parent - 3.1.3 + 4.0.2 @@ -21,7 +21,7 @@ org.opendaylight.mdsal mdsal-artifacts - 2.6.0-SNAPSHOT + 3.0.1 import pom diff --git a/features-aggregator/odl-openflowplugin-southbound/pom.xml b/features-aggregator/odl-openflowplugin-southbound/pom.xml index 3b55cb1268..38e0197217 100644 --- a/features-aggregator/odl-openflowplugin-southbound/pom.xml +++ b/features-aggregator/odl-openflowplugin-southbound/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.odlparent single-feature-parent - 3.1.3 + 4.0.2 diff --git a/features-aggregator/pom.xml b/features-aggregator/pom.xml index a04b584d2a..0cddbc15c6 100644 --- a/features-aggregator/pom.xml +++ b/features-aggregator/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.odlparent odlparent-lite - 3.1.3 + 4.0.2 diff --git a/libraries/liblldp/pom.xml b/libraries/liblldp/pom.xml index 99ddca1aa8..b785890d4d 100644 --- a/libraries/liblldp/pom.xml +++ b/libraries/liblldp/pom.xml @@ -58,4 +58,4 @@ https://wiki.opendaylight.org/view/OpenDaylight_OpenFlow_Plugin:Main HEAD - \ No newline at end of file + diff --git a/libraries/liblldp/src/main/java/org/opendaylight/openflowplugin/libraries/liblldp/BitBufferHelper.java b/libraries/liblldp/src/main/java/org/opendaylight/openflowplugin/libraries/liblldp/BitBufferHelper.java index 6d9ff899c7..b377bdcbfe 100644 --- a/libraries/liblldp/src/main/java/org/opendaylight/openflowplugin/libraries/liblldp/BitBufferHelper.java +++ b/libraries/liblldp/src/main/java/org/opendaylight/openflowplugin/libraries/liblldp/BitBufferHelper.java @@ -19,7 +19,7 @@ import org.slf4j.LoggerFactory; * convert primitive data types to stream of bits. */ public abstract class BitBufferHelper { - protected static final Logger LOG = LoggerFactory.getLogger(BitBufferHelper.class); + private static final Logger LOG = LoggerFactory.getLogger(BitBufferHelper.class); public static final long BYTE_MASK = 0xFF; diff --git a/libraries/liblldp/src/main/java/org/opendaylight/openflowplugin/libraries/liblldp/LLDP.java b/libraries/liblldp/src/main/java/org/opendaylight/openflowplugin/libraries/liblldp/LLDP.java index 0e10b316f1..cc799eb6b1 100644 --- a/libraries/liblldp/src/main/java/org/opendaylight/openflowplugin/libraries/liblldp/LLDP.java +++ b/libraries/liblldp/src/main/java/org/opendaylight/openflowplugin/libraries/liblldp/LLDP.java @@ -13,11 +13,14 @@ import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Class that represents the LLDP frame objects. */ public class LLDP extends Packet { + private static final Logger LOG = LoggerFactory.getLogger(LLDP.class); private static final String CHASSISID = "ChassisId"; private static final String SYSTEMNAMEID = "SystemNameID"; private static final String PORTID = "PortId"; diff --git a/libraries/liblldp/src/main/java/org/opendaylight/openflowplugin/libraries/liblldp/LLDPTLV.java b/libraries/liblldp/src/main/java/org/opendaylight/openflowplugin/libraries/liblldp/LLDPTLV.java index 6f3bfd339d..71bd964d66 100644 --- a/libraries/liblldp/src/main/java/org/opendaylight/openflowplugin/libraries/liblldp/LLDPTLV.java +++ b/libraries/liblldp/src/main/java/org/opendaylight/openflowplugin/libraries/liblldp/LLDPTLV.java @@ -18,12 +18,15 @@ import java.util.Map; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.tuple.MutablePair; import org.apache.commons.lang3.tuple.Pair; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Class that represents the LLDPTLV objects. */ @SuppressWarnings("checkstyle:AbbreviationAsWordInName") public class LLDPTLV extends Packet { + private static final Logger LOG = LoggerFactory.getLogger(LLDPTLV.class); private static final String TYPE = "Type"; private static final String LENGTH = "Length"; private static final String VALUE = "Value"; diff --git a/libraries/liblldp/src/main/java/org/opendaylight/openflowplugin/libraries/liblldp/NetUtils.java b/libraries/liblldp/src/main/java/org/opendaylight/openflowplugin/libraries/liblldp/NetUtils.java index 1425f0b7b3..1aa1163f8f 100644 --- a/libraries/liblldp/src/main/java/org/opendaylight/openflowplugin/libraries/liblldp/NetUtils.java +++ b/libraries/liblldp/src/main/java/org/opendaylight/openflowplugin/libraries/liblldp/NetUtils.java @@ -22,7 +22,7 @@ import org.slf4j.LoggerFactory; * Utility class containing the common utility functions needed for operating on networking data structures. */ public abstract class NetUtils { - protected static final Logger LOG = LoggerFactory.getLogger(NetUtils.class); + private static final Logger LOG = LoggerFactory.getLogger(NetUtils.class); /** * Constant holding the number of bits in a byte. diff --git a/libraries/liblldp/src/main/java/org/opendaylight/openflowplugin/libraries/liblldp/Packet.java b/libraries/liblldp/src/main/java/org/opendaylight/openflowplugin/libraries/liblldp/Packet.java index 271a77d54a..1516749232 100644 --- a/libraries/liblldp/src/main/java/org/opendaylight/openflowplugin/libraries/liblldp/Packet.java +++ b/libraries/liblldp/src/main/java/org/opendaylight/openflowplugin/libraries/liblldp/Packet.java @@ -22,7 +22,7 @@ import org.slf4j.LoggerFactory; */ public abstract class Packet { - protected static final Logger LOG = LoggerFactory.getLogger(Packet.class); + private static final Logger LOG = LoggerFactory.getLogger(Packet.class); // Access level granted to this packet protected boolean writeAccess; @@ -195,7 +195,7 @@ public abstract class Packet { postSerializeCustomOperation(packetBytes); if (LOG.isTraceEnabled()) { - LOG.trace("{}: {}", this.getClass().getSimpleName(), + LOG.trace("packet {}: {}", this.getClass().getSimpleName(), HexEncode.bytesToHexString(packetBytes)); } diff --git a/model/pom.xml b/model/pom.xml index 18b0292afe..acd5e9e18b 100644 --- a/model/pom.xml +++ b/model/pom.xml @@ -29,8 +29,8 @@ yang-common - org.opendaylight.mdsal.model - ietf-inet-types-2013-07-15 + org.opendaylight.mdsal.binding.model.ietf + rfc6991 org.opendaylight.mdsal.model diff --git a/openflowjava/features-openflowjava-aggregator/features-openflowjava/pom.xml b/openflowjava/features-openflowjava-aggregator/features-openflowjava/pom.xml index e99e6e9d04..ea452269d0 100644 --- a/openflowjava/features-openflowjava-aggregator/features-openflowjava/pom.xml +++ b/openflowjava/features-openflowjava-aggregator/features-openflowjava/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.odlparent feature-repo-parent - 3.1.3 + 4.0.2 diff --git a/openflowjava/features-openflowjava-aggregator/odl-openflowjava-protocol/pom.xml b/openflowjava/features-openflowjava-aggregator/odl-openflowjava-protocol/pom.xml index fdcbb7751e..72c244227c 100644 --- a/openflowjava/features-openflowjava-aggregator/odl-openflowjava-protocol/pom.xml +++ b/openflowjava/features-openflowjava-aggregator/odl-openflowjava-protocol/pom.xml @@ -5,7 +5,7 @@ org.opendaylight.odlparent single-feature-parent - 3.1.3 + 4.0.2 @@ -33,7 +33,7 @@ org.opendaylight.mdsal mdsal-artifacts - 2.6.0-SNAPSHOT + 3.0.1 import pom diff --git a/openflowjava/features-openflowjava-aggregator/pom.xml b/openflowjava/features-openflowjava-aggregator/pom.xml index 74d274014f..da054ad272 100644 --- a/openflowjava/features-openflowjava-aggregator/pom.xml +++ b/openflowjava/features-openflowjava-aggregator/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.odlparent odlparent-lite - 3.1.3 + 4.0.2 diff --git a/openflowjava/openflow-protocol-api/pom.xml b/openflowjava/openflow-protocol-api/pom.xml index ef34bb6c3f..16db447019 100644 --- a/openflowjava/openflow-protocol-api/pom.xml +++ b/openflowjava/openflow-protocol-api/pom.xml @@ -1,5 +1,5 @@ - + + 4.0.0 org.opendaylight.openflowplugin @@ -29,12 +29,8 @@ yang-common - org.opendaylight.mdsal.model - ietf-inet-types-2013-07-15 - - - org.opendaylight.mdsal.model - ietf-yang-types-20130715 + org.opendaylight.mdsal.binding.model.ietf + rfc6991 org.opendaylight.mdsal.model diff --git a/openflowjava/openflow-protocol-impl/pom.xml b/openflowjava/openflow-protocol-impl/pom.xml index d0ba023561..29a3afb80b 100644 --- a/openflowjava/openflow-protocol-impl/pom.xml +++ b/openflowjava/openflow-protocol-impl/pom.xml @@ -1,3 +1,4 @@ + 4.0.0 diff --git a/openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/ErrorMessageFactory.java b/openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/ErrorMessageFactory.java index 3069ea369e..b46c46f566 100644 --- a/openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/ErrorMessageFactory.java +++ b/openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/ErrorMessageFactory.java @@ -92,8 +92,7 @@ public class ErrorMessageFactory implements OFDeserializer, int code = rawMessage.readUnsignedShort(); if (type != null) { switch (type) { - case HELLOFAILED: - { + case HELLOFAILED: { HelloFailedCode errorCode = HelloFailedCode.forValue(code); if (errorCode != null) { setCode(builder, errorCode.getIntValue(), errorCode.name()); @@ -102,8 +101,7 @@ public class ErrorMessageFactory implements OFDeserializer, } break; } - case BADREQUEST: - { + case BADREQUEST: { BadRequestCode errorCode = BadRequestCode.forValue(code); if (errorCode != null) { setCode(builder, errorCode.getIntValue(), errorCode.name()); @@ -112,8 +110,7 @@ public class ErrorMessageFactory implements OFDeserializer, } break; } - case BADACTION: - { + case BADACTION: { BadActionCode errorCode = BadActionCode.forValue(code); if (errorCode != null) { setCode(builder, errorCode.getIntValue(), errorCode.name()); @@ -122,8 +119,7 @@ public class ErrorMessageFactory implements OFDeserializer, } break; } - case BADINSTRUCTION: - { + case BADINSTRUCTION: { BadInstructionCode errorCode = BadInstructionCode.forValue(code); if (errorCode != null) { setCode(builder, errorCode.getIntValue(), errorCode.name()); @@ -132,8 +128,7 @@ public class ErrorMessageFactory implements OFDeserializer, } break; } - case BADMATCH: - { + case BADMATCH: { BadMatchCode errorCode = BadMatchCode.forValue(code); if (errorCode != null) { setCode(builder, errorCode.getIntValue(), errorCode.name()); @@ -142,8 +137,7 @@ public class ErrorMessageFactory implements OFDeserializer, } break; } - case FLOWMODFAILED: - { + case FLOWMODFAILED: { FlowModFailedCode errorCode = FlowModFailedCode.forValue(code); if (errorCode != null) { setCode(builder, errorCode.getIntValue(), errorCode.name()); @@ -152,8 +146,7 @@ public class ErrorMessageFactory implements OFDeserializer, } break; } - case GROUPMODFAILED: - { + case GROUPMODFAILED: { GroupModFailedCode errorCode = GroupModFailedCode.forValue(code); if (errorCode != null) { setCode(builder, errorCode.getIntValue(), errorCode.name()); @@ -162,8 +155,7 @@ public class ErrorMessageFactory implements OFDeserializer, } break; } - case PORTMODFAILED: - { + case PORTMODFAILED: { PortModFailedCode errorCode = PortModFailedCode.forValue(code); if (errorCode != null) { setCode(builder, errorCode.getIntValue(), errorCode.name()); @@ -172,8 +164,7 @@ public class ErrorMessageFactory implements OFDeserializer, } break; } - case TABLEMODFAILED: - { + case TABLEMODFAILED: { TableModFailedCode errorCode = TableModFailedCode.forValue(code); if (errorCode != null) { setCode(builder, errorCode.getIntValue(), errorCode.name()); @@ -182,8 +173,7 @@ public class ErrorMessageFactory implements OFDeserializer, } break; } - case QUEUEOPFAILED: - { + case QUEUEOPFAILED: { QueueOpFailedCode errorCode = QueueOpFailedCode.forValue(code); if (errorCode != null) { setCode(builder, errorCode.getIntValue(), errorCode.name()); @@ -192,8 +182,7 @@ public class ErrorMessageFactory implements OFDeserializer, } break; } - case SWITCHCONFIGFAILED: - { + case SWITCHCONFIGFAILED: { SwitchConfigFailedCode errorCode = SwitchConfigFailedCode.forValue(code); if (errorCode != null) { setCode(builder, errorCode.getIntValue(), errorCode.name()); @@ -202,8 +191,7 @@ public class ErrorMessageFactory implements OFDeserializer, } break; } - case ROLEREQUESTFAILED: - { + case ROLEREQUESTFAILED: { RoleRequestFailedCode errorCode = RoleRequestFailedCode.forValue(code); if (errorCode != null) { setCode(builder, errorCode.getIntValue(), errorCode.name()); @@ -212,8 +200,7 @@ public class ErrorMessageFactory implements OFDeserializer, } break; } - case METERMODFAILED: - { + case METERMODFAILED: { MeterModFailedCode errorCode = MeterModFailedCode.forValue(code); if (errorCode != null) { setCode(builder, errorCode.getIntValue(), errorCode.name()); @@ -222,8 +209,7 @@ public class ErrorMessageFactory implements OFDeserializer, } break; } - case TABLEFEATURESFAILED: - { + case TABLEFEATURESFAILED: { TableFeaturesFailedCode errorCode = TableFeaturesFailedCode.forValue(code); if (errorCode != null) { setCode(builder, errorCode.getIntValue(), errorCode.name()); diff --git a/openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/OF10ErrorMessageFactory.java b/openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/OF10ErrorMessageFactory.java index adfafe630c..b9cd3b3dbc 100644 --- a/openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/OF10ErrorMessageFactory.java +++ b/openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/OF10ErrorMessageFactory.java @@ -64,8 +64,7 @@ public class OF10ErrorMessageFactory implements OFDeserializer { int code = rawMessage.readUnsignedShort(); if (type != null) { switch (type) { - case HELLOFAILED: - { + case HELLOFAILED: { HelloFailedCodeV10 errorCode = HelloFailedCodeV10.forValue(code); if (errorCode != null) { setCode(builder, errorCode.getIntValue(), errorCode.name()); @@ -74,8 +73,7 @@ public class OF10ErrorMessageFactory implements OFDeserializer { } break; } - case BADREQUEST: - { + case BADREQUEST: { BadRequestCodeV10 errorCode = BadRequestCodeV10.forValue(code); if (errorCode != null) { setCode(builder, errorCode.getIntValue(), errorCode.name()); @@ -84,8 +82,7 @@ public class OF10ErrorMessageFactory implements OFDeserializer { } break; } - case BADACTION: - { + case BADACTION: { BadActionCodeV10 errorCode = BadActionCodeV10.forValue(code); if (errorCode != null) { setCode(builder, errorCode.getIntValue(), errorCode.name()); @@ -94,8 +91,7 @@ public class OF10ErrorMessageFactory implements OFDeserializer { } break; } - case FLOWMODFAILED: - { + case FLOWMODFAILED: { FlowModFailedCodeV10 errorCode = FlowModFailedCodeV10.forValue(code); if (errorCode != null) { setCode(builder, errorCode.getIntValue(), errorCode.name()); @@ -104,8 +100,7 @@ public class OF10ErrorMessageFactory implements OFDeserializer { } break; } - case PORTMODFAILED: - { + case PORTMODFAILED: { PortModFailedCodeV10 errorCode = PortModFailedCodeV10.forValue(code); if (errorCode != null) { setCode(builder, errorCode.getIntValue(), errorCode.name()); @@ -114,8 +109,7 @@ public class OF10ErrorMessageFactory implements OFDeserializer { } break; } - case QUEUEOPFAILED: - { + case QUEUEOPFAILED: { QueueOpFailedCodeV10 errorCode = QueueOpFailedCodeV10.forValue(code); if (errorCode != null) { setCode(builder, errorCode.getIntValue(), errorCode.name()); diff --git a/openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/core/DelegatingInboundHandlerTest.java b/openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/core/DelegatingInboundHandlerTest.java index c323569a92..52cadd7e93 100644 --- a/openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/core/DelegatingInboundHandlerTest.java +++ b/openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/core/DelegatingInboundHandlerTest.java @@ -8,7 +8,7 @@ package org.opendaylight.openflowjava.protocol.impl.core; -import static org.mockito.Matchers.any; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; diff --git a/openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/core/IdleHandlerTest.java b/openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/core/IdleHandlerTest.java index 83cf468643..3bb1a5da3b 100644 --- a/openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/core/IdleHandlerTest.java +++ b/openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/core/IdleHandlerTest.java @@ -8,7 +8,7 @@ package org.opendaylight.openflowjava.protocol.impl.core; -import static org.mockito.Matchers.any; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; @@ -17,6 +17,7 @@ import java.util.concurrent.TimeUnit; import org.junit.Before; import org.junit.Test; import org.mockito.Mock; +import org.mockito.Mockito; import org.mockito.MockitoAnnotations; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.system.rev130927.SwitchIdleEvent; @@ -48,7 +49,7 @@ public class IdleHandlerTest { idleHandler.channelRead(mockChHndlrCtx, new Object()); // Verify that a read was fired for the next handler ... - verify(mockChHndlrCtx, times(1)).fireChannelRead(any(SwitchIdleEvent.class)) ; + verify(mockChHndlrCtx, times(1)).fireChannelRead(Mockito.any()) ; } /** diff --git a/openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/core/OFDecoderStatisticsTest.java b/openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/core/OFDecoderStatisticsTest.java index 9a454f0d8b..da6a108b97 100644 --- a/openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/core/OFDecoderStatisticsTest.java +++ b/openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/core/OFDecoderStatisticsTest.java @@ -7,8 +7,8 @@ */ package org.opendaylight.openflowjava.protocol.impl.core; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyShort; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyShort; import static org.mockito.Mockito.when; import io.netty.buffer.ByteBuf; diff --git a/openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/core/OFDecoderTest.java b/openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/core/OFDecoderTest.java index ab0b227281..a36b72917a 100644 --- a/openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/core/OFDecoderTest.java +++ b/openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/core/OFDecoderTest.java @@ -9,8 +9,8 @@ package org.opendaylight.openflowjava.protocol.impl.core; import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyShort; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyShort; import static org.mockito.Mockito.when; import io.netty.buffer.ByteBuf; diff --git a/openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/core/OFEncoderStatisticsTest.java b/openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/core/OFEncoderStatisticsTest.java index d13274b5c7..29b1e27f97 100644 --- a/openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/core/OFEncoderStatisticsTest.java +++ b/openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/core/OFEncoderStatisticsTest.java @@ -7,8 +7,8 @@ */ package org.opendaylight.openflowjava.protocol.impl.core; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyShort; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyShort; import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.when; diff --git a/openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/core/OFEncoderTest.java b/openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/core/OFEncoderTest.java index fc6477ea2a..1ef3ac8439 100644 --- a/openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/core/OFEncoderTest.java +++ b/openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/core/OFEncoderTest.java @@ -8,8 +8,8 @@ package org.opendaylight.openflowjava.protocol.impl.core; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyShort; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyShort; import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; diff --git a/openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/core/PublishingChannelInitializerTest.java b/openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/core/PublishingChannelInitializerTest.java index 70cdef5d03..71c23a28f2 100644 --- a/openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/core/PublishingChannelInitializerTest.java +++ b/openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/core/PublishingChannelInitializerTest.java @@ -9,8 +9,8 @@ package org.opendaylight.openflowjava.protocol.impl.core; import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.eq; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; diff --git a/openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/core/connection/ConnectionAdapterImplTest.java b/openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/core/connection/ConnectionAdapterImplTest.java index 0aa09a3726..53f42a6e02 100644 --- a/openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/core/connection/ConnectionAdapterImplTest.java +++ b/openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/core/connection/ConnectionAdapterImplTest.java @@ -8,7 +8,7 @@ package org.opendaylight.openflowjava.protocol.impl.core.connection; -import static org.mockito.Matchers.any; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; diff --git a/openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/BarrierReplyMessageFactoryTest.java b/openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/BarrierReplyMessageFactoryTest.java index 7edff8ed43..99b50600a3 100644 --- a/openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/BarrierReplyMessageFactoryTest.java +++ b/openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/BarrierReplyMessageFactoryTest.java @@ -31,7 +31,7 @@ public class BarrierReplyMessageFactoryTest extends DefaultDeserializerFactoryTe * Initializes deserializer registry and lookups OF13 deserializer. */ public BarrierReplyMessageFactoryTest() { - super(new MessageCodeKey(EncodeConstants.OF13_VERSION_ID, 21, BarrierOutput.class)); + super(new MessageCodeKey(EncodeConstants.OF13_VERSION_ID, 21, BarrierOutput.class)); } /** diff --git a/openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/ErrorMessageFactoryTest.java b/openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/ErrorMessageFactoryTest.java index babe84bc4d..1bf1a280b6 100644 --- a/openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/ErrorMessageFactoryTest.java +++ b/openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/ErrorMessageFactoryTest.java @@ -8,12 +8,13 @@ package org.opendaylight.openflowjava.protocol.impl.deserialization.factories; +import static org.mockito.ArgumentMatchers.any; + import io.netty.buffer.ByteBuf; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.Matchers; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.runners.MockitoJUnitRunner; @@ -42,7 +43,7 @@ public class ErrorMessageFactoryTest { @Before public void startUp() { errorFactory = new ErrorMessageFactory(); - Mockito.when(registry.getDeserializer(Matchers.any(MessageCodeKey.class))).thenReturn(deserializer); + Mockito.when(registry.getDeserializer(any(MessageCodeKey.class))).thenReturn(deserializer); errorFactory.injectDeserializerRegistry(registry); } diff --git a/openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/ExperimenterMessageFactoryTest.java b/openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/ExperimenterMessageFactoryTest.java index 2568f74383..7f26597f88 100644 --- a/openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/ExperimenterMessageFactoryTest.java +++ b/openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/ExperimenterMessageFactoryTest.java @@ -8,7 +8,7 @@ package org.opendaylight.openflowjava.protocol.impl.deserialization.factories; -import static org.mockito.Matchers.any; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.when; import io.netty.buffer.ByteBuf; diff --git a/openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/VendorMessageFactoryTest.java b/openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/VendorMessageFactoryTest.java index b03664a55e..535c6fc422 100644 --- a/openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/VendorMessageFactoryTest.java +++ b/openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/VendorMessageFactoryTest.java @@ -12,7 +12,7 @@ import io.netty.buffer.ByteBuf; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.Matchers; +import org.mockito.ArgumentMatchers; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.runners.MockitoJUnitRunner; @@ -36,7 +36,7 @@ public class VendorMessageFactoryTest { */ @Test public void test() { - Mockito.when(registry.getDeserializer(Matchers.any())).thenReturn(deserializer); + Mockito.when(registry.getDeserializer(ArgumentMatchers.any())).thenReturn(deserializer); ByteBuf buffer = ByteBufUtils.hexStringToByteBuf("01 02 03 04 FF FF FF FF 80 00 00 00"); VendorMessageFactory factory = new VendorMessageFactory(); factory.injectDeserializerRegistry(registry); diff --git a/openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/multipart/MultipartReplyExperimenterTest.java b/openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/multipart/MultipartReplyExperimenterTest.java index 181b9afb58..ae48666108 100644 --- a/openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/multipart/MultipartReplyExperimenterTest.java +++ b/openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/multipart/MultipartReplyExperimenterTest.java @@ -12,7 +12,7 @@ import io.netty.buffer.ByteBuf; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.Matchers; +import org.mockito.ArgumentMatchers; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.runners.MockitoJUnitRunner; @@ -43,7 +43,7 @@ public class MultipartReplyExperimenterTest { */ @Test public void testMultipartReplyExperimenter() { - Mockito.when(registry.getDeserializer(Matchers.any())).thenReturn(vendorDeserializer); + Mockito.when(registry.getDeserializer(ArgumentMatchers.any())).thenReturn(vendorDeserializer); factory.injectDeserializerRegistry(registry); ByteBuf bb = BufferHelper.buildBuffer("FF FF 00 01 00 00 00 00 " + "00 00 00 01 00 00 00 02"); // expID, expType diff --git a/openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/multipart/OF10StatsReplyExperimenterTest.java b/openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/multipart/OF10StatsReplyExperimenterTest.java index 8acaab7135..5120079aba 100644 --- a/openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/multipart/OF10StatsReplyExperimenterTest.java +++ b/openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/multipart/OF10StatsReplyExperimenterTest.java @@ -12,7 +12,7 @@ import io.netty.buffer.ByteBuf; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.Matchers; +import org.mockito.ArgumentMatchers; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.runners.MockitoJUnitRunner; @@ -40,7 +40,7 @@ public class OF10StatsReplyExperimenterTest { */ @Test public void test() { - Mockito.when(registry.getDeserializer(Matchers.any())).thenReturn(vendorDeserializer); + Mockito.when(registry.getDeserializer(ArgumentMatchers.any())).thenReturn(vendorDeserializer); OF10StatsReplyMessageFactory factory = new OF10StatsReplyMessageFactory(); factory.injectDeserializerRegistry(registry); diff --git a/openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/ExperimenterInputMessageFactoryTest.java b/openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/ExperimenterInputMessageFactoryTest.java index 27ac8f8cf8..eb7cdc1134 100644 --- a/openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/ExperimenterInputMessageFactoryTest.java +++ b/openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/ExperimenterInputMessageFactoryTest.java @@ -8,9 +8,10 @@ package org.opendaylight.openflowjava.protocol.impl.serialization.factories; +import static org.mockito.ArgumentMatchers.any; + import io.netty.buffer.ByteBuf; import org.junit.Test; -import org.mockito.Matchers; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; @@ -108,7 +109,7 @@ public class ExperimenterInputMessageFactoryTest { ExperimenterInput input = builder.build(); Mockito.when(registry.getSerializer( - (ExperimenterIdSerializerKey) Matchers.any())).thenReturn(serializer); + (ExperimenterIdSerializerKey) any())).thenReturn(serializer); expFactory.serialize(input, out); Mockito.verify(serializer, Mockito.times(1)).serialize(input.getExperimenterDataOfChoice(), out); @@ -129,7 +130,7 @@ public class ExperimenterInputMessageFactoryTest { ExperimenterInput input = builder.build(); Mockito.when(registry.getSerializer( - (ExperimenterIdSerializerKey) Matchers.any())).thenReturn(serializer); + (ExperimenterIdSerializerKey) any())).thenReturn(serializer); expFactory.serialize(input, out); Mockito.verify(serializer, Mockito.times(1)).serialize(input.getExperimenterDataOfChoice(), out); diff --git a/openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/VendorInputMessageFactoryTest.java b/openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/VendorInputMessageFactoryTest.java index 371e83ef4d..77ba1eddd8 100644 --- a/openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/VendorInputMessageFactoryTest.java +++ b/openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/VendorInputMessageFactoryTest.java @@ -12,7 +12,7 @@ import io.netty.buffer.ByteBuf; import io.netty.buffer.PooledByteBufAllocator; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.Matchers; +import org.mockito.ArgumentMatchers; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.runners.MockitoJUnitRunner; @@ -45,7 +45,7 @@ public class VendorInputMessageFactoryTest { */ @Test public void test() { - Mockito.when(registry.getSerializer(Matchers.>any())) + Mockito.when(registry.getSerializer(ArgumentMatchers.>any())) .thenReturn(serializer); VendorInputMessageFactory factory = new VendorInputMessageFactory(); factory.injectSerializerRegistry(registry); @@ -58,7 +58,8 @@ public class VendorInputMessageFactoryTest { builder.setExperimenterDataOfChoice(vendorData); ExperimenterInput experimenterInput = builder.build(); - Mockito.when(registry.getSerializer(Matchers.>any())) + Mockito.when(registry.getSerializer( + ArgumentMatchers.>any())) .thenReturn(foundSerializer); factory.serialize(experimenterInput, buffer); Mockito.verify(foundSerializer, Mockito.times(1)) diff --git a/openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/multipart/MultipartRequestExperimenterTest.java b/openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/multipart/MultipartRequestExperimenterTest.java index ea90453aa5..8f619556f6 100644 --- a/openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/multipart/MultipartRequestExperimenterTest.java +++ b/openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/multipart/MultipartRequestExperimenterTest.java @@ -13,7 +13,7 @@ import io.netty.buffer.UnpooledByteBufAllocator; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.Matchers; +import org.mockito.ArgumentMatchers; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.runners.MockitoJUnitRunner; @@ -51,7 +51,8 @@ public class MultipartRequestExperimenterTest { @Test public void testExperimenter() throws Exception { Mockito.when(mockRegistry.getSerializer( - Matchers.>any())).thenReturn(serializer); + ArgumentMatchers.>any())) + .thenReturn(serializer); MultipartRequestInputFactory multipartFactory = new MultipartRequestInputFactory(); multipartFactory.injectSerializerRegistry(mockRegistry); MultipartRequestInputBuilder builder = new MultipartRequestInputBuilder(); diff --git a/openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/multipart/MultipartRequestTableFeaturesTest.java b/openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/multipart/MultipartRequestTableFeaturesTest.java index c7fa7e0200..9b473765fd 100644 --- a/openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/multipart/MultipartRequestTableFeaturesTest.java +++ b/openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/multipart/MultipartRequestTableFeaturesTest.java @@ -7,6 +7,8 @@ */ package org.opendaylight.openflowjava.protocol.impl.serialization.factories.multipart; +import static org.mockito.ArgumentMatchers.any; + import io.netty.buffer.ByteBuf; import io.netty.buffer.UnpooledByteBufAllocator; import java.math.BigInteger; @@ -16,7 +18,6 @@ import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.Matchers; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.runners.MockitoJUnitRunner; @@ -94,7 +95,7 @@ public class MultipartRequestTableFeaturesTest { */ @Before public void startUp() { - Mockito.when(mockRegistry.getSerializer((MessageTypeKey)Matchers.any())).thenReturn(serializer); + Mockito.when(mockRegistry.getSerializer((MessageTypeKey)any())).thenReturn(serializer); registry = new SerializerRegistryImpl(); registry.init(); multipartFactory = registry.getSerializer( @@ -463,7 +464,7 @@ public class MultipartRequestTableFeaturesTest { new byte[] {0x00, 0x07, 0x01, 0x05, 0x01, 0x00, 0x03, 0x01}, metadataWrite); Assert.assertEquals("Wrong config", 8, out.readUnsignedInt()); Assert.assertEquals("Wrong max-entries", 65, out.readUnsignedInt()); - Mockito.verify(serializer, Mockito.times(2)).serialize(Matchers.any(TableFeatureProperties.class), - Matchers.any(ByteBuf.class)); + Mockito.verify(serializer, Mockito.times(2)).serialize(any(TableFeatureProperties.class), + any(ByteBuf.class)); } } diff --git a/openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/multipart/OF10StatsRequestExperimenterTest.java b/openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/multipart/OF10StatsRequestExperimenterTest.java index c22ab9a066..39baaf8bd1 100644 --- a/openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/multipart/OF10StatsRequestExperimenterTest.java +++ b/openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/multipart/OF10StatsRequestExperimenterTest.java @@ -13,7 +13,7 @@ import io.netty.buffer.UnpooledByteBufAllocator; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.Matchers; +import org.mockito.ArgumentMatchers; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.runners.MockitoJUnitRunner; @@ -51,7 +51,8 @@ public class OF10StatsRequestExperimenterTest { @Test public void testExperimenter() throws Exception { Mockito.when(mockRegistry.getSerializer( - Matchers.>any())).thenReturn(serializer); + ArgumentMatchers.>any())) + .thenReturn(serializer); OF10StatsRequestInputFactory multipartFactory = new OF10StatsRequestInputFactory(); multipartFactory.injectSerializerRegistry(mockRegistry); MultipartRequestInputBuilder builder = new MultipartRequestInputBuilder(); diff --git a/openflowjava/openflow-protocol-it/pom.xml b/openflowjava/openflow-protocol-it/pom.xml index 933d92c080..944d037ba6 100644 --- a/openflowjava/openflow-protocol-it/pom.xml +++ b/openflowjava/openflow-protocol-it/pom.xml @@ -1,3 +1,4 @@ + 4.0.0 diff --git a/openflowjava/openflow-protocol-spi/pom.xml b/openflowjava/openflow-protocol-spi/pom.xml index 3425dcaf34..1b50c63d44 100644 --- a/openflowjava/openflow-protocol-spi/pom.xml +++ b/openflowjava/openflow-protocol-spi/pom.xml @@ -1,3 +1,4 @@ + 4.0.0 diff --git a/openflowjava/openflowjava-blueprint-config/pom.xml b/openflowjava/openflowjava-blueprint-config/pom.xml index 8dd1c6da8d..7a6a8c5d2e 100644 --- a/openflowjava/openflowjava-blueprint-config/pom.xml +++ b/openflowjava/openflowjava-blueprint-config/pom.xml @@ -3,8 +3,7 @@ This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html --> - + 4.0.0 diff --git a/openflowjava/openflowjava-util/pom.xml b/openflowjava/openflowjava-util/pom.xml index 259291b68c..d0713b7a74 100644 --- a/openflowjava/openflowjava-util/pom.xml +++ b/openflowjava/openflowjava-util/pom.xml @@ -1,5 +1,5 @@ - + + 4.0.0 diff --git a/openflowplugin-blueprint-config/pom.xml b/openflowplugin-blueprint-config/pom.xml index 6633544646..76fa839584 100644 --- a/openflowplugin-blueprint-config/pom.xml +++ b/openflowplugin-blueprint-config/pom.xml @@ -1,6 +1,5 @@ - + 4.0.0 diff --git a/openflowplugin-common/pom.xml b/openflowplugin-common/pom.xml index 4afa8604e1..6e6fac1a11 100644 --- a/openflowplugin-common/pom.xml +++ b/openflowplugin-common/pom.xml @@ -1,6 +1,5 @@ - + 4.0.0 @@ -57,4 +56,3 @@ - diff --git a/openflowplugin-impl/pom.xml b/openflowplugin-impl/pom.xml index fc2ee773c9..96b0aa0dd1 100644 --- a/openflowplugin-impl/pom.xml +++ b/openflowplugin-impl/pom.xml @@ -1,6 +1,5 @@ - + 4.0.0 org.opendaylight.openflowplugin @@ -63,8 +62,8 @@ ${infrautils.version} - org.ops4j.pax.cdi - pax-cdi-api + org.apache.aries.blueprint + blueprint-maven-plugin-annotation true @@ -146,4 +145,3 @@ - diff --git a/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/sal/SalFlowServiceImpl.java b/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/sal/SalFlowServiceImpl.java index 00448e8ac4..ff33309b2a 100644 --- a/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/sal/SalFlowServiceImpl.java +++ b/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/sal/SalFlowServiceImpl.java @@ -31,7 +31,6 @@ import org.opendaylight.openflowplugin.impl.util.FlowCreatorUtil; import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor; import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId; import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow; -import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowKey; import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.AddFlowInput; import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.AddFlowInputBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.AddFlowOutput; @@ -207,7 +206,7 @@ public class SalFlowServiceImpl implements SalFlowService { final FlowDescriptor flowDescriptor; if (Objects.nonNull(input.getFlowRef())) { - final FlowId flowId = input.getFlowRef().getValue().firstKeyOf(Flow.class, FlowKey.class).getId(); + final FlowId flowId = input.getFlowRef().getValue().firstKeyOf(Flow.class).getId(); flowDescriptor = FlowDescriptorFactory.create(input.getTableId(), flowId); deviceContext.getDeviceFlowRegistry().storeDescriptor(flowRegistryKey, flowDescriptor); } else { diff --git a/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/StatisticsContextImpl.java b/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/StatisticsContextImpl.java index 30a9ee965a..0c967c87f4 100644 --- a/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/StatisticsContextImpl.java +++ b/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/StatisticsContextImpl.java @@ -26,7 +26,8 @@ import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicReference; import javax.annotation.Nonnull; import javax.annotation.Nullable; -import org.opendaylight.mdsal.common.api.TransactionChainClosedException; + +import org.opendaylight.mdsal.binding.api.TransactionChainClosedException; import org.opendaylight.mdsal.singleton.common.api.ServiceGroupIdentifier; import org.opendaylight.openflowplugin.api.ConnectionException; import org.opendaylight.openflowplugin.api.openflow.connection.ConnectionContext; diff --git a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/OpenFlowPluginProviderImplTest.java b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/OpenFlowPluginProviderImplTest.java index c7f8e4052e..cfc4f16ae9 100644 --- a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/OpenFlowPluginProviderImplTest.java +++ b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/OpenFlowPluginProviderImplTest.java @@ -8,8 +8,8 @@ package org.opendaylight.openflowplugin.impl; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.eq; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; @@ -104,12 +104,6 @@ public class OpenFlowPluginProviderImplTest { .thenReturn(THREAD_POOL_MAX_THREADS); when(configurationService.getProperty(eq(ConfigurationProperty.THREAD_POOL_TIMEOUT.toString()), any())) .thenReturn(THREAD_POOL_TIMEOUT); - when(configurationService.getProperty(eq(ConfigurationProperty.RPC_REQUESTS_QUOTA.toString()), any())) - .thenReturn(RPC_REQUESTS_QUOTA); - when(configurationService.getProperty(eq(ConfigurationProperty.GLOBAL_NOTIFICATION_QUOTA.toString()), any())) - .thenReturn(GLOBAL_NOTIFICATION_QUOTA); - when(configurationService.getProperty(eq(ConfigurationProperty.BASIC_TIMER_DELAY.toString()), any())) - .thenReturn(BASIC_TIMER_DELAY); when(configurationService.getProperty(eq(ConfigurationProperty.DEVICE_CONNECTION_RATE_LIMIT_PER_MIN.toString()), any())).thenReturn(DEVICE_CONNECTION_RATE_LIMIT_PER_MIN); } diff --git a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/configuration/ConfigurationServiceFactoryImplTest.java b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/configuration/ConfigurationServiceFactoryImplTest.java index 2523803506..a9685b24fd 100644 --- a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/configuration/ConfigurationServiceFactoryImplTest.java +++ b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/configuration/ConfigurationServiceFactoryImplTest.java @@ -10,7 +10,7 @@ package org.opendaylight.openflowplugin.impl.configuration; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotEquals; -import static org.mockito.Matchers.any; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; diff --git a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/configuration/OpenFlowProviderConfigImplTest.java b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/configuration/OpenFlowProviderConfigImplTest.java index 55af2a5f47..ea153bddeb 100644 --- a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/configuration/OpenFlowProviderConfigImplTest.java +++ b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/configuration/OpenFlowProviderConfigImplTest.java @@ -8,8 +8,8 @@ package org.opendaylight.openflowplugin.impl.configuration; import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.eq; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.when; import org.junit.After; diff --git a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/connection/ConnectionManagerImplTest.java b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/connection/ConnectionManagerImplTest.java index ce26880054..0aaeefe9ed 100644 --- a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/connection/ConnectionManagerImplTest.java +++ b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/connection/ConnectionManagerImplTest.java @@ -7,6 +7,8 @@ */ package org.opendaylight.openflowplugin.impl.connection; +import static org.mockito.ArgumentMatchers.any; + import com.google.common.util.concurrent.SettableFuture; import java.math.BigInteger; import java.net.InetSocketAddress; @@ -17,8 +19,8 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; +import org.mockito.ArgumentMatchers; import org.mockito.Captor; -import org.mockito.Matchers; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.runners.MockitoJUnitRunner; @@ -79,7 +81,7 @@ public class ConnectionManagerImplTest { final InetSocketAddress deviceAddress = InetSocketAddress.createUnresolved("yahoo", 42); Mockito.when(connection.getRemoteAddress()).thenReturn(deviceAddress); Mockito.when(connection.isAlive()).thenReturn(true); - Mockito.when(connection.barrier(Matchers.any())) + Mockito.when(connection.barrier(ArgumentMatchers.any())) .thenReturn(RpcResultBuilder.success(new BarrierOutputBuilder().build()).buildFuture()); } @@ -110,11 +112,11 @@ public class ConnectionManagerImplTest { // prepare void reply (hello rpc output) final SettableFuture> voidResponseFx = SettableFuture.create(); - Mockito.when(connection.hello(Matchers.any(HelloInput.class))).thenReturn(voidResponseFx); + Mockito.when(connection.hello(any(HelloInput.class))).thenReturn(voidResponseFx); // prepare getFeature reply (getFeture rpc output) final SettableFuture> featureResponseFx = SettableFuture.>create(); - Mockito.when(connection.getFeatures(Matchers.any(GetFeaturesInput.class))).thenReturn(featureResponseFx); + Mockito.when(connection.getFeatures(any(GetFeaturesInput.class))).thenReturn(featureResponseFx); // fire handshake @@ -141,7 +143,7 @@ public class ConnectionManagerImplTest { featureResponseFx.set(rpcFeaturesOutput); Mockito.verify(deviceConnectedHandler, - Mockito.timeout(500)).deviceConnected(Matchers.any(ConnectionContext.class)); + Mockito.timeout(500)).deviceConnected(any(ConnectionContext.class)); } /** @@ -166,11 +168,11 @@ public class ConnectionManagerImplTest { // prepare void reply (hello rpc output) final SettableFuture> voidResponseFx = SettableFuture.create(); - Mockito.when(connection.hello(Matchers.any(HelloInput.class))).thenReturn(voidResponseFx); + Mockito.when(connection.hello(any(HelloInput.class))).thenReturn(voidResponseFx); // prepare getFeature reply (getFeture rpc output) final SettableFuture> featureResponseFx = SettableFuture.>create(); - Mockito.when(connection.getFeatures(Matchers.any(GetFeaturesInput.class))).thenReturn(featureResponseFx); + Mockito.when(connection.getFeatures(any(GetFeaturesInput.class))).thenReturn(featureResponseFx); // fire handshake - send hello reply @@ -197,6 +199,6 @@ public class ConnectionManagerImplTest { featureResponseFx.set(rpcFeaturesOutput); Mockito.verify(deviceConnectedHandler, - Mockito.timeout(FINAL_STEP_TIMEOUT)).deviceConnected(Matchers.any(ConnectionContext.class)); + Mockito.timeout(FINAL_STEP_TIMEOUT)).deviceConnected(any(ConnectionContext.class)); } } diff --git a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/connection/HandshakeManagerImplTest.java b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/connection/HandshakeManagerImplTest.java index 8f89633156..e4746f7048 100644 --- a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/connection/HandshakeManagerImplTest.java +++ b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/connection/HandshakeManagerImplTest.java @@ -7,6 +7,9 @@ */ package org.opendaylight.openflowplugin.impl.connection; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyShort; + import com.google.common.collect.Lists; import com.google.common.util.concurrent.Futures; import java.util.ArrayList; @@ -17,7 +20,6 @@ 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; import org.mockito.runners.MockitoJUnitRunner; @@ -79,7 +81,7 @@ public class HandshakeManagerImplTest { resultFeatures = RpcResultBuilder.success(new GetFeaturesOutputBuilder().build()).build(); - Mockito.when(adapter.hello(Matchers.any(HelloInput.class))) + Mockito.when(adapter.hello(any(HelloInput.class))) .thenReturn(Futures.immediateFuture(RpcResultBuilder.success((HelloOutput) null).build())); } @@ -95,7 +97,7 @@ public class HandshakeManagerImplTest { LOG.warn(problem.getMessage(), problem); } - Mockito.verify(errorHandler, Mockito.times(expectedErrors)).handleException(Matchers.any(Throwable.class)); + Mockito.verify(errorHandler, Mockito.times(expectedErrors)).handleException(any(Throwable.class)); } /** @@ -153,7 +155,7 @@ public class HandshakeManagerImplTest { LOG.debug("testVersionNegotiation10"); Short version = OFConstants.OFP_VERSION_1_0; - Mockito.when(adapter.getFeatures(Matchers.any(GetFeaturesInput.class))) + Mockito.when(adapter.getFeatures(any(GetFeaturesInput.class))) .thenReturn(Futures.immediateFuture(resultFeatures)); handshakeManager.shake(null); @@ -172,7 +174,7 @@ public class HandshakeManagerImplTest { LOG.debug("testVersionNegotiation10-ss"); Short version = OFConstants.OFP_VERSION_1_0; - Mockito.when(adapter.getFeatures(Matchers.any(GetFeaturesInput.class))) + Mockito.when(adapter.getFeatures(any(GetFeaturesInput.class))) .thenReturn(Futures.immediateFuture(resultFeatures)); handshakeManager.shake(createHelloMessage(version, helloXid).build()); @@ -193,7 +195,7 @@ public class HandshakeManagerImplTest { handshakeManager.shake(createHelloMessage(version, helloXid).build()); Mockito.verify(handshakeListener, Mockito.never()) - .onHandshakeSuccessful(Matchers.any(GetFeaturesOutput.class), Matchers.anyShort()); + .onHandshakeSuccessful(any(GetFeaturesOutput.class), anyShort()); } /** @@ -211,7 +213,7 @@ public class HandshakeManagerImplTest { handshakeManager.shake(createHelloMessage(version, helloXid).build()); Mockito.verify(handshakeListener, Mockito.never()) - .onHandshakeSuccessful(Matchers.any(GetFeaturesOutput.class), Matchers.anyShort()); + .onHandshakeSuccessful(any(GetFeaturesOutput.class), anyShort()); } /** @@ -224,7 +226,7 @@ public class HandshakeManagerImplTest { Short version = (short) 0x02; Short expVersion = (short) 0x01; - Mockito.when(adapter.getFeatures(Matchers.any(GetFeaturesInput.class))) + Mockito.when(adapter.getFeatures(any(GetFeaturesInput.class))) .thenReturn(Futures.immediateFuture(resultFeatures)); handshakeManager.shake(createHelloMessage(version, helloXid).build()); @@ -243,7 +245,7 @@ public class HandshakeManagerImplTest { final Short version = (short) 0x02; final Short expVersion = (short) 0x01; - Mockito.when(adapter.getFeatures(Matchers.any(GetFeaturesInput.class))) + Mockito.when(adapter.getFeatures(any(GetFeaturesInput.class))) .thenReturn(Futures.immediateFuture(resultFeatures)); handshakeManager.shake(null); @@ -264,7 +266,7 @@ public class HandshakeManagerImplTest { LOG.debug("testVersionNegotiation13"); Short version = OFConstants.OFP_VERSION_1_3; - Mockito.when(adapter.getFeatures(Matchers.any(GetFeaturesInput.class))) + Mockito.when(adapter.getFeatures(any(GetFeaturesInput.class))) .thenReturn(Futures.immediateFuture(resultFeatures)); handshakeManager.shake(createHelloMessage(version, helloXid).build()); @@ -281,7 +283,7 @@ public class HandshakeManagerImplTest { LOG.debug("testVersionNegotiation13-ss"); Short version = OFConstants.OFP_VERSION_1_3; - Mockito.when(adapter.getFeatures(Matchers.any(GetFeaturesInput.class))) + Mockito.when(adapter.getFeatures(any(GetFeaturesInput.class))) .thenReturn(Futures.immediateFuture(resultFeatures)); handshakeManager.shake(null); @@ -301,7 +303,7 @@ public class HandshakeManagerImplTest { Short version = (short) 0x06; Short expVersion = OFConstants.OFP_VERSION_1_3; - Mockito.when(adapter.getFeatures(Matchers.any(GetFeaturesInput.class))) + Mockito.when(adapter.getFeatures(any(GetFeaturesInput.class))) .thenReturn(Futures.immediateFuture(resultFeatures)); handshakeManager.shake(createHelloMessage(version, helloXid).build()); @@ -321,7 +323,7 @@ public class HandshakeManagerImplTest { Short version = (short) 0x06; Short expVersion = OFConstants.OFP_VERSION_1_3; - Mockito.when(adapter.getFeatures(Matchers.any(GetFeaturesInput.class))) + Mockito.when(adapter.getFeatures(any(GetFeaturesInput.class))) .thenReturn(Futures.immediateFuture(resultFeatures)); handshakeManager.shake(createHelloMessage(version, helloXid).build()); @@ -346,7 +348,7 @@ public class HandshakeManagerImplTest { handshakeManager.shake(createHelloMessage(version, helloXid).build()); Mockito.verify(handshakeListener, Mockito.never()) - .onHandshakeSuccessful(Matchers.any(GetFeaturesOutput.class), Matchers.anyShort()); + .onHandshakeSuccessful(any(GetFeaturesOutput.class), anyShort()); } /** @@ -366,7 +368,7 @@ public class HandshakeManagerImplTest { handshakeManager.shake(createHelloMessage(version, helloXid).build()); Mockito.verify(handshakeListener, Mockito.never()) - .onHandshakeSuccessful(Matchers.any(GetFeaturesOutput.class), Matchers.anyShort()); + .onHandshakeSuccessful(any(GetFeaturesOutput.class), anyShort()); } /** @@ -382,7 +384,7 @@ public class HandshakeManagerImplTest { HelloMessageBuilder helloMessage = createHelloMessage(version, helloXid); addVersionBitmap(Lists.newArrayList((short) 0x05, OFConstants.OFP_VERSION_1_0), helloMessage); - Mockito.when(adapter.getFeatures(Matchers.any(GetFeaturesInput.class))) + Mockito.when(adapter.getFeatures(any(GetFeaturesInput.class))) .thenReturn(Futures.immediateFuture(resultFeatures)); handshakeManager.shake(helloMessage.build()); @@ -403,7 +405,7 @@ public class HandshakeManagerImplTest { HelloMessageBuilder helloMessage = createHelloMessage(version, helloXid); addVersionBitmap(Lists.newArrayList((short) 0x05, OFConstants.OFP_VERSION_1_0), helloMessage); - Mockito.when(adapter.getFeatures(Matchers.any(GetFeaturesInput.class))) + Mockito.when(adapter.getFeatures(any(GetFeaturesInput.class))) .thenReturn(Futures.immediateFuture(resultFeatures)); handshakeManager.shake(null); @@ -426,7 +428,7 @@ public class HandshakeManagerImplTest { HelloMessageBuilder helloMessage = createHelloMessage(version, helloXid); addVersionBitmap(Lists.newArrayList((short) 0x05, OFConstants.OFP_VERSION_1_3), helloMessage); - Mockito.when(adapter.getFeatures(Matchers.any(GetFeaturesInput.class))) + Mockito.when(adapter.getFeatures(any(GetFeaturesInput.class))) .thenReturn(Futures.immediateFuture(resultFeatures)); handshakeManager.shake(helloMessage.build()); @@ -447,7 +449,7 @@ public class HandshakeManagerImplTest { HelloMessageBuilder helloMessage = createHelloMessage(version, helloXid); addVersionBitmap(Lists.newArrayList((short) 0x05, OFConstants.OFP_VERSION_1_3), helloMessage); - Mockito.when(adapter.getFeatures(Matchers.any(GetFeaturesInput.class))) + Mockito.when(adapter.getFeatures(any(GetFeaturesInput.class))) .thenReturn(Futures.immediateFuture(resultFeatures)); handshakeManager.shake(null); @@ -474,7 +476,7 @@ public class HandshakeManagerImplTest { handshakeManager.shake(helloMessage.build()); Mockito.verify(handshakeListener, Mockito.never()) - .onHandshakeSuccessful(Matchers.any(GetFeaturesOutput.class), Matchers.anyShort()); + .onHandshakeSuccessful(any(GetFeaturesOutput.class), anyShort()); } /** @@ -496,7 +498,7 @@ public class HandshakeManagerImplTest { handshakeManager.shake(helloMessage.build()); Mockito.verify(handshakeListener, Mockito.never()) - .onHandshakeSuccessful(Matchers.any(GetFeaturesOutput.class), Matchers.anyShort()); + .onHandshakeSuccessful(any(GetFeaturesOutput.class), anyShort()); } diff --git a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/connection/listener/HandshakeListenerImplTest.java b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/connection/listener/HandshakeListenerImplTest.java index 5e75c48aba..417c878210 100644 --- a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/connection/listener/HandshakeListenerImplTest.java +++ b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/connection/listener/HandshakeListenerImplTest.java @@ -8,6 +8,8 @@ package org.opendaylight.openflowplugin.impl.connection.listener; +import static org.mockito.ArgumentMatchers.any; + import java.math.BigInteger; import java.net.InetSocketAddress; import org.junit.After; @@ -16,8 +18,8 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; +import org.mockito.ArgumentMatchers; import org.mockito.Captor; -import org.mockito.Matchers; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.runners.MockitoJUnitRunner; @@ -56,7 +58,7 @@ public class HandshakeListenerImplTest { @Before public void setUp() throws Exception { - Mockito.when(connectionAdapter.barrier(Matchers.any())) + Mockito.when(connectionAdapter.barrier(ArgumentMatchers.any())) .thenReturn(RpcResultBuilder.success(new BarrierOutputBuilder().build()).buildFuture()); connectionContextSpy = Mockito.spy(new ConnectionContextImpl(connectionAdapter)); Mockito.when(connectionContextSpy.getConnectionAdapter()).thenReturn(connectionAdapter); @@ -74,7 +76,7 @@ public class HandshakeListenerImplTest { public void testOnHandshakeSuccessfull() throws Exception { handshakeListener.onHandshakeSuccessful(features, OFConstants.OFP_VERSION_1_3); Mockito.verify(connectionContextSpy).changeStateToWorking(); - Mockito.verify(connectionContextSpy).setFeatures(Matchers.any(FeaturesReply.class)); + Mockito.verify(connectionContextSpy).setFeatures(any(FeaturesReply.class)); Mockito.verify(connectionContextSpy).setNodeId(nodeIdCaptor.capture()); Mockito.verify(connectionContextSpy).handshakeSuccessful(); Mockito.verify(deviceConnectedHandler).deviceConnected(connectionContextSpy); diff --git a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/connection/listener/OpenflowProtocolListenerInitialImplTest.java b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/connection/listener/OpenflowProtocolListenerInitialImplTest.java index 00ab46a2ca..e5c07b89e3 100644 --- a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/connection/listener/OpenflowProtocolListenerInitialImplTest.java +++ b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/connection/listener/OpenflowProtocolListenerInitialImplTest.java @@ -12,7 +12,7 @@ import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.Matchers; +import org.mockito.ArgumentMatchers; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.runners.MockitoJUnitRunner; @@ -61,7 +61,7 @@ public class OpenflowProtocolListenerInitialImplTest { .setVersion(OFConstants.OFP_VERSION_1_3); openflowProtocolListenerInitial.onEchoRequestMessage(echoRequestMessageBld.build()); - Mockito.verify(connectionAdapter).echoReply(Matchers.any()); + Mockito.verify(connectionAdapter).echoReply(ArgumentMatchers.any()); } @Test @@ -71,7 +71,7 @@ public class OpenflowProtocolListenerInitialImplTest { .setVersion(OFConstants.OFP_VERSION_1_3); openflowProtocolListenerInitial.onHelloMessage(helloMessageBld.build()); - Mockito.verify(handshakeManager).shake(Matchers.any()); + Mockito.verify(handshakeManager).shake(ArgumentMatchers.any()); } @Test diff --git a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/connection/listener/SystemNotificationsListenerImplTest.java b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/connection/listener/SystemNotificationsListenerImplTest.java index 62eb39a370..2abf175a02 100644 --- a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/connection/listener/SystemNotificationsListenerImplTest.java +++ b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/connection/listener/SystemNotificationsListenerImplTest.java @@ -8,6 +8,8 @@ package org.opendaylight.openflowplugin.impl.connection.listener; +import static org.mockito.ArgumentMatchers.any; + import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.SettableFuture; @@ -18,10 +20,9 @@ import org.junit.After; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.Matchers; import org.mockito.Mock; import org.mockito.Mockito; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; import org.opendaylight.openflowjava.protocol.api.connection.ConnectionAdapter; import org.opendaylight.openflowplugin.api.openflow.connection.ConnectionContext; import org.opendaylight.openflowplugin.impl.connection.ConnectionContextImpl; @@ -92,8 +93,6 @@ public class SystemNotificationsListenerImplTest { */ @Test public void testOnDisconnectEvent1() throws Exception { - Mockito.when(connectionAdapter.isAlive()).thenReturn(true); - Mockito.when(connectionAdapter.disconnect()).thenReturn(Futures.immediateFuture(Boolean.TRUE)); DisconnectEvent disconnectNotification = new DisconnectEventBuilder().setInfo("testing disconnect").build(); systemNotificationsListener.onDisconnectEvent(disconnectNotification); @@ -109,8 +108,6 @@ public class SystemNotificationsListenerImplTest { */ @Test public void testOnDisconnectEvent2() throws Exception { - Mockito.when(connectionAdapter.isAlive()).thenReturn(true); - Mockito.when(connectionAdapter.disconnect()).thenReturn(Futures.immediateFuture(Boolean.FALSE)); DisconnectEvent disconnectNotification = new DisconnectEventBuilder().setInfo("testing disconnect").build(); systemNotificationsListener.onDisconnectEvent(disconnectNotification); @@ -128,10 +125,6 @@ public class SystemNotificationsListenerImplTest { public void testOnDisconnectEvent3() throws Exception { connectionContextGolem.changeStateToTimeouting(); - Mockito.when(connectionAdapter.isAlive()).thenReturn(true); - Mockito.when(connectionAdapter.disconnect()) - .thenReturn(Futures.immediateFailedFuture(new Exception("unit exception"))); - DisconnectEvent disconnectNotification = new DisconnectEventBuilder().setInfo("testing disconnect").build(); systemNotificationsListener.onDisconnectEvent(disconnectNotification); @@ -147,7 +140,6 @@ public class SystemNotificationsListenerImplTest { @Test public void testOnDisconnectEvent4() throws Exception { Mockito.when(connectionContext.getConnectionState()).thenReturn(ConnectionContext.CONNECTION_STATE.RIP); - Mockito.when(connectionAdapter.isAlive()).thenReturn(false); DisconnectEvent disconnectNotification = new DisconnectEventBuilder().setInfo("testing disconnect").build(); systemNotificationsListener.onDisconnectEvent(disconnectNotification); @@ -166,7 +158,7 @@ public class SystemNotificationsListenerImplTest { final ListenableFuture> echoReply = Futures.immediateFuture(RpcResultBuilder.success(new EchoOutputBuilder().setXid(0L).build()).build()); - Mockito.when(connectionAdapter.echo(Matchers.any(EchoInput.class))).thenReturn(echoReply); + Mockito.when(connectionAdapter.echo(any(EchoInput.class))).thenReturn(echoReply); SwitchIdleEvent notification = new SwitchIdleEventBuilder().setInfo("wake up, device sleeps").build(); systemNotificationsListener.onSwitchIdleEvent(notification); @@ -175,7 +167,7 @@ public class SystemNotificationsListenerImplTest { Thread.sleep(SAFE_TIMEOUT); verifyCommonInvocations(); - Mockito.verify(connectionAdapter, Mockito.timeout(SAFE_TIMEOUT)).echo(Matchers.any(EchoInput.class)); + Mockito.verify(connectionAdapter, Mockito.timeout(SAFE_TIMEOUT)).echo(any(EchoInput.class)); Mockito.verify(connectionAdapter, Mockito.never()).disconnect(); Mockito.verify(connectionContext).changeStateToTimeouting(); Mockito.verify(connectionContext).changeStateToWorking(); @@ -187,7 +179,7 @@ public class SystemNotificationsListenerImplTest { @Test public void testOnSwitchIdleEvent2() throws Exception { final SettableFuture> echoReply = SettableFuture.create(); - Mockito.when(connectionAdapter.echo(Matchers.any(EchoInput.class))).thenReturn(echoReply); + Mockito.when(connectionAdapter.echo(any(EchoInput.class))).thenReturn(echoReply); Mockito.when(connectionAdapter.isAlive()).thenReturn(true); Mockito.when(connectionAdapter.disconnect()) .thenReturn(Futures.immediateFailedFuture(new Exception("unit exception"))); @@ -198,7 +190,7 @@ public class SystemNotificationsListenerImplTest { Thread.sleep(SystemNotificationsListenerImpl.MAX_ECHO_REPLY_TIMEOUT + SAFE_TIMEOUT); verifyCommonInvocations(); - Mockito.verify(connectionAdapter, Mockito.timeout(SAFE_TIMEOUT)).echo(Matchers.any(EchoInput.class)); + Mockito.verify(connectionAdapter, Mockito.timeout(SAFE_TIMEOUT)).echo(any(EchoInput.class)); Mockito.verify(connectionAdapter).disconnect(); Mockito.verify(connectionContext).changeStateToTimeouting(); Mockito.verify(connectionContext).closeConnection(true); diff --git a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/device/DeviceContextImplTest.java b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/device/DeviceContextImplTest.java index 6df3c52622..5424dce47e 100644 --- a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/device/DeviceContextImplTest.java +++ b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/device/DeviceContextImplTest.java @@ -11,9 +11,10 @@ package org.opendaylight.openflowplugin.impl.device; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyBoolean; -import static org.mockito.Matchers.eq; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyBoolean; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.lenient; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; @@ -183,38 +184,39 @@ public class DeviceContextImplTest { public void setUp() throws Exception { final CheckedFuture, ReadFailedException> noExistNodeFuture = Futures.immediateCheckedFuture(Optional.absent()); - Mockito.when(readTx.read(LogicalDatastoreType.OPERATIONAL, nodeKeyIdent)).thenReturn(noExistNodeFuture); + Mockito.lenient().when(readTx.read(LogicalDatastoreType.OPERATIONAL, nodeKeyIdent)) + .thenReturn(noExistNodeFuture); Mockito.when(dataBroker.newReadOnlyTransaction()).thenReturn(readTx); - Mockito.when(dataBroker.createTransactionChain(Mockito.any(TransactionChainManager.class))) + Mockito.when(dataBroker.createTransactionChain(any(TransactionChainManager.class))) .thenReturn(txChainFactory); Mockito.when(deviceInfo.getNodeInstanceIdentifier()).thenReturn(nodeKeyIdent); Mockito.when(deviceInfo.getNodeId()).thenReturn(nodeId); Mockito.when(deviceInfo.getDatapathId()).thenReturn(BigInteger.ONE); final SettableFuture> settableFuture = SettableFuture.create(); final SettableFuture> settableFutureMultiReply = SettableFuture.create(); - Mockito.when(requestContext.getFuture()).thenReturn(settableFuture); - Mockito.doAnswer(invocation -> { + Mockito.lenient().when(requestContext.getFuture()).thenReturn(settableFuture); + Mockito.lenient().doAnswer(invocation -> { settableFuture.set((RpcResult) invocation.getArguments()[0]); return null; - }).when(requestContext).setResult(any(RpcResult.class)); + }).when(requestContext).setResult(Mockito.any()); - Mockito.when(requestContextMultiReply.getFuture()).thenReturn(settableFutureMultiReply); - Mockito.doAnswer(invocation -> { + Mockito.lenient().when(requestContextMultiReply.getFuture()).thenReturn(settableFutureMultiReply); + Mockito.lenient().doAnswer(invocation -> { settableFutureMultiReply.set((RpcResult) invocation.getArguments()[0]); return null; }).when(requestContextMultiReply).setResult(any(RpcResult.class)); Mockito.when(txChainFactory.newReadWriteTransaction()).thenReturn(writeTx); Mockito.when(dataBroker.newReadOnlyTransaction()).thenReturn(readTx); - Mockito.when(connectionContext.getOutboundQueueProvider()).thenReturn(outboundQueueProvider); + Mockito.lenient().when(connectionContext.getOutboundQueueProvider()).thenReturn(outboundQueueProvider); Mockito.when(connectionContext.getConnectionAdapter()).thenReturn(connectionAdapter); Mockito.when(connectionContext.getDeviceInfo()).thenReturn(deviceInfo); final FeaturesReply mockedFeaturesReply = mock(FeaturesReply.class); - when(connectionContext.getFeatures()).thenReturn(mockedFeaturesReply); - when(connectionContext.getFeatures().getCapabilities()).thenReturn(mock(Capabilities.class)); + lenient().when(connectionContext.getFeatures()).thenReturn(mockedFeaturesReply); + lenient().when(connectionContext.getFeatures().getCapabilities()).thenReturn(mock(Capabilities.class)); - Mockito.when(deviceInfo.getVersion()).thenReturn(OFConstants.OFP_VERSION_1_3); - Mockito.when(featuresOutput.getDatapathId()).thenReturn(DUMMY_DATAPATH_ID); - Mockito.when(featuresOutput.getVersion()).thenReturn(OFConstants.OFP_VERSION_1_3); + Mockito.lenient().when(deviceInfo.getVersion()).thenReturn(OFConstants.OFP_VERSION_1_3); + Mockito.lenient().when(featuresOutput.getDatapathId()).thenReturn(DUMMY_DATAPATH_ID); + Mockito.lenient().when(featuresOutput.getVersion()).thenReturn(OFConstants.OFP_VERSION_1_3); Mockito.when(contextChainHolder.getContextChain(deviceInfo)).thenReturn(contextChain); Mockito.when(contextChain.isMastered(ContextChainMastershipState.CHECK, false)).thenReturn(true); @@ -225,10 +227,11 @@ public class DeviceContextImplTest { .build()) .build(); - Mockito.when(messageTranslatorPacketReceived.translate(any(Object.class), any(DeviceInfo.class), - any(Object.class))).thenReturn(packetReceived); - Mockito.when(messageTranslatorFlowCapableNodeConnector.translate(any(Object.class), any(DeviceInfo.class), - any(Object.class))).thenReturn(mock(FlowCapableNodeConnector.class)); + Mockito.when(messageTranslatorPacketReceived.translate(Mockito.any(), Mockito.any(), + Mockito.any())).thenReturn(packetReceived); + Mockito.when(messageTranslatorFlowCapableNodeConnector.translate(Mockito.any(), + Mockito.any(), + Mockito.any())).thenReturn(mock(FlowCapableNodeConnector.class)); Mockito.when(translatorLibrary.lookupTranslator(eq(new TranslatorKey(OFConstants.OFP_VERSION_1_3, PacketIn.class.getName())))).thenReturn(messageTranslatorPacketReceived); Mockito.when(translatorLibrary.lookupTranslator(eq(new TranslatorKey(OFConstants.OFP_VERSION_1_3, @@ -242,8 +245,9 @@ public class DeviceContextImplTest { final java.util.Optional deviceInitializer = java.util.Optional .of(this.abstractDeviceInitializer); - Mockito.when(deviceInitializerProvider.lookup(OFConstants.OFP_VERSION_1_3)).thenReturn(deviceInitializer); - Mockito.when(salRoleService.setRole(any())).thenReturn(Futures.immediateFuture(null)); + Mockito.lenient().when(deviceInitializerProvider.lookup(OFConstants.OFP_VERSION_1_3)) + .thenReturn(deviceInitializer); + Mockito.lenient().when(salRoleService.setRole(any())).thenReturn(Futures.immediateFuture(null)); deviceContext = new DeviceContextImpl( connectionContext, @@ -336,10 +340,12 @@ public class DeviceContextImplTest { public void testProcessReply() { final Error mockedError = mock(Error.class); deviceContext.processReply(mockedError); - verify(messageSpy).spyMessage(any(Class.class), eq(MessageSpy.StatisticsGroup.FROM_SWITCH_PUBLISHED_FAILURE)); + verify(messageSpy).spyMessage(Mockito.any(), + eq(MessageSpy.StatisticsGroup.FROM_SWITCH_PUBLISHED_FAILURE)); final OfHeader mockedOfHeader = mock(OfHeader.class); deviceContext.processReply(mockedOfHeader); - verify(messageSpy).spyMessage(any(Class.class), eq(MessageSpy.StatisticsGroup.FROM_SWITCH_PUBLISHED_SUCCESS)); + verify(messageSpy).spyMessage(Mockito.any(), + eq(MessageSpy.StatisticsGroup.FROM_SWITCH_PUBLISHED_SUCCESS)); } @Test @@ -348,11 +354,13 @@ public class DeviceContextImplTest { final Error mockedError = mock(Error.class); deviceContext.processReply(dummyXid, Lists.newArrayList(mockedError)); - verify(messageSpy).spyMessage(any(Class.class), eq(MessageSpy.StatisticsGroup.FROM_SWITCH_PUBLISHED_FAILURE)); + verify(messageSpy).spyMessage(Mockito.any(), + eq(MessageSpy.StatisticsGroup.FROM_SWITCH_PUBLISHED_FAILURE)); final MultipartReply mockedMultipartReply = mock(MultipartReply.class); deviceContext.processReply(dummyXid, Lists.newArrayList(mockedMultipartReply)); - verify(messageSpy).spyMessage(any(Class.class), eq(MessageSpy.StatisticsGroup.FROM_SWITCH_PUBLISHED_SUCCESS)); + verify(messageSpy).spyMessage(Mockito.any(), + eq(MessageSpy.StatisticsGroup.FROM_SWITCH_PUBLISHED_SUCCESS)); } @Test @@ -365,8 +373,9 @@ public class DeviceContextImplTest { .thenReturn(stringListenableFuture); deviceContext.setNotificationPublishService(mockedNotificationPublishService); deviceContext.processPacketInMessage(mockedPacketInMessage); - verify(messageSpy).spyMessage(any(Class.class), eq(MessageSpy.StatisticsGroup.FROM_SWITCH)); - verify(messageSpy).spyMessage(any(Class.class), eq(MessageSpy.StatisticsGroup.FROM_SWITCH_PUBLISHED_SUCCESS)); + verify(messageSpy).spyMessage(Mockito.any(), eq(MessageSpy.StatisticsGroup.FROM_SWITCH)); + verify(messageSpy).spyMessage(Mockito.any(), + eq(MessageSpy.StatisticsGroup.FROM_SWITCH_PUBLISHED_SUCCESS)); } @Test @@ -375,10 +384,10 @@ public class DeviceContextImplTest { final NotificationPublishService mockedNotificationPublishService = mock(NotificationPublishService.class); final ListenableFuture dummyFuture = Futures.immediateFailedFuture(new IllegalStateException()); - when(mockedNotificationPublishService.offerNotification(any(PacketReceived.class))).thenReturn(dummyFuture); + when(mockedNotificationPublishService.offerNotification(Mockito.any())).thenReturn(dummyFuture); deviceContext.setNotificationPublishService(mockedNotificationPublishService); deviceContext.processPacketInMessage(mockedPacketInMessage); - verify(messageSpy).spyMessage(any(Class.class), + verify(messageSpy).spyMessage(Mockito.any(), eq(MessageSpy.StatisticsGroup.FROM_SWITCH_NOTIFICATION_REJECTED)); } @@ -411,9 +420,9 @@ public class DeviceContextImplTest { final GetFeaturesOutput mockedFeature = mock(GetFeaturesOutput.class); - when(mockedFeature.getDatapathId()).thenReturn(DUMMY_DATAPATH_ID); + lenient().when(mockedFeature.getDatapathId()).thenReturn(DUMMY_DATAPATH_ID); - when(mockedPortStatusMessage.getVersion()).thenReturn(OFConstants.OFP_VERSION_1_3); + lenient().when(mockedPortStatusMessage.getVersion()).thenReturn(OFConstants.OFP_VERSION_1_3); when(mockedPortStatusMessage.getReason()).thenReturn(PortReason.OFPPRADD); when(mockedPortStatusMessage.getPortNo()).thenReturn(42L); @@ -431,7 +440,7 @@ public class DeviceContextImplTest { .setMatch(new MatchBuilder().build()); final NotificationPublishService mockedNotificationPublishService = mock(NotificationPublishService.class); - Mockito.when(messageTranslatorFlowRemoved + Mockito.lenient().when(messageTranslatorFlowRemoved .translate(any(Object.class), any(DeviceInfo.class), any(Object.class))) .thenReturn(flowRemovedMdsalBld.build()); diff --git a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/device/DeviceManagerImplTest.java b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/device/DeviceManagerImplTest.java index dd106cbb33..2a0a6f3ce3 100644 --- a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/device/DeviceManagerImplTest.java +++ b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/device/DeviceManagerImplTest.java @@ -10,8 +10,8 @@ package org.opendaylight.openflowplugin.impl.device; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.eq; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; @@ -21,7 +21,6 @@ import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; import io.netty.util.HashedWheelTimer; import java.lang.reflect.Field; -import java.math.BigInteger; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ExecutionException; import org.junit.Assert; @@ -36,7 +35,6 @@ 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.WriteTransaction; import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType; -import org.opendaylight.controller.md.sal.common.api.data.TransactionChainListener; import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException; import org.opendaylight.openflowjava.protocol.api.connection.ConnectionAdapter; import org.opendaylight.openflowplugin.api.openflow.connection.ConnectionContext; @@ -106,22 +104,14 @@ public class DeviceManagerImplTest { @Before public void setUp() throws Exception { - when(mockConnectionContext.getNodeId()).thenReturn(DUMMY_NODE_ID); when(mockConnectionContext.getFeatures()).thenReturn(mockFeatures); when(mockConnectionContext.getConnectionAdapter()).thenReturn(mockedConnectionAdapter); when(mockConnectionContext.getDeviceInfo()).thenReturn(deviceInfo); - when(mockedDeviceContext.getPrimaryConnectionContext()).thenReturn(mockConnectionContext); when(deviceInfo.getNodeInstanceIdentifier()).thenReturn(DUMMY_IDENTIFIER); when(deviceInfo.getNodeId()).thenReturn(DUMMY_NODE_ID); - when(mockFeatures.getCapabilities()).thenReturn(capabilities); - when(mockFeatures.getCapabilitiesV10()).thenReturn(capabilitiesV10); - when(mockFeatures.getDatapathId()).thenReturn(BigInteger.valueOf(21L)); - when(mockedFuture.isDone()).thenReturn(true); when(writeTransaction.submit()).thenReturn(mockedFuture); - when(transactionChain.newWriteOnlyTransaction()).thenReturn(writeTransaction); - when(dataBroker.createTransactionChain(any(TransactionChainListener.class))).thenReturn(transactionChain); when(dataBroker.newWriteOnlyTransaction()).thenReturn(writeTransaction); deviceManager = new DeviceManagerImpl( diff --git a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/device/PacketInRateLimiterTest.java b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/device/PacketInRateLimiterTest.java index 191745c09f..fb546dfc7f 100644 --- a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/device/PacketInRateLimiterTest.java +++ b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/device/PacketInRateLimiterTest.java @@ -8,12 +8,13 @@ package org.opendaylight.openflowplugin.impl.device; +import static org.mockito.ArgumentMatchers.anyBoolean; + import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.InOrder; -import org.mockito.Matchers; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.runners.MockitoJUnitRunner; @@ -91,7 +92,7 @@ public class PacketInRateLimiterTest { Assert.assertEquals(6, rateLimiter.getOccupiedPermits()); Assert.assertFalse(rateLimiter.isLimited()); - Mockito.verify(connectionAdapter, Mockito.times(2)).setPacketInFiltering(Matchers.anyBoolean()); + Mockito.verify(connectionAdapter, Mockito.times(2)).setPacketInFiltering(anyBoolean()); } private void acquirePermits(int permits) { @@ -136,7 +137,7 @@ public class PacketInRateLimiterTest { Assert.assertFalse(rateLimiter.isLimited()); caOrdered.verify(connectionAdapter).setPacketInFiltering(false); - Mockito.verify(connectionAdapter, Mockito.times(2)).setPacketInFiltering(Matchers.anyBoolean()); + Mockito.verify(connectionAdapter, Mockito.times(2)).setPacketInFiltering(anyBoolean()); } @Test @@ -163,7 +164,7 @@ public class PacketInRateLimiterTest { Assert.assertFalse(rateLimiter.isLimited()); caOrdered.verify(connectionAdapter).setPacketInFiltering(false); - Mockito.verify(connectionAdapter, Mockito.times(2)).setPacketInFiltering(Matchers.anyBoolean()); + Mockito.verify(connectionAdapter, Mockito.times(2)).setPacketInFiltering(anyBoolean()); } @Test @@ -195,6 +196,6 @@ public class PacketInRateLimiterTest { Assert.assertEquals(12, rateLimiter.getOccupiedPermits()); Assert.assertFalse(rateLimiter.isLimited()); - Mockito.verify(connectionAdapter, Mockito.times(2)).setPacketInFiltering(Matchers.anyBoolean()); + Mockito.verify(connectionAdapter, Mockito.times(2)).setPacketInFiltering(anyBoolean()); } } \ No newline at end of file diff --git a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/device/TransactionChainManagerTest.java b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/device/TransactionChainManagerTest.java index c2b7cfcb36..16cf635ba1 100644 --- a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/device/TransactionChainManagerTest.java +++ b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/device/TransactionChainManagerTest.java @@ -8,6 +8,8 @@ package org.opendaylight.openflowplugin.impl.device; +import static org.mockito.ArgumentMatchers.any; + import com.google.common.base.Optional; import com.google.common.util.concurrent.CheckedFuture; import com.google.common.util.concurrent.Futures; @@ -15,7 +17,6 @@ import org.junit.After; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.Matchers; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.runners.MockitoJUnitRunner; @@ -66,14 +67,10 @@ public class TransactionChainManagerTest { final ReadOnlyTransaction readOnlyTx = Mockito.mock(ReadOnlyTransaction.class); final CheckedFuture, ReadFailedException> noExistNodeFuture = Futures .immediateCheckedFuture(Optional.absent()); - Mockito.when(readOnlyTx.read(LogicalDatastoreType.OPERATIONAL, nodeKeyIdent)).thenReturn(noExistNodeFuture); - Mockito.when(dataBroker.newReadOnlyTransaction()).thenReturn(readOnlyTx); - Mockito.when(dataBroker.createTransactionChain(Matchers.any(TransactionChainListener.class))) + Mockito.when(dataBroker.createTransactionChain(any(TransactionChainListener.class))) .thenReturn(txChain); nodeId = new NodeId("h2g2:42"); nodeKeyIdent = DeviceStateUtil.createNodeInstanceIdentifier(nodeId); - Mockito.when(deviceInfo.getNodeInstanceIdentifier()).thenReturn(nodeKeyIdent); - Mockito.when(deviceInfo.getNodeId()).thenReturn(nodeId); txChainManager = new TransactionChainManager(dataBroker, nodeId.getValue()); Mockito.when(txChain.newReadWriteTransaction()).thenReturn(writeTx); @@ -187,9 +184,6 @@ public class TransactionChainManagerTest { @Test public void testDeactivateTransactionChainManagerFailed() throws Exception { - Mockito.when(writeTx.submit()).thenReturn( - Futures.immediateFailedCheckedFuture( - new TransactionCommitFailedException("mock"))); final Node data = new NodeBuilder().setId(nodeId).build(); txChainManager.writeToTransaction(LogicalDatastoreType.CONFIGURATION, path, data, false); diff --git a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/device/initialization/OF10DeviceInitializerTest.java b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/device/initialization/OF10DeviceInitializerTest.java index 7041f3455e..c61702f5cf 100644 --- a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/device/initialization/OF10DeviceInitializerTest.java +++ b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/device/initialization/OF10DeviceInitializerTest.java @@ -8,8 +8,8 @@ package org.opendaylight.openflowplugin.impl.device.initialization; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.eq; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; diff --git a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/device/initialization/OF13DeviceInitializerTest.java b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/device/initialization/OF13DeviceInitializerTest.java index 52e5f69799..d641a1f9e4 100644 --- a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/device/initialization/OF13DeviceInitializerTest.java +++ b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/device/initialization/OF13DeviceInitializerTest.java @@ -8,8 +8,8 @@ package org.opendaylight.openflowplugin.impl.device.initialization; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.eq; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; @@ -97,7 +97,6 @@ public class OF13DeviceInitializerTest { when(deviceInfo.getNodeInstanceIdentifier()).thenReturn(nodeInstanceIdentifier); when(deviceContext.getDeviceInfo()).thenReturn(deviceInfo); when(deviceContext.getMessageSpy()).thenReturn(messageSpy); - when(translatorLibrary.lookupTranslator(any())).thenReturn(messageTranslator); when(deviceContext.oook()).thenReturn(translatorLibrary); when(requestContext.getXid()).thenReturn(new Xid(42L)); when(deviceContext.createRequestContext()).thenReturn(requestContext); diff --git a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/device/listener/OpenflowProtocolListenerFullImplTest.java b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/device/listener/OpenflowProtocolListenerFullImplTest.java index b54ec50a87..54b5918150 100644 --- a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/device/listener/OpenflowProtocolListenerFullImplTest.java +++ b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/device/listener/OpenflowProtocolListenerFullImplTest.java @@ -8,12 +8,14 @@ package org.opendaylight.openflowplugin.impl.device.listener; +import static org.mockito.ArgumentMatchers.any; + import java.net.InetSocketAddress; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.Matchers; +import org.mockito.ArgumentMatchers; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.runners.MockitoJUnitRunner; @@ -64,7 +66,7 @@ public class OpenflowProtocolListenerFullImplTest { connectionAdapter.setMessageListener(ofProtocolListener); Mockito.when(connectionAdapter.getRemoteAddress()) .thenReturn(InetSocketAddress.createUnresolved("ofp-junit.example.org", 6663)); - Mockito.verify(connectionAdapter).setMessageListener(Matchers.any(OpenflowProtocolListener.class)); + Mockito.verify(connectionAdapter).setMessageListener(any(OpenflowProtocolListener.class)); } @After @@ -83,7 +85,7 @@ public class OpenflowProtocolListenerFullImplTest { .setVersion(OFConstants.OFP_VERSION_1_3).setXid(xid).build(); ofProtocolListener.onEchoRequestMessage(echoRequestMessage); - Mockito.verify(connectionAdapter).echoReply(Matchers.any(EchoReplyInput.class)); + Mockito.verify(connectionAdapter).echoReply(any(EchoReplyInput.class)); } /** @@ -97,7 +99,7 @@ public class OpenflowProtocolListenerFullImplTest { .setVersion(OFConstants.OFP_VERSION_1_3).setXid(xid).build(); ofProtocolListener.onErrorMessage(errorMessage); - Mockito.verify(deviceReplyProcessor).processReply(Matchers.any(ErrorMessage.class)); + Mockito.verify(deviceReplyProcessor).processReply(any(ErrorMessage.class)); } /** @@ -111,7 +113,7 @@ public class OpenflowProtocolListenerFullImplTest { .setVersion(OFConstants.OFP_VERSION_1_3).setXid(xid).build(); ofProtocolListener.onExperimenterMessage(experimenterMessage); - Mockito.verify(deviceReplyProcessor).processExperimenterMessage(Matchers.any()); + Mockito.verify(deviceReplyProcessor).processExperimenterMessage(ArgumentMatchers.any()); } /** @@ -125,7 +127,7 @@ public class OpenflowProtocolListenerFullImplTest { .setVersion(OFConstants.OFP_VERSION_1_3).setXid(xid).build(); ofProtocolListener.onFlowRemovedMessage(flowRemovedMessage); - Mockito.verify(deviceReplyProcessor).processFlowRemovedMessage(Matchers.any(FlowRemovedMessage.class)); + Mockito.verify(deviceReplyProcessor).processFlowRemovedMessage(any(FlowRemovedMessage.class)); } /** @@ -154,7 +156,7 @@ public class OpenflowProtocolListenerFullImplTest { .setVersion(OFConstants.OFP_VERSION_1_3).setXid(xid).build(); ofProtocolListener.onPacketInMessage(packetInMessage); - Mockito.verify(deviceReplyProcessor).processPacketInMessage(Matchers.any(PacketInMessage.class)); + Mockito.verify(deviceReplyProcessor).processPacketInMessage(any(PacketInMessage.class)); } /** @@ -168,7 +170,7 @@ public class OpenflowProtocolListenerFullImplTest { .setVersion(OFConstants.OFP_VERSION_1_3).setXid(xid).build(); ofProtocolListener.onPortStatusMessage(portStatusMessage); - Mockito.verify(deviceReplyProcessor).processPortStatusMessage(Matchers.any(PortStatusMessage.class)); + Mockito.verify(deviceReplyProcessor).processPortStatusMessage(any(PortStatusMessage.class)); } } diff --git a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/karaf/ClearStatsCommandProviderTest.java b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/karaf/ClearStatsCommandProviderTest.java index 8b016e982a..50da77de1c 100644 --- a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/karaf/ClearStatsCommandProviderTest.java +++ b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/karaf/ClearStatsCommandProviderTest.java @@ -8,12 +8,13 @@ package org.opendaylight.openflowplugin.impl.karaf; +import static org.mockito.ArgumentMatchers.anyString; + import com.google.common.base.Function; import javax.annotation.Nullable; import org.junit.After; import org.junit.Assert; import org.junit.Test; -import org.mockito.Matchers; import org.mockito.Mockito; import org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.MessageIntelligenceAgency; import org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.MessageSpy; @@ -45,7 +46,7 @@ public class ClearStatsCommandProviderTest extends AbstractKarafTest { @After public void tearDown() { - Mockito.verify(console).print(Matchers.anyString()); + Mockito.verify(console).print(anyString()); mi5.resetStatistics(); } diff --git a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/karaf/ResetEventTimesComandProviderTest.java b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/karaf/ResetEventTimesComandProviderTest.java index cc19551ce8..8e0dc77bd0 100644 --- a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/karaf/ResetEventTimesComandProviderTest.java +++ b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/karaf/ResetEventTimesComandProviderTest.java @@ -8,12 +8,13 @@ package org.opendaylight.openflowplugin.impl.karaf; +import static org.mockito.ArgumentMatchers.anyString; + import com.google.common.base.Function; import javax.annotation.Nullable; import org.junit.After; import org.junit.Assert; import org.junit.Test; -import org.mockito.Matchers; import org.mockito.Mockito; import org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.EventIdentifier; import org.opendaylight.openflowplugin.impl.statistics.ofpspecific.EventsTimeCounter; @@ -41,7 +42,7 @@ public class ResetEventTimesComandProviderTest extends AbstractKarafTest { @After public void tearDown() { - Mockito.verify(console).print(Matchers.anyString()); + Mockito.verify(console).print(anyString()); EventsTimeCounter.resetAllCounters(); } diff --git a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/karaf/ResetSessionStatsComandProviderTest.java b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/karaf/ResetSessionStatsComandProviderTest.java index bdc394449d..c09a1605a4 100644 --- a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/karaf/ResetSessionStatsComandProviderTest.java +++ b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/karaf/ResetSessionStatsComandProviderTest.java @@ -8,12 +8,13 @@ package org.opendaylight.openflowplugin.impl.karaf; +import static org.mockito.ArgumentMatchers.anyString; + import com.google.common.base.Function; import javax.annotation.Nullable; import org.junit.After; import org.junit.Assert; import org.junit.Test; -import org.mockito.Matchers; import org.mockito.Mockito; import org.opendaylight.openflowplugin.impl.statistics.ofpspecific.SessionStatistics; @@ -40,7 +41,7 @@ public class ResetSessionStatsComandProviderTest extends AbstractKarafTest { @After public void tearDown() { - Mockito.verify(console).print(Matchers.anyString()); + Mockito.verify(console).print(anyString()); SessionStatistics.resetAllCounters(); } diff --git a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/karaf/ShowEventTimesComandProviderTest.java b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/karaf/ShowEventTimesComandProviderTest.java index 65fe3cfc20..f8f4804893 100644 --- a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/karaf/ShowEventTimesComandProviderTest.java +++ b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/karaf/ShowEventTimesComandProviderTest.java @@ -8,12 +8,13 @@ package org.opendaylight.openflowplugin.impl.karaf; +import static org.mockito.ArgumentMatchers.contains; + import com.google.common.base.Function; import javax.annotation.Nullable; import org.junit.After; import org.junit.Assert; import org.junit.Test; -import org.mockito.Matchers; import org.mockito.Mockito; import org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.EventIdentifier; import org.opendaylight.openflowplugin.impl.statistics.ofpspecific.EventsTimeCounter; @@ -69,6 +70,6 @@ public class ShowEventTimesComandProviderTest extends AbstractKarafTest { showEventTimesComandProvider.execute(cmdSession); Assert.assertFalse(checkNoActivity(EventsTimeCounter.provideTimes(), CHECK_NO_ACTIVITY_FUNCTION)); - Mockito.verify(console).print(Matchers.contains("junitDevice")); + Mockito.verify(console).print(contains("junitDevice")); } } \ No newline at end of file diff --git a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/karaf/ShowSessionStatsCommandProviderTest.java b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/karaf/ShowSessionStatsCommandProviderTest.java index 559a096cb4..20508355d9 100644 --- a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/karaf/ShowSessionStatsCommandProviderTest.java +++ b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/karaf/ShowSessionStatsCommandProviderTest.java @@ -8,12 +8,13 @@ package org.opendaylight.openflowplugin.impl.karaf; +import static org.mockito.ArgumentMatchers.contains; + import com.google.common.base.Function; import javax.annotation.Nullable; import org.junit.After; import org.junit.Assert; import org.junit.Test; -import org.mockito.Matchers; import org.mockito.Mockito; import org.opendaylight.openflowplugin.impl.statistics.ofpspecific.SessionStatistics; @@ -67,6 +68,6 @@ public class ShowSessionStatsCommandProviderTest extends AbstractKarafTest { showSessionStatsCommandProvider.execute(cmdSession); Assert.assertFalse(checkNoActivity(SessionStatistics.provideStatistics(), CHECK_NO_ACTIVITY_FUNCTION)); - Mockito.verify(console).print(Matchers.contains(dummySessionId)); + Mockito.verify(console).print(contains(dummySessionId)); } } \ No newline at end of file diff --git a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/karaf/ShowStatsCommandProviderTest.java b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/karaf/ShowStatsCommandProviderTest.java index cb96800a74..b573d6f788 100644 --- a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/karaf/ShowStatsCommandProviderTest.java +++ b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/karaf/ShowStatsCommandProviderTest.java @@ -8,12 +8,13 @@ package org.opendaylight.openflowplugin.impl.karaf; +import static org.mockito.ArgumentMatchers.matches; + import com.google.common.base.Function; import javax.annotation.Nullable; import org.junit.After; import org.junit.Assert; import org.junit.Test; -import org.mockito.Matchers; import org.mockito.Mockito; import org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.MessageIntelligenceAgency; import org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.MessageSpy; @@ -46,7 +47,7 @@ public class ShowStatsCommandProviderTest extends AbstractKarafTest { @After public void tearDown() throws Exception { // Pattern.DOTALL is set inline via "(?s)" at the beginning - Mockito.verify(console).print(Matchers.matches("(?s).+")); + Mockito.verify(console).print(matches("(?s).+")); messageIntelligenceAgency.resetStatistics(); } diff --git a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/lifecycle/ContextChainHolderImplTest.java b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/lifecycle/ContextChainHolderImplTest.java index a6c7600ccd..c7c0a62cb9 100644 --- a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/lifecycle/ContextChainHolderImplTest.java +++ b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/lifecycle/ContextChainHolderImplTest.java @@ -89,11 +89,6 @@ public class ContextChainHolderImplTest { @Before public void setUp() throws Exception { - Mockito.doAnswer(invocation -> { - invocation.getArgumentAt(0, Runnable.class).run(); - return null; - }).when(executorService).submit(Mockito.any()); - Mockito.when(connectionContext.getDeviceInfo()).thenReturn(deviceInfo); Mockito.when(deviceManager.createContext(connectionContext)).thenReturn(deviceContext); @@ -178,8 +173,6 @@ public class ContextChainHolderImplTest { @Test public void reconciliationFrameworkSuccessButNotSubmit() throws Exception { contextChainHolder.createContextChain(connectionContext); - Mockito.when(reconciliationFrameworkEvent.onDevicePrepared(deviceInfo)) - .thenReturn(Futures.immediateFuture(ResultState.DONOTHING)); contextChainHolder.createContextChain(connectionContext); contextChainHolder.onMasterRoleAcquired(deviceInfo, ContextChainMastershipState.INITIAL_FLOW_REGISTRY_FILL); contextChainHolder.onMasterRoleAcquired(deviceInfo, ContextChainMastershipState.RPC_REGISTRATION); diff --git a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/lifecycle/ContextChainImplTest.java b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/lifecycle/ContextChainImplTest.java index 9cf6628c4d..690717634b 100644 --- a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/lifecycle/ContextChainImplTest.java +++ b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/lifecycle/ContextChainImplTest.java @@ -63,7 +63,6 @@ public class ContextChainImplTest { Mockito.when(rpcContext.closeServiceInstance()).thenReturn(Futures.immediateFuture(null)); Mockito.when(statisticsContext.closeServiceInstance()).thenReturn(Futures.immediateFuture(null)); Mockito.when(connectionContext.getDeviceInfo()).thenReturn(deviceInfo); - Mockito.when(connectionContext.getConnectionState()).thenReturn(ConnectionContext.CONNECTION_STATE.WORKING); Mockito.when(clusterSingletonServiceProvider.registerClusterSingletonService(Mockito.any())) .thenReturn(clusterSingletonServiceRegistration); diff --git a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/registry/flow/DeviceFlowRegistryImplTest.java b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/registry/flow/DeviceFlowRegistryImplTest.java index b9be54d894..5998817c55 100644 --- a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/registry/flow/DeviceFlowRegistryImplTest.java +++ b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/registry/flow/DeviceFlowRegistryImplTest.java @@ -10,7 +10,7 @@ package org.opendaylight.openflowplugin.impl.registry.flow; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; -import static org.mockito.Matchers.any; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.inOrder; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; diff --git a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/registry/flow/FlowRegistryKeyFactoryTest.java b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/registry/flow/FlowRegistryKeyFactoryTest.java index e1f1e4ffd7..f9e9c600d7 100644 --- a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/registry/flow/FlowRegistryKeyFactoryTest.java +++ b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/registry/flow/FlowRegistryKeyFactoryTest.java @@ -62,7 +62,6 @@ public class FlowRegistryKeyFactoryTest { flowAndStatisticsMapListList.add(TestFlowHelper.createFlowAndStatisticsMapListBuilder(i).build()); } FLOWS_STATISTICS_UPDATE_BUILDER.setFlowAndStatisticsMapList(flowAndStatisticsMapListList); - Mockito.when(deviceContext.getDeviceState()).thenReturn(deviceState); Mockito.when(deviceInfo.getVersion()).thenReturn(OFConstants.OFP_VERSION_1_3); } diff --git a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/role/RoleContextImplTest.java b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/role/RoleContextImplTest.java index 9b332b586b..fa491d38ce 100644 --- a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/role/RoleContextImplTest.java +++ b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/role/RoleContextImplTest.java @@ -8,7 +8,7 @@ package org.opendaylight.openflowplugin.impl.role; -import static org.mockito.Matchers.any; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; diff --git a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/rpc/RpcContextImplTest.java b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/rpc/RpcContextImplTest.java index 202cadd98d..9ca563094f 100644 --- a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/rpc/RpcContextImplTest.java +++ b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/rpc/RpcContextImplTest.java @@ -75,7 +75,6 @@ public class RpcContextImplTest { final NodeId nodeId = new NodeId("openflow:1"); nodeInstanceIdentifier = InstanceIdentifier.create(Nodes.class).child(Node.class, new NodeKey(nodeId)); - when(deviceContext.getDeviceState()).thenReturn(deviceState); when(deviceInfo.getNodeInstanceIdentifier()).thenReturn(nodeInstanceIdentifier); when(deviceContext.getMessageSpy()).thenReturn(messageSpy); when(deviceContext.getDeviceInfo()).thenReturn(deviceInfo); diff --git a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/rpc/RpcManagerImplTest.java b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/rpc/RpcManagerImplTest.java index 3fa77d09d0..722c766697 100644 --- a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/rpc/RpcManagerImplTest.java +++ b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/rpc/RpcManagerImplTest.java @@ -15,7 +15,6 @@ import java.util.concurrent.ConcurrentMap; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.Matchers; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.runners.MockitoJUnitRunner; @@ -90,17 +89,9 @@ public class RpcManagerImplTest { .setVersion(OFConstants.OFP_VERSION_1_3) .build(); - Mockito.when(deviceInfo.getNodeId()).thenReturn(nodeKey.getId()); Mockito.when(deviceInfo.getNodeInstanceIdentifier()).thenReturn(nodePath); - Mockito.when(connectionContext.getFeatures()).thenReturn(features); - Mockito.when(deviceContext.getPrimaryConnectionContext()).thenReturn(connectionContext); - Mockito.when(deviceContext.getDeviceState()).thenReturn(deviceState); Mockito.when(deviceContext.getDeviceInfo()).thenReturn(deviceInfo); Mockito.when(deviceContext.getMessageSpy()).thenReturn(messageSpy); - Mockito.when(rpcProviderRegistry.addRoutedRpcImplementation( - Matchers.any(), Matchers.any(RpcService.class))) - .thenReturn(routedRpcRegistration); - Mockito.when(contexts.remove(deviceInfo)).thenReturn(removedContexts); } @Test diff --git a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/MultipartRequestCallbackTest.java b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/MultipartRequestCallbackTest.java index 81c22459b1..c752535ca0 100644 --- a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/MultipartRequestCallbackTest.java +++ b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/MultipartRequestCallbackTest.java @@ -14,8 +14,8 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; +import org.mockito.ArgumentMatchers; import org.mockito.Captor; -import org.mockito.Matchers; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.runners.MockitoJUnitRunner; @@ -58,7 +58,7 @@ public class MultipartRequestCallbackTest { Mockito.when(deviceContext.getMessageSpy()).thenReturn(spy); final OngoingStubbing> when = - Mockito.when(deviceContext.getMultiMsgCollector(Matchers.any())); + Mockito.when(deviceContext.getMultiMsgCollector(ArgumentMatchers.any())); when.thenReturn(multiMsgCollector); multipartRequestCallback = new MultiLayerMultipartRequestCallback<>(requestContext, MultipartRequestInput.class, @@ -72,7 +72,7 @@ public class MultipartRequestCallbackTest { @Test public void testOnSuccess1() throws Exception { multipartRequestCallback.onSuccess(null); - Mockito.verify(multiMsgCollector).endCollecting(Matchers.any()); + Mockito.verify(multiMsgCollector).endCollecting(ArgumentMatchers.any()); } /** @@ -94,6 +94,6 @@ public class MultipartRequestCallbackTest { final MultipartReplyMessage replyMessage = new MultipartReplyMessageBuilder().build(); multipartRequestCallback.onSuccess(replyMessage); Mockito.verify(multiMsgCollector) - .addMultipartMsg(Matchers.eq(replyMessage), Matchers.eq(false), Matchers.any()); + .addMultipartMsg(ArgumentMatchers.eq(replyMessage), ArgumentMatchers.eq(false), ArgumentMatchers.any()); } } diff --git a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/MultipartRequestOnTheFlyCallbackTest.java b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/MultipartRequestOnTheFlyCallbackTest.java index bf4a5bfeba..158fed166b 100644 --- a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/MultipartRequestOnTheFlyCallbackTest.java +++ b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/MultipartRequestOnTheFlyCallbackTest.java @@ -10,7 +10,8 @@ package org.opendaylight.openflowplugin.impl.services; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; -import static org.mockito.Matchers.eq; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; @@ -25,7 +26,7 @@ import java.util.List; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.Matchers; +import org.mockito.ArgumentMatchers; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.runners.MockitoJUnitRunner; @@ -116,14 +117,7 @@ public class MultipartRequestOnTheFlyCallbackTest { public void initialization() { when(mockedDeviceContext.getMessageSpy()).thenReturn(new MessageIntelligenceAgencyImpl()); when(mockedNodeId.toString()).thenReturn(DUMMY_NODE_ID); - when(mockedPrimaryConnection.getNodeId()).thenReturn(mockedNodeId); when(mockedPrimaryConnection.getFeatures()).thenReturn(mockedFeaturesReply); - when(mockedFeaturesReply.getVersion()).thenReturn(OFConstants.OFP_VERSION_1_3); - when(mockedFeaturesReply.getDatapathId()).thenReturn(BigInteger.valueOf(123L)); - - when(mocketGetFeaturesOutput.getTables()).thenReturn(tableId); - when(mocketGetFeaturesOutput.getVersion()).thenReturn(OFConstants.OFP_VERSION_1_3); - when(mocketGetFeaturesOutput.getDatapathId()).thenReturn(BigInteger.valueOf(123L)); when(mockedDeviceContext.getPrimaryConnectionContext()).thenReturn(mockedPrimaryConnection); when(mockedDeviceInfo.getNodeInstanceIdentifier()).thenReturn(NODE_PATH); @@ -131,10 +125,9 @@ public class MultipartRequestOnTheFlyCallbackTest { when(mockedDeviceInfo.getDatapathId()).thenReturn(BigInteger.TEN); when(mockedDeviceInfo.getVersion()).thenReturn(OFConstants.OFP_VERSION_1_3); - when(mockedDeviceContext.getDeviceState()).thenReturn(mockedDeviceState); when(mockedDeviceContext.getDeviceInfo()).thenReturn(mockedDeviceInfo); when(mockedDeviceContext.getDeviceFlowRegistry()).thenReturn(mockedFlowRegistry); - when(mockedFlowRegistry.retrieveDescriptor(Matchers.any(FlowRegistryKey.class))) + when(mockedFlowRegistry.retrieveDescriptor(any(FlowRegistryKey.class))) .thenReturn(mockedFlowDescriptor); final InstanceIdentifier nodePath = @@ -144,9 +137,6 @@ public class MultipartRequestOnTheFlyCallbackTest { final Optional flowNodeOpt = Optional.of(flowNodeBuilder.build()); final CheckedFuture, ReadFailedException> flowNodeFuture = Futures.immediateCheckedFuture(flowNodeOpt); - when(mockedReadOnlyTx.read(LogicalDatastoreType.OPERATIONAL, nodePath)).thenReturn(flowNodeFuture); - when(mockedDeviceContext.getReadTransaction()).thenReturn(mockedReadOnlyTx); - dummyRequestContext = new AbstractRequestContext>(DUMMY_XID) { @Override @@ -198,8 +188,8 @@ public class MultipartRequestOnTheFlyCallbackTest { assertEquals(expectedRpcResult.isSuccessful(), actualResult.isSuccessful()); Mockito.verify(mockedDeviceContext, Mockito.never()) - .writeToTransaction(Matchers.eq(LogicalDatastoreType.OPERATIONAL), - Matchers.any(), Matchers.any()); + .writeToTransaction(eq(LogicalDatastoreType.OPERATIONAL), + ArgumentMatchers.any(), ArgumentMatchers.any()); Mockito.verify(mockedDeviceContext).submitTransaction(); } @@ -239,15 +229,13 @@ public class MultipartRequestOnTheFlyCallbackTest { final Optional flowNodeOpt = Optional.of(flowNodeBuilder.build()); final CheckedFuture, ReadFailedException> flowNodeFuture = Futures .immediateCheckedFuture(flowNodeOpt); - when(mockedReadOnlyTx.read(LogicalDatastoreType.OPERATIONAL, nodePath)).thenReturn(flowNodeFuture); - when(mockedDeviceContext.getReadTransaction()).thenReturn(mockedReadOnlyTx); multipartRequestOnTheFlyCallback.onSuccess(mpReplyMessage.build()); verify(mockedReadOnlyTx, times(0)).read(LogicalDatastoreType.OPERATIONAL, nodePath); verify(mockedReadOnlyTx, times(0)).close(); verify(mockedDeviceContext, times(1)).writeToTransaction(eq(LogicalDatastoreType.OPERATIONAL), - Matchers.any(), Matchers.any()); + any(), any()); } /** @@ -266,9 +254,9 @@ public class MultipartRequestOnTheFlyCallbackTest { // Nothing else than flow is supported by on the fly callback assertNotNull(actualResult.getErrors()); assertFalse(actualResult.getErrors().isEmpty()); - Mockito.verify(mockedFlowRegistry, Mockito.never()).store(Matchers.any()); + Mockito.verify(mockedFlowRegistry, Mockito.never()).store(any()); Mockito.verify(mockedDeviceContext, Mockito.never()) - .writeToTransaction(Matchers.eq(LogicalDatastoreType.OPERATIONAL), - Matchers.any(), Matchers.any()); + .writeToTransaction(eq(LogicalDatastoreType.OPERATIONAL), + ArgumentMatchers.any(), ArgumentMatchers.any()); } } diff --git a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/ServiceMocking.java b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/ServiceMocking.java index 3a489cb17a..f096ce8c50 100644 --- a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/ServiceMocking.java +++ b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/ServiceMocking.java @@ -7,6 +7,7 @@ */ package org.opendaylight.openflowplugin.impl.services; +import static org.mockito.Mockito.lenient; import static org.mockito.Mockito.when; import com.google.common.util.concurrent.Futures; @@ -97,34 +98,35 @@ public abstract class ServiceMocking { @Before @SuppressWarnings("unchecked") public void initialization() throws Exception { - when(mockedExtensionConverter.getExperimenterId()) + lenient().when(mockedExtensionConverter.getExperimenterId()) .thenReturn(new ExperimenterId(DUMMY_EXPERIMENTER_ID)); - when(mockedExtensionConverterProvider.getMessageConverter(Matchers.any())) + lenient().when(mockedExtensionConverterProvider.getMessageConverter(Matchers.any())) .thenReturn(mockedExtensionConverter); - when(mockedRequestContextStack.createRequestContext()).thenReturn(mockedRequestContext); - when(mockedRequestContext.getXid()).thenReturn(DUMMY_XID); - when(mockedFeatures.getDatapathId()).thenReturn(DUMMY_DATAPATH_ID); - when(mockedFeatures.getVersion()).thenReturn(DUMMY_VERSION); + lenient().when(mockedRequestContextStack.createRequestContext()).thenReturn(mockedRequestContext); + lenient().when(mockedRequestContext.getXid()).thenReturn(DUMMY_XID); + lenient().when(mockedFeatures.getDatapathId()).thenReturn(DUMMY_DATAPATH_ID); + lenient().when(mockedFeatures.getVersion()).thenReturn(DUMMY_VERSION); - when(mockedFeaturesOutput.getDatapathId()).thenReturn(DUMMY_DATAPATH_ID); - when(mockedFeaturesOutput.getVersion()).thenReturn(DUMMY_VERSION); + lenient().when(mockedFeaturesOutput.getDatapathId()).thenReturn(DUMMY_DATAPATH_ID); + lenient().when(mockedFeaturesOutput.getVersion()).thenReturn(DUMMY_VERSION); - when(mockedPrimConnectionContext.getFeatures()).thenReturn(mockedFeatures); - when(mockedPrimConnectionContext.getConnectionAdapter()).thenReturn(mockedConnectionAdapter); - when(mockedPrimConnectionContext.getConnectionState()).thenReturn(ConnectionContext.CONNECTION_STATE.WORKING); - when(mockedPrimConnectionContext.getOutboundQueueProvider()).thenReturn(mockedOutboundQueue); + lenient().when(mockedPrimConnectionContext.getFeatures()).thenReturn(mockedFeatures); + lenient().when(mockedPrimConnectionContext.getConnectionAdapter()).thenReturn(mockedConnectionAdapter); + lenient().when(mockedPrimConnectionContext.getConnectionState()) + .thenReturn(ConnectionContext.CONNECTION_STATE.WORKING); + lenient().when(mockedPrimConnectionContext.getOutboundQueueProvider()).thenReturn(mockedOutboundQueue); - when(mockedDeviceInfo.getNodeInstanceIdentifier()).thenReturn(DUMMY_NODE_II); + lenient().when(mockedDeviceInfo.getNodeInstanceIdentifier()).thenReturn(DUMMY_NODE_II); when(mockedDeviceInfo.getDatapathId()).thenReturn(DUMMY_DATAPATH_ID); when(mockedDeviceInfo.getVersion()).thenReturn(DUMMY_VERSION); - when(mockedDeviceContext.getPrimaryConnectionContext()).thenReturn(mockedPrimConnectionContext); + lenient().when(mockedDeviceContext.getPrimaryConnectionContext()).thenReturn(mockedPrimConnectionContext); when(mockedDeviceContext.getMessageSpy()).thenReturn(mockedMessagSpy); - when(mockedDeviceContext.getDeviceFlowRegistry()) + lenient().when(mockedDeviceContext.getDeviceFlowRegistry()) .thenReturn(new DeviceFlowRegistryImpl(DUMMY_VERSION, dataBroker, DUMMY_NODE_II)); - when(mockedDeviceContext.getDeviceState()).thenReturn(mockedDeviceState); + lenient().when(mockedDeviceContext.getDeviceState()).thenReturn(mockedDeviceState); when(mockedDeviceContext.getDeviceInfo()).thenReturn(mockedDeviceInfo); - when(mockedDeviceContext.getMultiMsgCollector(Matchers.any())).thenReturn(multiMessageCollector); + lenient().when(mockedDeviceContext.getMultiMsgCollector(Matchers.any())).thenReturn(multiMessageCollector); setup(); } diff --git a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/sal/SalAsyncConfigServiceImplTest.java b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/sal/SalAsyncConfigServiceImplTest.java index ec7574380a..c59addabc7 100644 --- a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/sal/SalAsyncConfigServiceImplTest.java +++ b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/sal/SalAsyncConfigServiceImplTest.java @@ -8,6 +8,7 @@ package org.opendaylight.openflowplugin.impl.services.sal; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.verify; import com.google.common.util.concurrent.FutureCallback; @@ -17,7 +18,7 @@ import java.util.concurrent.Future; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.Matchers; +import org.mockito.ArgumentMatchers; import org.mockito.Mockito; import org.mockito.runners.MockitoJUnitRunner; import org.opendaylight.openflowplugin.impl.services.ServiceMocking; @@ -76,7 +77,7 @@ public class SalAsyncConfigServiceImplTest extends ServiceMocking { Assert.assertTrue(getAsyncResult.isDone()); Assert.assertTrue(getAsyncResult.get().isSuccessful()); verify(mockedRequestContextStack).createRequestContext(); - verify(mockedOutboundQueue).commitEntry(Matchers.eq(ServiceMocking.DUMMY_XID_VALUE), - Matchers.any(), Matchers.>any()); + verify(mockedOutboundQueue).commitEntry(eq(ServiceMocking.DUMMY_XID_VALUE), + ArgumentMatchers.any(), ArgumentMatchers.>any()); } } diff --git a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/sal/SalBundleServiceImplTest.java b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/sal/SalBundleServiceImplTest.java index fd76f4e1f5..8af79bc7d2 100644 --- a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/sal/SalBundleServiceImplTest.java +++ b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/sal/SalBundleServiceImplTest.java @@ -8,13 +8,14 @@ package org.opendaylight.openflowplugin.impl.services.sal; +import static org.mockito.ArgumentMatchers.any; + import com.google.common.util.concurrent.SettableFuture; import java.util.ArrayList; import java.util.List; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.Matchers; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.runners.MockitoJUnitRunner; @@ -84,7 +85,7 @@ public class SalBundleServiceImplTest { experimenterBuilder.setExperimenterMessageOfChoice(new BundleControlSalBuilder() .setSalControlData(new SalControlDataBuilder(input).build()) .build()); - Mockito.when(experimenterMessageService.sendExperimenter(Matchers.any())).thenReturn(SettableFuture.create()); + Mockito.when(experimenterMessageService.sendExperimenter(any())).thenReturn(SettableFuture.create()); service.controlBundle(input); Mockito.verify(experimenterMessageService).sendExperimenter(experimenterBuilder.build()); } @@ -106,7 +107,7 @@ public class SalBundleServiceImplTest { final BundleAddMessageSalBuilder addMessageBuilder = new BundleAddMessageSalBuilder(); final SendExperimenterInputBuilder experimenterBuilder = new SendExperimenterInputBuilder() .setNode(NODE_REF); - Mockito.when(experimenterMessageService.sendExperimenter(Matchers.any())).thenReturn(SettableFuture.create()); + Mockito.when(experimenterMessageService.sendExperimenter(any())).thenReturn(SettableFuture.create()); service.addBundleMessages(input); for (Message msg : innerMessages) { Mockito.verify(experimenterMessageService) diff --git a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/sal/SalEchoServiceImplTest.java b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/sal/SalEchoServiceImplTest.java index 683abf9093..ee29c35c5e 100644 --- a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/sal/SalEchoServiceImplTest.java +++ b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/sal/SalEchoServiceImplTest.java @@ -8,6 +8,7 @@ package org.opendaylight.openflowplugin.impl.services.sal; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.verify; import com.google.common.util.concurrent.FutureCallback; @@ -16,7 +17,7 @@ import com.google.common.util.concurrent.ListenableFuture; import java.util.concurrent.Future; import org.junit.Assert; import org.junit.Test; -import org.mockito.Matchers; +import org.mockito.ArgumentMatchers; import org.mockito.Mockito; import org.opendaylight.openflowplugin.impl.services.ServiceMocking; import org.opendaylight.yang.gen.v1.urn.opendaylight.echo.service.rev150305.SendEchoInput; @@ -57,6 +58,7 @@ public class SalEchoServiceImplTest extends ServiceMocking { Assert.assertTrue(echoOutput.get().isSuccessful()); verify(mockedRequestContextStack).createRequestContext(); verify(mockedOutboundQueue) - .commitEntry(Matchers.eq(2121L), Matchers.any(), Matchers.>any()); + .commitEntry(eq(2121L), ArgumentMatchers.any(), + ArgumentMatchers.>any()); } } diff --git a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/sal/SalExperimenterMessageServiceImplTest.java b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/sal/SalExperimenterMessageServiceImplTest.java index 866cc862db..ecfe939247 100644 --- a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/sal/SalExperimenterMessageServiceImplTest.java +++ b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/sal/SalExperimenterMessageServiceImplTest.java @@ -10,10 +10,11 @@ package org.opendaylight.openflowplugin.impl.services.sal; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.verify; import org.junit.Test; -import org.mockito.Matchers; +import org.mockito.ArgumentMatchers; import org.mockito.Mock; import org.mockito.Mockito; import org.opendaylight.openflowplugin.api.openflow.device.Xid; @@ -48,7 +49,7 @@ public class SalExperimenterMessageServiceImplTest extends ServiceMocking { salExperimenterMessageService = new SalExperimenterMessageServiceImpl(mockedRequestContextStack, mockedDeviceContext, extensionConverterProvider); - Mockito.when(extensionConverterProvider.getMessageConverter(Matchers.any())) + Mockito.when(extensionConverterProvider.getMessageConverter(ArgumentMatchers.any())) .thenReturn(extensionConverter); Mockito.when(extensionConverter.getExperimenterId()).thenReturn(new ExperimenterId(43L)); Mockito.when(extensionConverter.getType()).thenReturn(44L); @@ -71,8 +72,8 @@ public class SalExperimenterMessageServiceImplTest extends ServiceMocking { final ExperimenterInput input = (ExperimenterInput) request; assertEquals(43L, input.getExperimenter().getValue().longValue()); assertEquals(44L, input.getExpType().longValue()); - Mockito.verify(extensionConverter).convert(Matchers.eq(sendExperimenterInput.getExperimenterMessageOfChoice()), - Matchers.any(ExtensionConvertorData.class)); + Mockito.verify(extensionConverter).convert(eq(sendExperimenterInput.getExperimenterMessageOfChoice()), + ArgumentMatchers.any(ExtensionConvertorData.class)); } private SendExperimenterInput buildSendExperimenterInput() { diff --git a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/sal/SalExperimenterMpMessageServiceImplTest.java b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/sal/SalExperimenterMpMessageServiceImplTest.java index 3c380b8e60..ecae3b0c2b 100644 --- a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/sal/SalExperimenterMpMessageServiceImplTest.java +++ b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/sal/SalExperimenterMpMessageServiceImplTest.java @@ -9,7 +9,6 @@ package org.opendaylight.openflowplugin.impl.services.sal; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; import java.util.List; import org.junit.Test; @@ -17,7 +16,6 @@ import org.opendaylight.openflowplugin.impl.services.ServiceMocking; import org.opendaylight.yang.gen.v1.urn.opendaylight.experimenter.mp.message.service.rev151020.SendExperimenterMpRequestInput; import org.opendaylight.yang.gen.v1.urn.opendaylight.experimenter.mp.message.service.rev151020.SendExperimenterMpRequestInputBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef; -import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReply; public class SalExperimenterMpMessageServiceImplTest extends ServiceMocking { @@ -27,8 +25,6 @@ public class SalExperimenterMpMessageServiceImplTest extends ServiceMocking { @SuppressWarnings("unchecked") protected void setup() { this.>mockSuccessfulFuture(); - when(mockedExtensionConverter.getType()) - .thenReturn((long) MultipartType.OFPMPEXPERIMENTER.getIntValue()); salExperimenterMpMessageService = new SalExperimenterMpMessageServiceImpl( mockedRequestContextStack, diff --git a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/sal/SalFlatBatchServiceImplTest.java b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/sal/SalFlatBatchServiceImplTest.java index 385d3d2e33..4a4f3da3ac 100644 --- a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/sal/SalFlatBatchServiceImplTest.java +++ b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/sal/SalFlatBatchServiceImplTest.java @@ -21,9 +21,9 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; +import org.mockito.ArgumentMatchers; import org.mockito.Captor; import org.mockito.InOrder; -import org.mockito.Matchers; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.runners.MockitoJUnitRunner; @@ -137,25 +137,25 @@ public class SalFlatBatchServiceImplTest { @Test public void testProcessFlatBatch_allSuccessFinished() throws Exception { - Mockito.when(salFlowsBatchService.addFlowsBatch(Matchers.any())) + Mockito.when(salFlowsBatchService.addFlowsBatch(ArgumentMatchers.any())) .thenReturn(RpcResultBuilder.success(new AddFlowsBatchOutputBuilder().build()).buildFuture()); - Mockito.when(salFlowsBatchService.removeFlowsBatch(Matchers.any())) + Mockito.when(salFlowsBatchService.removeFlowsBatch(ArgumentMatchers.any())) .thenReturn(RpcResultBuilder.success(new RemoveFlowsBatchOutputBuilder().build()).buildFuture()); - Mockito.when(salFlowsBatchService.updateFlowsBatch(Matchers.any())) + Mockito.when(salFlowsBatchService.updateFlowsBatch(ArgumentMatchers.any())) .thenReturn(RpcResultBuilder.success(new UpdateFlowsBatchOutputBuilder().build()).buildFuture()); - Mockito.when(salGroupsBatchService.addGroupsBatch(Matchers.any())) + Mockito.when(salGroupsBatchService.addGroupsBatch(ArgumentMatchers.any())) .thenReturn(RpcResultBuilder.success(new AddGroupsBatchOutputBuilder().build()).buildFuture()); - Mockito.when(salGroupsBatchService.removeGroupsBatch(Matchers.any())) + Mockito.when(salGroupsBatchService.removeGroupsBatch(ArgumentMatchers.any())) .thenReturn(RpcResultBuilder.success(new RemoveGroupsBatchOutputBuilder().build()).buildFuture()); - Mockito.when(salGroupsBatchService.updateGroupsBatch(Matchers.any())) + Mockito.when(salGroupsBatchService.updateGroupsBatch(ArgumentMatchers.any())) .thenReturn(RpcResultBuilder.success(new UpdateGroupsBatchOutputBuilder().build()).buildFuture()); - Mockito.when(salMetersBatchService.addMetersBatch(Matchers.any())) + Mockito.when(salMetersBatchService.addMetersBatch(ArgumentMatchers.any())) .thenReturn(RpcResultBuilder.success(new AddMetersBatchOutputBuilder().build()).buildFuture()); - Mockito.when(salMetersBatchService.removeMetersBatch(Matchers.any())) + Mockito.when(salMetersBatchService.removeMetersBatch(ArgumentMatchers.any())) .thenReturn(RpcResultBuilder.success(new RemoveMetersBatchOutputBuilder().build()).buildFuture()); - Mockito.when(salMetersBatchService.updateMetersBatch(Matchers.any())) + Mockito.when(salMetersBatchService.updateMetersBatch(ArgumentMatchers.any())) .thenReturn(RpcResultBuilder.success(new UpdateMetersBatchOutputBuilder().build()).buildFuture()); @@ -186,17 +186,17 @@ public class SalFlatBatchServiceImplTest { Assert.assertTrue(rpcResult.getResult().getBatchFailure().isEmpty()); final InOrder inOrder = Mockito.inOrder(salFlowsBatchService, salGroupsBatchService, salMetersBatchService); - inOrder.verify(salFlowsBatchService).addFlowsBatch(Matchers.any()); - inOrder.verify(salFlowsBatchService).removeFlowsBatch(Matchers.any()); - inOrder.verify(salFlowsBatchService).updateFlowsBatch(Matchers.any()); + inOrder.verify(salFlowsBatchService).addFlowsBatch(ArgumentMatchers.any()); + inOrder.verify(salFlowsBatchService).removeFlowsBatch(ArgumentMatchers.any()); + inOrder.verify(salFlowsBatchService).updateFlowsBatch(ArgumentMatchers.any()); - inOrder.verify(salGroupsBatchService).addGroupsBatch(Matchers.any()); - inOrder.verify(salGroupsBatchService).removeGroupsBatch(Matchers.any()); - inOrder.verify(salGroupsBatchService).updateGroupsBatch(Matchers.any()); + inOrder.verify(salGroupsBatchService).addGroupsBatch(ArgumentMatchers.any()); + inOrder.verify(salGroupsBatchService).removeGroupsBatch(ArgumentMatchers.any()); + inOrder.verify(salGroupsBatchService).updateGroupsBatch(ArgumentMatchers.any()); - inOrder.verify(salMetersBatchService).addMetersBatch(Matchers.any()); - inOrder.verify(salMetersBatchService).removeMetersBatch(Matchers.any()); - inOrder.verify(salMetersBatchService).updateMetersBatch(Matchers.any()); + inOrder.verify(salMetersBatchService).addMetersBatch(ArgumentMatchers.any()); + inOrder.verify(salMetersBatchService).removeMetersBatch(ArgumentMatchers.any()); + inOrder.verify(salMetersBatchService).updateMetersBatch(ArgumentMatchers.any()); } @Test @@ -232,10 +232,10 @@ public class SalFlatBatchServiceImplTest { Assert.assertEquals(3, rpcResult.getResult().getBatchFailure().get(0).getBatchOrder().intValue()); final InOrder inOrder = Mockito.inOrder(salFlowsBatchService, salGroupsBatchService, salMetersBatchService); - inOrder.verify(salFlowsBatchService).addFlowsBatch(Matchers.any()); - inOrder.verify(salFlowsBatchService).removeFlowsBatch(Matchers.any()); - inOrder.verify(salFlowsBatchService).updateFlowsBatch(Matchers.any()); - inOrder.verify(salGroupsBatchService).addGroupsBatch(Matchers.any()); + inOrder.verify(salFlowsBatchService).addFlowsBatch(ArgumentMatchers.any()); + inOrder.verify(salFlowsBatchService).removeFlowsBatch(ArgumentMatchers.any()); + inOrder.verify(salFlowsBatchService).updateFlowsBatch(ArgumentMatchers.any()); + inOrder.verify(salGroupsBatchService).addGroupsBatch(ArgumentMatchers.any()); } @Test @@ -271,23 +271,23 @@ public class SalFlatBatchServiceImplTest { Assert.assertEquals(3, rpcResult.getResult().getBatchFailure().get(0).getBatchOrder().intValue()); final InOrder inOrder = Mockito.inOrder(salFlowsBatchService, salGroupsBatchService, salMetersBatchService); - inOrder.verify(salFlowsBatchService).addFlowsBatch(Matchers.any()); - inOrder.verify(salFlowsBatchService).removeFlowsBatch(Matchers.any()); - inOrder.verify(salFlowsBatchService).updateFlowsBatch(Matchers.any()); + inOrder.verify(salFlowsBatchService).addFlowsBatch(ArgumentMatchers.any()); + inOrder.verify(salFlowsBatchService).removeFlowsBatch(ArgumentMatchers.any()); + inOrder.verify(salFlowsBatchService).updateFlowsBatch(ArgumentMatchers.any()); - inOrder.verify(salGroupsBatchService).addGroupsBatch(Matchers.any()); - inOrder.verify(salGroupsBatchService).removeGroupsBatch(Matchers.any()); - inOrder.verify(salGroupsBatchService).updateGroupsBatch(Matchers.any()); + inOrder.verify(salGroupsBatchService).addGroupsBatch(ArgumentMatchers.any()); + inOrder.verify(salGroupsBatchService).removeGroupsBatch(ArgumentMatchers.any()); + inOrder.verify(salGroupsBatchService).updateGroupsBatch(ArgumentMatchers.any()); - inOrder.verify(salMetersBatchService).addMetersBatch(Matchers.any()); - inOrder.verify(salMetersBatchService).removeMetersBatch(Matchers.any()); - inOrder.verify(salMetersBatchService).updateMetersBatch(Matchers.any()); + inOrder.verify(salMetersBatchService).addMetersBatch(ArgumentMatchers.any()); + inOrder.verify(salMetersBatchService).removeMetersBatch(ArgumentMatchers.any()); + inOrder.verify(salMetersBatchService).updateMetersBatch(ArgumentMatchers.any()); } private void prepareFirstFailingMockService() { - Mockito.when(salFlowsBatchService.addFlowsBatch(Matchers.any())) + Mockito.when(salFlowsBatchService.addFlowsBatch(ArgumentMatchers.any())) .thenReturn(RpcResultBuilder.success(new AddFlowsBatchOutputBuilder().build()).buildFuture()); - Mockito.when(salFlowsBatchService.removeFlowsBatch(Matchers.any())) + Mockito.when(salFlowsBatchService.removeFlowsBatch(ArgumentMatchers.any())) .thenReturn(RpcResultBuilder.failed() .withResult(new RemoveFlowsBatchOutputBuilder() .setBatchFailedFlowsOutput(Lists.newArrayList( @@ -298,21 +298,21 @@ public class SalFlatBatchServiceImplTest { .build()) .withError(RpcError.ErrorType.APPLICATION, "ut-firstFlowAddError") .buildFuture()); - Mockito.when(salFlowsBatchService.updateFlowsBatch(Matchers.any())) + Mockito.when(salFlowsBatchService.updateFlowsBatch(ArgumentMatchers.any())) .thenReturn(RpcResultBuilder.success(new UpdateFlowsBatchOutputBuilder().build()).buildFuture()); - Mockito.when(salGroupsBatchService.addGroupsBatch(Matchers.any())) + Mockito.when(salGroupsBatchService.addGroupsBatch(ArgumentMatchers.any())) .thenReturn(RpcResultBuilder.success(new AddGroupsBatchOutputBuilder().build()).buildFuture()); - Mockito.when(salGroupsBatchService.removeGroupsBatch(Matchers.any())) + Mockito.when(salGroupsBatchService.removeGroupsBatch(ArgumentMatchers.any())) .thenReturn(RpcResultBuilder.success(new RemoveGroupsBatchOutputBuilder().build()).buildFuture()); - Mockito.when(salGroupsBatchService.updateGroupsBatch(Matchers.any())) + Mockito.when(salGroupsBatchService.updateGroupsBatch(ArgumentMatchers.any())) .thenReturn(RpcResultBuilder.success(new UpdateGroupsBatchOutputBuilder().build()).buildFuture()); - Mockito.when(salMetersBatchService.addMetersBatch(Matchers.any())) + Mockito.when(salMetersBatchService.addMetersBatch(ArgumentMatchers.any())) .thenReturn(RpcResultBuilder.success(new AddMetersBatchOutputBuilder().build()).buildFuture()); - Mockito.when(salMetersBatchService.removeMetersBatch(Matchers.any())) + Mockito.when(salMetersBatchService.removeMetersBatch(ArgumentMatchers.any())) .thenReturn(RpcResultBuilder.success(new RemoveMetersBatchOutputBuilder().build()).buildFuture()); - Mockito.when(salMetersBatchService.updateMetersBatch(Matchers.any())) + Mockito.when(salMetersBatchService.updateMetersBatch(ArgumentMatchers.any())) .thenReturn(RpcResultBuilder.success(new UpdateMetersBatchOutputBuilder().build()).buildFuture()); } @@ -463,9 +463,9 @@ public class SalFlatBatchServiceImplTest { createFlowBatchFailure(1, "f2"))) .buildFuture(); - Mockito.when(batchStepJob1.getStepFunction().apply(Matchers.>any())) + Mockito.when(batchStepJob1.getStepFunction().apply(ArgumentMatchers.>any())) .thenReturn(succeededChainOutput); - Mockito.when(batchStepJob2.getStepFunction().apply(Matchers.>any())) + Mockito.when(batchStepJob2.getStepFunction().apply(ArgumentMatchers.>any())) .thenReturn(failedChainOutput); final List batchChainElements = Lists.newArrayList(batchStepJob1, batchStepJob2); @@ -510,7 +510,7 @@ public class SalFlatBatchServiceImplTest { Assert.assertEquals(1, batchChain.size()); - Mockito.when(salFlowsBatchService.addFlowsBatch(Matchers.any())) + Mockito.when(salFlowsBatchService.addFlowsBatch(ArgumentMatchers.any())) .thenReturn(RpcResultBuilder .success(new AddFlowsBatchOutputBuilder().build()) .buildFuture()); @@ -523,7 +523,7 @@ public class SalFlatBatchServiceImplTest { Assert.assertEquals(0, rpcResult.getErrors().size()); Assert.assertEquals(0, rpcResult.getResult().getBatchFailure().size()); - Mockito.verify(salFlowsBatchService).addFlowsBatch(Matchers.any()); + Mockito.verify(salFlowsBatchService).addFlowsBatch(ArgumentMatchers.any()); } @Test @@ -540,7 +540,7 @@ public class SalFlatBatchServiceImplTest { Assert.assertEquals(2, batchChain.size()); - Mockito.when(salFlowsBatchService.addFlowsBatch(Matchers.any())) + Mockito.when(salFlowsBatchService.addFlowsBatch(ArgumentMatchers.any())) .thenReturn(RpcResultBuilder .failed() .withResult(new AddFlowsBatchOutputBuilder() diff --git a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/sal/SalFlowServiceImplTest.java b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/sal/SalFlowServiceImplTest.java index 4f1fd3c626..af67ef1b58 100644 --- a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/sal/SalFlowServiceImplTest.java +++ b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/sal/SalFlowServiceImplTest.java @@ -7,6 +7,7 @@ */ package org.opendaylight.openflowplugin.impl.services.sal; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -18,7 +19,6 @@ import junit.framework.TestCase; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.Matchers; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.runners.MockitoJUnitRunner; @@ -113,11 +113,7 @@ public class SalFlowServiceImplTest extends TestCase { @Before public void initialization() { - when(mockedFeatures.getDatapathId()).thenReturn(DUMMY_DATAPATH_ID); - when(mockedFeaturesOutput.getDatapathId()).thenReturn(DUMMY_DATAPATH_ID); - when(mockedPrimConnectionContext.getFeatures()).thenReturn(mockedFeatures); - when(mockedPrimConnectionContext.getConnectionAdapter()).thenReturn(mockedConnectionAdapter); when(mockedPrimConnectionContext.getOutboundQueueProvider()).thenReturn(outboundQueue); when(mockedDeviceContext.getPrimaryConnectionContext()).thenReturn(mockedPrimConnectionContext); @@ -128,10 +124,8 @@ public class SalFlowServiceImplTest extends TestCase { when(requestContext.getFuture()).thenReturn(RpcResultBuilder.success().buildFuture()); when(mockedRequestContextStack.createRequestContext()).thenReturn(requestContext); - when(mockedDeviceInfo.getNodeInstanceIdentifier()).thenReturn(NODE_II); when(mockedDeviceInfo.getDatapathId()).thenReturn(DUMMY_DATAPATH_ID); - when(mockedDeviceContext.getDeviceState()).thenReturn(mockedDeviceState); when(mockedDeviceContext.getDeviceInfo()).thenReturn(mockedDeviceInfo); } @@ -307,10 +301,9 @@ public class SalFlowServiceImplTest extends TestCase { FlowDescriptor mockedFlowDescriptor = mock(FlowDescriptor.class); FlowId flowId = new FlowId(DUMMY_FLOW_ID); when(mockedFlowDescriptor.getFlowId()).thenReturn(flowId); - when(mockedFlowDescriptor.getTableKey()).thenReturn(new TableKey(DUMMY_TABLE_ID)); when(deviceFlowRegistry - .retrieveDescriptor(Matchers.any(FlowRegistryKey.class))).thenReturn(mockedFlowDescriptor); + .retrieveDescriptor(any(FlowRegistryKey.class))).thenReturn(mockedFlowDescriptor); } private void verifyOutput(Future> rpcResultFuture) throws ExecutionException, diff --git a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/sal/SalFlowsBatchServiceImplTest.java b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/sal/SalFlowsBatchServiceImplTest.java index 6e2941af38..e5f9b77e5c 100644 --- a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/sal/SalFlowsBatchServiceImplTest.java +++ b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/sal/SalFlowsBatchServiceImplTest.java @@ -17,9 +17,9 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; +import org.mockito.ArgumentMatchers; import org.mockito.Captor; import org.mockito.InOrder; -import org.mockito.Matchers; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.runners.MockitoJUnitRunner; @@ -99,7 +99,7 @@ public class SalFlowsBatchServiceImplTest { public void setUp() throws Exception { salFlowsBatchService = new SalFlowsBatchServiceImpl(salFlowService, transactionService); - Mockito.when(transactionService.sendBarrier(Matchers.any())) + Mockito.when(transactionService.sendBarrier(ArgumentMatchers.any())) .thenReturn(RpcResultBuilder.success().buildFuture()); } @@ -110,7 +110,7 @@ public class SalFlowsBatchServiceImplTest { @Test public void testRemoveFlowsBatch_success() throws Exception { - Mockito.when(salFlowService.removeFlow(Matchers.any())) + Mockito.when(salFlowService.removeFlow(ArgumentMatchers.any())) .thenReturn(RpcResultBuilder.success(new RemoveFlowOutputBuilder().build()) .buildFuture()); @@ -141,12 +141,12 @@ public class SalFlowsBatchServiceImplTest { Assert.assertEquals(42, allValues.get(0).getPriority().longValue()); Assert.assertEquals(43, allValues.get(1).getPriority().longValue()); - inOrder.verify(transactionService).sendBarrier(Matchers.any()); + inOrder.verify(transactionService).sendBarrier(ArgumentMatchers.any()); } @Test public void testRemoveFlowsBatch_failed() throws Exception { - Mockito.when(salFlowService.removeFlow(Matchers.any())) + Mockito.when(salFlowService.removeFlow(ArgumentMatchers.any())) .thenReturn(RpcResultBuilder.failed() .withError(RpcError.ErrorType.APPLICATION, "flow-remove-fail-1") .buildFuture()); @@ -178,7 +178,7 @@ public class SalFlowsBatchServiceImplTest { Assert.assertEquals(42, allValues.get(0).getPriority().longValue()); Assert.assertEquals(43, allValues.get(1).getPriority().longValue()); - inOrder.verify(transactionService).sendBarrier(Matchers.any()); + inOrder.verify(transactionService).sendBarrier(ArgumentMatchers.any()); } private static BatchAddFlows createEmptyBatchAddFlow(final String flowIdValue, final int priority) { @@ -211,7 +211,7 @@ public class SalFlowsBatchServiceImplTest { @Test public void testAddFlowsBatch_success() throws Exception { - Mockito.when(salFlowService.addFlow(Matchers.any())) + Mockito.when(salFlowService.addFlow(ArgumentMatchers.any())) .thenReturn(RpcResultBuilder.success(new AddFlowOutputBuilder().build()).buildFuture()); final AddFlowsBatchInput input = new AddFlowsBatchInputBuilder() @@ -235,12 +235,12 @@ public class SalFlowsBatchServiceImplTest { Assert.assertEquals(42, allValues.get(0).getPriority().longValue()); Assert.assertEquals(43, allValues.get(1).getPriority().longValue()); - inOrder.verify(transactionService).sendBarrier(Matchers.any()); + inOrder.verify(transactionService).sendBarrier(ArgumentMatchers.any()); } @Test public void testAddFlowsBatch_failed() throws Exception { - Mockito.when(salFlowService.addFlow(Matchers.any())) + Mockito.when(salFlowService.addFlow(ArgumentMatchers.any())) .thenReturn(RpcResultBuilder .failed().withError(RpcError.ErrorType.APPLICATION, "ut-groupAddError") .buildFuture()); @@ -272,12 +272,12 @@ public class SalFlowsBatchServiceImplTest { Assert.assertEquals(42, allValues.get(0).getPriority().longValue()); Assert.assertEquals(43, allValues.get(1).getPriority().longValue()); - inOrder.verify(transactionService).sendBarrier(Matchers.any()); + inOrder.verify(transactionService).sendBarrier(ArgumentMatchers.any()); } @Test public void testUpdateFlowsBatch_success() throws Exception { - Mockito.when(salFlowService.updateFlow(Matchers.any())) + Mockito.when(salFlowService.updateFlow(ArgumentMatchers.any())) .thenReturn(RpcResultBuilder.success(new UpdateFlowOutputBuilder().build()).buildFuture()); final UpdateFlowsBatchInput input = new UpdateFlowsBatchInputBuilder() @@ -303,12 +303,12 @@ public class SalFlowsBatchServiceImplTest { Assert.assertEquals(44, allValues.get(1).getOriginalFlow().getPriority().longValue()); Assert.assertEquals(45, allValues.get(1).getUpdatedFlow().getPriority().longValue()); - inOrder.verify(transactionService).sendBarrier(Matchers.any()); + inOrder.verify(transactionService).sendBarrier(ArgumentMatchers.any()); } @Test public void testUpdateFlowsBatch_failure() throws Exception { - Mockito.when(salFlowService.updateFlow(Matchers.any())) + Mockito.when(salFlowService.updateFlow(ArgumentMatchers.any())) .thenReturn(RpcResultBuilder.failed() .withError(RpcError.ErrorType.APPLICATION, "ut-flowUpdateError") .buildFuture()); @@ -342,6 +342,6 @@ public class SalFlowsBatchServiceImplTest { Assert.assertEquals(44, allValues.get(1).getOriginalFlow().getPriority().longValue()); Assert.assertEquals(45, allValues.get(1).getUpdatedFlow().getPriority().longValue()); - inOrder.verify(transactionService).sendBarrier(Matchers.any()); + inOrder.verify(transactionService).sendBarrier(ArgumentMatchers.any()); } } diff --git a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/sal/SalGroupServiceImplTest.java b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/sal/SalGroupServiceImplTest.java index 11e917eafb..3f3950635a 100755 --- a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/sal/SalGroupServiceImplTest.java +++ b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/sal/SalGroupServiceImplTest.java @@ -8,10 +8,8 @@ package org.opendaylight.openflowplugin.impl.services.sal; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; import org.junit.Test; - import org.mockito.Mock; import org.opendaylight.openflowplugin.api.openflow.registry.group.DeviceGroupRegistry; import org.opendaylight.openflowplugin.impl.services.ServiceMocking; @@ -43,7 +41,6 @@ public class SalGroupServiceImplTest extends ServiceMocking { @Override protected void setup() { - when(mockedDeviceContext.getDeviceGroupRegistry()).thenReturn(mockedDeviceGroupRegistry); final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager(); salGroupService = new SalGroupServiceImpl(mockedRequestContextStack, mockedDeviceContext, convertorManager); } diff --git a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/sal/SalGroupsBatchServiceImplTest.java b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/sal/SalGroupsBatchServiceImplTest.java index 8eef763b36..1816810285 100644 --- a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/sal/SalGroupsBatchServiceImplTest.java +++ b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/sal/SalGroupsBatchServiceImplTest.java @@ -17,9 +17,9 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; +import org.mockito.ArgumentMatchers; import org.mockito.Captor; import org.mockito.InOrder; -import org.mockito.Matchers; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.runners.MockitoJUnitRunner; @@ -93,7 +93,7 @@ public class SalGroupsBatchServiceImplTest { public void setUp() throws Exception { salGroupsBatchService = new SalGroupsBatchServiceImpl(salGroupService, transactionService); - Mockito.when(transactionService.sendBarrier(Matchers.any())) + Mockito.when(transactionService.sendBarrier(ArgumentMatchers.any())) .thenReturn(RpcResultBuilder.success().buildFuture()); } @@ -129,7 +129,7 @@ public class SalGroupsBatchServiceImplTest { Assert.assertEquals(44, allValues.get(1).getOriginalGroup().getGroupId().getValue().longValue()); Assert.assertEquals(45, allValues.get(1).getUpdatedGroup().getGroupId().getValue().longValue()); - inOrder.verify(transactionService).sendBarrier(Matchers.any()); + inOrder.verify(transactionService).sendBarrier(ArgumentMatchers.any()); } @Test @@ -168,7 +168,7 @@ public class SalGroupsBatchServiceImplTest { Assert.assertEquals(44, allValues.get(1).getOriginalGroup().getGroupId().getValue().longValue()); Assert.assertEquals(45, allValues.get(1).getUpdatedGroup().getGroupId().getValue().longValue()); - inOrder.verify(transactionService).sendBarrier(Matchers.any()); + inOrder.verify(transactionService).sendBarrier(ArgumentMatchers.any()); } @@ -197,7 +197,7 @@ public class SalGroupsBatchServiceImplTest { Assert.assertEquals(42L, allValues.get(0).getGroupId().getValue().longValue()); Assert.assertEquals(43L, allValues.get(1).getGroupId().getValue().longValue()); - inOrder.verify(transactionService).sendBarrier(Matchers.any()); + inOrder.verify(transactionService).sendBarrier(ArgumentMatchers.any()); } @Test @@ -234,7 +234,7 @@ public class SalGroupsBatchServiceImplTest { Assert.assertEquals(42L, allValues.get(0).getGroupId().getValue().longValue()); Assert.assertEquals(43L, allValues.get(1).getGroupId().getValue().longValue()); - inOrder.verify(transactionService).sendBarrier(Matchers.any()); + inOrder.verify(transactionService).sendBarrier(ArgumentMatchers.any()); } @Test @@ -263,7 +263,7 @@ public class SalGroupsBatchServiceImplTest { Assert.assertEquals(42L, allValues.get(0).getGroupId().getValue().longValue()); Assert.assertEquals(43L, allValues.get(1).getGroupId().getValue().longValue()); - inOrder.verify(transactionService).sendBarrier(Matchers.any()); + inOrder.verify(transactionService).sendBarrier(ArgumentMatchers.any()); } @Test @@ -300,7 +300,7 @@ public class SalGroupsBatchServiceImplTest { Assert.assertEquals(42L, allValues.get(0).getGroupId().getValue().longValue()); Assert.assertEquals(43L, allValues.get(1).getGroupId().getValue().longValue()); - inOrder.verify(transactionService).sendBarrier(Matchers.any()); + inOrder.verify(transactionService).sendBarrier(ArgumentMatchers.any()); } private static BatchAddGroups createEmptyBatchAddGroup(final long groupIdValue) { diff --git a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/sal/SalMeterServiceImplTest.java b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/sal/SalMeterServiceImplTest.java index 5f14136481..68ca0c0bd3 100755 --- a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/sal/SalMeterServiceImplTest.java +++ b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/sal/SalMeterServiceImplTest.java @@ -8,7 +8,6 @@ package org.opendaylight.openflowplugin.impl.services.sal; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; import org.junit.Test; import org.mockito.Mock; @@ -42,7 +41,6 @@ public class SalMeterServiceImplTest extends ServiceMocking { @Override protected void setup() { - when(mockedDeviceContext.getDeviceMeterRegistry()).thenReturn(mockedDeviceMeterRegistry); final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager(); salMeterService = new SalMeterServiceImpl(mockedRequestContextStack, mockedDeviceContext, convertorManager); } diff --git a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/sal/SalMetersBatchServiceImplTest.java b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/sal/SalMetersBatchServiceImplTest.java index 5c43de2b48..732187bf10 100644 --- a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/sal/SalMetersBatchServiceImplTest.java +++ b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/sal/SalMetersBatchServiceImplTest.java @@ -8,6 +8,8 @@ package org.opendaylight.openflowplugin.impl.services.sal; +import static org.mockito.ArgumentMatchers.any; + import com.google.common.collect.Lists; import java.util.List; import java.util.concurrent.Future; @@ -17,9 +19,9 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; +import org.mockito.ArgumentMatchers; import org.mockito.Captor; import org.mockito.InOrder; -import org.mockito.Matchers; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.runners.MockitoJUnitRunner; @@ -92,7 +94,7 @@ public class SalMetersBatchServiceImplTest { public void setUp() throws Exception { salMetersBatchService = new SalMetersBatchServiceImpl(salMeterService, transactionService); - Mockito.when(transactionService.sendBarrier(Matchers.any())) + Mockito.when(transactionService.sendBarrier(any())) .thenReturn(RpcResultBuilder.success().buildFuture()); } @@ -128,7 +130,7 @@ public class SalMetersBatchServiceImplTest { Assert.assertEquals(44, allValues.get(1).getOriginalMeter().getMeterId().getValue().longValue()); Assert.assertEquals(45, allValues.get(1).getUpdatedMeter().getMeterId().getValue().longValue()); - inOrder.verify(transactionService).sendBarrier(Matchers.any()); + inOrder.verify(transactionService).sendBarrier(ArgumentMatchers.any()); } @Test @@ -167,7 +169,7 @@ public class SalMetersBatchServiceImplTest { Assert.assertEquals(44, allValues.get(1).getOriginalMeter().getMeterId().getValue().longValue()); Assert.assertEquals(45, allValues.get(1).getUpdatedMeter().getMeterId().getValue().longValue()); - inOrder.verify(transactionService).sendBarrier(Matchers.any()); + inOrder.verify(transactionService).sendBarrier(ArgumentMatchers.any()); } @@ -196,7 +198,7 @@ public class SalMetersBatchServiceImplTest { Assert.assertEquals(42L, allValues.get(0).getMeterId().getValue().longValue()); Assert.assertEquals(43L, allValues.get(1).getMeterId().getValue().longValue()); - inOrder.verify(transactionService).sendBarrier(Matchers.any()); + inOrder.verify(transactionService).sendBarrier(ArgumentMatchers.any()); } @Test @@ -233,7 +235,7 @@ public class SalMetersBatchServiceImplTest { Assert.assertEquals(42L, allValues.get(0).getMeterId().getValue().longValue()); Assert.assertEquals(43L, allValues.get(1).getMeterId().getValue().longValue()); - inOrder.verify(transactionService).sendBarrier(Matchers.any()); + inOrder.verify(transactionService).sendBarrier(ArgumentMatchers.any()); } @Test @@ -262,7 +264,7 @@ public class SalMetersBatchServiceImplTest { Assert.assertEquals(42L, allValues.get(0).getMeterId().getValue().longValue()); Assert.assertEquals(43L, allValues.get(1).getMeterId().getValue().longValue()); - inOrder.verify(transactionService).sendBarrier(Matchers.any()); + inOrder.verify(transactionService).sendBarrier(ArgumentMatchers.any()); } @Test @@ -299,7 +301,7 @@ public class SalMetersBatchServiceImplTest { Assert.assertEquals(42L, allValues.get(0).getMeterId().getValue().longValue()); Assert.assertEquals(43L, allValues.get(1).getMeterId().getValue().longValue()); - inOrder.verify(transactionService).sendBarrier(Matchers.any()); + inOrder.verify(transactionService).sendBarrier(ArgumentMatchers.any()); } private static BatchAddMeters createEmptyBatchAddMeter(final long groupIdValue) { diff --git a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/sal/SalTableServiceImplTest.java b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/sal/SalTableServiceImplTest.java index 3397a303f4..2743236acd 100644 --- a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/sal/SalTableServiceImplTest.java +++ b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/sal/SalTableServiceImplTest.java @@ -7,6 +7,7 @@ */ package org.opendaylight.openflowplugin.impl.services.sal; +import static org.mockito.ArgumentMatchers.anyLong; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; @@ -18,7 +19,7 @@ import java.util.concurrent.ExecutionException; import java.util.concurrent.Future; import org.junit.Assert; import org.junit.Test; -import org.mockito.Matchers; +import org.mockito.ArgumentMatchers; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.stubbing.Answer; @@ -62,7 +63,7 @@ public class SalTableServiceImplTest extends ServiceMocking { return null; }) .when(mockedOutboundQueue).commitEntry( - Matchers.anyLong(), Matchers.any(), Matchers.>any()); + anyLong(), ArgumentMatchers.any(), ArgumentMatchers.>any()); final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager(); salTableService = new SalTableServiceImpl(mockedRequestContextStack, mockedDeviceContext, @@ -76,7 +77,7 @@ public class SalTableServiceImplTest extends ServiceMocking { RpcResultBuilder.>failed().build(); handleResultFuture.set(rpcResult); return null; - }).when(multiMessageCollector).endCollecting(Matchers.any()); + }).when(multiMessageCollector).endCollecting(ArgumentMatchers.any()); final Future> rpcResultFuture = salTableService.updateTable(prepareUpdateTable()); Assert.assertNotNull(rpcResultFuture); @@ -91,7 +92,7 @@ public class SalTableServiceImplTest extends ServiceMocking { .build(); handleResultFuture.set(rpcResult); return null; - }).when(multiMessageCollector).endCollecting(Matchers.any()); + }).when(multiMessageCollector).endCollecting(ArgumentMatchers.any()); final Future> rpcResultFuture = salTableService.updateTable(prepareUpdateTable()); Assert.assertNotNull(rpcResultFuture); @@ -119,7 +120,7 @@ public class SalTableServiceImplTest extends ServiceMocking { .build(); handleResultFuture.set(rpcResult); return null; - }).when(multiMessageCollector).endCollecting(Matchers.any()); + }).when(multiMessageCollector).endCollecting(ArgumentMatchers.any()); final Future> rpcResultFuture = salTableService.updateTable(prepareUpdateTable()); Assert.assertNotNull(rpcResultFuture); diff --git a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/util/RequestContextUtilTest.java b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/util/RequestContextUtilTest.java index 96bf817819..3354841307 100644 --- a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/util/RequestContextUtilTest.java +++ b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/util/RequestContextUtilTest.java @@ -8,7 +8,7 @@ package org.opendaylight.openflowplugin.impl.services.util; -import static org.mockito.Matchers.any; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyNoMoreInteractions; diff --git a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/StatisticsContextImpMockInitiation.java b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/StatisticsContextImpMockInitiation.java index 310f89c0ec..3fdd2e054c 100644 --- a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/StatisticsContextImpMockInitiation.java +++ b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/StatisticsContextImpMockInitiation.java @@ -91,10 +91,8 @@ class StatisticsContextImpMockInitiation { when(mockedDeviceContext.getMessageSpy()).thenReturn(mockedMessageSpy); when(mockedDeviceInfo.getNodeId()).thenReturn(DUMMY_NODE_ID.getKey().getId()); - when(mockedConnectionContext.getNodeId()).thenReturn(DUMMY_NODE_ID.getKey().getId()); when(mockedConnectionContext.getFeatures()).thenReturn(mockedFeatures); when(mockedConnectionContext.getConnectionState()).thenReturn(ConnectionContext.CONNECTION_STATE.WORKING); - when(mockedConnectionContext.getOutboundQueueProvider()).thenReturn(mockedOutboundQueue); } } diff --git a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/StatisticsContextImplParamTest.java b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/StatisticsContextImplParamTest.java index d46dad3eee..17672c9efe 100644 --- a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/StatisticsContextImplParamTest.java +++ b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/StatisticsContextImplParamTest.java @@ -9,7 +9,7 @@ package org.opendaylight.openflowplugin.impl.statistics; import static com.google.common.util.concurrent.Futures.immediateFuture; -import static org.mockito.Matchers.any; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; @@ -24,7 +24,6 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; -import org.mockito.Matchers; import org.mockito.Mock; import org.mockito.Mockito; import org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.EventIdentifier; @@ -113,9 +112,9 @@ public class StatisticsContextImplParamTest extends StatisticsContextImpMockInit statisticsContext.instantiateServiceInstance(); verify(mockedStatisticsGatheringService, times(7)) - .getStatisticsOfType(Matchers.any(EventIdentifier.class), Matchers.any(MultipartType.class)); + .getStatisticsOfType(any(EventIdentifier.class), any(MultipartType.class)); verify(mockedStatisticsOnFlyGatheringService) - .getStatisticsOfType(Matchers.any(EventIdentifier.class), Matchers.any(MultipartType.class)); + .getStatisticsOfType(any(EventIdentifier.class), any(MultipartType.class)); } } diff --git a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/StatisticsContextImplTest.java b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/StatisticsContextImplTest.java index 509f5ad7b1..aa3bbad44c 100644 --- a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/StatisticsContextImplTest.java +++ b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/StatisticsContextImplTest.java @@ -10,6 +10,7 @@ package org.opendaylight.openflowplugin.impl.statistics; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; @@ -21,7 +22,6 @@ import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.Matchers; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.runners.MockitoJUnitRunner; @@ -137,11 +137,11 @@ public class StatisticsContextImplTest extends StatisticsContextImpMockInitiatio initStatisticsContext(); when(mockedStatisticsGatheringService - .getStatisticsOfType(Matchers.any(EventIdentifier.class), Matchers.any(MultipartType.class))) + .getStatisticsOfType(any(EventIdentifier.class), any(MultipartType.class))) .thenReturn(Futures.immediateFuture( RpcResultBuilder.success(Collections.emptyList()).build())); when(mockedStatisticsOnFlyGatheringService - .getStatisticsOfType(Matchers.any(EventIdentifier.class), Matchers.any(MultipartType.class))) + .getStatisticsOfType(any(EventIdentifier.class), any(MultipartType.class))) .thenReturn(Futures.immediateFuture( RpcResultBuilder.success(Collections.emptyList()).build())); @@ -151,9 +151,9 @@ public class StatisticsContextImplTest extends StatisticsContextImpMockInitiatio statisticsContext.instantiateServiceInstance(); verify(mockedStatisticsGatheringService, times(7)) - .getStatisticsOfType(Matchers.any(EventIdentifier.class), Matchers.any(MultipartType.class)); + .getStatisticsOfType(any(EventIdentifier.class), any(MultipartType.class)); verify(mockedStatisticsOnFlyGatheringService) - .getStatisticsOfType(Matchers.any(EventIdentifier.class), Matchers.any(MultipartType.class)); + .getStatisticsOfType(any(EventIdentifier.class), any(MultipartType.class)); Mockito.verifyNoMoreInteractions(mockedStatisticsGatheringService, mockedStatisticsOnFlyGatheringService); } } diff --git a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/StatisticsGatheringUtilsTest.java b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/StatisticsGatheringUtilsTest.java index 3e4da90a32..e20411a953 100755 --- a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/StatisticsGatheringUtilsTest.java +++ b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/StatisticsGatheringUtilsTest.java @@ -8,6 +8,8 @@ package org.opendaylight.openflowplugin.impl.statistics; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; @@ -28,8 +30,8 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; +import org.mockito.ArgumentMatchers; import org.mockito.InOrder; -import org.mockito.Matchers; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.runners.MockitoJUnitRunner; @@ -172,17 +174,15 @@ public class StatisticsGatheringUtilsTest { @Before public void setUp() throws Exception { - when(deviceContext.getDeviceState()).thenReturn(deviceState); when(deviceContext.getDeviceInfo()).thenReturn(deviceInfo); when(deviceContext.getDeviceFlowRegistry()).thenReturn(deviceFlowRegistry); when(deviceContext.getDeviceGroupRegistry()).thenReturn(deviceGroupRegistry); when(deviceContext.getDeviceMeterRegistry()).thenReturn(deviceMeterRegistry); - when(deviceFlowRegistry.retrieveDescriptor(Matchers.any(FlowRegistryKey.class))).thenReturn(flowDescriptor); + when(deviceFlowRegistry.retrieveDescriptor(any(FlowRegistryKey.class))).thenReturn(flowDescriptor); when(deviceContext.getReadTransaction()).thenReturn(readTx); when(deviceContext.getReadTransaction()).thenReturn(readTx); when(deviceContext.getPrimaryConnectionContext()).thenReturn(connectionAdapter); when(deviceContext.isTransactionsEnabled()).thenReturn(Boolean.TRUE); - when(connectionAdapter.getNodeId()).thenReturn(DUMMY_NODE_ID); when(connectionAdapter.getFeatures()).thenReturn(features); when(features.getDatapathId()).thenReturn(BigInteger.ONE); when(features.getVersion()).thenReturn(OFConstants.OFP_VERSION_1_3); @@ -205,7 +205,7 @@ public class StatisticsGatheringUtilsTest { dataStoreType.capture(), flowPath.capture(), flow.capture()); Assert.assertEquals(LogicalDatastoreType.OPERATIONAL, dataStoreType.getValue()); final InstanceIdentifier flowCapableNodePath = flowPath.getValue(); - Assert.assertEquals(DUMMY_NODE_ID, flowCapableNodePath.firstKeyOf(Node.class, NodeKey.class).getId()); + Assert.assertEquals(DUMMY_NODE_ID, flowCapableNodePath.firstKeyOf(Node.class).getId()); Assert.assertEquals(42, flow.getValue().getTableId().intValue()); } @@ -249,8 +249,8 @@ public class StatisticsGatheringUtilsTest { .opendaylight.group.types.rev131018.GroupId(groupIdValue))) .augmentation(NodeGroupStatistics.class) .child(GroupStatistics.class); - verify(deviceContext).writeToTransaction(Matchers.eq(LogicalDatastoreType.OPERATIONAL), - Matchers.eq(groupPath), Matchers.any(GroupStatistics.class)); + verify(deviceContext).writeToTransaction(eq(LogicalDatastoreType.OPERATIONAL), + eq(groupPath), any(GroupStatistics.class)); } @Test @@ -279,11 +279,11 @@ public class StatisticsGatheringUtilsTest { final KeyedInstanceIdentifier groupPath = dummyNodePath.augmentation(FlowCapableNode.class).child(Group.class, new GroupKey(storedGroupId)); - verify(deviceContext, Mockito.never()).addDeleteToTxChain(Matchers.eq(LogicalDatastoreType.OPERATIONAL), - Matchers.>any()); + verify(deviceContext, Mockito.never()).addDeleteToTxChain(eq(LogicalDatastoreType.OPERATIONAL), + ArgumentMatchers.>any()); verify(deviceGroupRegistry).store(storedGroupId); - verify(deviceContext).writeToTransaction(Matchers.eq(LogicalDatastoreType.OPERATIONAL), - Matchers.eq(groupPath), Matchers.any(Group.class)); + verify(deviceContext).writeToTransaction(eq(LogicalDatastoreType.OPERATIONAL), + eq(groupPath), any(Group.class)); } @Test @@ -317,8 +317,8 @@ public class StatisticsGatheringUtilsTest { .opendaylight.meter.types.rev130918.MeterId(meterIdValue))) .augmentation(NodeMeterStatistics.class) .child(MeterStatistics.class); - verify(deviceContext).writeToTransaction(Matchers.eq(LogicalDatastoreType.OPERATIONAL), - Matchers.eq(meterPath), Matchers.any(MeterStatistics.class)); + verify(deviceContext).writeToTransaction(eq(LogicalDatastoreType.OPERATIONAL), + eq(meterPath), any(MeterStatistics.class)); } @Test @@ -343,9 +343,9 @@ public class StatisticsGatheringUtilsTest { .augmentation(FlowCapableNodeConnectorStatisticsData.class) .child(FlowCapableNodeConnectorStatistics.class); verify(deviceContext).writeToTransaction( - Matchers.eq(LogicalDatastoreType.OPERATIONAL), - Matchers.eq(portPath), - Matchers.any(FlowCapableNodeConnectorStatistics.class)); + eq(LogicalDatastoreType.OPERATIONAL), + eq(portPath), + any(FlowCapableNodeConnectorStatistics.class)); } @Test @@ -373,9 +373,9 @@ public class StatisticsGatheringUtilsTest { .augmentation(FlowTableStatisticsData.class) .child(FlowTableStatistics.class); verify(deviceContext).writeToTransaction( - Matchers.eq(LogicalDatastoreType.OPERATIONAL), - Matchers.eq(tablePath), - Matchers.any(FlowTableStatistics.class)); + eq(LogicalDatastoreType.OPERATIONAL), + eq(tablePath), + any(FlowTableStatistics.class)); } @Test @@ -408,9 +408,9 @@ public class StatisticsGatheringUtilsTest { .augmentation(FlowCapableNodeConnector.class) .child(Queue.class, new QueueKey(new QueueId(queueIdValue))); verify(deviceContext).writeToTransaction( - Matchers.eq(LogicalDatastoreType.OPERATIONAL), - Matchers.eq(queuePath), - Matchers.any(Queue.class)); + eq(LogicalDatastoreType.OPERATIONAL), + eq(queuePath), + any(Queue.class)); } @Test @@ -459,13 +459,13 @@ public class StatisticsGatheringUtilsTest { .child(Table.class, new TableKey((short) 0)); final KeyedInstanceIdentifier flowPath = tablePath.child(Flow.class, new FlowKey(flowId)); - verify(deviceContext, Mockito.never()).addDeleteToTxChain(Matchers.eq(LogicalDatastoreType.OPERATIONAL), - Matchers.>any()); + verify(deviceContext, Mockito.never()).addDeleteToTxChain(eq(LogicalDatastoreType.OPERATIONAL), + ArgumentMatchers.>any()); final InOrder inOrder = Mockito.inOrder(deviceContext); - inOrder.verify(deviceContext).writeToTransaction(Matchers.eq(LogicalDatastoreType.OPERATIONAL), - Matchers.any(), - Matchers.any()); + inOrder.verify(deviceContext).writeToTransaction(eq(LogicalDatastoreType.OPERATIONAL), + any(), + any()); } @Test @@ -493,16 +493,16 @@ public class StatisticsGatheringUtilsTest { new org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterId(meterIdValue); final KeyedInstanceIdentifier meterPath = dummyNodePath.augmentation(FlowCapableNode.class) .child(Meter.class, new MeterKey(meterId)); - verify(deviceContext, Mockito.never()).addDeleteToTxChain(Matchers.eq(LogicalDatastoreType.OPERATIONAL), - Matchers.>any()); + verify(deviceContext, Mockito.never()).addDeleteToTxChain(eq(LogicalDatastoreType.OPERATIONAL), + ArgumentMatchers.>any()); verify(deviceMeterRegistry).store(meterId); - verify(deviceContext).writeToTransaction(Matchers.eq(LogicalDatastoreType.OPERATIONAL), - Matchers.eq(meterPath), Matchers.any(Meter.class)); + verify(deviceContext).writeToTransaction(eq(LogicalDatastoreType.OPERATIONAL), + eq(meterPath), any(Meter.class)); } private void fireAndCheck(final MultipartType type, final List statsData) throws InterruptedException, ExecutionException, TimeoutException { - when(statisticsService.getStatisticsOfType(Matchers.any(EventIdentifier.class), Matchers.eq(type))) + when(statisticsService.getStatisticsOfType(any(EventIdentifier.class),eq(type))) .thenReturn(Futures.immediateFuture(RpcResultBuilder.success(statsData).build())); final ListenableFuture gatherStatisticsResult = StatisticsGatheringUtils.gatherStatistics( @@ -552,8 +552,6 @@ public class StatisticsGatheringUtilsTest { verify(deviceContext).isTransactionsEnabled(); verify(deviceContext).getReadTransaction(); - verify(deviceContext).writeToTransaction(Mockito.eq(LogicalDatastoreType.OPERATIONAL), - Mockito.any(), - Mockito.any()); + verify(deviceContext).writeToTransaction(eq(LogicalDatastoreType.OPERATIONAL), any(), any()); } } diff --git a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/StatisticsManagerImplTest.java b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/StatisticsManagerImplTest.java index 719e35d2d1..03a4d44769 100644 --- a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/StatisticsManagerImplTest.java +++ b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/StatisticsManagerImplTest.java @@ -8,13 +8,13 @@ package org.opendaylight.openflowplugin.impl.statistics; import static org.junit.Assert.assertNotNull; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.MoreExecutors; import java.lang.reflect.Field; -import java.math.BigInteger; import java.util.List; import java.util.Map; import java.util.concurrent.ExecutionException; @@ -23,7 +23,7 @@ import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.Matchers; +import org.mockito.ArgumentMatchers; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.runners.MockitoJUnitRunner; @@ -32,7 +32,6 @@ import org.opendaylight.controller.sal.binding.api.BindingAwareBroker; import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry; import org.opendaylight.openflowjava.protocol.api.connection.ConnectionAdapter; import org.opendaylight.openflowjava.protocol.api.connection.OutboundQueue; -import org.opendaylight.openflowplugin.api.OFConstants; import org.opendaylight.openflowplugin.api.openflow.connection.ConnectionContext; import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext; import org.opendaylight.openflowplugin.api.openflow.device.DeviceInfo; @@ -42,7 +41,6 @@ import org.opendaylight.openflowplugin.api.openflow.device.handlers.MultiMsgColl import org.opendaylight.openflowplugin.api.openflow.lifecycle.ReconciliationFrameworkRegistrar; import org.opendaylight.openflowplugin.api.openflow.statistics.StatisticsContext; import org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.MessageSpy; -import org.opendaylight.openflowplugin.impl.registry.flow.DeviceFlowRegistryImpl; import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager; import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory; import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId; @@ -110,37 +108,9 @@ public class StatisticsManagerImplTest { .create(Nodes.class) .child(Node.class, new NodeKey(new NodeId("openflow:10"))); - when(mockedPrimConnectionContext.getFeatures()).thenReturn(mockedFeatures); - when(mockedPrimConnectionContext.getConnectionAdapter()).thenReturn(mockedConnectionAdapter); - when(mockedPrimConnectionContext.getConnectionState()).thenReturn(ConnectionContext.CONNECTION_STATE.WORKING); - when(mockedPrimConnectionContext.getNodeId()).thenReturn(NODE_ID); - when(mockedPrimConnectionContext.getOutboundQueueProvider()).thenReturn(outboundQueue); - - when(mockedDeviceState.isFlowStatisticsAvailable()).thenReturn(Boolean.TRUE); - when(mockedDeviceState.isGroupAvailable()).thenReturn(Boolean.TRUE); - when(mockedDeviceState.isMetersAvailable()).thenReturn(Boolean.TRUE); - when(mockedDeviceState.isPortStatisticsAvailable()).thenReturn(Boolean.TRUE); - when(mockedDeviceState.isQueueStatisticsAvailable()).thenReturn(Boolean.TRUE); - when(mockedDeviceState.isTableStatisticsAvailable()).thenReturn(Boolean.TRUE); - when(mockedDeviceInfo.getNodeInstanceIdentifier()).thenReturn(nodePath); - when(mockedDeviceInfo.getDatapathId()).thenReturn(BigInteger.TEN); - when(mockedDeviceInfo.getNodeId()).thenReturn(NODE_ID); - - when(mockedDeviceContext.getDeviceInfo()).thenReturn(mockedDeviceInfo); - when(mockedDeviceContext.getPrimaryConnectionContext()).thenReturn(mockedPrimConnectionContext); - when(mockedDeviceContext.getMessageSpy()).thenReturn(mockedMessagSpy); - when(mockedDeviceContext.getDeviceFlowRegistry()) - .thenReturn(new DeviceFlowRegistryImpl(OFConstants.OFP_VERSION_1_3, dataBroker, nodePath)); - when(mockedDeviceContext.getDeviceState()).thenReturn(mockedDeviceState); - when(mockedDeviceContext.getMultiMsgCollector( - Matchers.>>any())).thenAnswer( - invocation -> { - currentRequestContext = (RequestContext>) invocation.getArguments()[0]; - return multiMagCollector; - }); when(rpcProviderRegistry.addRpcImplementation( - Matchers.eq(StatisticsManagerControlService.class), - Matchers.any())).thenReturn(serviceControlRegistration); + eq(StatisticsManagerControlService.class), + ArgumentMatchers.any())).thenReturn(serviceControlRegistration); final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager(); final long basicTimerDelay = 3000L; diff --git a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/AbstractSingleStatsServiceTest.java b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/AbstractSingleStatsServiceTest.java index 4baa7c6009..c021c7cf94 100644 --- a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/AbstractSingleStatsServiceTest.java +++ b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/AbstractSingleStatsServiceTest.java @@ -8,13 +8,11 @@ package org.opendaylight.openflowplugin.impl.statistics.services; -import org.mockito.Matchers; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.stubbing.Answer; import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService; import org.opendaylight.openflowplugin.api.openflow.device.RequestContext; -import org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.EventIdentifier; import org.opendaylight.openflowplugin.impl.rpc.AbstractRequestContext; import org.opendaylight.yangtools.yang.common.RpcResult; @@ -44,7 +42,5 @@ public abstract class AbstractSingleStatsServiceTest extends AbstractStatsServic Mockito.when(rqContextStack.createRequestContext()).thenReturn(rqContext); Mockito.doAnswer(closeRequestFutureAnswer).when(multiMsgCollector).endCollecting(null); - Mockito.doAnswer(closeRequestFutureAnswer).when(multiMsgCollector) - .endCollecting(Matchers.any(EventIdentifier.class)); } } diff --git a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/AbstractStatsServiceTest.java b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/AbstractStatsServiceTest.java index 0fbd162ed3..66f59b0193 100644 --- a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/AbstractStatsServiceTest.java +++ b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/AbstractStatsServiceTest.java @@ -8,11 +8,12 @@ package org.opendaylight.openflowplugin.impl.statistics.services; +import static org.mockito.ArgumentMatchers.any; + import com.google.common.util.concurrent.FutureCallback; import java.math.BigInteger; import org.junit.Before; import org.junit.runner.RunWith; -import org.mockito.Matchers; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.runners.MockitoJUnitRunner; @@ -77,21 +78,21 @@ public abstract class AbstractStatsServiceTest { @Before public void init() throws Exception { - Mockito.when(deviceContext.getPrimaryConnectionContext()).thenReturn(connectionContext); + Mockito.lenient().when(deviceContext.getPrimaryConnectionContext()).thenReturn(connectionContext); Mockito.when(deviceContext.getMessageSpy()).thenReturn(messageSpy); - Mockito.when(deviceContext.getMultiMsgCollector(Matchers.any(RequestContext.class))) + Mockito.lenient().when(deviceContext.getMultiMsgCollector(any(RequestContext.class))) .thenReturn(multiMsgCollector); - Mockito.when(deviceContext.oook()).thenReturn(translatorLibrary); - Mockito.when(deviceContext.getDeviceState()).thenReturn(deviceState); + Mockito.lenient().when(deviceContext.oook()).thenReturn(translatorLibrary); + Mockito.lenient().when(deviceContext.getDeviceState()).thenReturn(deviceState); Mockito.when(deviceContext.getDeviceInfo()).thenReturn(deviceInfo); - Mockito.when(deviceInfo.getNodeId()).thenReturn(NODE_ID); - Mockito.when(deviceInfo.getVersion()).thenReturn(OFConstants.OFP_VERSION_1_3); - Mockito.when(deviceInfo.getDatapathId()).thenReturn(BigInteger.TEN); - Mockito.when(connectionContext.getFeatures()).thenReturn(features); - Mockito.when(connectionContext.getOutboundQueueProvider()).thenReturn(outboundQueueProvider); - Mockito.when(features.getVersion()).thenReturn(OFConstants.OFP_VERSION_1_3); - Mockito.when(getFeaturesOutput.getDatapathId()).thenReturn(BigInteger.valueOf(123L)); - Mockito.when(getFeaturesOutput.getVersion()).thenReturn(OFConstants.OFP_VERSION_1_3); + Mockito.lenient().when(deviceInfo.getNodeId()).thenReturn(NODE_ID); + Mockito.lenient().when(deviceInfo.getVersion()).thenReturn(OFConstants.OFP_VERSION_1_3); + Mockito.lenient().when(deviceInfo.getDatapathId()).thenReturn(BigInteger.TEN); + Mockito.lenient().when(connectionContext.getFeatures()).thenReturn(features); + Mockito.lenient().when(connectionContext.getOutboundQueueProvider()).thenReturn(outboundQueueProvider); + Mockito.lenient().when(features.getVersion()).thenReturn(OFConstants.OFP_VERSION_1_3); + Mockito.lenient().when(getFeaturesOutput.getDatapathId()).thenReturn(BigInteger.valueOf(123L)); + Mockito.lenient().when(getFeaturesOutput.getVersion()).thenReturn(OFConstants.OFP_VERSION_1_3); setUp(); } diff --git a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/OpendaylightFlowStatisticsServiceImpl1Test.java b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/OpendaylightFlowStatisticsServiceImpl1Test.java index 39e9cccab8..4f9abf088b 100644 --- a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/OpendaylightFlowStatisticsServiceImpl1Test.java +++ b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/OpendaylightFlowStatisticsServiceImpl1Test.java @@ -12,7 +12,6 @@ import java.util.concurrent.Future; import org.junit.Test; import org.mockito.ArgumentCaptor; import org.mockito.Captor; -import org.mockito.Mockito; import org.opendaylight.openflowplugin.impl.rpc.AbstractRequestContext; import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager; import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory; @@ -46,7 +45,7 @@ public class OpendaylightFlowStatisticsServiceImpl1Test extends AbstractStatsSer //NOOP } }; - Mockito.when(rqContextStack.createRequestContext()).thenReturn(rqContext); + //Mockito.when(rqContextStack.createRequestContext()).thenReturn(rqContext); } @Test(expected = IllegalAccessError.class) diff --git a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/OpendaylightFlowStatisticsServiceImpl2Test.java b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/OpendaylightFlowStatisticsServiceImpl2Test.java index 4e0425fac0..758e0f668c 100644 --- a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/OpendaylightFlowStatisticsServiceImpl2Test.java +++ b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/OpendaylightFlowStatisticsServiceImpl2Test.java @@ -8,6 +8,10 @@ package org.opendaylight.openflowplugin.impl.statistics.services; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.ArgumentMatchers.isNull; +import static org.mockito.ArgumentMatchers.same; + import com.google.common.util.concurrent.FutureCallback; import java.util.Collections; import java.util.List; @@ -16,7 +20,6 @@ import org.junit.Assert; import org.junit.Test; import org.mockito.ArgumentCaptor; import org.mockito.Captor; -import org.mockito.Matchers; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.stubbing.Answer; @@ -67,14 +70,14 @@ public class OpendaylightFlowStatisticsServiceImpl2Test extends AbstractStatsSer }; Mockito.when(rqContextStack.>createRequestContext()).thenReturn(rqContextMp); Mockito.when(translatorLibrary - .lookupTranslator(Matchers.any(TranslatorKey.class))) + .lookupTranslator(Mockito.any())) .thenReturn(translator); } @Test public void testGetAggregateFlowStatisticsFromFlowTableForGivenMatch() throws Exception { Mockito.doAnswer(answerVoidToCallback).when(outboundQueueProvider) - .commitEntry(Matchers.eq(42L), requestInput.capture(), Matchers.any(FutureCallback.class)); + .commitEntry(eq(42L), requestInput.capture(), Mockito.any()); Mockito.doAnswer((Answer) invocation -> { final MultipartReplyMessageBuilder messageBuilder = new MultipartReplyMessageBuilder() .setVersion(OFConstants.OFP_VERSION_1_3); @@ -83,9 +86,9 @@ public class OpendaylightFlowStatisticsServiceImpl2Test extends AbstractStatsSer .success(Collections.singletonList(messageBuilder.build())) .build()); return null; - }).when(multiMsgCollector).endCollecting(Matchers.any(EventIdentifier.class)); + }).when(multiMsgCollector).endCollecting(Mockito.any()); Mockito.when(translator.translate( - Matchers.any(MultipartReply.class), Matchers.same(deviceInfo), Matchers.isNull()) + Mockito.any(), same(deviceInfo), isNull()) ).thenReturn(new AggregatedFlowStatisticsBuilder().build()); GetAggregateFlowStatisticsFromFlowTableForGivenMatchInputBuilder input = diff --git a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/OpendaylightFlowTableStatisticsServiceImplTest.java b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/OpendaylightFlowTableStatisticsServiceImplTest.java index 339bdbf76a..41df3a6974 100644 --- a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/OpendaylightFlowTableStatisticsServiceImplTest.java +++ b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/OpendaylightFlowTableStatisticsServiceImplTest.java @@ -8,6 +8,9 @@ package org.opendaylight.openflowplugin.impl.statistics.services; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; + import com.google.common.util.concurrent.FutureCallback; import java.math.BigInteger; import java.util.Collections; @@ -16,8 +19,8 @@ import java.util.concurrent.atomic.AtomicLong; import org.junit.Assert; import org.junit.Test; import org.mockito.ArgumentCaptor; +import org.mockito.ArgumentMatchers; import org.mockito.Captor; -import org.mockito.Matchers; import org.mockito.Mockito; import org.opendaylight.openflowplugin.api.OFConstants; import org.opendaylight.openflowplugin.api.openflow.device.Xid; @@ -54,7 +57,7 @@ public class OpendaylightFlowTableStatisticsServiceImplTest extends AbstractSing @Test public void testGetFlowTablesStatistics() throws Exception { Mockito.doAnswer(answerVoidToCallback).when(outboundQueueProvider) - .commitEntry(Matchers.eq(42L), requestInput.capture(), Matchers.any(FutureCallback.class)); + .commitEntry(eq(42L), requestInput.capture(), any(FutureCallback.class)); GetFlowTablesStatisticsInputBuilder input = new GetFlowTablesStatisticsInputBuilder() .setNode(createNodeRef("unitProt:123")); @@ -87,7 +90,7 @@ public class OpendaylightFlowTableStatisticsServiceImplTest extends AbstractSing Assert.assertTrue(rpcResult.isSuccessful()); Assert.assertEquals(MultipartType.OFPMPTABLE, requestInput.getValue().getType()); - Mockito.verify(notificationPublishService).offerNotification(Matchers.any()); + Mockito.verify(notificationPublishService).offerNotification(ArgumentMatchers.any()); } @Test diff --git a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/OpendaylightGroupStatisticsServiceImplTest.java b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/OpendaylightGroupStatisticsServiceImplTest.java index 14c27461dc..c0a013b59b 100644 --- a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/OpendaylightGroupStatisticsServiceImplTest.java +++ b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/OpendaylightGroupStatisticsServiceImplTest.java @@ -8,6 +8,9 @@ package org.opendaylight.openflowplugin.impl.statistics.services; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; + import com.google.common.util.concurrent.FutureCallback; import java.math.BigInteger; import java.util.Collections; @@ -17,8 +20,8 @@ import org.junit.After; import org.junit.Assert; import org.junit.Test; import org.mockito.ArgumentCaptor; +import org.mockito.ArgumentMatchers; import org.mockito.Captor; -import org.mockito.Matchers; import org.mockito.Mockito; import org.opendaylight.openflowplugin.api.OFConstants; import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager; @@ -73,12 +76,12 @@ public class OpendaylightGroupStatisticsServiceImplTest extends AbstractSingleSt new AtomicLong(), notificationPublishService, convertorManager); Mockito.doAnswer(answerVoidToCallback).when(outboundQueueProvider) - .commitEntry(Matchers.eq(42L), requestInput.capture(), Matchers.any(FutureCallback.class)); + .commitEntry(eq(42L), requestInput.capture(), any(FutureCallback.class)); } @After public void tearDown() throws Exception { - Mockito.verify(notificationPublishService).offerNotification(Matchers.any()); + Mockito.verify(notificationPublishService).offerNotification(ArgumentMatchers.any()); } @Test diff --git a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/OpendaylightMeterStatisticsServiceImplTest.java b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/OpendaylightMeterStatisticsServiceImplTest.java index 6c7be87d08..41eeb1fd1b 100644 --- a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/OpendaylightMeterStatisticsServiceImplTest.java +++ b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/OpendaylightMeterStatisticsServiceImplTest.java @@ -8,6 +8,9 @@ package org.opendaylight.openflowplugin.impl.statistics.services; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; + import com.google.common.util.concurrent.FutureCallback; import java.math.BigInteger; import java.util.Collections; @@ -17,8 +20,8 @@ import org.junit.After; import org.junit.Assert; import org.junit.Test; import org.mockito.ArgumentCaptor; +import org.mockito.ArgumentMatchers; import org.mockito.Captor; -import org.mockito.Matchers; import org.mockito.Mockito; import org.opendaylight.openflowplugin.api.OFConstants; import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager; @@ -73,12 +76,12 @@ public class OpendaylightMeterStatisticsServiceImplTest extends AbstractSingleSt new AtomicLong(), notificationPublishService, convertorManager); Mockito.doAnswer(answerVoidToCallback).when(outboundQueueProvider) - .commitEntry(Matchers.eq(42L), requestInput.capture(), Matchers.any(FutureCallback.class)); + .commitEntry(eq(42L), requestInput.capture(), any(FutureCallback.class)); } @After public void tearDown() throws Exception { - Mockito.verify(notificationPublishService).offerNotification(Matchers.any()); + Mockito.verify(notificationPublishService).offerNotification(ArgumentMatchers.any()); } @Test diff --git a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/OpendaylightPortStatisticsServiceImplTest.java b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/OpendaylightPortStatisticsServiceImplTest.java index f305799a09..5a42f0025b 100644 --- a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/OpendaylightPortStatisticsServiceImplTest.java +++ b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/OpendaylightPortStatisticsServiceImplTest.java @@ -8,6 +8,9 @@ package org.opendaylight.openflowplugin.impl.statistics.services; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; + import com.google.common.util.concurrent.FutureCallback; import java.math.BigInteger; import java.util.Collections; @@ -17,8 +20,8 @@ import org.junit.After; import org.junit.Assert; import org.junit.Test; import org.mockito.ArgumentCaptor; +import org.mockito.ArgumentMatchers; import org.mockito.Captor; -import org.mockito.Matchers; import org.mockito.Mockito; import org.opendaylight.openflowplugin.api.OFConstants; import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId; @@ -51,12 +54,12 @@ public class OpendaylightPortStatisticsServiceImplTest extends AbstractSingleSta new AtomicLong(), notificationPublishService); Mockito.doAnswer(answerVoidToCallback).when(outboundQueueProvider) - .commitEntry(Matchers.eq(42L), requestInput.capture(), Matchers.any(FutureCallback.class)); + .commitEntry(eq(42L), requestInput.capture(), any(FutureCallback.class)); } @After public void tearDown() throws Exception { - Mockito.verify(notificationPublishService).offerNotification(Matchers.any()); + Mockito.verify(notificationPublishService).offerNotification(ArgumentMatchers.any()); } @Test diff --git a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/OpendaylightQueueStatisticsServiceImplTest.java b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/OpendaylightQueueStatisticsServiceImplTest.java index ab35849fb9..ed5a55a3b6 100644 --- a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/OpendaylightQueueStatisticsServiceImplTest.java +++ b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/OpendaylightQueueStatisticsServiceImplTest.java @@ -8,6 +8,9 @@ package org.opendaylight.openflowplugin.impl.statistics.services; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; + import com.google.common.util.concurrent.FutureCallback; import java.math.BigInteger; import java.util.Collections; @@ -17,8 +20,8 @@ import org.junit.After; import org.junit.Assert; import org.junit.Test; import org.mockito.ArgumentCaptor; +import org.mockito.ArgumentMatchers; import org.mockito.Captor; -import org.mockito.Matchers; import org.mockito.Mockito; import org.opendaylight.openflowplugin.api.OFConstants; import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.queue.rev130925.QueueId; @@ -56,13 +59,13 @@ public class OpendaylightQueueStatisticsServiceImplTest extends AbstractSingleSt @After public void tearDown() throws Exception { - Mockito.verify(notificationPublishService).offerNotification(Matchers.any()); + Mockito.verify(notificationPublishService).offerNotification(ArgumentMatchers.any()); } @Test public void testGetAllQueuesStatisticsFromAllPorts() throws Exception { Mockito.doAnswer(answerVoidToCallback).when(outboundQueueProvider) - .commitEntry(Matchers.eq(42L), requestInput.capture(), Matchers.any(FutureCallback.class)); + .commitEntry(eq(42L), requestInput.capture(), any(FutureCallback.class)); GetAllQueuesStatisticsFromAllPortsInputBuilder input = new GetAllQueuesStatisticsFromAllPortsInputBuilder() .setNode(createNodeRef("unitProt:123")); @@ -102,7 +105,7 @@ public class OpendaylightQueueStatisticsServiceImplTest extends AbstractSingleSt @Test public void testGetAllQueuesStatisticsFromGivenPort() throws Exception { Mockito.doAnswer(answerVoidToCallback).when(outboundQueueProvider) - .commitEntry(Matchers.eq(42L), requestInput.capture(), Matchers.any(FutureCallback.class)); + .commitEntry(eq(42L), requestInput.capture(), any(FutureCallback.class)); GetAllQueuesStatisticsFromGivenPortInputBuilder input = new GetAllQueuesStatisticsFromGivenPortInputBuilder() .setNode(createNodeRef("unitProt:123")) @@ -122,7 +125,7 @@ public class OpendaylightQueueStatisticsServiceImplTest extends AbstractSingleSt @Test public void testGetQueueStatisticsFromGivenPort() throws Exception { Mockito.doAnswer(answerVoidToCallback).when(outboundQueueProvider) - .commitEntry(Matchers.eq(42L), requestInput.capture(), Matchers.any(FutureCallback.class)); + .commitEntry(eq(42L), requestInput.capture(), any(FutureCallback.class)); GetQueueStatisticsFromGivenPortInputBuilder input = new GetQueueStatisticsFromGivenPortInputBuilder() .setNode(createNodeRef("unitProt:123")) diff --git a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/compatibility/AbstractCompatibleStatServiceTest.java b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/compatibility/AbstractCompatibleStatServiceTest.java index 8d6092cdc6..16d7f35aa1 100644 --- a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/compatibility/AbstractCompatibleStatServiceTest.java +++ b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/compatibility/AbstractCompatibleStatServiceTest.java @@ -8,6 +8,9 @@ package org.opendaylight.openflowplugin.impl.statistics.services.compatibility; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; + import com.google.common.util.concurrent.FutureCallback; import com.google.common.util.concurrent.ListenableFuture; import java.math.BigInteger; @@ -17,7 +20,6 @@ import org.junit.Assert; import org.junit.Test; import org.mockito.ArgumentCaptor; import org.mockito.Captor; -import org.mockito.Matchers; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.stubbing.Answer; @@ -91,20 +93,20 @@ public class AbstractCompatibleStatServiceTest extends AbstractStatsServiceTest return null; }; - Mockito.when(featuresOutput.getVersion()).thenReturn(OFConstants.OFP_VERSION_1_3); + Mockito.lenient().when(featuresOutput.getVersion()).thenReturn(OFConstants.OFP_VERSION_1_3); Mockito.when(rqContextStack.createRequestContext()).thenReturn(rqContext); - Mockito.when(deviceContext.getDeviceState()).thenReturn(deviceState); + Mockito.lenient().when(deviceContext.getDeviceState()).thenReturn(deviceState); Mockito.when(deviceContext.getDeviceInfo()).thenReturn(deviceInfo); Mockito.when(deviceInfo.getNodeId()).thenReturn(NODE_ID); Mockito.when(deviceInfo.getVersion()).thenReturn(OFConstants.OFP_VERSION_1_3); Mockito.doAnswer(closeRequestFutureAnswer).when(multiMsgCollector).endCollecting(null); - Mockito.doAnswer(closeRequestFutureAnswer).when(multiMsgCollector) - .endCollecting(Matchers.any(EventIdentifier.class)); + Mockito.lenient().doAnswer(closeRequestFutureAnswer).when(multiMsgCollector) + .endCollecting(any(EventIdentifier.class)); Mockito.doAnswer(answerVoidToCallback).when(outboundQueueProvider) - .commitEntry(Matchers.eq(42L), requestInput.capture(), Matchers.any(FutureCallback.class)); + .commitEntry(eq(42L), requestInput.capture(), any(FutureCallback.class)); - Mockito.when(translatorLibrary.lookupTranslator(Matchers.any(TranslatorKey.class))).thenReturn(translator); + Mockito.when(translatorLibrary.lookupTranslator(any(TranslatorKey.class))).thenReturn(translator); service = AggregateFlowsInTableService.createWithOook(rqContextStack, deviceContext, new AtomicLong(20L)); } @@ -140,7 +142,7 @@ public class AbstractCompatibleStatServiceTest extends AbstractStatsServiceTest .setFlowCount(new Counter32(12L)) .setPacketCount(new Counter64(BigInteger.valueOf(13L))) .build(); - Mockito.when(translator.translate(Matchers.any(MultipartReply.class), Matchers.eq(deviceInfo), Matchers.any())) + Mockito.when(translator.translate(any(MultipartReply.class), eq(deviceInfo), any())) .thenReturn(aggregatedStats); @@ -152,6 +154,6 @@ public class AbstractCompatibleStatServiceTest extends AbstractStatsServiceTest Assert.assertTrue(result.isSuccessful()); Assert.assertEquals(MultipartType.OFPMPAGGREGATE, requestInput.getValue().getType()); Mockito.verify(notificationPublishService, Mockito.timeout(500)) - .offerNotification(Matchers.any(AggregateFlowStatisticsUpdate.class)); + .offerNotification(any(AggregateFlowStatisticsUpdate.class)); } } diff --git a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/compatibility/OpendaylightFlowStatisticsServiceDelegateImplTest.java b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/compatibility/OpendaylightFlowStatisticsServiceDelegateImplTest.java index c26b9d060c..aa8bf5526d 100644 --- a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/compatibility/OpendaylightFlowStatisticsServiceDelegateImplTest.java +++ b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/compatibility/OpendaylightFlowStatisticsServiceDelegateImplTest.java @@ -8,6 +8,9 @@ package org.opendaylight.openflowplugin.impl.statistics.services.compatibility; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; + import com.google.common.util.concurrent.FutureCallback; import java.math.BigInteger; import java.util.Collections; @@ -16,8 +19,8 @@ import java.util.concurrent.atomic.AtomicLong; import org.junit.Assert; import org.junit.Test; import org.mockito.ArgumentCaptor; +import org.mockito.ArgumentMatchers; import org.mockito.Captor; -import org.mockito.Matchers; import org.mockito.Mock; import org.mockito.Mockito; import org.opendaylight.openflowplugin.api.OFConstants; @@ -83,8 +86,8 @@ public class OpendaylightFlowStatisticsServiceDelegateImplTest extends AbstractS rqContextStack, deviceContext, notificationPublishService, new AtomicLong(21), convertorManager); Mockito.doAnswer(answerVoidToCallback).when(outboundQueueProvider) - .commitEntry(Matchers.eq(42L), requestInput.capture(), Matchers.any(FutureCallback.class)); - Mockito.when(translatorLibrary.lookupTranslator(Matchers.any())).thenReturn(translator); + .commitEntry(eq(42L), requestInput.capture(), any(FutureCallback.class)); + Mockito.when(translatorLibrary.lookupTranslator(ArgumentMatchers.any())).thenReturn(translator); } @Test(expected = IllegalAccessError.class) @@ -99,7 +102,7 @@ public class OpendaylightFlowStatisticsServiceDelegateImplTest extends AbstractS .setNode(createNodeRef("unitProt:123")) .setTableId(new TableId((short) 1)); - Mockito.when(translator.translate(Matchers.any(MultipartReply.class), Matchers.eq(deviceInfo), Matchers.any())) + Mockito.when(translator.translate(any(MultipartReply.class), eq(deviceInfo),any())) .thenReturn(new AggregatedFlowStatisticsBuilder() .setByteCount(new Counter64(BigInteger.valueOf(50L))) .setPacketCount(new Counter64(BigInteger.valueOf(51L))) @@ -130,7 +133,7 @@ public class OpendaylightFlowStatisticsServiceDelegateImplTest extends AbstractS Assert.assertEquals(MultipartType.OFPMPAGGREGATE, requestInput.getValue().getType()); Mockito.verify(notificationPublishService, Mockito.timeout(NOTIFICATION_WAIT_TIMEOUT_MS)) - .offerNotification(Matchers.any(Notification.class)); + .offerNotification(any(Notification.class)); } @Test @@ -150,7 +153,7 @@ public class OpendaylightFlowStatisticsServiceDelegateImplTest extends AbstractS Assert.assertEquals(MultipartType.OFPMPFLOW, requestInput.getValue().getType()); Mockito.verify(notificationPublishService, Mockito.timeout(NOTIFICATION_WAIT_TIMEOUT_MS)) - .offerNotification(Matchers.any(Notification.class)); + .offerNotification(any(Notification.class)); } private static RpcResult buildFlowStatsReply() { @@ -213,7 +216,7 @@ public class OpendaylightFlowStatisticsServiceDelegateImplTest extends AbstractS Assert.assertEquals(MultipartType.OFPMPFLOW, requestInput.getValue().getType()); Mockito.verify(notificationPublishService, Mockito.timeout(NOTIFICATION_WAIT_TIMEOUT_MS)) - .offerNotification(Matchers.any(Notification.class)); + .offerNotification(any(Notification.class)); } @Test @@ -235,6 +238,6 @@ public class OpendaylightFlowStatisticsServiceDelegateImplTest extends AbstractS Assert.assertEquals(MultipartType.OFPMPFLOW, requestInput.getValue().getType()); Mockito.verify(notificationPublishService, Mockito.timeout(NOTIFICATION_WAIT_TIMEOUT_MS)) - .offerNotification(Matchers.any(Notification.class)); + .offerNotification(any(Notification.class)); } } diff --git a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/dedicated/StatisticsGatheringOnTheFlyServiceTest.java b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/dedicated/StatisticsGatheringOnTheFlyServiceTest.java index 10f42edfa8..ab50f4030c 100644 --- a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/dedicated/StatisticsGatheringOnTheFlyServiceTest.java +++ b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/dedicated/StatisticsGatheringOnTheFlyServiceTest.java @@ -40,7 +40,6 @@ public class StatisticsGatheringOnTheFlyServiceTest extends ServiceMocking { convertorManager, MultipartWriterProviderFactory .createDefaultProvider(mockedDeviceContext)); - Mockito.doReturn(NODE_ID).when(mockedPrimConnectionContext).getNodeId(); Mockito.when(mockedDeviceInfo.getNodeId()).thenReturn(NODE_ID); Mockito.when(mockedDeviceContext.getDeviceInfo().getNodeId()).thenReturn(NODE_ID); } diff --git a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/direct/AbstractDirectStatisticsServiceTest.java b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/direct/AbstractDirectStatisticsServiceTest.java index 44081aabeb..1df959a2cc 100755 --- a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/direct/AbstractDirectStatisticsServiceTest.java +++ b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/direct/AbstractDirectStatisticsServiceTest.java @@ -8,7 +8,8 @@ package org.opendaylight.openflowplugin.impl.statistics.services.direct; -import static org.mockito.Matchers.any; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.lenient; import static org.mockito.Mockito.when; import java.math.BigInteger; @@ -105,25 +106,25 @@ public abstract class AbstractDirectStatisticsServiceTest { .child(Node.class, new NodeKey(new NodeId(NODE_ID))); convertorManager = ConvertorManagerFactory.createDefaultManager(); - when(deviceContext.getDeviceFlowRegistry()).thenReturn(deviceFlowRegistry); - when(deviceContext.getDeviceGroupRegistry()).thenReturn(deviceGroupRegistry); - when(deviceContext.getDeviceMeterRegistry()).thenReturn(deviceMeterRegistry); + lenient().when(deviceContext.getDeviceFlowRegistry()).thenReturn(deviceFlowRegistry); + lenient().when(deviceContext.getDeviceGroupRegistry()).thenReturn(deviceGroupRegistry); + lenient().when(deviceContext.getDeviceMeterRegistry()).thenReturn(deviceMeterRegistry); when(deviceContext.getPrimaryConnectionContext()).thenReturn(connectionContext); when(deviceContext.getMessageSpy()).thenReturn(messageSpy); - when(deviceContext.getMultiMsgCollector(any())).thenReturn(multiMsgCollector); - when(deviceContext.oook()).thenReturn(translatorLibrary); - when(deviceContext.getDeviceState()).thenReturn(deviceState); + lenient().when(deviceContext.getMultiMsgCollector(any())).thenReturn(multiMsgCollector); + lenient().when(deviceContext.oook()).thenReturn(translatorLibrary); + lenient().when(deviceContext.getDeviceState()).thenReturn(deviceState); when(deviceContext.getDeviceInfo()).thenReturn(deviceInfo); when(deviceInfo.getNodeInstanceIdentifier()).thenReturn(nodeInstanceIdentifier); - when(deviceInfo.getNodeId()).thenReturn(new NodeId(NODE_ID)); + lenient().when(deviceInfo.getNodeId()).thenReturn(new NodeId(NODE_ID)); when(deviceInfo.getVersion()).thenReturn(OF_VERSION); when(deviceInfo.getDatapathId()).thenReturn(DATAPATH_ID); - when(getFeaturesOutput.getVersion()).thenReturn(OF_VERSION); - when(getFeaturesOutput.getDatapathId()).thenReturn(DATAPATH_ID); + lenient().when(getFeaturesOutput.getVersion()).thenReturn(OF_VERSION); + lenient().when(getFeaturesOutput.getDatapathId()).thenReturn(DATAPATH_ID); when(connectionContext.getFeatures()).thenReturn(features); - when(connectionContext.getOutboundQueueProvider()).thenReturn(outboundQueueProvider); - when(features.getVersion()).thenReturn(OF_VERSION); - when(features.getDatapathId()).thenReturn(DATAPATH_ID); + lenient().when(connectionContext.getOutboundQueueProvider()).thenReturn(outboundQueueProvider); + lenient().when(features.getVersion()).thenReturn(OF_VERSION); + lenient().when(features.getDatapathId()).thenReturn(DATAPATH_ID); multipartWriterProvider = MultipartWriterProviderFactory.createDefaultProvider(deviceContext); setUp(); } diff --git a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/direct/multilayer/FlowDirectStatisticsServiceTest.java b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/direct/multilayer/FlowDirectStatisticsServiceTest.java index 6f598f8737..d763332497 100644 --- a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/direct/multilayer/FlowDirectStatisticsServiceTest.java +++ b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/direct/multilayer/FlowDirectStatisticsServiceTest.java @@ -10,8 +10,8 @@ package org.opendaylight.openflowplugin.impl.statistics.services.direct.multilay import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.eq; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; @@ -60,7 +60,6 @@ public class FlowDirectStatisticsServiceTest extends AbstractDirectStatisticsSer public void testBuildRequestBody() throws Exception { final GetFlowStatisticsInput input = mock(GetFlowStatisticsInput.class); - when(input.getNode()).thenReturn(createNodeRef(NODE_ID)); when(input.getTableId()).thenReturn(TABLE_NO); final MultipartRequestFlowCase body = (MultipartRequestFlowCase) ((MultipartRequestInput) service diff --git a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/direct/multilayer/GroupDirectStatisticsServiceTest.java b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/direct/multilayer/GroupDirectStatisticsServiceTest.java index be0ea42658..8358a7a658 100644 --- a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/direct/multilayer/GroupDirectStatisticsServiceTest.java +++ b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/direct/multilayer/GroupDirectStatisticsServiceTest.java @@ -10,8 +10,9 @@ package org.opendaylight.openflowplugin.impl.statistics.services.direct.multilay import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.eq; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.lenient; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; @@ -51,7 +52,7 @@ public class GroupDirectStatisticsServiceTest extends AbstractDirectStatisticsSe public void testBuildRequestBody() throws Exception { final GetGroupStatisticsInput input = mock(GetGroupStatisticsInput.class); - when(input.getNode()).thenReturn(createNodeRef(NODE_ID)); + lenient().when(input.getNode()).thenReturn(createNodeRef(NODE_ID)); when(input.getGroupId()).thenReturn(new GroupId(GROUP_NO)); final MultipartRequestGroupCase body = (MultipartRequestGroupCase) ((MultipartRequestInput) service diff --git a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/direct/multilayer/MeterDirectStatisticsServiceTest.java b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/direct/multilayer/MeterDirectStatisticsServiceTest.java index 3f79b21405..8cc436ae05 100644 --- a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/direct/multilayer/MeterDirectStatisticsServiceTest.java +++ b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/direct/multilayer/MeterDirectStatisticsServiceTest.java @@ -10,8 +10,8 @@ package org.opendaylight.openflowplugin.impl.statistics.services.direct.multilay import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.eq; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; @@ -49,7 +49,6 @@ public class MeterDirectStatisticsServiceTest extends AbstractDirectStatisticsSe public void testBuildRequestBody() throws Exception { final GetMeterStatisticsInput input = mock(GetMeterStatisticsInput.class); - when(input.getNode()).thenReturn(createNodeRef(NODE_ID)); when(input.getMeterId()).thenReturn(new MeterId(METER_NO)); final MultipartRequestMeterCase body = (MultipartRequestMeterCase) ((MultipartRequestInput) service diff --git a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/direct/multilayer/NodeConnectorDirectStatisticsServiceTest.java b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/direct/multilayer/NodeConnectorDirectStatisticsServiceTest.java index 821299ce1e..e17fe48437 100644 --- a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/direct/multilayer/NodeConnectorDirectStatisticsServiceTest.java +++ b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/direct/multilayer/NodeConnectorDirectStatisticsServiceTest.java @@ -10,8 +10,9 @@ package org.opendaylight.openflowplugin.impl.statistics.services.direct.multilay import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.eq; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.lenient; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; @@ -49,7 +50,7 @@ public class NodeConnectorDirectStatisticsServiceTest extends AbstractDirectStat public void testBuildRequestBody() throws Exception { final GetNodeConnectorStatisticsInput input = mock(GetNodeConnectorStatisticsInput.class); - when(input.getNode()).thenReturn(createNodeRef(NODE_ID)); + lenient().when(input.getNode()).thenReturn(createNodeRef(NODE_ID)); when(input.getNodeConnectorId()).thenReturn(nodeConnectorId); final MultipartRequestPortStatsCase body = (MultipartRequestPortStatsCase) ((MultipartRequestInput)service diff --git a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/direct/multilayer/QueueDirectStatisticsServiceTest.java b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/direct/multilayer/QueueDirectStatisticsServiceTest.java index e57f794083..45706f1175 100644 --- a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/direct/multilayer/QueueDirectStatisticsServiceTest.java +++ b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/direct/multilayer/QueueDirectStatisticsServiceTest.java @@ -10,8 +10,9 @@ package org.opendaylight.openflowplugin.impl.statistics.services.direct.multilay import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.eq; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.lenient; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; @@ -53,7 +54,7 @@ public class QueueDirectStatisticsServiceTest extends AbstractDirectStatisticsSe public void testBuildRequestBody() throws Exception { final GetQueueStatisticsInput input = mock(GetQueueStatisticsInput.class); - when(input.getNode()).thenReturn(createNodeRef(NODE_ID)); + lenient().when(input.getNode()).thenReturn(createNodeRef(NODE_ID)); when(input.getQueueId()).thenReturn(new QueueId(QUEUE_NO)); when(input.getNodeConnectorId()).thenReturn(new NodeConnectorId(NODE_ID + ":" + PORT_NO)); diff --git a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/direct/singlelayer/FlowDirectStatisticsServiceTest.java b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/direct/singlelayer/FlowDirectStatisticsServiceTest.java index 3276a81b4c..95759a287c 100644 --- a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/direct/singlelayer/FlowDirectStatisticsServiceTest.java +++ b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/direct/singlelayer/FlowDirectStatisticsServiceTest.java @@ -10,8 +10,8 @@ package org.opendaylight.openflowplugin.impl.statistics.services.direct.singlela import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.eq; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; @@ -61,7 +61,6 @@ public class FlowDirectStatisticsServiceTest extends AbstractDirectStatisticsSer public void testBuildRequestBody() throws Exception { final GetFlowStatisticsInput input = mock(GetFlowStatisticsInput.class); - when(input.getNode()).thenReturn(createNodeRef(NODE_ID)); when(input.getTableId()).thenReturn(TABLE_NO); final MultipartRequestFlowStats body = (MultipartRequestFlowStats) ((MultipartRequest) service diff --git a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/direct/singlelayer/GroupDirectStatisticsServiceTest.java b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/direct/singlelayer/GroupDirectStatisticsServiceTest.java index 455bdd1d33..55f29132a8 100644 --- a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/direct/singlelayer/GroupDirectStatisticsServiceTest.java +++ b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/direct/singlelayer/GroupDirectStatisticsServiceTest.java @@ -10,8 +10,9 @@ package org.opendaylight.openflowplugin.impl.statistics.services.direct.singlela import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.eq; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.lenient; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; @@ -49,7 +50,7 @@ public class GroupDirectStatisticsServiceTest extends AbstractDirectStatisticsSe public void testBuildRequestBody() throws Exception { final GetGroupStatisticsInput input = mock(GetGroupStatisticsInput.class); - when(input.getNode()).thenReturn(createNodeRef(NODE_ID)); + lenient().when(input.getNode()).thenReturn(createNodeRef(NODE_ID)); when(input.getGroupId()).thenReturn(new GroupId(GROUP_NO)); final MultipartRequestGroupStats body = (MultipartRequestGroupStats) ((MultipartRequest) service diff --git a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/direct/singlelayer/MeterDirectStatisticsServiceTest.java b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/direct/singlelayer/MeterDirectStatisticsServiceTest.java index 7e0c9fd476..6b5b5dbfff 100644 --- a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/direct/singlelayer/MeterDirectStatisticsServiceTest.java +++ b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/direct/singlelayer/MeterDirectStatisticsServiceTest.java @@ -10,8 +10,9 @@ package org.opendaylight.openflowplugin.impl.statistics.services.direct.singlela import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.eq; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.lenient; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; @@ -54,7 +55,7 @@ public class MeterDirectStatisticsServiceTest extends AbstractDirectStatisticsSe public void testBuildRequestBody() throws Exception { final GetMeterStatisticsInput input = mock(GetMeterStatisticsInput.class); - when(input.getNode()).thenReturn(createNodeRef(NODE_ID)); + lenient().when(input.getNode()).thenReturn(createNodeRef(NODE_ID)); when(input.getMeterId()).thenReturn(new MeterId(METER_NO)); final MultipartRequestMeterStats body = (MultipartRequestMeterStats) ((MultipartRequest) service diff --git a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/direct/singlelayer/NodeConnectorDirectStatisticsServiceTest.java b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/direct/singlelayer/NodeConnectorDirectStatisticsServiceTest.java index dfe8880c99..b7fe1136f4 100644 --- a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/direct/singlelayer/NodeConnectorDirectStatisticsServiceTest.java +++ b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/direct/singlelayer/NodeConnectorDirectStatisticsServiceTest.java @@ -10,8 +10,9 @@ package org.opendaylight.openflowplugin.impl.statistics.services.direct.singlela import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.eq; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.lenient; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; @@ -47,7 +48,7 @@ public class NodeConnectorDirectStatisticsServiceTest extends AbstractDirectStat public void testBuildRequestBody() throws Exception { final GetNodeConnectorStatisticsInput input = mock(GetNodeConnectorStatisticsInput.class); - when(input.getNode()).thenReturn(createNodeRef(NODE_ID)); + lenient().when(input.getNode()).thenReturn(createNodeRef(NODE_ID)); when(input.getNodeConnectorId()).thenReturn(nodeConnectorId); final MultipartRequestPortStats body = (MultipartRequestPortStats) ((MultipartRequest)service diff --git a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/direct/singlelayer/QueueDirectStatisticsServiceTest.java b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/direct/singlelayer/QueueDirectStatisticsServiceTest.java index d709649440..f53dd84dd0 100644 --- a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/direct/singlelayer/QueueDirectStatisticsServiceTest.java +++ b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/direct/singlelayer/QueueDirectStatisticsServiceTest.java @@ -10,8 +10,9 @@ package org.opendaylight.openflowplugin.impl.statistics.services.direct.singlela import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.eq; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.lenient; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; @@ -53,7 +54,7 @@ public class QueueDirectStatisticsServiceTest extends AbstractDirectStatisticsSe public void testBuildRequestBody() throws Exception { final GetQueueStatisticsInput input = mock(GetQueueStatisticsInput.class); - when(input.getNode()).thenReturn(createNodeRef(NODE_ID)); + lenient().when(input.getNode()).thenReturn(createNodeRef(NODE_ID)); when(input.getQueueId()).thenReturn(new QueueId(QUEUE_NO)); when(input.getNodeConnectorId()).thenReturn(nodeConnectorId); diff --git a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/translator/FlowRemovedTranslatorTest.java b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/translator/FlowRemovedTranslatorTest.java index dd26d67dc2..fec15b653a 100644 --- a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/translator/FlowRemovedTranslatorTest.java +++ b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/translator/FlowRemovedTranslatorTest.java @@ -73,9 +73,7 @@ public class FlowRemovedTranslatorTest { translator = new FlowRemovedTranslator(convertorManager); translatorV10 = new FlowRemovedV10Translator(convertorManager); - when(deviceContext.getDeviceState()).thenReturn(deviceState); when(deviceInfo.getNodeInstanceIdentifier()).thenReturn(nodeId); - when(features.getDatapathId()).thenReturn(BigInteger.TEN); } @Test diff --git a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/translator/PacketReceivedTranslatorTest.java b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/translator/PacketReceivedTranslatorTest.java index 53c372d127..225ffb12cf 100644 --- a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/translator/PacketReceivedTranslatorTest.java +++ b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/translator/PacketReceivedTranslatorTest.java @@ -29,7 +29,6 @@ import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorM import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId; import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes; import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector; -import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorKey; import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node; import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PacketInReason; @@ -83,15 +82,7 @@ public class PacketReceivedTranslatorTest { final List phyPorts = Collections.singletonList(phyPort); convertorManager = ConvertorManagerFactory.createDefaultManager(); - Mockito.when(deviceContext.getPrimaryConnectionContext()).thenReturn(connectionContext); - Mockito.when(connectionContext.getFeatures()).thenReturn(featuresReply); - Mockito.when(featuresReply.getDatapathId()).thenReturn(BigInteger.TEN); - Mockito.when(deviceContext.getDeviceState()).thenReturn(deviceState); - Mockito.when(deviceInfo.getVersion()).thenReturn(OFConstants.OFP_VERSION_1_3); Mockito.when(deviceInfo.getDatapathId()).thenReturn(BigInteger.TEN); - Mockito.when(getFeaturesOutput.getDatapathId()).thenReturn(BigInteger.TEN); - Mockito.when(getFeaturesOutput.getPhyPort()).thenReturn(phyPorts); - Mockito.when(phyPort.getPortNo()).thenReturn(PORT_NO_DS); } @Test @@ -101,7 +92,6 @@ public class PacketReceivedTranslatorTest { .child(Node.class, new NodeKey(new NodeId("openflow:10"))); final PacketReceivedTranslator packetReceivedTranslator = new PacketReceivedTranslator(convertorManager); final PacketInMessage packetInMessage = createPacketInMessage(DATA.getBytes(), PORT_NO); - Mockito.when(deviceInfo.getNodeInstanceIdentifier()).thenReturn(nodePath); final PacketReceived packetReceived = packetReceivedTranslator.translate(packetInMessage, deviceInfo, null); @@ -109,8 +99,7 @@ public class PacketReceivedTranslatorTest { Assert.assertEquals("org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.SendToController", packetReceived.getPacketInReason().getName()); Assert.assertEquals("openflow:10:" + PORT_NO, - packetReceived.getIngress().getValue().firstKeyOf(NodeConnector.class, NodeConnectorKey.class) - .getId().getValue()); + packetReceived.getIngress().getValue().firstKeyOf(NodeConnector.class).getId().getValue()); Assert.assertEquals(0L, packetReceived.getFlowCookie().getValue().longValue()); Assert.assertEquals(42L, packetReceived.getTableId().getValue().longValue()); } diff --git a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/translator/PortUpdateTranslatorTest.java b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/translator/PortUpdateTranslatorTest.java index 4e3a449fe2..6c82e6dc57 100644 --- a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/translator/PortUpdateTranslatorTest.java +++ b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/translator/PortUpdateTranslatorTest.java @@ -48,7 +48,6 @@ public class PortUpdateTranslatorTest { @Before public void setUp() throws Exception { - Mockito.when(deviceContext.getDeviceInfo()).thenReturn(deviceInfo); portUpdateTranslator = new PortUpdateTranslator(); portStateBld = new StateBuilder().setLive(true); diff --git a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/util/BarrierUtilTest.java b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/util/BarrierUtilTest.java index e3880f4441..4a366ce0f8 100644 --- a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/util/BarrierUtilTest.java +++ b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/util/BarrierUtilTest.java @@ -17,8 +17,8 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; +import org.mockito.ArgumentMatchers; import org.mockito.Captor; -import org.mockito.Matchers; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.runners.MockitoJUnitRunner; @@ -53,7 +53,7 @@ public class BarrierUtilTest { @Before public void setUp() throws Exception { - Mockito.when(transactionService.sendBarrier(Matchers.any())) + Mockito.when(transactionService.sendBarrier(ArgumentMatchers.any())) .thenReturn(RpcResultBuilder.success().buildFuture()); } @@ -69,7 +69,7 @@ public class BarrierUtilTest { final ListenableFuture> chainResult = BarrierUtil.chainBarrier(input, NODE_REF, transactionService, compositeTransform); - Mockito.verify(transactionService).sendBarrier(Matchers.any()); + Mockito.verify(transactionService).sendBarrier(ArgumentMatchers.any()); Mockito.verify(compositeTransform).apply(pairCpt.capture()); final Pair, RpcResult> value = pairCpt.getValue(); diff --git a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/util/DeviceInitializationUtilTest.java b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/util/DeviceInitializationUtilTest.java index c32b49d191..75adf0cfad 100644 --- a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/util/DeviceInitializationUtilTest.java +++ b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/util/DeviceInitializationUtilTest.java @@ -9,8 +9,8 @@ package org.opendaylight.openflowplugin.impl.util; import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.eq; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; diff --git a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/util/MdSalRegistrationUtilsTest.java b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/util/MdSalRegistrationUtilsTest.java index acfee6858c..94643b753b 100644 --- a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/util/MdSalRegistrationUtilsTest.java +++ b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/util/MdSalRegistrationUtilsTest.java @@ -8,7 +8,7 @@ package org.opendaylight.openflowplugin.impl.util; -import static org.mockito.Matchers.any; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; @@ -17,7 +17,6 @@ import java.math.BigInteger; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.Matchers; import org.mockito.Mock; import org.mockito.runners.MockitoJUnitRunner; import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService; @@ -68,10 +67,8 @@ public class MdSalRegistrationUtilsTest { @Before public void setUp() throws Exception { convertorManager = ConvertorManagerFactory.createDefaultManager(); - when(mockedDeviceContext.getDeviceState()).thenReturn(mockedDeviceState); when(mockedDeviceContext.getDeviceInfo()).thenReturn(mockedDeviceInfo); when(mockedConnectionContext.getFeatures()).thenReturn(mockedFeatures); - when(mockedFeatures.getDatapathId()).thenReturn(mockedDataPathId); when(mockedDeviceInfo.getDatapathId()).thenReturn(mockedDataPathId); when(mockedDeviceContext.getPrimaryConnectionContext()).thenReturn(mockedConnectionContext); } @@ -83,7 +80,7 @@ public class MdSalRegistrationUtilsTest { extensionConverterProvider, convertorManager); verify(mockedRpcContext, times(NUMBER_OF_RPC_SERVICE_REGISTRATION)).registerRpcServiceImplementation( - Matchers.any(), any(RpcService.class)); + any(), any(RpcService.class)); } @Test @@ -98,7 +95,7 @@ public class MdSalRegistrationUtilsTest { notificationPublishService, convertorManager); verify(mockedRpcContext, times(NUMBER_OF_STAT_COMPAT_RPC_SERVICE_REGISTRATION)) - .registerRpcServiceImplementation(Matchers.any(), any(RpcService.class)); + .registerRpcServiceImplementation(any(), any(RpcService.class)); } } \ No newline at end of file diff --git a/openflowplugin-it/pom.xml b/openflowplugin-it/pom.xml index 4f34a618e1..2afadcacf8 100644 --- a/openflowplugin-it/pom.xml +++ b/openflowplugin-it/pom.xml @@ -1,3 +1,4 @@ + 4.0.0 @@ -53,7 +54,7 @@ - + diff --git a/openflowplugin/pom.xml b/openflowplugin/pom.xml index 71a61f0ce2..8f78142c2d 100644 --- a/openflowplugin/pom.xml +++ b/openflowplugin/pom.xml @@ -102,4 +102,3 @@ - diff --git a/openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/MeterConvertor.java b/openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/MeterConvertor.java index b3e68b4dbf..d6d6460660 100644 --- a/openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/MeterConvertor.java +++ b/openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/MeterConvertor.java @@ -186,7 +186,7 @@ public class MeterConvertor extends Convertor org.opendaylight.mdsal binding-parent - 0.14.0-SNAPSHOT + 3.0.1 diff --git a/samples/learning-switch/pom.xml b/samples/learning-switch/pom.xml index a28fe782d5..b97c466399 100644 --- a/samples/learning-switch/pom.xml +++ b/samples/learning-switch/pom.xml @@ -52,4 +52,3 @@ - diff --git a/samples/learning-switch/src/main/java/org/opendaylight/openflowplugin/learningswitch/FlowUtils.java b/samples/learning-switch/src/main/java/org/opendaylight/openflowplugin/learningswitch/FlowUtils.java index f770f214ef..d799e8fe9b 100644 --- a/samples/learning-switch/src/main/java/org/opendaylight/openflowplugin/learningswitch/FlowUtils.java +++ b/samples/learning-switch/src/main/java/org/opendaylight/openflowplugin/learningswitch/FlowUtils.java @@ -34,7 +34,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instru import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionKey; import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorRef; import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector; -import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorKey; import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetDestinationBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetSourceBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatch; @@ -67,7 +66,7 @@ public final class FlowUtils { MatchBuilder match = new MatchBuilder(); match.setEthernetMatch(ethernetMatch); - Uri outputPort = dstPort.getValue().firstKeyOf(NodeConnector.class, NodeConnectorKey.class).getId(); + Uri outputPort = dstPort.getValue().firstKeyOf(NodeConnector.class).getId(); Action outputToControllerAction = new ActionBuilder() .setOrder(0) diff --git a/samples/learning-switch/src/main/java/org/opendaylight/openflowplugin/learningswitch/InstanceIdentifierUtils.java b/samples/learning-switch/src/main/java/org/opendaylight/openflowplugin/learningswitch/InstanceIdentifierUtils.java index fa3b3f2d93..2acc10228b 100644 --- a/samples/learning-switch/src/main/java/org/opendaylight/openflowplugin/learningswitch/InstanceIdentifierUtils.java +++ b/samples/learning-switch/src/main/java/org/opendaylight/openflowplugin/learningswitch/InstanceIdentifierUtils.java @@ -77,14 +77,14 @@ public final class InstanceIdentifierUtils { * @param tablePath the table path */ public static Short getTableId(final InstanceIdentifier tablePath) { - return tablePath.firstKeyOf(Table.class, TableKey.class).getId(); + return tablePath.firstKeyOf(Table.class).getId(); } /** * Extracts NodeConnectorKey from node connector path. */ public static NodeConnectorKey getNodeConnectorKey(final InstanceIdentifier nodeConnectorPath) { - return nodeConnectorPath.firstKeyOf(NodeConnector.class, NodeConnectorKey.class); + return nodeConnectorPath.firstKeyOf(NodeConnector.class); } public static InstanceIdentifier createNodeConnectorPath(final InstanceIdentifier nodeKey, diff --git a/samples/learning-switch/src/main/java/org/opendaylight/openflowplugin/learningswitch/LearningSwitchHandlerSimpleImpl.java b/samples/learning-switch/src/main/java/org/opendaylight/openflowplugin/learningswitch/LearningSwitchHandlerSimpleImpl.java index d1a0b9be0a..a7d86b9300 100644 --- a/samples/learning-switch/src/main/java/org/opendaylight/openflowplugin/learningswitch/LearningSwitchHandlerSimpleImpl.java +++ b/samples/learning-switch/src/main/java/org/opendaylight/openflowplugin/learningswitch/LearningSwitchHandlerSimpleImpl.java @@ -96,7 +96,7 @@ public class LearningSwitchHandlerSimpleImpl implements LearningSwitchHandler, P tablePath = appearedTablePath; nodePath = tablePath.firstIdentifierOf(Node.class); - nodeId = nodePath.firstKeyOf(Node.class, NodeKey.class).getId(); + nodeId = nodePath.firstKeyOf(Node.class).getId(); mac2portMapping = new HashMap<>(); // start forwarding all packages to controller @@ -181,7 +181,7 @@ public class LearningSwitchHandlerSimpleImpl implements LearningSwitchHandler, P String macPath = srcMac.toString() + dstMac.toString(); if (!coveredMacPaths.contains(macPath)) { LOG.debug("covering mac path: {} by [{}]", macPath, - destNodeConnector.getValue().firstKeyOf(NodeConnector.class, NodeConnectorKey.class).getId()); + destNodeConnector.getValue().firstKeyOf(NodeConnector.class).getId()); coveredMacPaths.add(macPath); FlowId flowId = new FlowId(String.valueOf(flowIdInc.getAndIncrement())); @@ -211,7 +211,7 @@ public class LearningSwitchHandlerSimpleImpl implements LearningSwitchHandler, P } private NodeConnectorId nodeConnectorId(String connectorId) { - NodeKey nodeKey = nodePath.firstKeyOf(Node.class, NodeKey.class); + NodeKey nodeKey = nodePath.firstKeyOf(Node.class); StringBuilder stringId = new StringBuilder(nodeKey.getId().getValue()).append(":").append(connectorId); return new NodeConnectorId(stringId.toString()); } diff --git a/samples/pom.xml b/samples/pom.xml index 0c51676662..8e1da375b5 100644 --- a/samples/pom.xml +++ b/samples/pom.xml @@ -1,6 +1,5 @@ - + 4.0.0 diff --git a/samples/sample-bundles/pom.xml b/samples/sample-bundles/pom.xml index a41fa2425e..23db039407 100644 --- a/samples/sample-bundles/pom.xml +++ b/samples/sample-bundles/pom.xml @@ -6,7 +6,6 @@ ~ terms of the Eclipse Public License v1.0 which accompanies this distribution, ~ and is available at http://www.eclipse.org/legal/epl-v10.html --> - 4.0.0 @@ -71,4 +70,3 @@ - diff --git a/samples/sample-consumer/pom.xml b/samples/sample-consumer/pom.xml index b40a328d41..fa1232b82e 100644 --- a/samples/sample-consumer/pom.xml +++ b/samples/sample-consumer/pom.xml @@ -47,4 +47,3 @@ - diff --git a/samples/simple-client/pom.xml b/samples/simple-client/pom.xml index fd74a8aba9..a6747f165d 100644 --- a/samples/simple-client/pom.xml +++ b/samples/simple-client/pom.xml @@ -1,3 +1,4 @@ + 4.0.0 diff --git a/samples/simple-client/src/main/java/org/opendaylight/openflowjava/protocol/impl/clients/CallableClient.java b/samples/simple-client/src/main/java/org/opendaylight/openflowjava/protocol/impl/clients/CallableClient.java index f7d278f8b4..836344f558 100644 --- a/samples/simple-client/src/main/java/org/opendaylight/openflowjava/protocol/impl/clients/CallableClient.java +++ b/samples/simple-client/src/main/java/org/opendaylight/openflowjava/protocol/impl/clients/CallableClient.java @@ -100,7 +100,7 @@ public class CallableClient implements Callable, OFClient { } } } catch (RuntimeException ex) { - LOG.error(ex.getMessage(), ex); + LOG.error("Error {}", ex); return false; } if (scenarioHandler.isFinishedOK()) { diff --git a/samples/simple-client/src/main/java/org/opendaylight/openflowjava/protocol/impl/clients/ListeningSimpleClient.java b/samples/simple-client/src/main/java/org/opendaylight/openflowjava/protocol/impl/clients/ListeningSimpleClient.java index d19f655757..7eba2f845d 100644 --- a/samples/simple-client/src/main/java/org/opendaylight/openflowjava/protocol/impl/clients/ListeningSimpleClient.java +++ b/samples/simple-client/src/main/java/org/opendaylight/openflowjava/protocol/impl/clients/ListeningSimpleClient.java @@ -76,7 +76,7 @@ public class ListeningSimpleClient implements OFClient { } } } catch (InterruptedException ex) { - LOG.error(ex.getMessage(), ex); + LOG.error("Error {}", ex); } finally { LOG.debug("listening client shutting down"); try { @@ -84,7 +84,7 @@ public class ListeningSimpleClient implements OFClient { bossGroup.shutdownGracefully().get(); LOG.debug("listening client shutdown succesful"); } catch (InterruptedException | ExecutionException e) { - LOG.error(e.getMessage(), e); + LOG.error("Error {}", e); } } scenarioDone.set(true); diff --git a/samples/simple-client/src/main/java/org/opendaylight/openflowjava/protocol/impl/clients/ScenarioHandler.java b/samples/simple-client/src/main/java/org/opendaylight/openflowjava/protocol/impl/clients/ScenarioHandler.java index 14d4538aa9..cae78d5d0e 100644 --- a/samples/simple-client/src/main/java/org/opendaylight/openflowjava/protocol/impl/clients/ScenarioHandler.java +++ b/samples/simple-client/src/main/java/org/opendaylight/openflowjava/protocol/impl/clients/ScenarioHandler.java @@ -62,7 +62,7 @@ public class ScenarioHandler extends Thread { WaitForMessageEvent event = (WaitForMessageEvent) peek; event.setHeaderReceived(ofMsg.poll(2000, TimeUnit.MILLISECONDS)); } catch (InterruptedException e) { - LOG.error(e.getMessage(), e); + LOG.error("Error {}", e); break; } } else if (peek instanceof SendEvent) { @@ -81,14 +81,14 @@ public class ScenarioHandler extends Thread { } if (freezeCounter > freeze) { LOG.warn("Scenario frozen: {}", freezeCounter); - LOG.warn("Scenario step not finished NOT OK!", freezeCounter); + LOG.warn("Scenario step not finished NOT OK! {}", freezeCounter); this.finishedOK = false; break; } try { sleep(sleepBetweenTries); } catch (InterruptedException e) { - LOG.error(e.getMessage(), e); + LOG.error("Error {}", e); } } LOG.debug("Scenario finished"); diff --git a/samples/simple-client/src/main/java/org/opendaylight/openflowjava/protocol/impl/clients/SendEvent.java b/samples/simple-client/src/main/java/org/opendaylight/openflowjava/protocol/impl/clients/SendEvent.java index d5885ef62a..fa4936a3b3 100644 --- a/samples/simple-client/src/main/java/org/opendaylight/openflowjava/protocol/impl/clients/SendEvent.java +++ b/samples/simple-client/src/main/java/org/opendaylight/openflowjava/protocol/impl/clients/SendEvent.java @@ -44,7 +44,7 @@ public class SendEvent implements ClientEvent { ctx.writeAndFlush(buffer); if (LOG.isDebugEnabled()) { - LOG.debug(">> {}", ByteBufUtils.bytesToHexString(msgToSend)); + LOG.debug("Message to send {}", ByteBufUtils.bytesToHexString(msgToSend)); LOG.debug("message sent"); } return true; diff --git a/samples/simple-client/src/main/java/org/opendaylight/openflowjava/protocol/impl/clients/SimpleClient.java b/samples/simple-client/src/main/java/org/opendaylight/openflowjava/protocol/impl/clients/SimpleClient.java index 8bbcd85a0e..3564ea3548 100644 --- a/samples/simple-client/src/main/java/org/opendaylight/openflowjava/protocol/impl/clients/SimpleClient.java +++ b/samples/simple-client/src/main/java/org/opendaylight/openflowjava/protocol/impl/clients/SimpleClient.java @@ -75,14 +75,14 @@ public class SimpleClient implements OFClient { } } } catch (InterruptedException ex) { - LOG.error(ex.getMessage(), ex); + LOG.error("Error {}", ex); } finally { LOG.debug("shutting down"); try { group.shutdownGracefully().get(); LOG.debug("shutdown succesful"); } catch (InterruptedException | ExecutionException e) { - LOG.error(e.getMessage(), e); + LOG.error("Error {}", e); } } scenarioDone.set(true); diff --git a/samples/simple-client/src/main/java/org/opendaylight/openflowjava/protocol/impl/clients/SimpleClientHandler.java b/samples/simple-client/src/main/java/org/opendaylight/openflowjava/protocol/impl/clients/SimpleClientHandler.java index eac94db3d1..f4ff429859 100644 --- a/samples/simple-client/src/main/java/org/opendaylight/openflowjava/protocol/impl/clients/SimpleClientHandler.java +++ b/samples/simple-client/src/main/java/org/opendaylight/openflowjava/protocol/impl/clients/SimpleClientHandler.java @@ -44,7 +44,7 @@ public class SimpleClientHandler extends ChannelInboundHandlerAdapter { public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { ByteBuf bb = (ByteBuf) msg; if (LOG.isDebugEnabled()) { - LOG.debug("<< {}", ByteBufUtils.byteBufToHexString(bb)); + LOG.debug("Message {}", ByteBufUtils.byteBufToHexString(bb)); } int length = bb.getUnsignedShort(bb.readerIndex() + LENGTH_INDEX_IN_HEADER); LOG.trace("SimpleClientHandler - start of read"); diff --git a/samples/simple-client/src/main/java/org/opendaylight/openflowjava/protocol/impl/clients/SleepEvent.java b/samples/simple-client/src/main/java/org/opendaylight/openflowjava/protocol/impl/clients/SleepEvent.java index 9017a5195c..55dd0054ee 100644 --- a/samples/simple-client/src/main/java/org/opendaylight/openflowjava/protocol/impl/clients/SleepEvent.java +++ b/samples/simple-client/src/main/java/org/opendaylight/openflowjava/protocol/impl/clients/SleepEvent.java @@ -37,7 +37,7 @@ public class SleepEvent implements ClientEvent { LOG.debug("Sleeping"); return true; } catch (InterruptedException e) { - LOG.error(e.getMessage(), e); + LOG.error("Error {}", e); } return false; } diff --git a/samples/simple-client/src/main/java/org/opendaylight/openflowjava/protocol/impl/clients/UdpSimpleClient.java b/samples/simple-client/src/main/java/org/opendaylight/openflowjava/protocol/impl/clients/UdpSimpleClient.java index d18438f04f..4438ba84f9 100644 --- a/samples/simple-client/src/main/java/org/opendaylight/openflowjava/protocol/impl/clients/UdpSimpleClient.java +++ b/samples/simple-client/src/main/java/org/opendaylight/openflowjava/protocol/impl/clients/UdpSimpleClient.java @@ -76,14 +76,14 @@ public class UdpSimpleClient implements OFClient { } } } catch (InterruptedException ex) { - LOG.error(ex.getMessage(), ex); + LOG.error("Error {}", ex); } finally { LOG.debug("shutting down"); try { group.shutdownGracefully().get(); LOG.debug("shutdown succesful"); } catch (InterruptedException | ExecutionException e) { - LOG.error(e.getMessage(), e); + LOG.error("Error {}", e); } } scenarioDone.set(true); diff --git a/test-common/pom.xml b/test-common/pom.xml index 22c8b7463e..1ad87aad28 100644 --- a/test-common/pom.xml +++ b/test-common/pom.xml @@ -1,5 +1,5 @@ - + + 4.0.0 org.opendaylight.openflowplugin diff --git a/test-common/src/main/java/org/opendaylight/openflowplugin/testcommon/AbstractDropTest.java b/test-common/src/main/java/org/opendaylight/openflowplugin/testcommon/AbstractDropTest.java index 8590e66548..3a7da65b0d 100644 --- a/test-common/src/main/java/org/opendaylight/openflowplugin/testcommon/AbstractDropTest.java +++ b/test-common/src/main/java/org/opendaylight/openflowplugin/testcommon/AbstractDropTest.java @@ -142,7 +142,7 @@ abstract class AbstractDropTest implements PacketProcessingListener, AutoCloseab } catch (RejectedExecutionException e) { incrementRunableRejected(); } - LOG.debug("onPacketReceived - Leaving", notification); + LOG.debug("onPacketReceived - {} Leaving", notification); } private static final Instructions DROP_INSTRUCTIONS = makeStaticDropActionInstructions(); diff --git a/test-provider/pom.xml b/test-provider/pom.xml index d83e6a9263..78e4436030 100644 --- a/test-provider/pom.xml +++ b/test-provider/pom.xml @@ -1,3 +1,4 @@ + 4.0.0 diff --git a/test-provider/src/main/java/org/opendaylight/openflowplugin/test/FlowEventListenerLoggingImpl.java b/test-provider/src/main/java/org/opendaylight/openflowplugin/test/FlowEventListenerLoggingImpl.java index ae2f8d6b3a..e6b610e34f 100644 --- a/test-provider/src/main/java/org/opendaylight/openflowplugin/test/FlowEventListenerLoggingImpl.java +++ b/test-provider/src/main/java/org/opendaylight/openflowplugin/test/FlowEventListenerLoggingImpl.java @@ -27,23 +27,20 @@ public class FlowEventListenerLoggingImpl implements SalFlowListener { @Override public void onFlowAdded(FlowAdded notification) { - LOG.info("flow to be added.........................." + notification.toString()); - LOG.info("added flow Xid........................." + notification.getTransactionId().getValue()); - LOG.info("-----------------------------------------------------------------------------------"); + LOG.info("flow to be added {}", notification.toString()); + LOG.info("added flow Xid {}", notification.getTransactionId().getValue()); } @Override public void onFlowRemoved(FlowRemoved notification) { - LOG.debug("removed flow.........................." + notification.toString()); - LOG.debug("remove flow Xid........................." + notification.getTransactionId().getValue()); - LOG.debug("-----------------------------------------------------------------------------------"); + LOG.debug("removed flow {}", notification.toString()); + LOG.debug("remove flow Xid {}", notification.getTransactionId().getValue()); } @Override public void onFlowUpdated(FlowUpdated notification) { - LOG.debug("updated flow.........................." + notification.toString()); - LOG.debug("updated flow Xid........................." + notification.getTransactionId().getValue()); - LOG.debug("-----------------------------------------------------------------------------------"); + LOG.debug("updated flow {}", notification.toString()); + LOG.debug("updated flow Xid {}", notification.getTransactionId().getValue()); } @Override @@ -66,8 +63,6 @@ public class FlowEventListenerLoggingImpl implements SalFlowListener { @Override public void onSwitchFlowRemoved(SwitchFlowRemoved notification) { - LOG.debug("Switch flow removed : Cookies..................." - + notification.getCookie().toString()); - LOG.debug("-----------------------------------------------------------------------------------"); + LOG.debug("Switch flow removed : Cookies {}", notification.getCookie().toString()); } } diff --git a/test-provider/src/main/java/org/opendaylight/openflowplugin/test/NodeErrorListenerLoggingImpl.java b/test-provider/src/main/java/org/opendaylight/openflowplugin/test/NodeErrorListenerLoggingImpl.java index 1a70b6abac..1b48eec380 100644 --- a/test-provider/src/main/java/org/opendaylight/openflowplugin/test/NodeErrorListenerLoggingImpl.java +++ b/test-provider/src/main/java/org/opendaylight/openflowplugin/test/NodeErrorListenerLoggingImpl.java @@ -40,92 +40,92 @@ public class NodeErrorListenerLoggingImpl implements NodeErrorListener { @Override public void onBadActionErrorNotification(BadActionErrorNotification notification) { - LOG.error("Error notification ----" - + toStr(notification.getType(), notification.getCode(), notification.getTransactionId().getValue())); + LOG.error("Error notification {}", toStr(notification.getType(), notification.getCode(), + notification.getTransactionId().getValue())); } @Override public void onBadInstructionErrorNotification(BadInstructionErrorNotification notification) { - LOG.error("Error notification ----" - + toStr(notification.getType(), notification.getCode(), notification.getTransactionId().getValue())); + LOG.error("Error notification {}", toStr(notification.getType(), notification.getCode(), + notification.getTransactionId().getValue())); } @Override public void onBadMatchErrorNotification(BadMatchErrorNotification notification) { - LOG.error("Error notification ----" - + toStr(notification.getType(), notification.getCode(), notification.getTransactionId().getValue())); + LOG.error("Error notification {}", toStr(notification.getType(), notification.getCode(), + notification.getTransactionId().getValue())); } @Override public void onBadRequestErrorNotification(BadRequestErrorNotification notification) { - LOG.error("Error notification ----" - + toStr(notification.getType(), notification.getCode(), notification.getTransactionId().getValue())); + LOG.error("Error notification {}", toStr(notification.getType(), notification.getCode(), + notification.getTransactionId().getValue())); } @Override public void onExperimenterErrorNotification(ExperimenterErrorNotification notification) { - LOG.error("Error notification ----" - + toStr(notification.getType(), notification.getCode(), notification.getTransactionId().getValue())); + LOG.error("Error notification {}", toStr(notification.getType(), notification.getCode(), + notification.getTransactionId().getValue())); } @Override public void onFlowModErrorNotification(FlowModErrorNotification notification) { - LOG.error("Error notification ----" - + toStr(notification.getType(), notification.getCode(), notification.getTransactionId().getValue())); + LOG.error("Error notification {}", toStr(notification.getType(), notification.getCode(), + notification.getTransactionId().getValue())); } @Override public void onGroupModErrorNotification(GroupModErrorNotification notification) { - LOG.error("Error notification ----" - + toStr(notification.getType(), notification.getCode(), notification.getTransactionId().getValue())); + LOG.error("Error notification {}", toStr(notification.getType(), notification.getCode(), + notification.getTransactionId().getValue())); } @Override public void onHelloFailedErrorNotification(HelloFailedErrorNotification notification) { - LOG.error("Error notification ----" - + toStr(notification.getType(), notification.getCode(), notification.getTransactionId().getValue())); + LOG.error("Error notification {}", toStr(notification.getType(), notification.getCode(), + notification.getTransactionId().getValue())); } @Override public void onMeterModErrorNotification(MeterModErrorNotification notification) { - LOG.error("Error notification ----" - + toStr(notification.getType(), notification.getCode(), notification.getTransactionId().getValue())); + LOG.error("Error notification {}", toStr(notification.getType(), notification.getCode(), + notification.getTransactionId().getValue())); } @Override public void onPortModErrorNotification(PortModErrorNotification notification) { - LOG.error("Error notification ----" - + toStr(notification.getType(), notification.getCode(), notification.getTransactionId().getValue())); + LOG.error("Error notification {}", toStr(notification.getType(), notification.getCode(), + notification.getTransactionId().getValue())); } @Override public void onQueueOpErrorNotification(QueueOpErrorNotification notification) { - LOG.error("Error notification ----" - + toStr(notification.getType(), notification.getCode(), notification.getTransactionId().getValue())); + LOG.error("Error notification {}", toStr(notification.getType(), notification.getCode(), + notification.getTransactionId().getValue())); } @Override public void onRoleRequestErrorNotification(RoleRequestErrorNotification notification) { - LOG.error("Error notification ----" - + toStr(notification.getType(), notification.getCode(), notification.getTransactionId().getValue())); + LOG.error("Error notification {}", toStr(notification.getType(), notification.getCode(), + notification.getTransactionId().getValue())); } @Override public void onSwitchConfigErrorNotification(SwitchConfigErrorNotification notification) { - LOG.error("Error notification ----" - + toStr(notification.getType(), notification.getCode(), notification.getTransactionId().getValue())); + LOG.error("Error notification {}", toStr(notification.getType(), notification.getCode(), + notification.getTransactionId().getValue())); } @Override public void onTableFeaturesErrorNotification(TableFeaturesErrorNotification notification) { - LOG.error("Error notification ----" - + toStr(notification.getType(), notification.getCode(), notification.getTransactionId().getValue())); + LOG.error("Error notification {}", toStr(notification.getType(), notification.getCode(), + notification.getTransactionId().getValue())); } @Override public void onTableModErrorNotification(TableModErrorNotification notification) { - LOG.error("Error notification ----" - + toStr(notification.getType(), notification.getCode(), notification.getTransactionId().getValue())); + LOG.error("Error notification {}", toStr(notification.getType(), notification.getCode(), + notification.getTransactionId().getValue())); } private String toStr(ErrorType type, int code, BigInteger xid) { diff --git a/test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowPluginBulkTransactionProvider.java b/test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowPluginBulkTransactionProvider.java index 58637d97be..c761ae5498 100644 --- a/test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowPluginBulkTransactionProvider.java +++ b/test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowPluginBulkTransactionProvider.java @@ -659,7 +659,7 @@ public class OpenflowPluginBulkTransactionProvider implements CommandProvider { @Override public void onFailure(Throwable throwable) { - LOG.error(throwable.getMessage(), throwable); + LOG.error("Status of Group Data Loaded Transaction : failure. Reason : {}", throwable); ci.println(String.format("Status of Group Data Loaded Transaction : failure. Reason : %s", throwable)); } }, MoreExecutors.directExecutor()); @@ -716,7 +716,7 @@ public class OpenflowPluginBulkTransactionProvider implements CommandProvider { @Override public void onFailure(Throwable throwable) { - LOG.error(throwable.getMessage(), throwable); + LOG.error("Status of Group Data Loaded Transaction : failure. Reason : {}", throwable); ci.println(String.format("Status of Group Data Loaded Transaction : failure. Reason : %s", throwable)); } }, MoreExecutors.directExecutor()); diff --git a/test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginGroupTestServiceProvider.java b/test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginGroupTestServiceProvider.java index 0c30639811..b1c69012d4 100644 --- a/test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginGroupTestServiceProvider.java +++ b/test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginGroupTestServiceProvider.java @@ -102,8 +102,7 @@ public class OpenflowpluginGroupTestServiceProvider implements AutoCloseable, */ @Override public ListenableFuture> addGroup(AddGroupInput input) { - String plus = "addGroup - " + input; - OpenflowpluginGroupTestServiceProvider.LOG.info(plus); + OpenflowpluginGroupTestServiceProvider.LOG.info("addGroup - {}", input); return null; } @@ -119,8 +118,7 @@ public class OpenflowpluginGroupTestServiceProvider implements AutoCloseable, @Override public ListenableFuture> removeGroup( RemoveGroupInput input) { - String plus = "removeGroup - " + input; - OpenflowpluginGroupTestServiceProvider.LOG.info(plus); + OpenflowpluginGroupTestServiceProvider.LOG.info("removeGroup - {}", input); return null; } @@ -136,8 +134,7 @@ public class OpenflowpluginGroupTestServiceProvider implements AutoCloseable, @Override public ListenableFuture> updateGroup( UpdateGroupInput input) { - String plus = "updateGroup - " + input; - OpenflowpluginGroupTestServiceProvider.LOG.info(plus); + OpenflowpluginGroupTestServiceProvider.LOG.info("updateGroup - {}", input); return null; } diff --git a/test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginMeterTestCommandProvider.java b/test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginMeterTestCommandProvider.java index 9ca3d4fdae..2ca6c7a3d8 100644 --- a/test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginMeterTestCommandProvider.java +++ b/test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginMeterTestCommandProvider.java @@ -102,23 +102,20 @@ public class OpenflowpluginMeterTestCommandProvider implements CommandProvider { @Override public void onMeterAdded(MeterAdded notification) { - LOG.info("Meter to be added.........................." + notification.toString()); - LOG.info("Meter Xid........................." + notification.getTransactionId().getValue()); - LOG.info("-----------------------------------------------------------------------------------"); + LOG.info("Meter to be added {}", notification.toString()); + LOG.info("Meter Xid {}", notification.getTransactionId().getValue()); } @Override public void onMeterRemoved(MeterRemoved notification) { - LOG.info("Meter to be removed.........................." + notification.toString()); - LOG.info("Meter Xid........................." + notification.getTransactionId().getValue()); - LOG.info("-----------------------------------------------------------------------------------"); + LOG.info("Meter to be removed {}", notification.toString()); + LOG.info("Meter Xid {}", notification.getTransactionId().getValue()); } @Override public void onMeterUpdated(MeterUpdated notification) { - LOG.info("Meter to be updated.........................." + notification.toString()); - LOG.info("Meter Xid........................." + notification.getTransactionId().getValue()); - LOG.info("-----------------------------------------------------------------------------------"); + LOG.info("Meter to be updated {}", notification.toString()); + LOG.info("Meter Xid {}", notification.getTransactionId().getValue()); } } diff --git a/test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginMeterTestServiceProvider.java b/test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginMeterTestServiceProvider.java index 98cfe835e2..cf89034d30 100644 --- a/test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginMeterTestServiceProvider.java +++ b/test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginMeterTestServiceProvider.java @@ -119,8 +119,7 @@ public class OpenflowpluginMeterTestServiceProvider implements AutoCloseable, */ @Override public ListenableFuture> addMeter(final AddMeterInput input) { - String plus = "addMeter - " + input; - OpenflowpluginMeterTestServiceProvider.LOG.info(plus); + OpenflowpluginMeterTestServiceProvider.LOG.info("addMeter - {}", input); return null; } @@ -136,8 +135,7 @@ public class OpenflowpluginMeterTestServiceProvider implements AutoCloseable, @Override public ListenableFuture> removeMeter( final RemoveMeterInput input) { - String plus = "removeMeter - " + input; - OpenflowpluginMeterTestServiceProvider.LOG.info(plus); + OpenflowpluginMeterTestServiceProvider.LOG.info("removeMeter - {}", input); return null; } @@ -153,8 +151,7 @@ public class OpenflowpluginMeterTestServiceProvider implements AutoCloseable, @Override public ListenableFuture> updateMeter( final UpdateMeterInput input) { - String plus = "updateMeter - " + input; - OpenflowpluginMeterTestServiceProvider.LOG.info(plus); + OpenflowpluginMeterTestServiceProvider.LOG.info("updateMeter - {}", input); return null; } diff --git a/test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginTableFeaturesTestServiceProvider.java b/test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginTableFeaturesTestServiceProvider.java index ea49777c0f..c2c14c7a3b 100644 --- a/test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginTableFeaturesTestServiceProvider.java +++ b/test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginTableFeaturesTestServiceProvider.java @@ -99,8 +99,7 @@ public class OpenflowpluginTableFeaturesTestServiceProvider implements @Override public ListenableFuture> updateTable( UpdateTableInput input) { - String plus = "updateTable - " + input; - OpenflowpluginTableFeaturesTestServiceProvider.LOG.info(plus); + OpenflowpluginTableFeaturesTestServiceProvider.LOG.info("updateTable - {}", input); return null; } diff --git a/test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginTestCommandProvider.java b/test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginTestCommandProvider.java index 01cac59d94..f8a7081648 100644 --- a/test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginTestCommandProvider.java +++ b/test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginTestCommandProvider.java @@ -3160,7 +3160,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider { @Override public void onFailure(final Throwable throwable) { - LOG.error(throwable.getMessage(), throwable); + LOG.error("Status of Group Data Loaded Transaction : failure. Reason : {}", throwable); ci.println(String.format("Status of Group Data Loaded Transaction : failure. Reason : %s", throwable)); } }, MoreExecutors.directExecutor()); @@ -3200,7 +3200,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider { @Override public void onFailure(final Throwable throwable) { - LOG.error(throwable.getMessage(), throwable); + LOG.error("Status of Group Data Loaded Transaction : failure. Reason : {}", throwable); ci.println(String.format("Status of Group Data Loaded Transaction : failure. Reason : %s", throwable)); } }, MoreExecutors.directExecutor()); diff --git a/test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginTestNodeConnectorNotification.java b/test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginTestNodeConnectorNotification.java index 9eb918fadc..d40e741593 100644 --- a/test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginTestNodeConnectorNotification.java +++ b/test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginTestNodeConnectorNotification.java @@ -43,33 +43,29 @@ public class OpenflowpluginTestNodeConnectorNotification { @Override public void onNodeConnectorRemoved(NodeConnectorRemoved notification) { - LOG.debug("NodeConnectorRemoved Notification ..................."); - LOG.debug("NodeConnectorRef " + notification.getNodeConnectorRef()); - LOG.debug("----------------------------------------------------------------------"); + LOG.debug("NodeConnectorRemoved Notification"); + LOG.debug("NodeConnectorRef {}", notification.getNodeConnectorRef()); nodeConnectorRemoved.add(notification); } @Override public void onNodeConnectorUpdated(NodeConnectorUpdated notification) { - LOG.debug("NodeConnectorUpdated Notification..................."); - LOG.debug("NodeConnectorRef " + notification.getNodeConnectorRef()); - LOG.debug("----------------------------------------------------------------------"); + LOG.debug("NodeConnectorUpdated Notification"); + LOG.debug("NodeConnectorRef {}", notification.getNodeConnectorRef()); nodeConnectorUpdated.add(notification); } @Override public void onNodeRemoved(NodeRemoved notification) { - LOG.debug("NodeRemoved Notification ..................."); - LOG.debug("NodeRef " + notification.getNodeRef()); - LOG.debug("----------------------------------------------------------------------"); + LOG.debug("NodeRemoved Notification"); + LOG.debug("NodeRef {}", notification.getNodeRef()); nodeRemoved.add(notification); } @Override public void onNodeUpdated(NodeUpdated notification) { - LOG.debug("NodeUpdated Notification ..................."); - LOG.debug("NodeRef " + notification.getNodeRef()); - LOG.debug("----------------------------------------------------------------------"); + LOG.debug("NodeUpdated Notification"); + LOG.debug("NodeRef {}", notification.getNodeRef()); nodeUpdated.add(notification); } } diff --git a/test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginTestServiceProvider.java b/test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginTestServiceProvider.java index 10ee6a4d0d..3aa5ecf58f 100644 --- a/test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginTestServiceProvider.java +++ b/test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginTestServiceProvider.java @@ -107,8 +107,7 @@ public class OpenflowpluginTestServiceProvider implements AutoCloseable, */ @Override public ListenableFuture> addFlow(AddFlowInput input) { - String plus = "addFlow - " + input; - OpenflowpluginTestServiceProvider.LOG.info(plus); + OpenflowpluginTestServiceProvider.LOG.info("addFlow - {}", input); return null; } @@ -123,8 +122,7 @@ public class OpenflowpluginTestServiceProvider implements AutoCloseable, */ @Override public ListenableFuture> removeFlow(RemoveFlowInput input) { - String plus = "removeFlow - " + input; - OpenflowpluginTestServiceProvider.LOG.info(plus); + OpenflowpluginTestServiceProvider.LOG.info("removeFlow - {}", input); return null; } @@ -139,8 +137,7 @@ public class OpenflowpluginTestServiceProvider implements AutoCloseable, */ @Override public ListenableFuture> updateFlow(UpdateFlowInput input) { - String plus = "updateFlow - " + input; - OpenflowpluginTestServiceProvider.LOG.info(plus); + OpenflowpluginTestServiceProvider.LOG.info("updateFlow - {}", input); return null; } -- 2.36.6