use of org.onosproject.common.event.impl.TestEventDispatcher in project up4 by omec-project.
the class Up4DeviceManagerTest method setUp.
@Before
public void setUp() {
component = new Up4DeviceManager();
component.coreService = new CoreServiceAdapter();
component.flowRuleService = new FlowRuleServiceAdapter();
component.meterService = new MeterServiceAdapter();
component.deviceService = new DeviceServiceAdapter();
component.piPipeconfService = new PiPipeconfServiceAdapter();
component.netCfgService = new NetworkConfigRegistryAdapter();
component.componentConfigService = new ComponentConfigAdapter();
component.up4Store = TestDistributedUp4Store.build();
injectEventDispatcher(component, new TestEventDispatcher());
component.activate();
}
use of org.onosproject.common.event.impl.TestEventDispatcher in project onos by opennetworkinglab.
the class ReplicaInfoManagerTest method setUp.
@Before
public void setUp() throws Exception {
mastershipListenerRegistry = new ListenerRegistry<>();
mgr = new ReplicaInfoManager();
service = mgr;
eventDispatcher = new TestEventDispatcher();
mgr.eventDispatcher = eventDispatcher;
mgr.mastershipService = new TestMastershipService();
// register dummy mastership event source
mgr.eventDispatcher.addSink(MastershipEvent.class, mastershipListenerRegistry);
mgr.activate();
}
use of org.onosproject.common.event.impl.TestEventDispatcher in project onos by opennetworkinglab.
the class DeviceManagerTest method setUp.
@Before
public void setUp() {
mgr = new DeviceManager();
service = mgr;
admin = mgr;
registry = mgr;
mgr.store = new SimpleDeviceStore();
injectEventDispatcher(mgr, new TestEventDispatcher());
TestMastershipManager mastershipManager = new TestMastershipManager();
mgr.mastershipService = mastershipManager;
mgr.termService = mastershipManager;
mgr.clusterService = new TestClusterService();
mgr.networkConfigService = new TestNetworkConfigService();
mgr.communicationService = new TestClusterCommunicationService();
mgr.activate();
service.addListener(listener);
provider = new TestProvider();
providerService = registry.register(provider);
assertTrue("provider should be registered", registry.getProviders().contains(provider.id()));
}
use of org.onosproject.common.event.impl.TestEventDispatcher in project onos by opennetworkinglab.
the class FlowRuleManagerTest method setUp.
@Before
public void setUp() {
mgr = new FlowRuleManager();
mgr.store = new SimpleFlowRuleStore();
injectEventDispatcher(mgr, new TestEventDispatcher());
mgr.deviceService = new TestDeviceService();
mgr.mastershipService = new TestMastershipService();
mgr.coreService = new TestCoreService();
mgr.operationsService = MoreExecutors.newDirectExecutorService();
mgr.deviceInstallers = MoreExecutors.newDirectExecutorService();
mgr.cfgService = new ComponentConfigAdapter();
ClusterService mockClusterService = createMock(ClusterService.class);
NodeId nodeId = new NodeId(NODE_ID);
MockControllerNode mockControllerNode = new MockControllerNode(nodeId);
expect(mockClusterService.getLocalNode()).andReturn(mockControllerNode).anyTimes();
replay(mockClusterService);
mgr.clusterService = mockClusterService;
service = mgr;
registry = mgr;
DriverRegistryManager driverRegistry = new DriverRegistryManager();
driverService = new TestDriverManager(driverRegistry);
driverRegistry.addDriver(new DefaultDriver("foo", ImmutableList.of(), "", "", "", ImmutableMap.of(FlowRuleProgrammable.class, TestFlowRuleProgrammable.class), ImmutableMap.of()));
mgr.activate(null);
mgr.addListener(listener);
provider = new TestProvider(PID);
providerService = this.registry.register(provider);
appId = new TestApplicationId(0, "FlowRuleManagerTest");
assertTrue("provider should be registered", this.registry.getProviders().contains(provider.id()));
}
use of org.onosproject.common.event.impl.TestEventDispatcher in project onos by opennetworkinglab.
the class MastershipManagerTest method setUp.
@Before
public void setUp() throws Exception {
mgr = new MastershipManager();
service = mgr;
injectEventDispatcher(mgr, new TestEventDispatcher());
testClusterService = new TestClusterService();
mgr.clusterService = testClusterService;
mgr.upgradeService = new UpgradeServiceAdapter();
mgr.store = new TestSimpleMastershipStore(mgr.clusterService);
regionStore = new DistributedRegionStore();
TestUtils.setField(regionStore, "storageService", new TestStorageService());
TestUtils.callMethod(regionStore, "activate", new Class<?>[] {});
regionManager = new TestRegionManager();
TestUtils.setField(regionManager, "store", regionStore);
regionManager.activate();
mgr.regionService = regionManager;
ComponentConfigService mockConfigService = EasyMock.createMock(ComponentConfigService.class);
expect(mockConfigService.getProperties(anyObject())).andReturn(ImmutableSet.of());
mockConfigService.registerProperties(mgr.getClass());
expectLastCall();
mockConfigService.unregisterProperties(mgr.getClass(), false);
expectLastCall();
expect(mockConfigService.getProperties(anyObject())).andReturn(ImmutableSet.of());
mgr.cfgService = mockConfigService;
replay(mockConfigService);
mgr.activate();
}
Aggregations