use of io.joynr.accesscontrol.StaticDomainAccessControlProvisioningModule 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.accesscontrol.StaticDomainAccessControlProvisioningModule 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;
}
use of io.joynr.accesscontrol.StaticDomainAccessControlProvisioningModule in project joynr by bmwcarit.
the class AbstractProviderProxyEnd2EndTest method baseSetup.
@Before
public void baseSetup() throws Exception {
MockitoAnnotations.initMocks(this);
// prints the tests name in the log so we know what we are testing
String methodName = name.getMethodName();
logger.info(methodName + " setup beginning...");
domain = "ProviderProxyEnd2EndTest." + name.getMethodName() + System.currentTimeMillis();
domainAsync = domain + "Async";
provisionPermissiveAccessControlEntry(domain, ProviderAnnotations.getInterfaceName(TestProvider.class));
provisionPermissiveAccessControlEntry(domainAsync, ProviderAnnotations.getInterfaceName(TestProvider.class));
// use channelNames = test name
String channelIdProvider = "JavaTest-" + methodName + UUID.randomUUID().getLeastSignificantBits() + "-end2endTestProvider";
String channelIdConsumer = "JavaTest-" + methodName + UUID.randomUUID().getLeastSignificantBits() + "-end2endConsumer";
Properties joynrConfigProvider = PropertyLoader.loadProperties("testMessaging.properties");
joynrConfigProvider.put(AbstractJoynrApplication.PROPERTY_JOYNR_DOMAIN_LOCAL, "localdomain." + UUID.randomUUID().toString());
joynrConfigProvider.put(MessagingPropertyKeys.CHANNELID, channelIdProvider);
joynrConfigProvider.put(MessagingPropertyKeys.RECEIVERID, UUID.randomUUID().toString());
joynrConfigProvider.put(ConfigurableMessagingSettings.PROPERTY_MAX_MESSAGE_SIZE, MAX_MESSAGE_SIZE);
providerRuntime = getRuntime(joynrConfigProvider, getSubscriptionPublisherFactoryModule(), new StaticDomainAccessControlProvisioningModule());
if (providerRuntime != null) {
createdRuntimes.add(providerRuntime);
}
Properties joynrConfigConsumer = PropertyLoader.loadProperties("testMessaging.properties");
joynrConfigConsumer.put(AbstractJoynrApplication.PROPERTY_JOYNR_DOMAIN_LOCAL, "localdomain." + UUID.randomUUID().toString());
joynrConfigConsumer.put(MessagingPropertyKeys.CHANNELID, channelIdConsumer);
joynrConfigConsumer.put(MessagingPropertyKeys.RECEIVERID, UUID.randomUUID().toString());
joynrConfigConsumer.put(ConfigurableMessagingSettings.PROPERTY_MAX_MESSAGE_SIZE, MAX_MESSAGE_SIZE);
consumerRuntime = getRuntime(joynrConfigConsumer, getSubscriptionPublisherFactoryModule());
if (consumerRuntime != null) {
createdRuntimes.add(consumerRuntime);
}
provider = new TestProvider();
testProviderQos.setPriority(System.currentTimeMillis());
providerAsync = new TestAsyncProviderImpl();
// check that registerProvider does not block
long startTime = System.currentTimeMillis();
providerRuntime.registerProvider(domain, provider, testProviderQos).get(CONST_DEFAULT_TEST_TIMEOUT);
long endTime = System.currentTimeMillis();
timeTookToRegisterProvider = endTime - startTime;
providerRuntime.registerProvider(domainAsync, providerAsync, testProviderQos).get(CONST_DEFAULT_TEST_TIMEOUT);
// this sleep greatly speeds up the tests (400 ms vs 2500 / test) by
// making sure the channel is created before first messages sent.
Thread.sleep(100);
logger.info("setup finished");
}
use of io.joynr.accesscontrol.StaticDomainAccessControlProvisioningModule in project joynr by bmwcarit.
the class AbstractSSLEnd2EndTest method setup.
@Before
public void setup() throws Exception {
MockitoAnnotations.initMocks(this);
String methodName = name.getMethodName();
logger.info("{} setup beginning...", methodName);
domain = "SSLEnd2EndTest." + methodName + System.currentTimeMillis();
provisionPermissiveAccessControlEntry(domain, ProviderAnnotations.getInterfaceName(DefaulttestProvider.class));
// use channelNames = test name
String channelIdProvider = "JavaTest-" + methodName + UUID.randomUUID().getLeastSignificantBits() + "-end2endTestProvider";
String channelIdConsumer = "JavaTest-" + methodName + UUID.randomUUID().getLeastSignificantBits() + "-end2endConsumer";
Properties joynrConfigProvider = PropertyLoader.loadProperties("testMessaging.properties");
joynrConfigProvider.put(AbstractJoynrApplication.PROPERTY_JOYNR_DOMAIN_LOCAL, "localdomain." + UUID.randomUUID().toString());
joynrConfigProvider.put(MessagingPropertyKeys.CHANNELID, channelIdProvider);
joynrConfigProvider.put(MessagingPropertyKeys.RECEIVERID, UUID.randomUUID().toString());
providerRuntime = getRuntime(joynrConfigProvider, new StaticDomainAccessControlProvisioningModule());
Properties joynrConfigConsumer = PropertyLoader.loadProperties("testMessaging.properties");
joynrConfigConsumer.put(AbstractJoynrApplication.PROPERTY_JOYNR_DOMAIN_LOCAL, "localdomain." + UUID.randomUUID().toString());
joynrConfigConsumer.put(MessagingPropertyKeys.CHANNELID, channelIdConsumer);
joynrConfigConsumer.put(MessagingPropertyKeys.RECEIVERID, UUID.randomUUID().toString());
consumerRuntime = getRuntime(joynrConfigConsumer);
provider = new DefaulttestProvider();
ProviderQos providerQos = new ProviderQos();
providerRuntime.registerProvider(domain, provider, providerQos);
messagingQos = new MessagingQos(5000);
discoveryQos = new DiscoveryQos(5000, ArbitrationStrategy.HighestPriority, Long.MAX_VALUE);
// Make sure the channel is created before the first messages sent.
Thread.sleep(200);
logger.info("setup finished");
}
use of io.joynr.accesscontrol.StaticDomainAccessControlProvisioningModule in project joynr by bmwcarit.
the class AbstractBroadcastEnd2EndTest method setupProviderRuntime.
private void setupProviderRuntime(String methodName) throws InterruptedException, ApplicationException {
Properties factoryPropertiesProvider;
String channelIdProvider = "JavaTest-" + UUID.randomUUID().getLeastSignificantBits() + "-Provider-BroadcastEnd2EndTest-" + methodName;
factoryPropertiesProvider = PropertyLoader.loadProperties("testMessaging.properties");
factoryPropertiesProvider.put(MessagingPropertyKeys.CHANNELID, channelIdProvider);
factoryPropertiesProvider.put(MessagingPropertyKeys.RECEIVERID, UUID.randomUUID().toString());
factoryPropertiesProvider.put(AbstractJoynrApplication.PROPERTY_JOYNR_DOMAIN_LOCAL, domain);
providerRuntime = getRuntime(factoryPropertiesProvider, getSubscriptionPublisherFactoryModule(), new StaticDomainAccessControlProvisioningModule());
provider = new DefaulttestProvider();
// .waitForFullRegistration(CONST_DEFAULT_TEST_TIMEOUT);
Future<Void> voidFuture = providerRuntime.registerProvider(domain, provider, providerQos);
voidFuture.get(CONST_DEFAULT_TEST_TIMEOUT);
}
Aggregations