use of io.joynr.runtime.JoynrInjectorFactory in project joynr by bmwcarit.
the class IltConsumerTest method getRuntime.
protected static JoynrRuntime getRuntime(Properties joynrConfig, Module... modules) {
LOG.info("getRuntime: Entering");
providerDomain = joynrConfig.getProperty("provider.domain");
LOG.info("getRuntime: providerDomain = " + providerDomain);
Properties appConfig = new Properties();
appConfig.setProperty(INTER_LANGUAGE_PROVIDER_DOMAIN, providerDomain);
Module modulesWithRuntime = getRuntimeModule(joynrConfig);
IltDummyApplication application = (IltDummyApplication) new JoynrInjectorFactory(joynrConfig, modulesWithRuntime).createApplication(IltDummyApplication.class, appConfig);
objectMapper = application.getObjectMapper();
LOG.info("getRuntime: Leaving");
return application.getRuntime();
}
use of io.joynr.runtime.JoynrInjectorFactory in project joynr by bmwcarit.
the class EchoProviderApplication method createJoynrApplication.
private static JoynrApplication createJoynrApplication() throws Exception {
Module runtimeModule = Modules.override(getRuntimeModule()).with(getBackendModule());
Properties joynrConfig = createJoynrConfig();
Properties appConfig = createAppConfig();
JoynrInjectorFactory injectorFactory = new JoynrInjectorFactory(joynrConfig, runtimeModule, new StaticDomainAccessControlProvisioningModule());
JoynrApplication joynrApplication = injectorFactory.createApplication(new JoynrApplicationModule(EchoProviderApplication.class, appConfig));
return joynrApplication;
}
use of io.joynr.runtime.JoynrInjectorFactory in project joynr by bmwcarit.
the class ShortCircuitTest method setup.
@Before
public void setup() throws Exception {
Module runtimeModule = Modules.override(new CCInProcessRuntimeModule()).with(new TestGlobalAddressModule());
Properties joynrConfig = new Properties();
DummyJoynrApplication application = (DummyJoynrApplication) new JoynrInjectorFactory(joynrConfig, runtimeModule).createApplication(DummyJoynrApplication.class);
runtime = application.getRuntime();
DiscoveryQos discoveryQos = new DiscoveryQos(CONST_DEFAULT_TEST_TIMEOUT, ArbitrationStrategy.HighestPriority, DiscoveryQos.NO_MAX_AGE, DiscoveryScope.LOCAL_ONLY);
ProxyBuilder<EchoProxy> proxyBuilder = runtime.getProxyBuilder(DOMAIN, EchoProxy.class).setDiscoveryQos(discoveryQos);
echoProxy = proxyBuilder.build();
EchoProvider echoProvider = new EchoProviderImpl();
ProviderQos providerQos = new ProviderQos();
providerQos.setPriority(System.currentTimeMillis());
providerQos.setScope(ProviderScope.LOCAL);
runtime.registerProvider(DOMAIN, echoProvider, providerQos);
// warmup
for (int i = 0; i < 100; i++) {
echoProxy.echoString("warmup");
echoProxy.echoByteArray(new Byte[1]);
}
}
use of io.joynr.runtime.JoynrInjectorFactory in project joynr by bmwcarit.
the class ConsumerApplication method main.
/**
* Main method.
*
* @throws IOException
*/
public static void main(String[] args) throws IOException {
if (args.length != 1 && args.length != 2) {
LOG.error("USAGE: java {} <provider-domain> [websocket]", ConsumerApplication.class.getName());
return;
}
String providerDomain = args[0];
LOG.debug("Searching for providers on domain \"{}\"", providerDomain);
Properties joynrConfig = new Properties();
Module runtimeModule = getRuntimeModule(args, joynrConfig);
LOG.debug("Using the following runtime module: " + runtimeModule.getClass().getSimpleName());
LOG.debug("Searching for providers on domain \"{}\"", providerDomain);
joynrConfig.setProperty(MessagingPropertyKeys.PERSISTENCE_FILE, STATIC_PERSISTENCE_FILE);
joynrConfig.setProperty(PROPERTY_JOYNR_DOMAIN_LOCAL, providerDomain);
Properties appConfig = new Properties();
appConfig.setProperty(SYSTEMINTEGRATIONTEST_PROVIDER_DOMAIN, providerDomain);
JoynrApplication myConsumerApp = new JoynrInjectorFactory(joynrConfig, runtimeModule).createApplication(new JoynrApplicationModule(ConsumerApplication.class, appConfig));
myConsumerApp.run();
myConsumerApp.shutdown();
}
use of io.joynr.runtime.JoynrInjectorFactory in project joynr by bmwcarit.
the class DefaultJoynrRuntimeFactory method getInjector.
@Override
public Injector getInjector() {
if (fInjector == null) {
Module jeeModule = override(new CCInProcessRuntimeModule()).with(new JeeJoynrIntegrationModule(scheduledExecutorService));
Module finalModule = override(jeeModule).with(new AbstractModule() {
@Override
protected void configure() {
bind(RawMessagingPreprocessor.class).toInstance(rawMessagePreprocessor);
if (mqttClientIdProvider != null) {
bind(MqttClientIdProvider.class).toInstance(mqttClientIdProvider);
}
bind(MqttStatusReceiver.class).toInstance(mqttStatusReceiver);
bind(StatusReceiver.class).toInstance(statusReceiver);
}
});
fInjector = new JoynrInjectorFactory(joynrProperties, new StaticDomainAccessControlProvisioningModule(), getMessageProcessorsModule(), finalModule).getInjector();
}
return fInjector;
}
Aggregations