Search in sources :

Example 51 with TestServiceDirectory

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

the class NetworkConfigWebResourceTest method setUpMocks.

/**
 * Sets up mocked config service.
 */
@Before
public void setUpMocks() {
    mockNetworkConfigService = new MockNetworkConfigService();
    ServiceDirectory testDirectory = new TestServiceDirectory().add(NetworkConfigService.class, mockNetworkConfigService);
    setServiceDirectory(testDirectory);
}
Also used : ServiceDirectory(org.onlab.osgi.ServiceDirectory) TestServiceDirectory(org.onlab.osgi.TestServiceDirectory) TestServiceDirectory(org.onlab.osgi.TestServiceDirectory) Before(org.junit.Before)

Example 52 with TestServiceDirectory

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

the class RegionsResourceTest 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(RegionService.class, mockRegionService).add(RegionAdminService.class, mockRegionAdminService).add(CodecService.class, codecService);
    setServiceDirectory(testDirectory);
}
Also used : RegionAdminService(org.onosproject.net.region.RegionAdminService) 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)

Example 53 with TestServiceDirectory

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

the class ComponentConfigWebResourceTest method setUpMock.

@Before
public void setUpMock() {
    service = new TestConfigManager();
    ServiceDirectory testDirectory = new TestServiceDirectory().add(ComponentConfigService.class, service);
    setServiceDirectory(testDirectory);
}
Also used : ServiceDirectory(org.onlab.osgi.ServiceDirectory) TestServiceDirectory(org.onlab.osgi.TestServiceDirectory) TestServiceDirectory(org.onlab.osgi.TestServiceDirectory) Before(org.junit.Before)

Example 54 with TestServiceDirectory

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

the class DeviceKeyWebResourceTest method setUpMocks.

/**
 * Initializes test mocks and environment.
 */
@Before
public void setUpMocks() {
    expect(mockDeviceKeyService.getDeviceKeys()).andReturn(deviceKeySet).anyTimes();
    // Register the services needed for the test
    CodecManager codecService = new CodecManager();
    codecService.activate();
    ServiceDirectory testDirectory = new TestServiceDirectory().add(DeviceKeyService.class, mockDeviceKeyService).add(DeviceKeyAdminService.class, mockDeviceKeyAdminService).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) DeviceKeyAdminService(org.onosproject.net.key.DeviceKeyAdminService) Before(org.junit.Before)

Example 55 with TestServiceDirectory

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

the class DevicesResourceTest method setUpMocks.

/**
 * Initializes test mocks and environment.
 */
@Before
public void setUpMocks() {
    mockDeviceService = createMock(DeviceService.class);
    mockDriverService = createMock(DriverService.class);
    expect(mockDeviceService.isAvailable(isA(DeviceId.class))).andReturn(true).anyTimes();
    expect(mockDeviceService.getRole(isA(DeviceId.class))).andReturn(MastershipRole.MASTER).anyTimes();
    expect(mockDeviceService.getLastUpdatedInstant(isA(DeviceId.class))).andReturn(0L).anyTimes();
    expect(mockDeviceService.localStatus(isA(DeviceId.class))).andReturn("").anyTimes();
    // Register the services needed for the test
    CodecManager codecService = new CodecManager();
    codecService.activate();
    ServiceDirectory testDirectory = new TestServiceDirectory().add(DeviceService.class, mockDeviceService).add(DriverService.class, mockDriverService).add(CodecService.class, codecService);
    setServiceDirectory(testDirectory);
}
Also used : ServiceDirectory(org.onlab.osgi.ServiceDirectory) TestServiceDirectory(org.onlab.osgi.TestServiceDirectory) DeviceService(org.onosproject.net.device.DeviceService) TestServiceDirectory(org.onlab.osgi.TestServiceDirectory) CodecManager(org.onosproject.codec.impl.CodecManager) DriverService(org.onosproject.net.driver.DriverService) 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