Search in sources :

Example 21 with TestEventDispatcher

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();
}
Also used : ComponentConfigAdapter(org.onosproject.cfg.ComponentConfigAdapter) TestEventDispatcher(org.onosproject.common.event.impl.TestEventDispatcher) CoreServiceAdapter(org.onosproject.core.CoreServiceAdapter) FlowRuleServiceAdapter(org.onosproject.net.flow.FlowRuleServiceAdapter) NetworkConfigRegistryAdapter(org.onosproject.net.config.NetworkConfigRegistryAdapter) MeterServiceAdapter(org.onosproject.net.meter.MeterServiceAdapter) PiPipeconfServiceAdapter(org.onosproject.net.pi.PiPipeconfServiceAdapter) DeviceServiceAdapter(org.onosproject.net.device.DeviceServiceAdapter) Before(org.junit.Before)

Example 22 with TestEventDispatcher

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();
}
Also used : TestEventDispatcher(org.onosproject.common.event.impl.TestEventDispatcher) Before(org.junit.Before)

Example 23 with TestEventDispatcher

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()));
}
Also used : TestEventDispatcher(org.onosproject.common.event.impl.TestEventDispatcher) SimpleDeviceStore(org.onosproject.store.trivial.SimpleDeviceStore) Before(org.junit.Before)

Example 24 with TestEventDispatcher

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()));
}
Also used : TestEventDispatcher(org.onosproject.common.event.impl.TestEventDispatcher) ComponentConfigAdapter(org.onosproject.cfg.ComponentConfigAdapter) ClusterService(org.onosproject.cluster.ClusterService) SimpleFlowRuleStore(org.onosproject.store.trivial.SimpleFlowRuleStore) NodeId(org.onosproject.cluster.NodeId) DefaultDriver(org.onosproject.net.driver.DefaultDriver) DriverRegistryManager(org.onosproject.net.driver.impl.DriverRegistryManager) Before(org.junit.Before)

Example 25 with TestEventDispatcher

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();
}
Also used : TestEventDispatcher(org.onosproject.common.event.impl.TestEventDispatcher) UpgradeServiceAdapter(org.onosproject.upgrade.impl.UpgradeServiceAdapter) ComponentConfigService(org.onosproject.cfg.ComponentConfigService) TestStorageService(org.onosproject.store.service.TestStorageService) DistributedRegionStore(org.onosproject.store.region.impl.DistributedRegionStore) Before(org.junit.Before)

Aggregations

TestEventDispatcher (org.onosproject.common.event.impl.TestEventDispatcher)41 Before (org.junit.Before)39 TestStorageService (org.onosproject.store.service.TestStorageService)18 TestServiceDirectory (org.onlab.osgi.TestServiceDirectory)13 DistributedVirtualNetworkStore (org.onosproject.incubator.net.virtual.store.impl.DistributedVirtualNetworkStore)13 CoreService (org.onosproject.core.CoreService)8 ComponentConfigAdapter (org.onosproject.cfg.ComponentConfigAdapter)6 VirtualProviderManager (org.onosproject.incubator.net.virtual.impl.provider.VirtualProviderManager)6 DefaultDriver (org.onosproject.net.driver.DefaultDriver)6 TestApplicationId (org.onosproject.TestApplicationId)4 ClusterServiceAdapter (org.onosproject.cluster.ClusterServiceAdapter)4 VirtualProviderRegistryService (org.onosproject.incubator.net.virtual.provider.VirtualProviderRegistryService)4 SimpleVirtualFlowRuleStore (org.onosproject.incubator.net.virtual.store.impl.SimpleVirtualFlowRuleStore)4 DriverRegistryManager (org.onosproject.net.driver.impl.DriverRegistryManager)4 ClusterService (org.onosproject.cluster.ClusterService)3 VirtualNetworkStore (org.onosproject.incubator.net.virtual.VirtualNetworkStore)3 SimpleVirtualFlowObjectiveStore (org.onosproject.incubator.net.virtual.store.impl.SimpleVirtualFlowObjectiveStore)3 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 Semaphore (java.util.concurrent.Semaphore)2