Search in sources :

Example 1 with DistributedLockBuilder

use of org.onosproject.store.service.DistributedLockBuilder in project onos by opennetworkinglab.

the class RouteManagerTest method setUp.

@Before
public void setUp() throws Exception {
    setUpHostService();
    routeListener = createMock(RouteListener.class);
    routeManager = new TestRouteManager();
    routeManager.hostService = hostService;
    routeManager.clusterService = createNiceMock(ClusterService.class);
    replay(routeManager.clusterService);
    routeManager.storageService = createNiceMock(StorageService.class);
    AsyncDistributedLock adl = createNiceMock(AsyncDistributedLock.class);
    expect(adl.asLock()).andReturn(createNiceMock(DistributedLock.class));
    replay(adl);
    DistributedLockBuilder dlb = createNiceMock(DistributedLockBuilder.class);
    expect(dlb.withName(anyString())).andReturn(dlb);
    expect(dlb.build()).andReturn(adl);
    replay(dlb);
    expect(routeManager.storageService.lockBuilder()).andReturn(dlb);
    expect(routeManager.storageService.getWorkQueue(anyString(), anyObject())).andReturn(createNiceMock(WorkQueue.class));
    replay(routeManager.storageService);
    LocalRouteStore routeStore = new LocalRouteStore();
    routeStore.activate();
    routeManager.routeStore = routeStore;
    routeManager.activate();
    routeManager.hostEventExecutors = new PredictableExecutor(0, groupedThreads("onos/route-manager-test", "event-host-%d"), true);
    routeManager.routeResolver.routeResolvers = new PredictableExecutor(0, groupedThreads("onos/route-resolver-test", "route-resolver-%d"), true);
    routeManager.addListener(routeListener);
}
Also used : AsyncDistributedLock(org.onosproject.store.service.AsyncDistributedLock) DistributedLock(org.onosproject.store.service.DistributedLock) ClusterService(org.onosproject.cluster.ClusterService) DistributedLockBuilder(org.onosproject.store.service.DistributedLockBuilder) LocalRouteStore(org.onosproject.routeservice.store.LocalRouteStore) AsyncDistributedLock(org.onosproject.store.service.AsyncDistributedLock) PredictableExecutor(org.onlab.util.PredictableExecutor) WorkQueue(org.onosproject.store.service.WorkQueue) RouteListener(org.onosproject.routeservice.RouteListener) StorageService(org.onosproject.store.service.StorageService) Before(org.junit.Before)

Aggregations

Before (org.junit.Before)1 PredictableExecutor (org.onlab.util.PredictableExecutor)1 ClusterService (org.onosproject.cluster.ClusterService)1 RouteListener (org.onosproject.routeservice.RouteListener)1 LocalRouteStore (org.onosproject.routeservice.store.LocalRouteStore)1 AsyncDistributedLock (org.onosproject.store.service.AsyncDistributedLock)1 DistributedLock (org.onosproject.store.service.DistributedLock)1 DistributedLockBuilder (org.onosproject.store.service.DistributedLockBuilder)1 StorageService (org.onosproject.store.service.StorageService)1 WorkQueue (org.onosproject.store.service.WorkQueue)1