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);
}
Aggregations