use of org.onosproject.cfg.ComponentConfigAdapter in project onos by opennetworkinglab.
the class NetconfDeviceProviderTest method setUp.
@Before
public void setUp() throws IOException {
coreService = createMock(CoreService.class);
expect(coreService.registerApplication(APP_NAME)).andReturn(appId).anyTimes();
replay(coreService);
provider.coreService = coreService;
provider.providerRegistry = deviceRegistry;
provider.mastershipService = mastershipService;
provider.deviceService = deviceService;
provider.providerService = providerService;
provider.cfgService = cfgService;
provider.controller = controller;
provider.deviceKeyAdminService = deviceKeyAdminService;
provider.componentConfigService = new ComponentConfigAdapter();
AbstractProjectableModel.setDriverService(null, new DriverServiceAdapter());
provider.activate(null);
devices.clear();
available = false;
firstRequest = true;
DeviceId subject = DeviceId.deviceId(NETCONF_DEVICE_ID_STRING);
DeviceId subjectIpv6 = DeviceId.deviceId(NETCONF_DEVICE_ID_STRING_IPV6);
String key = "netconf";
ObjectMapper mapper = new ObjectMapper();
JsonNode jsonNode = mapper.readTree(jsonStream);
ConfigApplyDelegate delegate = new MockDelegate();
netconfDeviceConfig.init(subject, key, jsonNode, mapper, delegate);
JsonNode jsonNodesshKey = mapper.readTree(jsonStreamSshKey);
netconfDeviceConfigSshKey.init(subject, key, jsonNodesshKey, mapper, delegate);
JsonNode jsonNodeEmpty = mapper.createObjectNode();
netconfDeviceConfigEmptyIpv4.init(subject, key, jsonNodeEmpty, mapper, delegate);
netconfDeviceConfigEmptyIpv6.init(subjectIpv6, key, jsonNodeEmpty, mapper, delegate);
deviceAdded = new CountDownLatch(0);
}
use of org.onosproject.cfg.ComponentConfigAdapter in project onos by opennetworkinglab.
the class InfluxDbMetricsReporterTest method setUp.
/**
* Sets up the services required by influxDB metrics reporter.
*/
@Before
public void setUp() {
influxReporter = new DefaultInfluxDbMetricsReporter();
influxReporter.coreService = new CoreServiceAdapter();
influxReporter.cfgService = new ComponentConfigAdapter();
influxReporter.clusterService = new ClusterServiceAdapter();
influxReporter.metricsService = new TestMetricsService();
influxReporter.activate();
}
use of org.onosproject.cfg.ComponentConfigAdapter in project onos by opennetworkinglab.
the class LinkCollectionOptimizationTest method setUp.
@Before
public void setUp() {
sut = new LinkCollectionIntentCompiler();
coreService = createMock(CoreService.class);
expect(coreService.registerApplication("org.onosproject.net.intent")).andReturn(appId);
sut.coreService = coreService;
domainService = createMock(DomainService.class);
expect(domainService.getDomain(anyObject(DeviceId.class))).andReturn(LOCAL).anyTimes();
sut.domainService = domainService;
super.setUp();
intentExtensionService = createMock(IntentExtensionService.class);
intentExtensionService.registerCompiler(LinkCollectionIntent.class, sut);
intentExtensionService.unregisterCompiler(LinkCollectionIntent.class);
registrator = new IntentConfigurableRegistrator();
registrator.extensionService = intentExtensionService;
registrator.cfgService = new ComponentConfigAdapter();
registrator.activate();
sut.registrator = registrator;
sut.resourceService = new MockResourceService();
/*
* We activate the optimizations.
*/
LinkCollectionCompiler.optimizeInstructions = true;
LinkCollectionCompiler.copyTtl = true;
replay(coreService, domainService, intentExtensionService);
}
use of org.onosproject.cfg.ComponentConfigAdapter in project onos by opennetworkinglab.
the class VirtualNetworkPacketManagerWithDistStoreTest method setUpDistPacketStore.
private void setUpDistPacketStore() throws TestUtils.TestUtilsException {
distStore = new DistributedVirtualPacketStore();
TestUtils.setField(distStore, "cfgService", new ComponentConfigAdapter());
TestUtils.setField(distStore, "storageService", storageService);
TestUtils.setField(distStore, "clusterService", clusterService);
TestUtils.setField(distStore, "communicationService", new TestClusterCommunicationService());
TestUtils.setField(distStore, "mastershipService", new TestMastershipService());
distStore.activate(new ComponentContextAdapter());
// super.setUp() will cause Distributed store to be used.
packetStore = distStore;
}
use of org.onosproject.cfg.ComponentConfigAdapter in project onos by opennetworkinglab.
the class ECFlowRuleStoreTest method setUp.
@Before
public void setUp() throws Exception {
flowStoreImpl = new ECFlowRuleStore();
flowStoreImpl.storageService = new TestStorageService() {
@Override
public <K, V> ConsistentMapBuilder<K, V> consistentMapBuilder() {
return new ConsistentMapBuilder<K, V>() {
@Override
public AsyncConsistentMap<K, V> buildAsyncMap() {
return new AsyncConsistentMapAdapter<K, V>();
}
@Override
public ConsistentMap<K, V> build() {
return null;
}
};
}
};
ReplicaInfoManager replicaInfoManager = new ReplicaInfoManager();
replicaInfoManager.mastershipService = new MasterOfAll();
flowStoreImpl.replicaInfoManager = replicaInfoManager;
mockClusterService = createMock(ClusterService.class);
flowStoreImpl.clusterService = mockClusterService;
nodeId = new NodeId("1");
mockControllerNode = new MockControllerNode(nodeId);
expect(mockClusterService.getLocalNode()).andReturn(mockControllerNode).anyTimes();
replay(mockClusterService);
flowStoreImpl.clusterCommunicator = new ClusterCommunicationServiceAdapter();
flowStoreImpl.mastershipService = new MasterOfAll();
flowStoreImpl.deviceService = new DeviceServiceAdapter();
flowStoreImpl.coreService = new CoreServiceAdapter();
flowStoreImpl.configService = new ComponentConfigAdapter();
flowStoreImpl.persistenceService = new PersistenceServiceAdapter();
flowStoreImpl.activate(context);
}
Aggregations