Search in sources :

Example 11 with AtmosphereMessagingModule

use of io.joynr.messaging.AtmosphereMessagingModule in project joynr by bmwcarit.

the class MyRadioConsumerApplication method getRuntimeModule.

private static Module getRuntimeModule(String transport, String host, int port, Properties joynrConfig) {
    Module runtimeModule;
    if (transport != null) {
        if (transport.contains("websocket")) {
            joynrConfig.setProperty(WebsocketModule.PROPERTY_WEBSOCKET_MESSAGING_HOST, host);
            joynrConfig.setProperty(WebsocketModule.PROPERTY_WEBSOCKET_MESSAGING_PORT, "" + port);
            joynrConfig.setProperty(WebsocketModule.PROPERTY_WEBSOCKET_MESSAGING_PROTOCOL, "ws");
            joynrConfig.setProperty(WebsocketModule.PROPERTY_WEBSOCKET_MESSAGING_PATH, "");
            runtimeModule = new LibjoynrWebSocketRuntimeModule();
        } else {
            runtimeModule = new CCInProcessRuntimeModule();
        }
        Module backendTransportModules = Modules.EMPTY_MODULE;
        if (transport.contains("http")) {
            backendTransportModules = Modules.combine(backendTransportModules, new AtmosphereMessagingModule());
        }
        if (transport.contains("mqtt")) {
            joynrConfig.put("joynr.messaging.mqtt.brokerUri", "tcp://localhost:1883");
            joynrConfig.put(MessagingPropertyKeys.PROPERTY_MESSAGING_PRIMARYGLOBALTRANSPORT, "mqtt");
            backendTransportModules = Modules.combine(backendTransportModules, new MqttPahoModule());
        }
        return Modules.override(runtimeModule).with(backendTransportModules);
    }
    return Modules.override(new CCInProcessRuntimeModule()).with(new MqttPahoModule());
}
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) AtmosphereMessagingModule(io.joynr.messaging.AtmosphereMessagingModule) MqttPahoModule(io.joynr.messaging.mqtt.paho.client.MqttPahoModule) LibjoynrWebSocketRuntimeModule(io.joynr.runtime.LibjoynrWebSocketRuntimeModule) CCInProcessRuntimeModule(io.joynr.runtime.CCInProcessRuntimeModule) JoynrApplicationModule(io.joynr.runtime.JoynrApplicationModule) WebsocketModule(io.joynr.messaging.websocket.WebsocketModule) AtmosphereMessagingModule(io.joynr.messaging.AtmosphereMessagingModule)

Example 12 with AtmosphereMessagingModule

use of io.joynr.messaging.AtmosphereMessagingModule in project joynr by bmwcarit.

the class UrlResolverTest method setUp.

@Before
public void setUp() throws Exception {
    Properties properties = new Properties();
    properties.put(MessagingPropertyKeys.CHANNELID, channelId);
    Injector injector = Guice.createInjector(new JoynrPropertiesModule(properties), new MessagingTestModule(), new AtmosphereMessagingModule(), new AbstractModule() {

        @Override
        protected void configure() {
            bind(RequestConfig.class).toProvider(HttpDefaultRequestConfigProvider.class).in(Singleton.class);
            bind(MessageRouter.class).toInstance(mockMessageRouter);
            Multibinder.newSetBinder(binder(), new TypeLiteral<JoynrMessageProcessor>() {
            });
        }
    });
    urlResolver = injector.getInstance(UrlResolver.class);
}
Also used : RequestConfig(org.apache.http.client.config.RequestConfig) TypeLiteral(com.google.inject.TypeLiteral) Injector(com.google.inject.Injector) JoynrPropertiesModule(io.joynr.common.JoynrPropertiesModule) Singleton(com.google.inject.Singleton) Properties(java.util.Properties) MessagingTestModule(io.joynr.messaging.MessagingTestModule) AtmosphereMessagingModule(io.joynr.messaging.AtmosphereMessagingModule) AbstractModule(com.google.inject.AbstractModule) Before(org.junit.Before)

Example 13 with AtmosphereMessagingModule

use of io.joynr.messaging.AtmosphereMessagingModule in project joynr by bmwcarit.

the class HttpCommunicationManagerTest method setUp.

@Before
@edu.umd.cs.findbugs.annotations.SuppressWarnings(value = "ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD", justification = "correct use of RestAssured API")
public void setUp() throws Exception {
    RestAssured.port = port;
    String basePath = "/bounceproxy/";
    RestAssured.basePath = basePath;
    bounceProxyUrlString = "http://localhost:" + port + basePath;
    Properties properties = new Properties();
    properties.put(MessagingPropertyKeys.CHANNELID, testChannelId);
    properties.put(MessagingPropertyKeys.BOUNCE_PROXY_URL, bounceProxyUrlString);
    Injector injector = Guice.createInjector(new JoynrPropertiesModule(properties), new MessagingTestModule(), new AtmosphereMessagingModule(), new AbstractModule() {

        @Override
        protected void configure() {
            bind(RequestConfig.class).toProvider(HttpDefaultRequestConfigProvider.class).in(Singleton.class);
            bind(MessageRouter.class).toInstance(mockMessageRouter);
            Multibinder.newSetBinder(binder(), new TypeLiteral<JoynrMessageProcessor>() {
            });
        }
    });
    longpollingMessageReceiver = injector.getInstance(LongPollingMessageReceiver.class);
}
Also used : RequestConfig(org.apache.http.client.config.RequestConfig) TypeLiteral(com.google.inject.TypeLiteral) Injector(com.google.inject.Injector) JoynrPropertiesModule(io.joynr.common.JoynrPropertiesModule) Singleton(com.google.inject.Singleton) Matchers.containsString(org.hamcrest.Matchers.containsString) Properties(java.util.Properties) MessagingTestModule(io.joynr.messaging.MessagingTestModule) AtmosphereMessagingModule(io.joynr.messaging.AtmosphereMessagingModule) AbstractModule(com.google.inject.AbstractModule) Before(org.junit.Before)

Aggregations

AtmosphereMessagingModule (io.joynr.messaging.AtmosphereMessagingModule)13 Module (com.google.inject.Module)10 CCInProcessRuntimeModule (io.joynr.runtime.CCInProcessRuntimeModule)10 WebsocketModule (io.joynr.messaging.websocket.WebsocketModule)7 MqttPahoModule (io.joynr.messaging.mqtt.paho.client.MqttPahoModule)6 JoynrApplicationModule (io.joynr.runtime.JoynrApplicationModule)6 LibjoynrWebSocketRuntimeModule (io.joynr.runtime.LibjoynrWebSocketRuntimeModule)6 JoynrInjectorFactory (io.joynr.runtime.JoynrInjectorFactory)5 Properties (java.util.Properties)5 StaticDomainAccessControlProvisioningModule (io.joynr.accesscontrol.StaticDomainAccessControlProvisioningModule)4 Injector (com.google.inject.Injector)3 DummyJoynrApplication (io.joynr.integration.util.DummyJoynrApplication)3 AbstractModule (com.google.inject.AbstractModule)2 Singleton (com.google.inject.Singleton)2 TypeLiteral (com.google.inject.TypeLiteral)2 JoynrPropertiesModule (io.joynr.common.JoynrPropertiesModule)2 MessagingTestModule (io.joynr.messaging.MessagingTestModule)2 AbstractJoynrApplication (io.joynr.runtime.AbstractJoynrApplication)2 CCWebSocketRuntimeModule (io.joynr.runtime.CCWebSocketRuntimeModule)2 JoynrApplication (io.joynr.runtime.JoynrApplication)2