X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=openflowplugin-impl%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fopenflowplugin%2Fimpl%2FOpenFlowPluginProviderImplTest.java;h=abf719b2454ad8984debaef8af93430571675c3d;hb=a425274a36f7ea227ba3ec7181ee646b5fa50d40;hp=cfc4f16ae942c830e3676695d0d27b4087780204;hpb=b4f4b4b702e2ccd8a7c62fd2a5c184c5b1cbe665;p=openflowplugin.git 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 cfc4f16ae9..abf719b245 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 @@ -5,11 +5,11 @@ * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html */ - package org.opendaylight.openflowplugin.impl; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; @@ -19,37 +19,40 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; -import org.opendaylight.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.sal.binding.api.BindingAwareBroker; -import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry; +import org.mockito.junit.MockitoJUnitRunner; import org.opendaylight.infrautils.ready.SystemReadyMonitor; +import org.opendaylight.mdsal.binding.api.NotificationPublishService; +import org.opendaylight.mdsal.binding.api.RpcProviderService; +import org.opendaylight.mdsal.binding.api.WriteTransaction; +import org.opendaylight.mdsal.common.api.CommitInfo; import org.opendaylight.mdsal.eos.binding.api.EntityOwnershipListenerRegistration; import org.opendaylight.mdsal.eos.binding.api.EntityOwnershipService; import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider; +import org.opendaylight.openflowjava.protocol.api.connection.OpenflowDiagStatusProvider; import org.opendaylight.openflowjava.protocol.spi.connection.SwitchConnectionProvider; -import org.opendaylight.openflowplugin.api.diagstatus.OpenflowPluginDiagStatusProvider; +import org.opendaylight.openflowjava.protocol.spi.connection.SwitchConnectionProviderList; import org.opendaylight.openflowplugin.api.openflow.configuration.ConfigurationProperty; import org.opendaylight.openflowplugin.api.openflow.configuration.ConfigurationService; import org.opendaylight.openflowplugin.api.openflow.mastership.MastershipChangeServiceManager; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflowplugin.sm.control.rev150812.StatisticsManagerControlService; +import org.opendaylight.yangtools.concepts.ObjectRegistration; +import org.opendaylight.yangtools.yang.common.Uint16; +import org.opendaylight.yangtools.yang.common.Uint32; @RunWith(MockitoJUnitRunner.class) public class OpenFlowPluginProviderImplTest { @Mock - DataBroker dataBroker; + PingPongDataBroker dataBroker; @Mock - RpcProviderRegistry rpcProviderRegistry; + RpcProviderService rpcProviderRegistry; @Mock NotificationPublishService notificationPublishService; @Mock - OpenflowPluginDiagStatusProvider ofPluginDiagstatusProvider; + OpenflowDiagStatusProvider ofPluginDiagstatusProvider; @Mock SystemReadyMonitor systemReadyMonitor; @@ -64,7 +67,7 @@ public class OpenFlowPluginProviderImplTest { EntityOwnershipListenerRegistration entityOwnershipListenerRegistration; @Mock - BindingAwareBroker.RpcRegistration controlServiceRegistration; + ObjectRegistration controlServiceRegistration; @Mock SwitchConnectionProvider switchConnectionProvider; @@ -80,19 +83,19 @@ public class OpenFlowPluginProviderImplTest { private static final int RPC_REQUESTS_QUOTA = 500; private static final long GLOBAL_NOTIFICATION_QUOTA = 131072; - private static final int THREAD_POOL_MIN_THREADS = 1; + private static final Uint16 THREAD_POOL_MIN_THREADS = Uint16.ONE; private static final int THREAD_POOL_MAX_THREADS = 32000; - private static final long THREAD_POOL_TIMEOUT = 60; + private static final Uint32 THREAD_POOL_TIMEOUT = Uint32.valueOf(60); private static final long BASIC_TIMER_DELAY = 1L; private static final boolean USE_SINGLE_LAYER_SERIALIZATION = false; - private static final int DEVICE_CONNECTION_RATE_LIMIT_PER_MIN = 0; + private static final Uint16 DEVICE_CONNECTION_RATE_LIMIT_PER_MIN = Uint16.ZERO; @Before - public void setUp() throws Exception { + public void setUp() { when(dataBroker.newWriteOnlyTransaction()).thenReturn(writeTransaction); - when(writeTransaction.submit()).thenReturn(Futures.immediateCheckedFuture(null)); + doReturn(CommitInfo.emptyFluentFuture()).when(writeTransaction).commit(); when(entityOwnershipService.registerListener(any(), any())).thenReturn(entityOwnershipListenerRegistration); - when(rpcProviderRegistry.addRpcImplementation(eq(StatisticsManagerControlService.class), any())) + when(rpcProviderRegistry.registerRpcImplementation(eq(StatisticsManagerControlService.class), any())) .thenReturn(controlServiceRegistration); when(switchConnectionProvider.startup()).thenReturn(Futures.immediateFuture(true)); when(switchConnectionProvider.shutdown()).thenReturn(Futures.immediateFuture(true)); @@ -109,10 +112,10 @@ public class OpenFlowPluginProviderImplTest { } @Test - public void testInitializeAndClose() throws Exception { + public void testInitializeAndClose() { final OpenFlowPluginProviderImpl provider = new OpenFlowPluginProviderImpl( configurationService, - Lists.newArrayList(switchConnectionProvider), + new SwitchConnectionProviderList(Lists.newArrayList(switchConnectionProvider)), dataBroker, rpcProviderRegistry, notificationPublishService,