use of joynr.types.DiscoveryQos in project joynr by bmwcarit.
the class LocalDiscoveryAggregatorTest method doesNotQueryProvisionedEntry.
@SuppressWarnings("unchecked")
@Test
public void doesNotQueryProvisionedEntry() {
localDiscoveryAggregator.lookup(lookupCallback, new String[] { systemServicesDomain }, Discovery.INTERFACE_NAME, new DiscoveryQos());
verify(discoveryProxyMock, never()).lookup(any(Callback.class), any(String[].class), anyString(), any(DiscoveryQos.class));
}
use of joynr.types.DiscoveryQos in project joynr by bmwcarit.
the class LocalDiscoveryAggregatorTest method findsProvisionedEntryForMultipleDomains.
@SuppressWarnings("unchecked")
@Test
public void findsProvisionedEntryForMultipleDomains() throws Exception {
discoveryProviderEntries = new DiscoveryEntryWithMetaInfo[] { anotherDiscoveryProviderEntry };
allDomains = new String[] { systemServicesDomain, anotherDomain };
String[] missingDomains = new String[] { anotherDomain };
DiscoveryQos discoveryQos = new DiscoveryQos();
discoveryQos.setDiscoveryScope(DiscoveryScope.LOCAL_ONLY);
doAnswer(new Answer<Object>() {
@Override
public Object answer(InvocationOnMock invocation) {
Callback<DiscoveryEntryWithMetaInfo[]> callback = (Callback<DiscoveryEntryWithMetaInfo[]>) invocation.getArguments()[0];
callback.onSuccess(discoveryProviderEntries);
return null;
}
}).when(discoveryProxyMock).lookup(any(Callback.class), any(String[].class), anyString(), any(DiscoveryQos.class));
Future<DiscoveryEntryWithMetaInfo[]> discoveryEntriesFuture = localDiscoveryAggregator.lookup(lookupCallback, allDomains, Discovery.INTERFACE_NAME, discoveryQos);
assertNotNull(discoveryEntriesFuture);
DiscoveryEntry[] result = discoveryEntriesFuture.get();
logger.info("Got discovery entries: " + Arrays.toString(result));
assertNotNull(result);
assertEquals(2, result.length);
assertTrue(containsByInterfaceDomain(result, discoveryProviderEntry.getInterfaceName(), discoveryProviderEntry.getDomain()));
assertTrue(containsByInterfaceDomain(result, anotherDiscoveryProviderEntry.getInterfaceName(), anotherDiscoveryProviderEntry.getDomain()));
verify(discoveryProxyMock).lookup(any(Callback.class), eq(missingDomains), eq(Discovery.INTERFACE_NAME), eq(discoveryQos));
}
use of joynr.types.DiscoveryQos in project joynr by bmwcarit.
the class LocalDiscoveryAggregatorTest method findsProvisionedEntryForSingleDomain.
@SuppressWarnings("unchecked")
@Test
public void findsProvisionedEntryForSingleDomain() {
discoveryProviderEntries = new DiscoveryEntryWithMetaInfo[] { discoveryProviderEntry };
oneDomain = new String[] { systemServicesDomain };
// Double Decla. allDomains = new String[]{ anotherDomain, systemServicesDomain };
DiscoveryQos discoveryQos = new DiscoveryQos();
discoveryQos.setDiscoveryScope(DiscoveryScope.LOCAL_ONLY);
Future<DiscoveryEntryWithMetaInfo[]> discoveryEntryFuture = localDiscoveryAggregator.lookup(lookupCallback, oneDomain, Discovery.INTERFACE_NAME, discoveryQos);
ArgumentCaptor<DiscoveryEntry[]> discoveryEntriesCaptor = ArgumentCaptor.forClass(DiscoveryEntry[].class);
verify(lookupCallback).resolve((Object) discoveryEntriesCaptor.capture());
DiscoveryEntry[] discoveryEntriesPassed = discoveryEntriesCaptor.getValue();
assertEquals(1, discoveryEntriesPassed.length);
assertEquals(discoveryProviderEntry.getDomain(), discoveryEntriesPassed[0].getDomain());
assertEquals(discoveryProviderEntry.getInterfaceName(), discoveryEntriesPassed[0].getInterfaceName());
assertEquals(discoveryProviderEntry.getParticipantId(), discoveryEntriesPassed[0].getParticipantId());
assertEquals(discoveryProviderEntry.getQos(), discoveryEntriesPassed[0].getQos());
assertEquals(discoveryProviderEntry.getProviderVersion(), discoveryEntriesPassed[0].getProviderVersion());
try {
discoveryEntriesPassed = discoveryEntryFuture.get();
} catch (Exception e) {
Assert.fail("Got exception from future: " + e);
}
assertEquals(1, discoveryEntriesPassed.length);
assertEquals(discoveryProviderEntry.getDomain(), discoveryEntriesPassed[0].getDomain());
assertEquals(discoveryProviderEntry.getInterfaceName(), discoveryEntriesPassed[0].getInterfaceName());
assertEquals(discoveryProviderEntry.getParticipantId(), discoveryEntriesPassed[0].getParticipantId());
assertEquals(discoveryProviderEntry.getQos(), discoveryEntriesPassed[0].getQos());
assertEquals(discoveryProviderEntry.getProviderVersion(), discoveryEntriesPassed[0].getProviderVersion());
verify(discoveryProxyMock, never()).lookup(any(Callback.class), any(String[].class), anyString(), any(DiscoveryQos.class));
}
Aggregations