use of joynr.types.DiscoveryEntry in project joynr by bmwcarit.
the class CapabilitiesUtilsTest method compareCollectionOfDiscoveryEntries.
private void compareCollectionOfDiscoveryEntries(Collection<DiscoveryEntry> convertedEntries, Collection<DiscoveryEntryWithMetaInfo> discoveryEntries) {
int numberOfValidConversions = 0;
assertEquals(discoveryEntries.size(), convertedEntries.size());
for (DiscoveryEntryWithMetaInfo discoveryEntry : discoveryEntries) {
for (DiscoveryEntry convertedEntry : convertedEntries) {
if (convertedEntry.getParticipantId().equals(discoveryEntry.getParticipantId())) {
assertTrue(DiscoveryEntry.class.equals(convertedEntry.getClass()));
compareDiscoveryEntries(discoveryEntry.getIsLocal(), convertedEntry, discoveryEntry);
numberOfValidConversions++;
break;
}
continue;
}
}
assertEquals(discoveryEntries.size(), numberOfValidConversions);
}
use of joynr.types.DiscoveryEntry in project joynr by bmwcarit.
the class CapabilitiesUtilsTest method compareCollectionOfDiscoveryEntriesWithMetaInfo.
private void compareCollectionOfDiscoveryEntriesWithMetaInfo(boolean isLocal, Collection<DiscoveryEntry> discoveryEntries, Collection<DiscoveryEntryWithMetaInfo> convertedEntries) {
int numberOfValidConversions = 0;
assertEquals(discoveryEntries.size(), convertedEntries.size());
for (DiscoveryEntry discoveryEntry : discoveryEntries) {
for (DiscoveryEntryWithMetaInfo convertedEntry : convertedEntries) {
if (convertedEntry.getParticipantId().equals(discoveryEntry.getParticipantId())) {
assertTrue(DiscoveryEntryWithMetaInfo.class.equals(convertedEntry.getClass()));
compareDiscoveryEntries(isLocal, discoveryEntry, convertedEntry);
numberOfValidConversions++;
break;
}
continue;
}
}
assertEquals(discoveryEntries.size(), numberOfValidConversions);
}
use of joynr.types.DiscoveryEntry in project joynr by bmwcarit.
the class CapabilitiesUtilsTest method createCollectionOfDiscoveryEntries.
private Collection<DiscoveryEntry> createCollectionOfDiscoveryEntries() {
Collection<DiscoveryEntry> discoveryEntries = new ArrayList<>(2);
discoveryEntries.add(new DiscoveryEntry(new Version(42, 23), "testDomain1", "testInterfaceName", "testParticipantId1", new ProviderQos(), 4711l, 4712l, "testPublicKeyId1"));
discoveryEntries.add(new DiscoveryEntry(new Version(42, 23), "testDomain2", "testInterfaceName", "testParticipantId2", new ProviderQos(), 4721l, 4722l, "testPublicKeyId2"));
return discoveryEntries;
}
use of joynr.types.DiscoveryEntry in project joynr by bmwcarit.
the class CapabilitiesUtilsTest method testConvertLocalDiscoveryEntryToDiscoveryEntryWithMetaInfo.
@Test
public void testConvertLocalDiscoveryEntryToDiscoveryEntryWithMetaInfo() {
boolean isLocal = true;
DiscoveryEntry discoveryEntry = new DiscoveryEntry(new Version(42, 23), "testDomain", "testInterfaceName", "testParticipantId", new ProviderQos(), 4711l, 4712l, "testPublicKeyId");
DiscoveryEntryWithMetaInfo convertedDiscoveryEntry = CapabilityUtils.convertToDiscoveryEntryWithMetaInfo(isLocal, discoveryEntry);
compareDiscoveryEntries(isLocal, discoveryEntry, convertedDiscoveryEntry);
}
use of joynr.types.DiscoveryEntry in project joynr by bmwcarit.
the class StaticCapabilitiesProvisioningTest method testOverrideJsonWithLegacy.
@Test
public void testOverrideJsonWithLegacy() throws IOException {
Set<DiscoveryEntry> discoveryEntries = createDiscoveryEntries("io.joynr", GlobalCapabilitiesDirectory.INTERFACE_NAME, GlobalDomainAccessController.INTERFACE_NAME);
LegacyCapabilitiesProvisioning.LegacyProvisioningPropertiesHolder properties = createLegacyProvisioningPropertiesHolder();
final String serializedDiscoveryEntries = objectMapper.writeValueAsString(discoveryEntries);
Injector injector = createInjectorForJsonValue(serializedDiscoveryEntries, properties);
CapabilitiesProvisioning subject = injector.getInstance(CapabilitiesProvisioning.class);
Collection<DiscoveryEntry> provisionedDiscoveryEntries = subject.getDiscoveryEntries();
assertEquals(2, provisionedDiscoveryEntries.size());
assertContainsEntryFor(provisionedDiscoveryEntries, GlobalCapabilitiesDirectory.INTERFACE_NAME, properties.capabilitiesDirectoryParticipantId, properties.discoveryDirectoryUrl);
assertContainsEntryFor(provisionedDiscoveryEntries, GlobalDomainAccessController.INTERFACE_NAME, properties.domainAccessControllerParticipantId, properties.domainAccessControllerUrl);
}
Aggregations