Search in sources :

Example 26 with TestEventDispatcher

use of org.onosproject.common.event.impl.TestEventDispatcher in project onos by opennetworkinglab.

the class MeterManagerTest method setup.

@Before
public void setup() {
    DeviceService deviceService = new TestDeviceService();
    DriverRegistryManager driverRegistry = new DriverRegistryManager();
    DriverManager driverService = new TestDriverManager(driverRegistry, deviceService, new NetworkConfigServiceAdapter());
    driverRegistry.addDriver(new DefaultDriver("foo", ImmutableList.of(), "", "", "", ImmutableMap.of(MeterProgrammable.class, TestMeterProgrammable.class, MeterQuery.class, TestMeterQuery.class), ImmutableMap.of()));
    meterStore = new DistributedMeterStore();
    TestUtils.setField(meterStore, "storageService", new TestStorageService());
    TestUtils.setField(meterStore, "driverService", driverService);
    KryoNamespace.Builder testKryoBuilder = TestUtils.getField(meterStore, "APP_KRYO_BUILDER");
    testKryoBuilder.register(TestApplicationId.class);
    Serializer testSerializer = Serializer.using(Lists.newArrayList(testKryoBuilder.build()));
    TestUtils.setField(meterStore, "serializer", testSerializer);
    meterStore.activate();
    manager = new MeterManager();
    TestUtils.setField(manager, "store", meterStore);
    injectEventDispatcher(manager, new TestEventDispatcher());
    manager.deviceService = deviceService;
    manager.mastershipService = new TestMastershipService();
    manager.cfgService = new ComponentConfigAdapter();
    manager.clusterService = new TestClusterService();
    registry = manager;
    manager.driverService = driverService;
    Dictionary<String, Object> cfgDict = new Hashtable<>();
    expect(componentContext.getProperties()).andReturn(cfgDict);
    replay(componentContext);
    manager.activate(componentContext);
    provider = new TestProvider(PID);
    providerService = registry.register(provider);
    assertTrue("provider should be registered", registry.getProviders().contains(provider.id()));
}
Also used : TestEventDispatcher(org.onosproject.common.event.impl.TestEventDispatcher) TestStorageService(org.onosproject.store.service.TestStorageService) Hashtable(java.util.Hashtable) DeviceService(org.onosproject.net.device.DeviceService) DistributedMeterStore(org.onosproject.store.meter.impl.DistributedMeterStore) ComponentConfigAdapter(org.onosproject.cfg.ComponentConfigAdapter) DefaultDriver(org.onosproject.net.driver.DefaultDriver) KryoNamespace(org.onlab.util.KryoNamespace) NetworkConfigServiceAdapter(org.onosproject.net.config.NetworkConfigServiceAdapter) DriverManager(org.onosproject.net.driver.impl.DriverManager) DriverRegistryManager(org.onosproject.net.driver.impl.DriverRegistryManager) Serializer(org.onosproject.store.service.Serializer) Before(org.junit.Before)

Example 27 with TestEventDispatcher

use of org.onosproject.common.event.impl.TestEventDispatcher in project onos by opennetworkinglab.

the class PiPipeconfManagerTest method setUp.

@Before
public void setUp() throws IOException {
    mgr = new PiPipeconfManager();
    pipeconf = BASIC_PIPECONF;
    mgr.cfgService = cfgService;
    mgr.driverAdminService = driverAdminService;
    injectEventDispatcher(mgr, new TestEventDispatcher());
    ObjectMapper mapper = new ObjectMapper();
    ConfigApplyDelegate delegate = new MockDelegate();
    String keyBasic = "basic";
    JsonNode jsonNodeBasic = mapper.readTree(jsonStreamBasic);
    basicDeviceConfig.init(DEVICE_ID, keyBasic, jsonNodeBasic, mapper, delegate);
    mgr.activate();
}
Also used : TestEventDispatcher(org.onosproject.common.event.impl.TestEventDispatcher) JsonNode(com.fasterxml.jackson.databind.JsonNode) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) ConfigApplyDelegate(org.onosproject.net.config.ConfigApplyDelegate) Before(org.junit.Before)

Example 28 with TestEventDispatcher

use of org.onosproject.common.event.impl.TestEventDispatcher in project onos by opennetworkinglab.

the class RegionManagerTest method setUp.

@Before
public void setUp() throws Exception {
    TestUtils.setField(store, "storageService", new TestStorageService());
    store.activate();
    manager.store = store;
    manager.addListener(listener);
    NetTestTools.injectEventDispatcher(manager, new TestEventDispatcher());
    manager.activate();
    service = manager;
}
Also used : TestEventDispatcher(org.onosproject.common.event.impl.TestEventDispatcher) TestStorageService(org.onosproject.store.service.TestStorageService) Before(org.junit.Before)

Example 29 with TestEventDispatcher

use of org.onosproject.common.event.impl.TestEventDispatcher in project onos by opennetworkinglab.

the class TopologyManagerTest method setUp.

@Before
public void setUp() {
    mgr = new TopologyManager();
    service = mgr;
    registry = mgr;
    mgr.store = new SimpleTopologyStore();
    injectEventDispatcher(mgr, new TestEventDispatcher());
    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) SimpleTopologyStore(org.onosproject.store.trivial.SimpleTopologyStore) Before(org.junit.Before)

Example 30 with TestEventDispatcher

use of org.onosproject.common.event.impl.TestEventDispatcher in project onos by opennetworkinglab.

the class VirtualNetworkIntentManagerTest method setUp.

@Before
public void setUp() throws Exception {
    virtualNetworkManagerStore = new DistributedVirtualNetworkStore();
    intentStore = new SimpleVirtualIntentStore();
    coreService = new VirtualNetworkIntentManagerTest.TestCoreService();
    MockIdGenerator.cleanBind();
    TestUtils.setField(virtualNetworkManagerStore, "coreService", coreService);
    TestUtils.setField(virtualNetworkManagerStore, "storageService", new TestStorageService());
    virtualNetworkManagerStore.activate();
    manager = new VirtualNetworkManager();
    manager.store = virtualNetworkManagerStore;
    NetTestTools.injectEventDispatcher(manager, new TestEventDispatcher());
    intentService.addListener(listener);
    // Register a compiler and an installer both setup for success.
    intentExtensionService = intentService;
    intentExtensionService.registerCompiler(VirtualNetworkIntent.class, compiler);
    created = new Semaphore(0, true);
    withdrawn = new Semaphore(0, true);
    purged = new Semaphore(0, true);
    workPartitionService = new WorkPartitionServiceAdapter();
    testDirectory = new TestServiceDirectory().add(VirtualNetworkStore.class, virtualNetworkManagerStore).add(IntentService.class, intentService).add(WorkPartitionService.class, workPartitionService);
    TestUtils.setField(manager, "serviceDirectory", testDirectory);
    manager.activate();
}
Also used : TestEventDispatcher(org.onosproject.common.event.impl.TestEventDispatcher) SimpleVirtualIntentStore(org.onosproject.incubator.net.virtual.store.impl.SimpleVirtualIntentStore) DistributedVirtualNetworkStore(org.onosproject.incubator.net.virtual.store.impl.DistributedVirtualNetworkStore) WorkPartitionServiceAdapter(org.onosproject.net.intent.WorkPartitionServiceAdapter) WorkPartitionService(org.onosproject.net.intent.WorkPartitionService) TestStorageService(org.onosproject.store.service.TestStorageService) TestServiceDirectory(org.onlab.osgi.TestServiceDirectory) Semaphore(java.util.concurrent.Semaphore) VirtualNetworkStore(org.onosproject.incubator.net.virtual.VirtualNetworkStore) DistributedVirtualNetworkStore(org.onosproject.incubator.net.virtual.store.impl.DistributedVirtualNetworkStore) 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