import com.google.common.collect.Lists;
import com.google.common.util.concurrent.Futures;
-import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider;
import org.opendaylight.openflowjava.protocol.spi.connection.SwitchConnectionProvider;
-import org.opendaylight.openflowplugin.api.openflow.OpenFlowPluginConfigurationService.PropertyType;
+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;
@RunWith(MockitoJUnitRunner.class)
@Mock
ClusterSingletonServiceProvider clusterSingletonServiceProvider;
+ @Mock
+ ConfigurationService configurationService;
+
+ @Mock
+ MastershipChangeServiceManager mastershipChangeServiceManager;
+
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 int THREAD_POOL_MAX_THREADS = 32000;
private static final long THREAD_POOL_TIMEOUT = 60;
+ private static final long BASIC_TIMER_DELAY = 1L;
+ private static final boolean USE_SINGLE_LAYER_SERIALIZATION = false;
private OpenFlowPluginProviderImpl provider;
when(entityOwnershipService.registerListener(any(), any())).thenReturn(entityOwnershipListenerRegistration);
when(rpcProviderRegistry.addRpcImplementation(eq(StatisticsManagerControlService.class), any())).thenReturn(controlServiceRegistration);
when(switchConnectionProvider.startup()).thenReturn(Futures.immediateCheckedFuture(null));
+ when(configurationService.getProperty(eq(ConfigurationProperty.USE_SINGLE_LAYER_SERIALIZATION.toString()), any())).thenReturn(USE_SINGLE_LAYER_SERIALIZATION);
+ when(configurationService.getProperty(eq(ConfigurationProperty.THREAD_POOL_MIN_THREADS.toString()), any())).thenReturn(THREAD_POOL_MIN_THREADS);
+ when(configurationService.getProperty(eq(ConfigurationProperty.THREAD_POOL_MAX_THREADS.toString()), any())).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);
provider = new OpenFlowPluginProviderImpl(
+ configurationService,
Lists.newArrayList(switchConnectionProvider),
dataBroker,
rpcProviderRegistry,
notificationPublishService,
clusterSingletonServiceProvider,
- entityOwnershipService);
-
- provider.updateProperty(PropertyType.THREAD_POOL_MIN_THREADS, THREAD_POOL_MIN_THREADS);
- provider.updateProperty(PropertyType.THREAD_POOL_MAX_THREADS, THREAD_POOL_MAX_THREADS);
- provider.updateProperty(PropertyType.THREAD_POOL_TIMEOUT, THREAD_POOL_TIMEOUT);
- provider.updateProperty(PropertyType.RPC_REQUESTS_QUOTA, RPC_REQUESTS_QUOTA);
- provider.updateProperty(PropertyType.GLOBAL_NOTIFICATION_QUOTA, GLOBAL_NOTIFICATION_QUOTA);
- }
-
- @After
- public void tearDown() throws Exception {
-
+ entityOwnershipService,
+ mastershipChangeServiceManager);
}
@Test