Search in sources :

Example 16 with CodecManager

use of org.onosproject.codec.impl.CodecManager in project onos by opennetworkinglab.

the class OpenstackVtapNetworkWebResourceTest method setUpTest.

/**
 * Sets up the global values for all the tests.
 */
@Before
public void setUpTest() {
    final CodecManager codecService = new CodecManager();
    codecService.activate();
    codecService.registerCodec(OpenstackVtapNetwork.class, new OpenstackVtapNetworkCodec());
    ServiceDirectory testDirectory = new TestServiceDirectory().add(OpenstackVtapService.class, mockVtapService).add(CodecService.class, codecService);
    setServiceDirectory(testDirectory);
    vtapNetwork = DefaultOpenstackVtapNetwork.builder().mode(OpenstackVtapNetwork.Mode.VXLAN).networkId(1).serverIp(IpAddress.valueOf("10.10.10.1")).build();
}
Also used : OpenstackVtapService(org.onosproject.openstackvtap.api.OpenstackVtapService) OpenstackVtapNetworkCodec(org.onosproject.openstackvtap.codec.OpenstackVtapNetworkCodec) 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 17 with CodecManager

use of org.onosproject.codec.impl.CodecManager in project onos by opennetworkinglab.

the class FlowObjectiveResourceTest method setUpTest.

/**
 * Sets up the global values for all the tests.
 */
@Before
public void setUpTest() {
    // Mock Core Service
    expect(mockCoreService.getAppId(anyShort())).andReturn(NetTestTools.APP_ID).anyTimes();
    expect(mockCoreService.registerApplication(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(FlowObjectiveService.class, mockFlowObjectiveService).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) Before(org.junit.Before)

Example 18 with CodecManager

use of org.onosproject.codec.impl.CodecManager in project onos by opennetworkinglab.

the class IntentsResourceTest method setUpTest.

/**
 * Initializes test mocks and environment.
 */
@Before
public void setUpTest() {
    expect(mockIntentService.getIntents()).andReturn(intents).anyTimes();
    expect(mockIntentService.getIntentState(anyObject())).andReturn(IntentState.INSTALLED).anyTimes();
    // Register the services needed for the test
    final CodecManager codecService = new CodecManager();
    codecService.activate();
    ServiceDirectory testDirectory = new TestServiceDirectory().add(IntentService.class, mockIntentService).add(FlowRuleService.class, mockFlowService).add(CodecService.class, codecService).add(CoreService.class, mockCoreService);
    setServiceDirectory(testDirectory);
    MockIdGenerator.cleanBind();
}
Also used : IntentService(org.onosproject.net.intent.IntentService) 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) Before(org.junit.Before)

Example 19 with CodecManager

use of org.onosproject.codec.impl.CodecManager in project onos by opennetworkinglab.

the class ControlMetricsResourceTest method setUpTest.

/**
 * Sets up the global values for all the tests.
 */
@Before
public void setUpTest() {
    final CodecManager codecService = new CodecManager();
    codecService.activate();
    codecService.registerCodec(ControlLoadSnapshot.class, new ControlLoadSnapshotCodec());
    ServiceDirectory testDirectory = new TestServiceDirectory().add(ControlPlaneMonitorService.class, mockControlPlaneMonitorService).add(ClusterService.class, mockClusterService).add(CodecService.class, codecService);
    setServiceDirectory(testDirectory);
    nodeId = new NodeId("1");
    mockControlLoad = new MockControlLoad();
    ControllerNode mockControllerNode = new MockControllerNode(nodeId);
    expect(mockClusterService.getLocalNode()).andReturn(mockControllerNode).anyTimes();
    replay(mockClusterService);
}
Also used : ClusterService(org.onosproject.cluster.ClusterService) ControlLoadSnapshotCodec(org.onosproject.cpman.codec.ControlLoadSnapshotCodec) ServiceDirectory(org.onlab.osgi.ServiceDirectory) TestServiceDirectory(org.onlab.osgi.TestServiceDirectory) TestServiceDirectory(org.onlab.osgi.TestServiceDirectory) NodeId(org.onosproject.cluster.NodeId) ControllerNode(org.onosproject.cluster.ControllerNode) CodecManager(org.onosproject.codec.impl.CodecManager) Before(org.junit.Before)

Example 20 with CodecManager

use of org.onosproject.codec.impl.CodecManager in project onos by opennetworkinglab.

the class AlarmsWebResourceTest method setUpMock.

@Before
public void setUpMock() {
    CodecManager codecService = new CodecManager();
    codecService.activate();
    ServiceDirectory testDirectory = new TestServiceDirectory().add(CodecService.class, codecService);
    setServiceDirectory(testDirectory);
}
Also used : TestServiceDirectory(org.onlab.osgi.TestServiceDirectory) ServiceDirectory(org.onlab.osgi.ServiceDirectory) 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