use of io.joynr.jeeintegration.DefaultJoynrRuntimeFactory 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);
}
Aggregations