use of joynr.types.ProviderQos 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.ProviderQos 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.ProviderQos 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.ProviderQos 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.ProviderQos in project joynr by bmwcarit.
the class LegacyCapabilitiesProvisioning method createDiscoveryEntryFor.
private void createDiscoveryEntryFor(Class<?> interfaceClass, String interfaceName, String channelId, String participantId, String urlForAddress, String localChannelId, String domain) {
boolean hasUrl = isPresent(urlForAddress);
boolean hasParticipantId = isPresent(participantId);
if (hasUrl && !hasParticipantId) {
throw new IllegalArgumentException(format("When configuring the discovery directory or domain access controller " + "via properties, you must provide both a URL and a participant ID per service.%n" + "You provided the URL '%s' and the participant ID '%s' for the service %s.%n" + "Please complete the configuration and restart the application.", urlForAddress, participantId, interfaceName));
}
if (hasParticipantId && hasUrl && isPresent(channelId) && isPresent(domain)) {
Address address;
if (localChannelId.equals(channelId)) {
address = new InProcessAddress();
} else if (urlForAddress.startsWith("tcp") || urlForAddress.startsWith("mqtt")) {
address = new MqttAddress(urlForAddress, channelId);
} else {
address = new ChannelAddress(urlForAddress, channelId);
}
DiscoveryEntry discoveryEntry = CapabilityUtils.newGlobalDiscoveryEntry(new Version(0, 1), domain, interfaceName, participantId, new ProviderQos(), System.currentTimeMillis(), Long.MAX_VALUE, "", address);
logger.debug("Created legacy discovery entry: {}", discoveryEntry);
legacyDiscoveryEntries.put(interfaceClass, discoveryEntry);
legacyAddresses.put(interfaceClass, address);
} else {
logger.trace("Insufficient properties data to create entry for interface {}", interfaceName);
}
}
Aggregations