Search in sources :

Example 51 with CodecManager

use of org.onosproject.codec.impl.CodecManager 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 52 with CodecManager

use of org.onosproject.codec.impl.CodecManager 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 CodecManager

use of org.onosproject.codec.impl.CodecManager 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

CodecManager (org.onosproject.codec.impl.CodecManager)53 Before (org.junit.Before)48 TestServiceDirectory (org.onlab.osgi.TestServiceDirectory)35 ServiceDirectory (org.onlab.osgi.ServiceDirectory)30 LispMappingExtensionCodecRegistrator (org.onosproject.drivers.lisp.extensions.LispMappingExtensionCodecRegistrator)10 MappingCodecRegistrator (org.onosproject.mapping.MappingCodecRegistrator)7 BeforeClass (org.junit.BeforeClass)5 CodecService (org.onosproject.codec.CodecService)5 BaseConfig (org.onosproject.net.config.BaseConfig)5 DeviceService (org.onosproject.net.device.DeviceService)5 CoreService (org.onosproject.core.CoreService)2 K8sNetworkAdminService (org.onosproject.k8snetworking.api.K8sNetworkAdminService)2 MetricsService (org.onlab.metrics.MetricsService)1 ApplicationAdminService (org.onosproject.app.ApplicationAdminService)1 ClusterService (org.onosproject.cluster.ClusterService)1 ControllerNode (org.onosproject.cluster.ControllerNode)1 NodeId (org.onosproject.cluster.NodeId)1 ControlLoadSnapshotCodec (org.onosproject.cpman.codec.ControlLoadSnapshotCodec)1 LispAppDataAddress (org.onosproject.drivers.lisp.extensions.LispAppDataAddress)1 LispAsAddress (org.onosproject.drivers.lisp.extensions.LispAsAddress)1