use of org.onosproject.net.driver.DefaultDriverProvider in project onos by opennetworkinglab.
the class DriverRegistryManagerTest method basicQueries.
@Test
public void basicQueries() {
DefaultDriverProvider mockProvider = new DefaultDriverProvider();
DefaultDriver driver = new DefaultDriver("default", Lists.newArrayList(), MFR, HW, SW, ImmutableMap.of(TestBehaviour.class, TestBehaviourImpl.class), ImmutableMap.of("foo", "bar"));
mockProvider.addDriver(driver);
mgr.registerProvider(mockProvider);
assertSame("driver is missing", driver, mgr.getDriver("default"));
assertSame("driver is missing", driver, mgr.getDriver(MFR, HW, SW));
assertArrayEquals("driver list is wrong", ImmutableList.of(driver).toArray(), mgr.getDrivers().toArray());
assertArrayEquals("provider list is wrong", ImmutableList.of(mockProvider).toArray(), mgr.getProviders().toArray());
assertEquals("wrong behaviour class", TestBehaviourImpl.class, mgr.getBehaviourClass("org.onosproject.net.driver.TestBehaviourImpl"));
}
use of org.onosproject.net.driver.DefaultDriverProvider in project onos by opennetworkinglab.
the class DriverRegistryManagerTest method basicEvents.
@Test
public void basicEvents() {
mgr.addListener(testListener);
DefaultDriverProvider mockProvider = new DefaultDriverProvider();
DefaultDriver driver = new DefaultDriver("foo", Lists.newArrayList(), MFR, HW, SW, ImmutableMap.of(TestBehaviour.class, TestBehaviourImpl.class), ImmutableMap.of("foo", "bar"));
mockProvider.addDriver(driver);
mgr.registerProvider(mockProvider);
assertEquals("wrong driver event type", DRIVER_ENHANCED, testListener.event.type());
assertSame("wrong driver event subject", driver, testListener.event.subject());
mgr.unregisterProvider(mockProvider);
assertEquals("wrong driver event type", DRIVER_REDUCED, testListener.event.type());
assertSame("wrong driver event subject", driver, testListener.event.subject());
mgr.removeListener(testListener);
}
use of org.onosproject.net.driver.DefaultDriverProvider in project onos by opennetworkinglab.
the class DriverRegistryManagerTest method managerStart.
@Test
public void managerStart() {
DefaultDriverProvider mockProvider = new DefaultDriverProvider();
DefaultDriver driver = new DefaultDriver("default", Lists.newArrayList(), MFR, HW, SW, ImmutableMap.of(TestBehaviour.class, TestBehaviourImpl.class), ImmutableMap.of("foo", "bar"));
mockProvider.addDriver(driver);
mgr.registerProvider(mockProvider);
assertTrue("should be activated", componentService.activated);
mgr.unregisterProvider(mockProvider);
assertFalse("should not be dactivated", componentService.activated);
}
Aggregations