Search in sources :

Example 46 with TestServiceDirectory

use of org.onlab.osgi.TestServiceDirectory in project onos by opennetworkinglab.

the class VirtualNetworkTopologyManagerTest method setUp.

@Before
public void setUp() throws Exception {
    virtualNetworkManagerStore = new DistributedVirtualNetworkStore();
    coreService = new VirtualNetworkTopologyManagerTest.TestCoreService();
    TestUtils.setField(virtualNetworkManagerStore, "coreService", coreService);
    TestUtils.setField(virtualNetworkManagerStore, "storageService", new TestStorageService());
    virtualNetworkManagerStore.activate();
    manager = new VirtualNetworkManager();
    manager.store = virtualNetworkManagerStore;
    manager.coreService = coreService;
    NetTestTools.injectEventDispatcher(manager, new TestEventDispatcher());
    testDirectory = new TestServiceDirectory();
    TestUtils.setField(manager, "serviceDirectory", testDirectory);
    manager.activate();
}
Also used : TestEventDispatcher(org.onosproject.common.event.impl.TestEventDispatcher) DistributedVirtualNetworkStore(org.onosproject.incubator.net.virtual.store.impl.DistributedVirtualNetworkStore) TestStorageService(org.onosproject.store.service.TestStorageService) TestServiceDirectory(org.onlab.osgi.TestServiceDirectory) Before(org.junit.Before)

Example 47 with TestServiceDirectory

use of org.onlab.osgi.TestServiceDirectory in project onos by opennetworkinglab.

the class LinksResourceTest method setUpTest.

/**
 * Initializes test mocks and environment.
 */
@Before
public void setUpTest() {
    mockLinkService = createMock(LinkService.class);
    // Register the services needed for the test
    CodecManager codecService = new CodecManager();
    codecService.activate();
    ServiceDirectory testDirectory = new TestServiceDirectory().add(LinkService.class, mockLinkService).add(CodecService.class, codecService);
    setServiceDirectory(testDirectory);
}
Also used : ServiceDirectory(org.onlab.osgi.ServiceDirectory) TestServiceDirectory(org.onlab.osgi.TestServiceDirectory) TestServiceDirectory(org.onlab.osgi.TestServiceDirectory) CodecManager(org.onosproject.codec.impl.CodecManager) LinkService(org.onosproject.net.link.LinkService) Before(org.junit.Before)

Example 48 with TestServiceDirectory

use of org.onlab.osgi.TestServiceDirectory in project onos by opennetworkinglab.

the class MastershipResourceTest method setUpTest.

/**
 * Sets up the global values for all the tests.
 */
@Before
public void setUpTest() {
    final CodecManager codecService = new CodecManager();
    codecService.activate();
    ServiceDirectory testDirectory = new TestServiceDirectory().add(MastershipService.class, mockService).add(MastershipAdminService.class, mockAdminService).add(DeviceService.class, mockDeviceService).add(CodecService.class, codecService);
    setServiceDirectory(testDirectory);
}
Also used : ServiceDirectory(org.onlab.osgi.ServiceDirectory) TestServiceDirectory(org.onlab.osgi.TestServiceDirectory) TestServiceDirectory(org.onlab.osgi.TestServiceDirectory) DeviceService(org.onosproject.net.device.DeviceService) CodecManager(org.onosproject.codec.impl.CodecManager) MastershipService(org.onosproject.mastership.MastershipService) Before(org.junit.Before)

Example 49 with TestServiceDirectory

use of org.onlab.osgi.TestServiceDirectory in project onos by opennetworkinglab.

the class MetersResourceTest method setUpTest.

/**
 * Sets up the global values for all the tests.
 */
@Before
public void setUpTest() {
    // Mock device service
    expect(mockDeviceService.getDevice(deviceId1)).andReturn(device1);
    expect(mockDeviceService.getDevice(deviceId2)).andReturn(device2);
    expect(mockDeviceService.getDevice(deviceId4)).andReturn(device4);
    expect(mockDeviceService.getDevices()).andReturn(ImmutableSet.of(device1, device2, device4));
    // Mock Core Service
    expect(mockCoreService.getAppId(anyShort())).andReturn(NetTestTools.APP_ID).anyTimes();
    expect(mockCoreService.registerApplication(MeterCodec.REST_APP_ID)).andReturn(APP_ID).anyTimes();
    replay(mockCoreService);
    // Register the services needed for the test
    final CodecManager codecService = new CodecManager();
    codecService.activate();
    ServiceDirectory testDirectory = new TestServiceDirectory().add(MeterService.class, mockMeterService).add(DeviceService.class, mockDeviceService).add(CodecService.class, codecService).add(CoreService.class, mockCoreService);
    setServiceDirectory(testDirectory);
}
Also used : ServiceDirectory(org.onlab.osgi.ServiceDirectory) TestServiceDirectory(org.onlab.osgi.TestServiceDirectory) CodecService(org.onosproject.codec.CodecService) TestServiceDirectory(org.onlab.osgi.TestServiceDirectory) CodecManager(org.onosproject.codec.impl.CodecManager) MeterService(org.onosproject.net.meter.MeterService) Before(org.junit.Before)

Example 50 with TestServiceDirectory

use of org.onlab.osgi.TestServiceDirectory in project onos by opennetworkinglab.

the class MetricsResourceTest method setUpTest.

/**
 * Initializes test mocks and environment.
 */
@Before
public void setUpTest() {
    mockMetricsService = createMock(MetricsService.class);
    // Register the services needed for the test
    final CodecManager codecService = new CodecManager();
    codecService.activate();
    ServiceDirectory testDirectory = new TestServiceDirectory().add(MetricsService.class, mockMetricsService).add(CodecService.class, codecService);
    setServiceDirectory(testDirectory);
}
Also used : MetricsService(org.onlab.metrics.MetricsService) ServiceDirectory(org.onlab.osgi.ServiceDirectory) TestServiceDirectory(org.onlab.osgi.TestServiceDirectory) TestServiceDirectory(org.onlab.osgi.TestServiceDirectory) CodecManager(org.onosproject.codec.impl.CodecManager) Before(org.junit.Before)

Aggregations

TestServiceDirectory (org.onlab.osgi.TestServiceDirectory)71 Before (org.junit.Before)66 ServiceDirectory (org.onlab.osgi.ServiceDirectory)53 CodecManager (org.onosproject.codec.impl.CodecManager)37 DistributedVirtualNetworkStore (org.onosproject.incubator.net.virtual.store.impl.DistributedVirtualNetworkStore)14 TestEventDispatcher (org.onosproject.common.event.impl.TestEventDispatcher)13 TestStorageService (org.onosproject.store.service.TestStorageService)12 CoreService (org.onosproject.core.CoreService)10 BeforeClass (org.junit.BeforeClass)5 CfmCodecContext (org.onosproject.cfm.CfmCodecContext)5 CodecService (org.onosproject.codec.CodecService)5 VirtualProviderManager (org.onosproject.incubator.net.virtual.impl.provider.VirtualProviderManager)5 BaseConfig (org.onosproject.net.config.BaseConfig)5 DeviceService (org.onosproject.net.device.DeviceService)5 TestApplicationId (org.onosproject.TestApplicationId)4 CfmMdService (org.onosproject.incubator.net.l2monitoring.cfm.service.CfmMdService)3 VirtualNetworkStore (org.onosproject.incubator.net.virtual.VirtualNetworkStore)3 VirtualProviderRegistryService (org.onosproject.incubator.net.virtual.provider.VirtualProviderRegistryService)3 SimpleVirtualFlowRuleStore (org.onosproject.incubator.net.virtual.store.impl.SimpleVirtualFlowRuleStore)3 Semaphore (java.util.concurrent.Semaphore)2