use of org.onosproject.lisp.ctl.LispRouterAdapter in project onos by opennetworkinglab.
the class LispControllerImplTest method setUp.
/**
* Sets up routers to use as data, mocks and launches a controller instance.
*/
@Before
public void setUp() {
try {
router1 = new LispRouterAdapter();
routerId1 = LispRouterId.routerId(new URI("lisp:10.1.1.1"));
router2 = new LispRouterAdapter();
routerId2 = LispRouterId.routerId(new URI("lisp:10.1.1.2"));
router3 = new LispRouterAdapter();
routerId3 = LispRouterId.routerId(new URI("lisp:10.1.1.3"));
} catch (URISyntaxException e) {
// this will never happen...
fail();
}
controller = new LispControllerImpl();
agent = controller.agent;
routerListener = new TestRouterListener();
controller.addRouterListener(routerListener);
messageListener = new TestMessageListener();
controller.addMessageListener(messageListener);
controller.coreService = createMock(CoreService.class);
ComponentConfigService mockConfigService = createMock(ComponentConfigService.class);
expect(mockConfigService.getProperties(anyObject())).andReturn(ImmutableSet.of());
mockConfigService.registerProperties(controller.getClass());
expectLastCall();
mockConfigService.unregisterProperties(controller.getClass(), false);
expectLastCall();
expect(mockConfigService.getProperties(anyObject())).andReturn(ImmutableSet.of());
controller.cfgService = mockConfigService;
replay(mockConfigService);
ComponentContext mockContext = createMock(ComponentContext.class);
Dictionary<String, Object> properties = new Hashtable<>();
properties.put("lispAuthKey", "onos");
properties.put("lispAuthKeyId", 1);
expect(mockContext.getProperties()).andReturn(properties);
replay(mockContext);
LispControllerBootstrap bootstrap = createMock(LispControllerBootstrap.class);
bootstrap.start();
expectLastCall();
controller.bootstrap = bootstrap;
replay(bootstrap);
controller.activate(mockContext);
}
Aggregations