Search in sources :

Example 6 with JoynrInjectorFactory

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

the class GlobalDomainAccessControllerLauncher method start.

public static GlobalDomainAccessControllerLauncher start(Properties joynrConfig) {
    JoynrInjectorFactory injectorFactory = new JoynrInjectorFactory(joynrConfig, new GlobalDomainAccessControllerModule());
    JoynrApplication domainAccessControllerLauncherApp = injectorFactory.createApplication(new JoynrApplicationModule(APP_ID, GlobalDomainAccessControllerLauncher.class));
    domainAccessControllerLauncherApp.run();
    return (GlobalDomainAccessControllerLauncher) domainAccessControllerLauncherApp;
}
Also used : JoynrApplicationModule(io.joynr.runtime.JoynrApplicationModule) JoynrInjectorFactory(io.joynr.runtime.JoynrInjectorFactory) JoynrApplication(io.joynr.runtime.JoynrApplication) AbstractJoynrApplication(io.joynr.runtime.AbstractJoynrApplication)

Example 7 with JoynrInjectorFactory

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

the class LocalDiscoveryTest method setUp.

@Before
public void setUp() {
    MockitoAnnotations.initMocks(this);
    when(localDiscoveryEntryStoreMock.hasDiscoveryEntry(any(DiscoveryEntry.class))).thenReturn(true);
    // use default freshnessUpdateIntervalMs: 3600000ms (1h)
    final LocalCapabilitiesDirectoryImpl localCapabilitiesDirectory = new LocalCapabilitiesDirectoryImpl(capabilitiesProvisioningMock, globalAddressProviderMock, localDiscoveryEntryStoreMock, globalDiscoveryEntryCacheMock, messageRouterMock, globalCapabilitiesDirectoryClientMock, expiredDiscoveryEntryCacheCleanerMock, 3600000, capabilitiesFreshnessUpdateExecutorMock, defaultDiscoveryRetryIntervalMs, shutdownNotifier);
    Module testModule = Modules.override(new CCInProcessRuntimeModule()).with(new TestGlobalAddressModule(), new AbstractModule() {

        @Override
        protected void configure() {
            bind(JoynrMessagingConnectorFactory.class).annotatedWith(Names.named("connectorFactoryMock")).toInstance(joynrMessagingConnectorFactoryMock);
            bind(LocalCapabilitiesDirectory.class).toInstance(localCapabilitiesDirectory);
            bind(LocalCapabilitiesDirectoryImpl.class).toInstance(localCapabilitiesDirectory);
            bind(ProxyInvocationHandlerFactory.class).to(ProxyInvocationHandlerFactoryImpl.class);
        }
    });
    Properties joynrProperties = new Properties();
    Injector injector = new JoynrInjectorFactory(new JoynrBaseModule(joynrProperties, testModule)).getInjector();
    runtime = injector.getInstance(JoynrRuntime.class);
}
Also used : TestGlobalAddressModule(io.joynr.messaging.routing.TestGlobalAddressModule) DiscoveryEntry(joynr.types.DiscoveryEntry) GlobalDiscoveryEntry(joynr.types.GlobalDiscoveryEntry) LocalCapabilitiesDirectoryImpl(io.joynr.capabilities.LocalCapabilitiesDirectoryImpl) JoynrBaseModule(io.joynr.runtime.JoynrBaseModule) Properties(java.util.Properties) AbstractModule(com.google.inject.AbstractModule) JoynrInjectorFactory(io.joynr.runtime.JoynrInjectorFactory) JoynrRuntime(io.joynr.runtime.JoynrRuntime) CCInProcessRuntimeModule(io.joynr.runtime.CCInProcessRuntimeModule) JoynrMessagingConnectorFactory(io.joynr.proxy.JoynrMessagingConnectorFactory) Injector(com.google.inject.Injector) Module(com.google.inject.Module) JoynrBaseModule(io.joynr.runtime.JoynrBaseModule) TestGlobalAddressModule(io.joynr.messaging.routing.TestGlobalAddressModule) CCInProcessRuntimeModule(io.joynr.runtime.CCInProcessRuntimeModule) AbstractModule(com.google.inject.AbstractModule) Before(org.junit.Before)

Example 8 with JoynrInjectorFactory

use of io.joynr.runtime.JoynrInjectorFactory 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 9 with JoynrInjectorFactory

use of io.joynr.runtime.JoynrInjectorFactory 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 10 with JoynrInjectorFactory

use of io.joynr.runtime.JoynrInjectorFactory 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)

Aggregations

JoynrInjectorFactory (io.joynr.runtime.JoynrInjectorFactory)31 Module (com.google.inject.Module)22 CCInProcessRuntimeModule (io.joynr.runtime.CCInProcessRuntimeModule)21 Properties (java.util.Properties)20 MqttPahoModule (io.joynr.messaging.mqtt.paho.client.MqttPahoModule)11 AbstractJoynrApplication (io.joynr.runtime.AbstractJoynrApplication)11 JoynrApplication (io.joynr.runtime.JoynrApplication)11 JoynrApplicationModule (io.joynr.runtime.JoynrApplicationModule)11 DummyJoynrApplication (io.joynr.integration.util.DummyJoynrApplication)10 AtmosphereMessagingModule (io.joynr.messaging.AtmosphereMessagingModule)10 LibjoynrWebSocketRuntimeModule (io.joynr.runtime.LibjoynrWebSocketRuntimeModule)10 WebsocketModule (io.joynr.messaging.websocket.WebsocketModule)9 AbstractModule (com.google.inject.AbstractModule)7 StaticDomainAccessControlProvisioningModule (io.joynr.accesscontrol.StaticDomainAccessControlProvisioningModule)7 CCWebSocketRuntimeModule (io.joynr.runtime.CCWebSocketRuntimeModule)7 Injector (com.google.inject.Injector)5 TestGlobalAddressModule (io.joynr.messaging.routing.TestGlobalAddressModule)5 JoynrRuntime (io.joynr.runtime.JoynrRuntime)5 MqttModule (io.joynr.messaging.mqtt.MqttModule)3 ClusterControllerRuntime (io.joynr.runtime.ClusterControllerRuntime)3