Search in sources :

Example 6 with CCInProcessRuntimeModule

use of io.joynr.runtime.CCInProcessRuntimeModule in project joynr by bmwcarit.

the class MqttProviderProxyEnd2EndTest method getRuntime.

@Override
protected JoynrRuntime getRuntime(Properties joynrConfig, Module... modules) {
    mqttConfig = new Properties();
    mqttConfig.put(MqttModule.PROPERTY_KEY_MQTT_BROKER_URI, "tcp://localhost:" + mqttBrokerPort);
    // test is using 2 global address typs, so need to set one of them as primary
    mqttConfig.put(MessagingPropertyKeys.PROPERTY_MESSAGING_PRIMARYGLOBALTRANSPORT, "mqtt");
    mqttConfig.put(MessagingPropertyKeys.DISCOVERYDIRECTORYURL, "tcp://localhost:" + mqttBrokerPort);
    mqttConfig.put(MessagingPropertyKeys.DOMAINACCESSCONTROLLERURL, "tcp://localhost:" + mqttBrokerPort);
    mqttConfig.put(MessagingPropertyKeys.MQTT_TOPIC_PREFIX_MULTICAST, "");
    mqttConfig.put(MessagingPropertyKeys.MQTT_TOPIC_PREFIX_REPLYTO, "replyto/");
    mqttConfig.put(MessagingPropertyKeys.MQTT_TOPIC_PREFIX_UNICAST, "");
    joynrConfig.putAll(mqttConfig);
    joynrConfig.putAll(baseTestConfig);
    Module runtimeModule = Modules.override(new CCInProcessRuntimeModule()).with(modules);
    Module modulesWithRuntime = Modules.override(runtimeModule).with(new MqttPahoModule(), new AbstractModule() {

        @Override
        protected void configure() {
            bind(RawMessagingPreprocessor.class).toInstance(new RawMessagingPreprocessor() {

                @Override
                public byte[] process(byte[] rawMessage, Map<String, Serializable> context) {
                    return rawMessage;
                }
            });
        }
    });
    DummyJoynrApplication application = (DummyJoynrApplication) new JoynrInjectorFactory(joynrConfig, modulesWithRuntime).createApplication(DummyJoynrApplication.class);
    return application.getRuntime();
}
Also used : DummyJoynrApplication(io.joynr.integration.util.DummyJoynrApplication) MqttPahoModule(io.joynr.messaging.mqtt.paho.client.MqttPahoModule) CCInProcessRuntimeModule(io.joynr.runtime.CCInProcessRuntimeModule) Properties(java.util.Properties) Module(com.google.inject.Module) MqttModule(io.joynr.messaging.mqtt.MqttModule) MqttPahoModule(io.joynr.messaging.mqtt.paho.client.MqttPahoModule) CCInProcessRuntimeModule(io.joynr.runtime.CCInProcessRuntimeModule) AbstractModule(com.google.inject.AbstractModule) RawMessagingPreprocessor(io.joynr.messaging.RawMessagingPreprocessor) Map(java.util.Map) AbstractModule(com.google.inject.AbstractModule) JoynrInjectorFactory(io.joynr.runtime.JoynrInjectorFactory)

Example 7 with CCInProcessRuntimeModule

use of io.joynr.runtime.CCInProcessRuntimeModule in project joynr by bmwcarit.

the class RoutingTableOverwriteEnd2EndTest method createRuntime.

protected JoynrRuntime createRuntime(String runtimeId, Properties additionalProperties) {
    Properties properties = new Properties();
    properties.put(MqttModule.PROPERTY_KEY_MQTT_BROKER_URI, "tcp://localhost:" + mqttBrokerPort);
    properties.put(MessagingPropertyKeys.PROPERTY_MESSAGING_PRIMARYGLOBALTRANSPORT, "mqtt");
    properties.put(MessagingPropertyKeys.DISCOVERYDIRECTORYURL, "tcp://localhost:" + mqttBrokerPort);
    properties.put(MessagingPropertyKeys.CHANNELID, runtimeId);
    properties.put(MqttModule.PROPERTY_KEY_MQTT_CLIENT_ID_PREFIX, runtimeId);
    if (additionalProperties != null) {
        properties.putAll(additionalProperties);
    }
    Module module = Modules.override(new CCInProcessRuntimeModule()).with(new MqttPahoModule());
    DummyJoynrApplication application = (DummyJoynrApplication) new JoynrInjectorFactory(properties, module).createApplication(DummyJoynrApplication.class);
    return application.getRuntime();
}
Also used : DummyJoynrApplication(io.joynr.integration.util.DummyJoynrApplication) MqttPahoModule(io.joynr.messaging.mqtt.paho.client.MqttPahoModule) CCInProcessRuntimeModule(io.joynr.runtime.CCInProcessRuntimeModule) Properties(java.util.Properties) Module(com.google.inject.Module) MqttModule(io.joynr.messaging.mqtt.MqttModule) MqttPahoModule(io.joynr.messaging.mqtt.paho.client.MqttPahoModule) CCInProcessRuntimeModule(io.joynr.runtime.CCInProcessRuntimeModule) JoynrInjectorFactory(io.joynr.runtime.JoynrInjectorFactory)

Example 8 with CCInProcessRuntimeModule

use of io.joynr.runtime.CCInProcessRuntimeModule in project joynr by bmwcarit.

the class ProxyErrorsTest method getRuntime.

protected JoynrRuntime getRuntime(Properties joynrConfig, Module... modules) {
    Module runtimeModule = new CCInProcessRuntimeModule();
    Module modulesWithRuntime = Modules.override(runtimeModule).with(modules);
    modulesWithRuntime = Modules.override(modulesWithRuntime).with(new TestGlobalAddressModule());
    DummyJoynrApplication application = (DummyJoynrApplication) new JoynrInjectorFactory(joynrConfig, modulesWithRuntime).createApplication(DummyJoynrApplication.class);
    return application.getRuntime();
}
Also used : TestGlobalAddressModule(io.joynr.messaging.routing.TestGlobalAddressModule) DummyJoynrApplication(io.joynr.integration.util.DummyJoynrApplication) CCInProcessRuntimeModule(io.joynr.runtime.CCInProcessRuntimeModule) Module(com.google.inject.Module) TestGlobalAddressModule(io.joynr.messaging.routing.TestGlobalAddressModule) CCInProcessRuntimeModule(io.joynr.runtime.CCInProcessRuntimeModule) JoynrInjectorFactory(io.joynr.runtime.JoynrInjectorFactory)

Example 9 with CCInProcessRuntimeModule

use of io.joynr.runtime.CCInProcessRuntimeModule in project joynr by bmwcarit.

the class SubscriptionEnd2EndTest method getRuntime.

@Override
protected JoynrRuntime getRuntime(Properties joynrConfig, Module... modules) {
    Module runtimeModule = Modules.override(new CCInProcessRuntimeModule()).with(new AtmosphereMessagingModule());
    Module modulesWithRuntime = Modules.override(modules).with(runtimeModule);
    DummyJoynrApplication application = (DummyJoynrApplication) new JoynrInjectorFactory(joynrConfig, modulesWithRuntime).createApplication(DummyJoynrApplication.class);
    dummyApplications.add(application);
    return application.getRuntime();
}
Also used : DummyJoynrApplication(io.joynr.integration.util.DummyJoynrApplication) CCInProcessRuntimeModule(io.joynr.runtime.CCInProcessRuntimeModule) Module(com.google.inject.Module) AtmosphereMessagingModule(io.joynr.messaging.AtmosphereMessagingModule) CCInProcessRuntimeModule(io.joynr.runtime.CCInProcessRuntimeModule) AtmosphereMessagingModule(io.joynr.messaging.AtmosphereMessagingModule) JoynrInjectorFactory(io.joynr.runtime.JoynrInjectorFactory)

Example 10 with CCInProcessRuntimeModule

use of io.joynr.runtime.CCInProcessRuntimeModule in project joynr by bmwcarit.

the class IltConsumerTest method getRuntimeModule.

private static Module getRuntimeModule(Properties joynrConfig) {
    LOG.info("getRuntimeModule: Entering");
    Module runtimeModule;
    String transport = System.getProperty("transport");
    if (transport == null) {
        throw new IllegalArgumentException("property \"transport\" not set");
    }
    LOG.info("getRuntimeModule: transport = " + transport);
    if (transport.contains("websocket")) {
        LOG.info("getRuntimeModule: websocket host = " + joynrConfig.getProperty(WebsocketModule.PROPERTY_WEBSOCKET_MESSAGING_HOST));
        LOG.info("getRuntimeModule: websocket port = " + joynrConfig.getProperty(WebsocketModule.PROPERTY_WEBSOCKET_MESSAGING_PORT));
        LOG.info("getRuntimeModule: websocket protocol = " + joynrConfig.getProperty(WebsocketModule.PROPERTY_WEBSOCKET_MESSAGING_PROTOCOL));
        LOG.info("getRuntimeModule: websocket path = " + joynrConfig.getProperty(WebsocketModule.PROPERTY_WEBSOCKET_MESSAGING_PATH));
        LOG.info("getRuntimeModule: selecting LibjoynrWebSocketRuntimeModule");
        runtimeModule = new LibjoynrWebSocketRuntimeModule();
    } else {
        LOG.info("getRuntimeModule: selecting CCInProcessRuntimeModule");
        runtimeModule = new CCInProcessRuntimeModule();
    }
    Module backendTransportModules = Modules.EMPTY_MODULE;
    if (transport.contains("http")) {
        LOG.info("getRuntimeModule: using AtmosphereMessagingModule");
        backendTransportModules = Modules.combine(backendTransportModules, new AtmosphereMessagingModule());
    }
    if (transport.contains("mqtt")) {
        LOG.info("getRuntimeModule: using MqttPahoModule");
        joynrConfig.put(MessagingPropertyKeys.PROPERTY_MESSAGING_PRIMARYGLOBALTRANSPORT, "mqtt");
        backendTransportModules = Modules.combine(backendTransportModules, new MqttPahoModule());
    }
    LOG.info("getRuntimeModule: Leaving");
    return Modules.override(runtimeModule).with(backendTransportModules);
}
Also used : LibjoynrWebSocketRuntimeModule(io.joynr.runtime.LibjoynrWebSocketRuntimeModule) MqttPahoModule(io.joynr.messaging.mqtt.paho.client.MqttPahoModule) CCInProcessRuntimeModule(io.joynr.runtime.CCInProcessRuntimeModule) Module(com.google.inject.Module) LibjoynrWebSocketRuntimeModule(io.joynr.runtime.LibjoynrWebSocketRuntimeModule) AtmosphereMessagingModule(io.joynr.messaging.AtmosphereMessagingModule) MqttPahoModule(io.joynr.messaging.mqtt.paho.client.MqttPahoModule) CCInProcessRuntimeModule(io.joynr.runtime.CCInProcessRuntimeModule) WebsocketModule(io.joynr.messaging.websocket.WebsocketModule) AtmosphereMessagingModule(io.joynr.messaging.AtmosphereMessagingModule)

Aggregations

CCInProcessRuntimeModule (io.joynr.runtime.CCInProcessRuntimeModule)20 Module (com.google.inject.Module)17 JoynrInjectorFactory (io.joynr.runtime.JoynrInjectorFactory)15 AtmosphereMessagingModule (io.joynr.messaging.AtmosphereMessagingModule)10 DummyJoynrApplication (io.joynr.integration.util.DummyJoynrApplication)8 MqttPahoModule (io.joynr.messaging.mqtt.paho.client.MqttPahoModule)8 Properties (java.util.Properties)8 JoynrApplicationModule (io.joynr.runtime.JoynrApplicationModule)7 WebsocketModule (io.joynr.messaging.websocket.WebsocketModule)6 LibjoynrWebSocketRuntimeModule (io.joynr.runtime.LibjoynrWebSocketRuntimeModule)6 AbstractModule (com.google.inject.AbstractModule)5 StaticDomainAccessControlProvisioningModule (io.joynr.accesscontrol.StaticDomainAccessControlProvisioningModule)5 TestGlobalAddressModule (io.joynr.messaging.routing.TestGlobalAddressModule)5 MqttModule (io.joynr.messaging.mqtt.MqttModule)3 AbstractJoynrApplication (io.joynr.runtime.AbstractJoynrApplication)3 JoynrApplication (io.joynr.runtime.JoynrApplication)3 Before (org.junit.Before)3 CCWebSocketRuntimeModule (io.joynr.runtime.CCWebSocketRuntimeModule)2 ProviderQos (joynr.types.ProviderQos)2 Injector (com.google.inject.Injector)1