use of io.joynr.messaging.NoOpRawMessagingPreprocessor in project joynr by bmwcarit.
the class DefaultJoynrRuntimeFactoryTest method createFixture.
@SuppressWarnings("unchecked")
private void createFixture(Instance<Properties> joynrProperties, Instance<String> joynrLocalDomain) throws Exception {
Instance<RawMessagingPreprocessor> rawMessageProcessor = mock(Instance.class);
when(rawMessageProcessor.get()).thenReturn(new NoOpRawMessagingPreprocessor());
BeanManager beanManager = mock(BeanManager.class);
Bean<JoynrMessageProcessor> bean = mock(Bean.class);
when(bean.create(Mockito.any())).thenReturn(new JoynrMessageProcessorTest());
when(beanManager.getBeans(Mockito.<Type>eq(JoynrMessageProcessor.class), Mockito.<Annotation>any())).thenReturn(Sets.newHashSet(bean));
final String mqttClientId = "someTestMqttClientId";
MqttClientIdProvider mqttClientIdProvider = mock(MqttClientIdProvider.class);
when(mqttClientIdProvider.getClientId()).thenReturn(mqttClientId);
Instance<MqttClientIdProvider> mqttClientIdProviderInstance = mock(Instance.class);
when(mqttClientIdProviderInstance.get()).thenReturn(mqttClientIdProvider);
fixture = new DefaultJoynrRuntimeFactory(joynrProperties, joynrLocalDomain, rawMessageProcessor, mqttClientIdProviderInstance, beanManager, mock(StatusReceiver.class), mock(MqttStatusReceiver.class));
scheduledExecutorService = mock(ScheduledExecutorService.class);
Field executorField = DefaultJoynrRuntimeFactory.class.getDeclaredField("scheduledExecutorService");
executorField.setAccessible(true);
executorField.set(fixture, scheduledExecutorService);
}
use of io.joynr.messaging.NoOpRawMessagingPreprocessor in project joynr by bmwcarit.
the class MqttMessagingSkeletonTest method testJoynrMessageProcessorIsCalled.
@Test
public void testJoynrMessageProcessorIsCalled() throws Exception {
JoynrMessageProcessor processorMock = mock(JoynrMessageProcessor.class);
when(processorMock.processIncoming(any(ImmutableMessage.class))).then(returnsFirstArg());
subject = new MqttMessagingSkeleton(ownAddress, maxIncomingMqttRequests, messageRouter, mqttClientFactory, mqttTopicPrefixProvider, new NoOpRawMessagingPreprocessor(), Sets.newHashSet(processorMock), mqttStatusReceiver);
ImmutableMessage rqMessage = createTestRequestMessage();
subject.transmit(rqMessage.getSerializedMessage(), failIfCalledAction);
ArgumentCaptor<ImmutableMessage> argCaptor = ArgumentCaptor.forClass(ImmutableMessage.class);
verify(processorMock).processIncoming(argCaptor.capture());
Assert.assertArrayEquals(rqMessage.getSerializedMessage(), argCaptor.getValue().getSerializedMessage());
}
use of io.joynr.messaging.NoOpRawMessagingPreprocessor in project joynr by bmwcarit.
the class SharedSubscriptionsMqttMessagingSkeletonTest method createAndInitSkeleton.
private void createAndInitSkeleton(String channelId) {
subject = new SharedSubscriptionsMqttMessagingSkeleton(ownAddress, maxMqttMessagesInQueue, backpressureEnabled, backpressureIncomingMqttRequestsUpperThreshold, backpressureIncomingMqttRequestsLowerThreshold, replyToAddress, messageRouter, mqttClientFactory, channelId, mqttTopicPrefixProvider, new NoOpRawMessagingPreprocessor(), new HashSet<JoynrMessageProcessor>(), mqttStatusReceiver);
subject.init();
verify(mqttClient).subscribe(startsWith("$share:"));
}
Aggregations