Search in sources :

Example 1 with DefaultJoynrRuntimeFactory

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);
}
Also used : NoOpRawMessagingPreprocessor(io.joynr.messaging.NoOpRawMessagingPreprocessor) ScheduledExecutorService(java.util.concurrent.ScheduledExecutorService) MqttClientIdProvider(io.joynr.messaging.mqtt.MqttClientIdProvider) JoynrMessageProcessor(io.joynr.messaging.JoynrMessageProcessor) NoOpRawMessagingPreprocessor(io.joynr.messaging.NoOpRawMessagingPreprocessor) RawMessagingPreprocessor(io.joynr.messaging.RawMessagingPreprocessor) Field(java.lang.reflect.Field) DefaultJoynrRuntimeFactory(io.joynr.jeeintegration.DefaultJoynrRuntimeFactory) BeanManager(javax.enterprise.inject.spi.BeanManager)

Aggregations

DefaultJoynrRuntimeFactory (io.joynr.jeeintegration.DefaultJoynrRuntimeFactory)1 JoynrMessageProcessor (io.joynr.messaging.JoynrMessageProcessor)1 NoOpRawMessagingPreprocessor (io.joynr.messaging.NoOpRawMessagingPreprocessor)1 RawMessagingPreprocessor (io.joynr.messaging.RawMessagingPreprocessor)1 MqttClientIdProvider (io.joynr.messaging.mqtt.MqttClientIdProvider)1 Field (java.lang.reflect.Field)1 ScheduledExecutorService (java.util.concurrent.ScheduledExecutorService)1 BeanManager (javax.enterprise.inject.spi.BeanManager)1