use of org.onosproject.codec.CodecService in project onos by opennetworkinglab.
the class HostResourceTest method setUpTest.
/**
* Initializes test mocks and environment.
*/
@Before
public void setUpTest() {
expect(mockHostService.getHosts()).andReturn(hosts).anyTimes();
// Register the services needed for the test
final CodecManager codecService = new CodecManager();
codecService.activate();
ServiceDirectory testDirectory = new TestServiceDirectory().add(HostService.class, mockHostService).add(HostAdminService.class, mockHostService).add(CodecService.class, codecService).add(HostProviderRegistry.class, mockHostProviderRegistry);
setServiceDirectory(testDirectory);
}
use of org.onosproject.codec.CodecService in project onos by opennetworkinglab.
the class OpenstackNetworkingCodecRegisterTest method testActivateDeactivate.
/**
* Tests codec register activation and deactivation.
*/
@Test
public void testActivateDeactivate() {
register = new OpenstackNetworkingCodecRegister();
CodecService codecService = new TestCodecService();
TestUtils.setField(register, "codecService", codecService);
register.activate();
assertEquals(InstancePortCodec.class.getName(), codecService.getCodec(InstancePort.class).getClass().getName());
register.deactivate();
assertNull(codecService.getCodec(InstancePort.class));
}
use of org.onosproject.codec.CodecService in project onos by opennetworkinglab.
the class OpenstackRestCodecRegisterTest method testActivateDeactivate.
/**
* Tests codec register activation and deactivation.
*/
@Test
public void testActivateDeactivate() {
register = new OpenstackRestCodecRegister();
CodecService codecService = new TestCodecService();
TestUtils.setField(register, "codecService", codecService);
register.activate();
assertEquals(StatsInfoJsonCodec.class.getName(), codecService.getCodec(StatsInfo.class).getClass().getName());
assertEquals(FlowInfoJsonCodec.class.getName(), codecService.getCodec(FlowInfo.class).getClass().getName());
assertEquals(StatsFlowRuleJsonCodec.class.getName(), codecService.getCodec(StatsFlowRule.class).getClass().getName());
assertEquals(TelemetryConfigJsonCodec.class.getName(), codecService.getCodec(TelemetryConfig.class).getClass().getName());
register.deactivate();
assertNull(codecService.getCodec(StatsInfo.class));
assertNull(codecService.getCodec(FlowInfo.class));
assertNull(codecService.getCodec(StatsFlowRule.class));
assertNull(codecService.getCodec(TelemetryConfig.class));
}
Aggregations