use of joynr.types.DiscoveryEntryWithMetaInfo in project joynr by bmwcarit.
the class CapabilitiesUtilsTest method testConvertDiscoveryEntryWithMetaInfoToDiscoveryEntry.
@Test
public void testConvertDiscoveryEntryWithMetaInfoToDiscoveryEntry() {
boolean isLocal = true;
DiscoveryEntryWithMetaInfo discoveryEntry = new DiscoveryEntryWithMetaInfo(new Version(42, 23), "testDomain", "testInterfaceName", "testParticipantId", new ProviderQos(), 4711l, 4712l, "testPublicKeyId", isLocal);
DiscoveryEntry convertedEntry = CapabilityUtils.convertToDiscoveryEntry(discoveryEntry);
assertTrue(DiscoveryEntry.class.equals(convertedEntry.getClass()));
compareDiscoveryEntries(isLocal, convertedEntry, discoveryEntry);
}
use of joynr.types.DiscoveryEntryWithMetaInfo in project joynr by bmwcarit.
the class CapabilitiesUtilsTest method testConvertGlobalDiscoveryEntryToDiscoveryEntryWithMetaInfo.
@Test
public void testConvertGlobalDiscoveryEntryToDiscoveryEntryWithMetaInfo() {
boolean isLocal = false;
DiscoveryEntry discoveryEntry = new DiscoveryEntry(new Version(42, 23), "testDomain", "testInterfaceName", "testParticipantId", new ProviderQos(), 4711l, 4712l, "testPublicKeyId");
GlobalDiscoveryEntry globalDiscoveryEntry = CapabilityUtils.discoveryEntry2GlobalDiscoveryEntry(discoveryEntry, new MqttAddress());
DiscoveryEntryWithMetaInfo convertedEntry = CapabilityUtils.convertToDiscoveryEntryWithMetaInfo(isLocal, discoveryEntry);
compareDiscoveryEntries(isLocal, discoveryEntry, convertedEntry);
DiscoveryEntryWithMetaInfo convertedGlobalEntry = CapabilityUtils.convertToDiscoveryEntryWithMetaInfo(isLocal, globalDiscoveryEntry);
compareDiscoveryEntries(isLocal, globalDiscoveryEntry, convertedGlobalEntry);
}
use of joynr.types.DiscoveryEntryWithMetaInfo 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.DiscoveryEntryWithMetaInfo 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.DiscoveryEntryWithMetaInfo 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);
}
Aggregations