use of org.onosproject.common.event.impl.TestEventDispatcher in project onos by opennetworkinglab.
the class MeterManagerTest method setup.
@Before
public void setup() {
DeviceService deviceService = new TestDeviceService();
DriverRegistryManager driverRegistry = new DriverRegistryManager();
DriverManager driverService = new TestDriverManager(driverRegistry, deviceService, new NetworkConfigServiceAdapter());
driverRegistry.addDriver(new DefaultDriver("foo", ImmutableList.of(), "", "", "", ImmutableMap.of(MeterProgrammable.class, TestMeterProgrammable.class, MeterQuery.class, TestMeterQuery.class), ImmutableMap.of()));
meterStore = new DistributedMeterStore();
TestUtils.setField(meterStore, "storageService", new TestStorageService());
TestUtils.setField(meterStore, "driverService", driverService);
KryoNamespace.Builder testKryoBuilder = TestUtils.getField(meterStore, "APP_KRYO_BUILDER");
testKryoBuilder.register(TestApplicationId.class);
Serializer testSerializer = Serializer.using(Lists.newArrayList(testKryoBuilder.build()));
TestUtils.setField(meterStore, "serializer", testSerializer);
meterStore.activate();
manager = new MeterManager();
TestUtils.setField(manager, "store", meterStore);
injectEventDispatcher(manager, new TestEventDispatcher());
manager.deviceService = deviceService;
manager.mastershipService = new TestMastershipService();
manager.cfgService = new ComponentConfigAdapter();
manager.clusterService = new TestClusterService();
registry = manager;
manager.driverService = driverService;
Dictionary<String, Object> cfgDict = new Hashtable<>();
expect(componentContext.getProperties()).andReturn(cfgDict);
replay(componentContext);
manager.activate(componentContext);
provider = new TestProvider(PID);
providerService = registry.register(provider);
assertTrue("provider should be registered", registry.getProviders().contains(provider.id()));
}
use of org.onosproject.common.event.impl.TestEventDispatcher in project onos by opennetworkinglab.
the class PiPipeconfManagerTest method setUp.
@Before
public void setUp() throws IOException {
mgr = new PiPipeconfManager();
pipeconf = BASIC_PIPECONF;
mgr.cfgService = cfgService;
mgr.driverAdminService = driverAdminService;
injectEventDispatcher(mgr, new TestEventDispatcher());
ObjectMapper mapper = new ObjectMapper();
ConfigApplyDelegate delegate = new MockDelegate();
String keyBasic = "basic";
JsonNode jsonNodeBasic = mapper.readTree(jsonStreamBasic);
basicDeviceConfig.init(DEVICE_ID, keyBasic, jsonNodeBasic, mapper, delegate);
mgr.activate();
}
use of org.onosproject.common.event.impl.TestEventDispatcher in project onos by opennetworkinglab.
the class RegionManagerTest method setUp.
@Before
public void setUp() throws Exception {
TestUtils.setField(store, "storageService", new TestStorageService());
store.activate();
manager.store = store;
manager.addListener(listener);
NetTestTools.injectEventDispatcher(manager, new TestEventDispatcher());
manager.activate();
service = manager;
}
use of org.onosproject.common.event.impl.TestEventDispatcher in project onos by opennetworkinglab.
the class TopologyManagerTest method setUp.
@Before
public void setUp() {
mgr = new TopologyManager();
service = mgr;
registry = mgr;
mgr.store = new SimpleTopologyStore();
injectEventDispatcher(mgr, new TestEventDispatcher());
mgr.activate();
service.addListener(listener);
provider = new TestProvider();
providerService = registry.register(provider);
assertTrue("provider should be registered", registry.getProviders().contains(provider.id()));
}
use of org.onosproject.common.event.impl.TestEventDispatcher in project onos by opennetworkinglab.
the class VirtualNetworkIntentManagerTest method setUp.
@Before
public void setUp() throws Exception {
virtualNetworkManagerStore = new DistributedVirtualNetworkStore();
intentStore = new SimpleVirtualIntentStore();
coreService = new VirtualNetworkIntentManagerTest.TestCoreService();
MockIdGenerator.cleanBind();
TestUtils.setField(virtualNetworkManagerStore, "coreService", coreService);
TestUtils.setField(virtualNetworkManagerStore, "storageService", new TestStorageService());
virtualNetworkManagerStore.activate();
manager = new VirtualNetworkManager();
manager.store = virtualNetworkManagerStore;
NetTestTools.injectEventDispatcher(manager, new TestEventDispatcher());
intentService.addListener(listener);
// Register a compiler and an installer both setup for success.
intentExtensionService = intentService;
intentExtensionService.registerCompiler(VirtualNetworkIntent.class, compiler);
created = new Semaphore(0, true);
withdrawn = new Semaphore(0, true);
purged = new Semaphore(0, true);
workPartitionService = new WorkPartitionServiceAdapter();
testDirectory = new TestServiceDirectory().add(VirtualNetworkStore.class, virtualNetworkManagerStore).add(IntentService.class, intentService).add(WorkPartitionService.class, workPartitionService);
TestUtils.setField(manager, "serviceDirectory", testDirectory);
manager.activate();
}
Aggregations