Search in sources :

Example 46 with ServiceDirectory

use of org.onlab.osgi.ServiceDirectory 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 47 with ServiceDirectory

use of org.onlab.osgi.ServiceDirectory 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 ServiceDirectory

use of org.onlab.osgi.ServiceDirectory 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 49 with ServiceDirectory

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

the class GroupsResourceTest 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.getDevices()).andReturn(ImmutableSet.of(device1, device2));
    // Mock Core Service
    expect(mockCoreService.getAppId(anyShort())).andReturn(NetTestTools.APP_ID).anyTimes();
    expect(mockCoreService.registerApplication(GroupCodec.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(GroupService.class, mockGroupService).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) GroupService(org.onosproject.net.group.GroupService) Before(org.junit.Before)

Example 50 with ServiceDirectory

use of org.onlab.osgi.ServiceDirectory 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)

Aggregations

ServiceDirectory (org.onlab.osgi.ServiceDirectory)54 Before (org.junit.Before)51 TestServiceDirectory (org.onlab.osgi.TestServiceDirectory)51 CodecManager (org.onosproject.codec.impl.CodecManager)30 DeviceService (org.onosproject.net.device.DeviceService)7 CfmCodecContext (org.onosproject.cfm.CfmCodecContext)5 CodecService (org.onosproject.codec.CodecService)5 CoreService (org.onosproject.core.CoreService)3 CfmMdService (org.onosproject.incubator.net.l2monitoring.cfm.service.CfmMdService)3 OpenstackRouterAdminService (org.onosproject.openstacknetworking.api.OpenstackRouterAdminService)3 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)2 DefaultServiceDirectory (org.onlab.osgi.DefaultServiceDirectory)2 ClusterService (org.onosproject.cluster.ClusterService)2 SoamService (org.onosproject.incubator.net.l2monitoring.soam.SoamService)2 K8sNetworkAdminService (org.onosproject.k8snetworking.api.K8sNetworkAdminService)2 GroupService (org.onosproject.net.group.GroupService)2 OpenstackNetworkAdminService (org.onosproject.openstacknetworking.api.OpenstackNetworkAdminService)2 OpenstackSecurityGroupAdminService (org.onosproject.openstacknetworking.api.OpenstackSecurityGroupAdminService)2 RemovalNotification (com.google.common.cache.RemovalNotification)1 MetricsService (org.onlab.metrics.MetricsService)1