Search in sources :

Example 41 with TestStorageService

use of org.onosproject.store.service.TestStorageService in project onos by opennetworkinglab.

the class DistributedDeviceKeyStoreTest method setUp.

/**
 * Sets up the device key store and the storage service test harness.
 */
@Before
public void setUp() {
    deviceKeyStore = new DistributedDeviceKeyStore();
    deviceKeyStore.storageService = new TestStorageService();
    deviceKeyStore.setDelegate(event -> {
    });
    deviceKeyStore.activate();
}
Also used : TestStorageService(org.onosproject.store.service.TestStorageService) Before(org.junit.Before)

Example 42 with TestStorageService

use of org.onosproject.store.service.TestStorageService 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)

Example 43 with TestStorageService

use of org.onosproject.store.service.TestStorageService 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 44 with TestStorageService

use of org.onosproject.store.service.TestStorageService 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 45 with TestStorageService

use of org.onosproject.store.service.TestStorageService 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

Before (org.junit.Before)75 TestStorageService (org.onosproject.store.service.TestStorageService)75 TestEventDispatcher (org.onosproject.common.event.impl.TestEventDispatcher)18 TestServiceDirectory (org.onlab.osgi.TestServiceDirectory)12 DistributedVirtualNetworkStore (org.onosproject.incubator.net.virtual.store.impl.DistributedVirtualNetworkStore)12 CoreService (org.onosproject.core.CoreService)8 ClusterServiceAdapter (org.onosproject.cluster.ClusterServiceAdapter)6 ClusterCommunicationServiceAdapter (org.onosproject.store.cluster.messaging.ClusterCommunicationServiceAdapter)5 TestApplicationId (org.onosproject.TestApplicationId)3 ComponentConfigAdapter (org.onosproject.cfg.ComponentConfigAdapter)3 ClusterService (org.onosproject.cluster.ClusterService)3 LeadershipServiceAdapter (org.onosproject.cluster.LeadershipServiceAdapter)3 CoreServiceAdapter (org.onosproject.core.CoreServiceAdapter)3 VirtualNetworkStore (org.onosproject.incubator.net.virtual.VirtualNetworkStore)3 VirtualProviderManager (org.onosproject.incubator.net.virtual.impl.provider.VirtualProviderManager)3 FlowObjectiveServiceAdapter (org.onosproject.net.flowobjective.FlowObjectiveServiceAdapter)3 Semaphore (java.util.concurrent.Semaphore)2 ComponentContextAdapter (org.onlab.osgi.ComponentContextAdapter)2 KryoNamespace (org.onlab.util.KryoNamespace)2 NodeId (org.onosproject.cluster.NodeId)2