use of joynr.system.RoutingTypes.Address in project joynr by bmwcarit.
the class JeeHttpMessagingModule method configure.
@Override
protected void configure() {
messagingSkeletonFactory.addBinding(ChannelAddress.class).to(ChannelMessagingSkeleton.class);
messagingStubFactory.addBinding(ChannelAddress.class).to(ChannelMessagingStubFactory.class);
Multibinder<GlobalAddressFactory<? extends Address>> globalAddresses;
globalAddresses = Multibinder.newSetBinder(binder(), new TypeLiteral<GlobalAddressFactory<? extends Address>>() {
}, Names.named(GlobalAddressProvider.GLOBAL_ADDRESS_PROVIDER));
globalAddresses.addBinding().to(ServletHttpGlobalAddressFactory.class);
Multibinder<GlobalAddressFactory<? extends Address>> replyToAddresses;
replyToAddresses = Multibinder.newSetBinder(binder(), new TypeLiteral<GlobalAddressFactory<? extends Address>>() {
}, Names.named(ReplyToAddressProvider.REPLY_TO_ADDRESS_PROVIDER));
replyToAddresses.addBinding().to(ServletHttpGlobalAddressFactory.class);
install(new AccessControlClientModule());
bind(RequestConfig.class).toProvider(HttpDefaultRequestConfigProvider.class).in(Singleton.class);
bind(CloseableHttpClient.class).toProvider(HttpClientProvider.class).in(Singleton.class);
bind(HttpRequestFactory.class).to(ApacheHttpRequestFactory.class);
bind(MessageRouter.class).to(CcMessageRouter.class).in(Singleton.class);
bind(MessageSender.class).to(CcMessageSender.class);
bind(MessageReceiver.class).to(JeeServletMessageReceiver.class);
bind(ServletMessageReceiver.class).to(JeeServletMessageReceiver.class);
}
use of joynr.system.RoutingTypes.Address in project joynr by bmwcarit.
the class DiscoveryEntryStorePersistedTest method createDiscoveryEntry.
private GlobalDiscoveryEntryPersisted createDiscoveryEntry(String domain, String interfaceName, String participantId) throws Exception {
ProviderQos qos = new ProviderQos();
long lastSeenDateMs = 123L;
long expiryDateMs = Long.MAX_VALUE;
String publicKeyId = "publicKeyId";
Address address = new MqttAddress("brokerUri", "topic");
String addressSerialized = new ObjectMapper().writeValueAsString(address);
GlobalDiscoveryEntryPersisted discoveryEntry = new GlobalDiscoveryEntryPersisted(new Version(47, 11), domain, interfaceName, participantId, qos, lastSeenDateMs, expiryDateMs, publicKeyId, addressSerialized, "clusterControllerId");
return discoveryEntry;
}
use of joynr.system.RoutingTypes.Address in project joynr by bmwcarit.
the class CapabilitiesDirectoryImpl method add.
@Override
public Promise<DeferredVoid> add(GlobalDiscoveryEntry globalDiscoveryEntry) {
DeferredVoid deferred = new DeferredVoid();
Promise<DeferredVoid> promise = new Promise<DeferredVoid>(deferred);
Address address = CapabilityUtils.getAddressFromGlobalDiscoveryEntry(globalDiscoveryEntry);
String clusterControllerId;
if (address instanceof MqttAddress) {
clusterControllerId = ((MqttAddress) address).getTopic();
} else if (address instanceof ChannelAddress) {
clusterControllerId = ((ChannelAddress) address).getChannelId();
} else {
deferred.reject(new ProviderRuntimeException(""));
return promise;
}
GlobalDiscoveryEntryPersisted discoveryEntry = new GlobalDiscoveryEntryPersisted(globalDiscoveryEntry, clusterControllerId);
logger.debug("registered discovery entry: {}", discoveryEntry);
discoveryEntryStore.add(discoveryEntry);
deferred.resolve();
return promise;
}
use of joynr.system.RoutingTypes.Address in project joynr by bmwcarit.
the class AddressManagerTest method testGetLocalMulticastParticipantWithoutGlobalTransports.
@Test
public void testGetLocalMulticastParticipantWithoutGlobalTransports() {
createAddressManager(NO_PRIMARY_GLOBAL_TRANSPORT_SELECTED);
when(joynrMessage.getSender()).thenReturn("from");
String multicastId = "from/to";
when(joynrMessage.getRecipient()).thenReturn(multicastId);
Set<String> particpantIds = Sets.newHashSet("one");
when(multicastReceiverRegistry.getReceivers(multicastId)).thenReturn(particpantIds);
Address one = mock(Address.class);
when(routingTable.get("one")).thenReturn(one);
Set<Address> result = subject.getAddresses(joynrMessage);
assertNotNull(result);
assertEquals(1, result.size());
assertTrue(result.contains(one));
}
use of joynr.system.RoutingTypes.Address in project joynr by bmwcarit.
the class AddressManagerTest method testGetLocalAndGlobalAddressesForNonExistingProvider.
@Test
public void testGetLocalAndGlobalAddressesForNonExistingProvider() {
createAddressManager(GLOBAL_TRANSPORT_MQTT, multicastAddressCalculator);
when(joynrMessage.getSender()).thenReturn("participantId");
String multicastId = participantId + "/to";
when(joynrMessage.getRecipient()).thenReturn(multicastId);
when(routingTable.getIsGloballyVisible(participantId)).thenThrow(new JoynrRuntimeException());
Set<String> localParticipantIds = Sets.newHashSet("one");
when(multicastReceiverRegistry.getReceivers(multicastId)).thenReturn(localParticipantIds);
Address localAddress = mock(Address.class);
when(routingTable.get("one")).thenReturn(localAddress);
Address globalAddress = mock(Address.class);
when(multicastAddressCalculator.supports(GLOBAL_TRANSPORT_MQTT)).thenReturn(true);
when(multicastAddressCalculator.createsGlobalTransportAddresses()).thenReturn(true);
when(multicastAddressCalculator.calculate(joynrMessage)).thenReturn(globalAddress);
Set<Address> result = subject.getAddresses(joynrMessage);
assertNotNull(result);
assertEquals(1, result.size());
assertTrue(result.contains(localAddress));
assertFalse(result.contains(globalAddress));
}
Aggregations