use of org.onlab.osgi.TestServiceDirectory in project onos by opennetworkinglab.
the class MulticastRouteResourceTest method setupTest.
@Before
public void setupTest() {
final CodecManager codecService = new CodecManager();
codecService.activate();
ServiceDirectory testDirectory = new TestServiceDirectory().add(MulticastRouteService.class, mockMulticastRouteService).add(CodecService.class, codecService);
setServiceDirectory(testDirectory);
}
use of org.onlab.osgi.TestServiceDirectory in project onos by opennetworkinglab.
the class PathsResourceTest method setUpTest.
/**
* Initializes test mocks and environment.
*/
@Before
public void setUpTest() {
// Register the services needed for the test
CodecManager codecService = new CodecManager();
codecService.activate();
ServiceDirectory testDirectory = new TestServiceDirectory().add(PathService.class, mockPathService).add(CodecService.class, codecService);
setServiceDirectory(testDirectory);
}
use of org.onlab.osgi.TestServiceDirectory in project onos by opennetworkinglab.
the class ApplicationsResourceTest method setUpMocks.
/**
* Initializes test mocks and environment.
*/
@Before
public void setUpMocks() {
appService = createMock(ApplicationAdminService.class);
coreService = createMock(CoreService.class);
expect(appService.getId("one")).andReturn(id1).anyTimes();
expect(appService.getId("two")).andReturn(id2).anyTimes();
expect(appService.getId("three")).andReturn(id3).anyTimes();
expect(appService.getId("four")).andReturn(id4).anyTimes();
expect(appService.getApplication(id3)).andReturn(app3).anyTimes();
expect(appService.getState(isA(ApplicationId.class))).andReturn(ApplicationState.ACTIVE).anyTimes();
// Register the services needed for the test
CodecManager codecService = new CodecManager();
codecService.activate();
ServiceDirectory testDirectory = new TestServiceDirectory().add(ApplicationAdminService.class, appService).add(ApplicationService.class, appService).add(CoreService.class, coreService).add(CodecService.class, codecService);
setServiceDirectory(testDirectory);
}
use of org.onlab.osgi.TestServiceDirectory in project onos by opennetworkinglab.
the class StatisticsResourceTest method setUpTest.
/**
* Initializes test mocks and environment.
*/
@Before
public void setUpTest() {
mockLinkService = createMock(LinkService.class);
expect(mockLinkService.getLinks()).andReturn(ImmutableList.of(link1, link2, link3));
expect(mockLinkService.getLinks(connectPoint("0000000000000001", 2))).andReturn(ImmutableSet.of(link3));
mockStatisticService = createMock(StatisticService.class);
expect(mockStatisticService.load(link1)).andReturn(new DefaultLoad(2, 1, 1));
expect(mockStatisticService.load(link2)).andReturn(new DefaultLoad(22, 11, 1));
expect(mockStatisticService.load(link3)).andReturn(new DefaultLoad(222, 111, 1));
replay(mockLinkService, mockStatisticService);
// Register the services needed for the test
CodecManager codecService = new CodecManager();
codecService.activate();
ServiceDirectory testDirectory = new TestServiceDirectory().add(LinkService.class, mockLinkService).add(StatisticService.class, mockStatisticService).add(CodecService.class, codecService);
setServiceDirectory(testDirectory);
}
use of org.onlab.osgi.TestServiceDirectory in project onos by opennetworkinglab.
the class TopologyResourceTest method setUpTest.
/**
* Initializes the test harness.
*/
@Before
public void setUpTest() {
TopologyService topologyService = new MockTopologyService();
DeviceService mockDeviceService = new MockDeviceService();
CodecManager codecService = new CodecManager();
codecService.activate();
ServiceDirectory testDirectory = new TestServiceDirectory().add(DeviceService.class, mockDeviceService).add(TopologyService.class, topologyService).add(CodecService.class, codecService);
setServiceDirectory(testDirectory);
}
Aggregations