Search in sources :

Example 41 with MessagingQos

use of io.joynr.messaging.MessagingQos 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 42 with MessagingQos

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

the class AbstractSubscriptionEnd2EndTest method testSubscribeToNonExistentDomain.

@edu.umd.cs.findbugs.annotations.SuppressWarnings(value = "NP_NULL_ON_SOME_PATH_EXCEPTION", justification = "NPE in test would fail test")
@SuppressWarnings("unchecked")
@Ignore
@Test
public void testSubscribeToNonExistentDomain() throws InterruptedException {
    AttributeSubscriptionListener<Integer> integerListener = mock(AttributeSubscriptionListener.class);
    testProxy proxyToNonexistentDomain = null;
    try {
        ProxyBuilder<testProxy> proxyBuilder;
        String nonExistentDomain = UUID.randomUUID().toString() + "-domaindoesnotexist-end2end";
        MessagingQos messagingQos = new MessagingQos(20000);
        DiscoveryQos discoveryQos = new DiscoveryQos(50000, ArbitrationStrategy.HighestPriority, Long.MAX_VALUE);
        proxyBuilder = consumerRuntime.getProxyBuilder(nonExistentDomain, testProxy.class);
        proxyToNonexistentDomain = proxyBuilder.setMessagingQos(messagingQos).setDiscoveryQos(discoveryQos).build();
    } catch (DiscoveryException e) {
        logger.error(e.getMessage(), e);
    } catch (JoynrIllegalStateException e) {
        logger.error(e.getMessage(), e);
    }
    // This should not cause an exception
    PeriodicSubscriptionQos subscriptionQos = new PeriodicSubscriptionQos();
    subscriptionQos.setPeriodMs(PERIOD_MS);
    subscriptionQos.setValidityMs(30000);
    subscriptionQos.setAlertAfterIntervalMs(0);
    subscriptionQos.setPublicationTtlMs(0);
    Future<String> subscriptionId = proxyToNonexistentDomain.subscribeToTestAttribute(integerListener, subscriptionQos);
    Thread.sleep(4000);
    try {
        proxyToNonexistentDomain.unsubscribeFromTestAttribute(subscriptionId.get(FUTURE_SUBSCRIPTION_ID_TIMEOUTMS));
    } catch (JoynrRuntimeException | ApplicationException e) {
        assertTrue(e.getMessage(), e != null);
    }
    getSubscriptionTestsPublisher().waitForAttributeUnsubscription("testAttribute");
}
Also used : joynr.tests.testProxy(joynr.tests.testProxy) JoynrRuntimeException(io.joynr.exceptions.JoynrRuntimeException) DiscoveryQos(io.joynr.arbitration.DiscoveryQos) JoynrIllegalStateException(io.joynr.exceptions.JoynrIllegalStateException) PeriodicSubscriptionQos(joynr.PeriodicSubscriptionQos) MessagingQos(io.joynr.messaging.MessagingQos) ApplicationException(joynr.exceptions.ApplicationException) DiscoveryException(io.joynr.exceptions.DiscoveryException) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 43 with MessagingQos

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

the class AccessControllerEnd2EndTest method sendProvisionedEntriesToGDAC.

private void sendProvisionedEntriesToGDAC(List<DomainRoleEntry> domainRoleEntries, List<MasterAccessControlEntry> masterAccessControlEntries, List<MasterAccessControlEntry> mediatorAccessControlEntries, List<OwnerAccessControlEntry> ownerAccessControlEntries) {
    DiscoveryQos discoveryQos = new DiscoveryQos();
    discoveryQos.setDiscoveryScope(DiscoveryScope.GLOBAL_ONLY);
    discoveryQos.setArbitrationStrategy(ArbitrationStrategy.HighestPriority);
    discoveryQos.setDiscoveryTimeoutMs(DISCOVERY_TIMEOUT);
    MessagingQos messagingQos = new MessagingQos();
    messagingQos.setTtl_ms(MESSAGING_TTL);
    GlobalDomainAccessControlListEditorProxy gdacListEditorProxy = runtime.getProxyBuilder(GDAC_DOMAIN, GlobalDomainAccessControlListEditorProxy.class).setDiscoveryQos(discoveryQos).setMessagingQos(messagingQos).build();
    GlobalDomainRoleControllerProxy gdrcProxy = runtime.getProxyBuilder(GDAC_DOMAIN, GlobalDomainRoleControllerProxy.class).setDiscoveryQos(discoveryQos).setMessagingQos(messagingQos).build();
    for (DomainRoleEntry entry : domainRoleEntries) {
        assertTrue(gdrcProxy.updateDomainRole(entry));
    }
    for (MasterAccessControlEntry entry : masterAccessControlEntries) {
        assertTrue(gdacListEditorProxy.updateMasterAccessControlEntry(entry));
    }
    for (MasterAccessControlEntry entry : mediatorAccessControlEntries) {
        assertTrue(gdacListEditorProxy.updateMediatorAccessControlEntry(entry));
    }
    for (OwnerAccessControlEntry entry : ownerAccessControlEntries) {
        assertTrue(gdacListEditorProxy.updateOwnerAccessControlEntry(entry));
    }
}
Also used : MessagingQos(io.joynr.messaging.MessagingQos) GlobalDomainAccessControlListEditorProxy(joynr.infrastructure.GlobalDomainAccessControlListEditorProxy) MasterAccessControlEntry(joynr.infrastructure.DacTypes.MasterAccessControlEntry) OwnerAccessControlEntry(joynr.infrastructure.DacTypes.OwnerAccessControlEntry) DomainRoleEntry(joynr.infrastructure.DacTypes.DomainRoleEntry) GlobalDomainRoleControllerProxy(joynr.infrastructure.GlobalDomainRoleControllerProxy) DiscoveryQos(io.joynr.arbitration.DiscoveryQos)

Example 44 with MessagingQos

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

the class AccessControllerEnd2EndTest method createProxy.

private testProxy createProxy(JoynrRuntime runtime) {
    DiscoveryQos discoveryQos = new DiscoveryQos();
    discoveryQos.setDiscoveryScope(DiscoveryScope.LOCAL_ONLY);
    discoveryQos.setArbitrationStrategy(ArbitrationStrategy.HighestPriority);
    discoveryQos.setDiscoveryTimeoutMs(DISCOVERY_TIMEOUT);
    MessagingQos messagingQos = new MessagingQos();
    messagingQos.setTtl_ms(MESSAGING_TTL);
    final Future<Void> future = new Future<Void>();
    testProxy testProxy;
    testProxy = runtime.getProxyBuilder(TEST_DOMAIN, testProxy.class).setDiscoveryQos(discoveryQos).setMessagingQos(messagingQos).build(new ProxyCreatedCallback<testProxy>() {

        @Override
        public void onProxyCreationFinished(testProxy result) {
            future.onSuccess(null);
        }

        @Override
        public void onProxyCreationError(JoynrRuntimeException error) {
            future.onFailure(error);
        }
    });
    try {
        future.get(5000);
    } catch (Exception e) {
        Assert.fail("Unexpected exception from ProxyCreatedCallback: " + e);
    }
    return testProxy;
}
Also used : MessagingQos(io.joynr.messaging.MessagingQos) joynr.tests.testProxy(joynr.tests.testProxy) Future(io.joynr.proxy.Future) ProxyCreatedCallback(io.joynr.proxy.ProxyBuilder.ProxyCreatedCallback) JoynrRuntimeException(io.joynr.exceptions.JoynrRuntimeException) DiscoveryQos(io.joynr.arbitration.DiscoveryQos) JoynrMessageNotSentException(io.joynr.exceptions.JoynrMessageNotSentException) ExpectedException(org.junit.rules.ExpectedException) JoynrRuntimeException(io.joynr.exceptions.JoynrRuntimeException)

Example 45 with MessagingQos

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

the class AbstractLocalCommunicationTest method setUp.

@Before
public void setUp() throws Exception {
    MockitoAnnotations.initMocks(this);
    logger.info("setup beginning...");
    String channelId = UUID.randomUUID().toString() + "-end2endA";
    Properties customProperties = new Properties();
    customProperties.put(MessagingPropertyKeys.CHANNELID, channelId);
    runtimeA = getRuntime(customProperties);
    provider = new SubscriptionTestsProviderImpl();
    domain = "TestDomain" + System.currentTimeMillis();
    ProviderQos providerQos = new ProviderQos();
    runtimeA.registerProvider(domain, provider, providerQos);
    ProxyBuilder<testProxy> proxyBuilder;
    MessagingQos messagingQos = new MessagingQos(20000);
    DiscoveryQos discoveryQos = new DiscoveryQos(50000, ArbitrationStrategy.HighestPriority, Long.MAX_VALUE);
    proxyBuilder = runtimeA.getProxyBuilder(domain, testProxy.class);
    proxy = proxyBuilder.setMessagingQos(messagingQos).setDiscoveryQos(discoveryQos).build();
}
Also used : MessagingQos(io.joynr.messaging.MessagingQos) SubscriptionTestsProviderImpl(io.joynr.dispatching.subscription.SubscriptionTestsProviderImpl) joynr.tests.testProxy(joynr.tests.testProxy) Properties(java.util.Properties) ProviderQos(joynr.types.ProviderQos) DiscoveryQos(io.joynr.arbitration.DiscoveryQos) Before(org.junit.Before)

Aggregations

MessagingQos (io.joynr.messaging.MessagingQos)55 Test (org.junit.Test)23 DiscoveryQos (io.joynr.arbitration.DiscoveryQos)19 MutableMessage (joynr.MutableMessage)15 JoynrRuntimeException (io.joynr.exceptions.JoynrRuntimeException)11 Matchers.anyString (org.mockito.Matchers.anyString)11 OnChangeSubscriptionQos (joynr.OnChangeSubscriptionQos)9 SubscriptionRequest (joynr.SubscriptionRequest)9 Before (org.junit.Before)8 Properties (java.util.Properties)6 ImmutableMessage (joynr.ImmutableMessage)6 Request (joynr.Request)6 Injector (com.google.inject.Injector)5 BroadcastSubscriptionRequest (joynr.BroadcastSubscriptionRequest)5 MulticastSubscriptionRequest (joynr.MulticastSubscriptionRequest)5 joynr.tests.testProxy (joynr.tests.testProxy)5 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)4 AbstractModule (com.google.inject.AbstractModule)4 IOException (java.io.IOException)4 OneWayRequest (joynr.OneWayRequest)4