use of org.osgi.service.device.Match in project felix by apache.
the class DriverMatcherTest method GetBestMatchWithMultipleDrivers.
@Test
public void GetBestMatchWithMultipleDrivers() throws Exception {
add("org.apache.felix.driver.a-1.0", 1);
add("org.apache.felix.driver.b-1.0", 1);
add("org.apache.felix.driver.c-1.0", 10);
Match match = m_matcherImpl.getBestMatch();
Assert.assertNotNull(match);
Assert.assertEquals("org.apache.felix.driver.c-1.0", tstDriverId(match));
}
use of org.osgi.service.device.Match in project felix by apache.
the class DriverMatcherTest method GetBestMatchWithInvalidRanking.
@Test
public void GetBestMatchWithInvalidRanking() throws Exception {
add("org.apache.felix.driver.a-1.0", 1, 0);
add("org.apache.felix.driver.b-1.0", 1, -1);
Match match = m_matcherImpl.getBestMatch();
Assert.assertNotNull(match);
Assert.assertEquals("org.apache.felix.driver.a-1.0", tstDriverId(match));
}
use of org.osgi.service.device.Match in project felix by apache.
the class DriverMatcherTest method VerifyMatchToString.
@Test
public void VerifyMatchToString() throws Exception {
DriverSelector selector = Mockito.mock(DriverSelector.class);
ServiceReference deviceRef = Mockito.mock(ServiceReference.class);
Mockito.when(selector.select(Mockito.eq(deviceRef), Mockito.isA(Match[].class))).thenReturn(0);
add("org.apache.felix.driver-1.5", 2);
Match match = m_matcherImpl.selectBestMatch(deviceRef, selector);
Assert.assertNotNull(match);
Assert.assertNotNull(match.toString());
}
Aggregations