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