use of org.osgi.service.device.DriverLocator in project felix by apache.
the class DriverLoaderTest method loadDrivers_InstallFails.
@Test
public void loadDrivers_InstallFails() throws IOException, BundleException {
List<DriverLocator> locators = new ArrayList<DriverLocator>();
DriverLocator dl = Mockito.mock(DriverLocator.class, "dl");
locators.add(dl);
String[] driverIds = new String[] { "org.apache.felix.driver-1.0", "org.apache.felix.driver-1.1" };
for (String string : driverIds) {
Mockito.when(dl.loadDriver(string)).thenReturn(null);
Mockito.when(m_context.installBundle(DriverLoader.DRIVER_LOCATION_PREFIX + string, null)).thenThrow(new BundleException("test exception"));
}
List<ServiceReference> refs = m_loader.loadDrivers(locators, driverIds);
Assert.assertEquals("", 0, refs.size());
}
Aggregations