use of io.joynr.messaging.MessagingQos in project joynr by bmwcarit.
the class RequestReplyManagerTest method requestMessagesSentToTheCommunicationManager.
@Test
public void requestMessagesSentToTheCommunicationManager() throws Exception {
requestReplyManager.sendRequest(testSenderParticipantId, testMessageResponderDiscoveryEntry, request1, new MessagingQos(TIME_TO_LIVE));
ArgumentCaptor<MutableMessage> messageCapture = ArgumentCaptor.forClass(MutableMessage.class);
verify(messageSenderMock, times(1)).sendMessage(messageCapture.capture());
assertEquals(messageCapture.getValue().getSender(), testSenderParticipantId);
assertEquals(messageCapture.getValue().getRecipient(), testMessageResponderParticipantId);
assertEquals(new String(messageCapture.getValue().getPayload(), Charsets.UTF_8), objectMapper.writeValueAsString(request1));
}
use of io.joynr.messaging.MessagingQos in project joynr by bmwcarit.
the class RequestReplyManagerTest method oneWayMessagesAreSentToTheCommunicationManager.
@Test
public void oneWayMessagesAreSentToTheCommunicationManager() throws Exception {
requestReplyManager.sendOneWayRequest(testSenderParticipantId, testOneWayRecipientDiscoveryEntries, oneWay1, new MessagingQos(TIME_TO_LIVE));
ArgumentCaptor<MutableMessage> messageCapture = ArgumentCaptor.forClass(MutableMessage.class);
verify(messageSenderMock, times(1)).sendMessage(messageCapture.capture());
assertEquals(messageCapture.getValue().getSender(), testSenderParticipantId);
assertEquals(messageCapture.getValue().getRecipient(), testOneWayRecipientParticipantId);
assertEquals(oneWay1, objectMapper.readValue(messageCapture.getValue().getPayload(), OneWayRequest.class));
}
use of io.joynr.messaging.MessagingQos in project joynr by bmwcarit.
the class GlobalDomainAccessControllerClient method getGlobalDomainAccessControllerProxy.
private GlobalDomainAccessControllerProxy getGlobalDomainAccessControllerProxy(long ttl) {
ProxyBuilder<GlobalDomainAccessControllerProxy> accessControlProxyBuilder = proxyBuilderFactory.get(domain, GlobalDomainAccessControllerProxy.class);
DiscoveryQos discoveryQos = new DiscoveryQos();
discoveryQos.setDiscoveryScope(DiscoveryScope.GLOBAL_ONLY);
discoveryQos.setCacheMaxAgeMs(DiscoveryQos.NO_MAX_AGE);
MessagingQos messagingQos = new MessagingQos(ttl);
return accessControlProxyBuilder.setDiscoveryQos(discoveryQos).setMessagingQos(messagingQos).build();
}
use of io.joynr.messaging.MessagingQos in project joynr by bmwcarit.
the class GlobalDomainAccessControllerClient method getGlobalDomainAccessControlListEditorProxy.
private GlobalDomainAccessControlListEditorProxy getGlobalDomainAccessControlListEditorProxy(long ttl) {
ProxyBuilder<GlobalDomainAccessControlListEditorProxy> accessControlListEditorProxyBuilder = proxyBuilderFactory.get(domain, GlobalDomainAccessControlListEditorProxy.class);
DiscoveryQos discoveryQos = new DiscoveryQos();
discoveryQos.setDiscoveryScope(DiscoveryScope.GLOBAL_ONLY);
discoveryQos.setCacheMaxAgeMs(DiscoveryQos.NO_MAX_AGE);
MessagingQos messagingQos = new MessagingQos(ttl);
return accessControlListEditorProxyBuilder.setDiscoveryQos(discoveryQos).setMessagingQos(messagingQos).build();
}
use of io.joynr.messaging.MessagingQos in project joynr by bmwcarit.
the class RoutingTableOverwriteEnd2EndTest method testProviderAddressCanBeOverwrittenAfterDiscovery.
@Test
public void testProviderAddressCanBeOverwrittenAfterDiscovery() throws Exception {
// Tests that if a provider's address is changed in the discovery directory and a new proxy is
// created for the provider, the routing table of the proxy's runtime will also be updated as long as
// a new arbitration (cache max age = 0) is performed.
final String providerDomain = "testDomain";
final Properties fixedParticipantIdProperty = createFixedParticipantIdProperties(providerDomain, DefaulttestProvider.class, "fixedParticipantId");
DiscoveryQos discoveryQos = new DiscoveryQos();
discoveryQos.setArbitrationStrategy(ArbitrationStrategy.HighestPriority);
discoveryQos.setCacheMaxAgeMs(0);
JoynrRuntime runtimeProxy = createRuntime("proxy", null);
JoynrRuntime runtimeProvider1 = createRuntime("provider_initial", fixedParticipantIdProperty);
DefaulttestProvider provider1 = Mockito.spy(DefaulttestProvider.class);
runtimeProvider1.registerProvider(providerDomain, provider1, createProviderQos()).get();
testProxy proxy1 = runtimeProxy.getProxyBuilder(providerDomain, testProxy.class).setMessagingQos(new MessagingQos(2000)).setDiscoveryQos(discoveryQos).build();
proxy1.addNumbers(1, 2, 3);
verify(provider1).addNumbers(1, 2, 3);
reset(provider1);
JoynrRuntime runtimeProvider2 = createRuntime("provider_override", fixedParticipantIdProperty);
DefaulttestProvider provider2 = Mockito.spy(DefaulttestProvider.class);
runtimeProvider2.registerProvider(providerDomain, provider2, createProviderQos()).get();
testProxy proxy2 = runtimeProxy.getProxyBuilder(providerDomain, testProxy.class).setMessagingQos(new MessagingQos(2000)).setDiscoveryQos(discoveryQos).build();
proxy2.addNumbers(1, 2, 3);
verify(provider1, never()).addNumbers(1, 2, 3);
verify(provider2).addNumbers(1, 2, 3);
}
Aggregations