Search in sources :

Example 6 with StaticDomainAccessControlProvisioningModule

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;
}
Also used : Module(com.google.inject.Module) MqttPahoModule(io.joynr.messaging.mqtt.paho.client.MqttPahoModule) CCInProcessRuntimeModule(io.joynr.runtime.CCInProcessRuntimeModule) JoynrApplicationModule(io.joynr.runtime.JoynrApplicationModule) StaticDomainAccessControlProvisioningModule(io.joynr.accesscontrol.StaticDomainAccessControlProvisioningModule) Properties(java.util.Properties) StaticDomainAccessControlProvisioningModule(io.joynr.accesscontrol.StaticDomainAccessControlProvisioningModule) JoynrApplicationModule(io.joynr.runtime.JoynrApplicationModule) JoynrInjectorFactory(io.joynr.runtime.JoynrInjectorFactory) JoynrApplication(io.joynr.runtime.JoynrApplication) AbstractJoynrApplication(io.joynr.runtime.AbstractJoynrApplication)

Example 7 with StaticDomainAccessControlProvisioningModule

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;
}
Also used : CCInProcessRuntimeModule(io.joynr.runtime.CCInProcessRuntimeModule) Module(com.google.inject.Module) StaticDomainAccessControlProvisioningModule(io.joynr.accesscontrol.StaticDomainAccessControlProvisioningModule) CCInProcessRuntimeModule(io.joynr.runtime.CCInProcessRuntimeModule) AbstractModule(com.google.inject.AbstractModule) StaticDomainAccessControlProvisioningModule(io.joynr.accesscontrol.StaticDomainAccessControlProvisioningModule) AbstractModule(com.google.inject.AbstractModule) JoynrInjectorFactory(io.joynr.runtime.JoynrInjectorFactory)

Example 8 with StaticDomainAccessControlProvisioningModule

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");
}
Also used : Properties(java.util.Properties) StaticDomainAccessControlProvisioningModule(io.joynr.accesscontrol.StaticDomainAccessControlProvisioningModule) Before(org.junit.Before)

Example 9 with StaticDomainAccessControlProvisioningModule

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");
}
Also used : MessagingQos(io.joynr.messaging.MessagingQos) DefaulttestProvider(joynr.tests.DefaulttestProvider) Properties(java.util.Properties) StaticDomainAccessControlProvisioningModule(io.joynr.accesscontrol.StaticDomainAccessControlProvisioningModule) ProviderQos(joynr.types.ProviderQos) DiscoveryQos(io.joynr.arbitration.DiscoveryQos) Before(org.junit.Before)

Example 10 with StaticDomainAccessControlProvisioningModule

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);
}
Also used : DefaulttestProvider(joynr.tests.DefaulttestProvider) Properties(java.util.Properties) StaticDomainAccessControlProvisioningModule(io.joynr.accesscontrol.StaticDomainAccessControlProvisioningModule)

Aggregations

StaticDomainAccessControlProvisioningModule (io.joynr.accesscontrol.StaticDomainAccessControlProvisioningModule)11 Properties (java.util.Properties)10 Module (com.google.inject.Module)7 JoynrInjectorFactory (io.joynr.runtime.JoynrInjectorFactory)7 AbstractJoynrApplication (io.joynr.runtime.AbstractJoynrApplication)6 CCInProcessRuntimeModule (io.joynr.runtime.CCInProcessRuntimeModule)6 JoynrApplication (io.joynr.runtime.JoynrApplication)6 JoynrApplicationModule (io.joynr.runtime.JoynrApplicationModule)6 WebsocketModule (io.joynr.messaging.websocket.WebsocketModule)5 LibjoynrWebSocketRuntimeModule (io.joynr.runtime.LibjoynrWebSocketRuntimeModule)5 AtmosphereMessagingModule (io.joynr.messaging.AtmosphereMessagingModule)4 MqttPahoModule (io.joynr.messaging.mqtt.paho.client.MqttPahoModule)4 CCWebSocketRuntimeModule (io.joynr.runtime.CCWebSocketRuntimeModule)2 DefaulttestProvider (joynr.tests.DefaulttestProvider)2 Before (org.junit.Before)2 AbstractModule (com.google.inject.AbstractModule)1 DiscoveryQos (io.joynr.arbitration.DiscoveryQos)1 SubscriptionTestsProviderImpl (io.joynr.dispatching.subscription.SubscriptionTestsProviderImpl)1 MessagingQos (io.joynr.messaging.MessagingQos)1 ProviderQos (joynr.types.ProviderQos)1