Search in sources :

Example 36 with ProviderQos

use of joynr.types.ProviderQos in project joynr by bmwcarit.

the class RoutingTableOverwriteEnd2EndTest method createProviderQos.

protected ProviderQos createProviderQos() {
    final ProviderQos providerQos = new ProviderQos();
    providerQos.setScope(ProviderScope.GLOBAL);
    providerQos.setPriority(System.currentTimeMillis());
    return providerQos;
}
Also used : ProviderQos(joynr.types.ProviderQos)

Example 37 with ProviderQos

use of joynr.types.ProviderQos in project joynr by bmwcarit.

the class ShutdownTest method setup.

@Before
public void setup() {
    Properties factoryPropertiesProvider = new Properties();
    factoryPropertiesProvider.put(AbstractJoynrApplication.PROPERTY_JOYNR_DOMAIN_LOCAL, "localdomain");
    factoryPropertiesProvider.put(MessagingPropertyKeys.CHANNELID, "ShutdownTestChannelId");
    MockitoAnnotations.initMocks(this);
    Module runtimeModule = Modules.override(new CCInProcessRuntimeModule()).with(new TestGlobalAddressModule());
    dummyApplication = (DummyJoynrApplication) new JoynrInjectorFactory(factoryPropertiesProvider, runtimeModule).createApplication(DummyJoynrApplication.class);
    provider = new DefaulttestProvider();
    providerQos = new ProviderQos();
    providerQos.setScope(ProviderScope.LOCAL);
    providerQos.setPriority(System.currentTimeMillis());
}
Also used : TestGlobalAddressModule(io.joynr.messaging.routing.TestGlobalAddressModule) CCInProcessRuntimeModule(io.joynr.runtime.CCInProcessRuntimeModule) DefaulttestProvider(joynr.tests.DefaulttestProvider) Properties(java.util.Properties) Module(com.google.inject.Module) TestGlobalAddressModule(io.joynr.messaging.routing.TestGlobalAddressModule) CCInProcessRuntimeModule(io.joynr.runtime.CCInProcessRuntimeModule) ProviderQos(joynr.types.ProviderQos) JoynrInjectorFactory(io.joynr.runtime.JoynrInjectorFactory) Before(org.junit.Before)

Example 38 with ProviderQos

use of joynr.types.ProviderQos in project joynr by bmwcarit.

the class ShutdownTest method unregisterMultibleProvidersBeforeShutdown.

@Test
public void unregisterMultibleProvidersBeforeShutdown() throws JoynrWaitExpiredException, JoynrRuntimeException, InterruptedException, ApplicationException {
    int providercount = 10;
    JoynrProvider[] providers = new JoynrProvider[providercount];
    for (int i = 0; i < providers.length; i++) {
        providerQos = new ProviderQos();
        providerQos.setScope(ProviderScope.LOCAL);
        providerQos.setPriority(System.currentTimeMillis());
        providers[i] = new DefaulttestProvider();
        Future<Void> registerFinished = dummyApplication.getRuntime().registerProvider("ShutdownTestdomain" + i, providers[i], providerQos);
        registerFinished.get();
    }
    for (int i = 0; i < providers.length; i++) {
        dummyApplication.getRuntime().unregisterProvider("ShutdownTestdomain" + i, providers[i]);
    }
    dummyApplication.shutdown();
}
Also used : DefaulttestProvider(joynr.tests.DefaulttestProvider) JoynrProvider(io.joynr.provider.JoynrProvider) ProviderQos(joynr.types.ProviderQos) Test(org.junit.Test)

Example 39 with ProviderQos

use of joynr.types.ProviderQos in project joynr by bmwcarit.

the class ProxyErrorsTest method setUp.

@Before
public void setUp() {
    // the error callback and NoCompatibleProviderFoundException will each increment the permits.
    // The test will wait until 2 permits are available, or fail in the junit test timeout time.
    waitOnExceptionAndErrorCallbackSemaphore = new Semaphore(-1, true);
    domain = "domain-" + UUID.randomUUID().toString();
    domain2 = "domain2-" + UUID.randomUUID().toString();
    Properties joynrConfig = new Properties();
    joynrConfig.setProperty(MessagingPropertyKeys.CHANNELID, "discoverydirectory_channelid");
    // provider and proxy using same runtime to allow local-only communications
    runtime = getRuntime(joynrConfig);
    ProviderQos providerQos = new ProviderQos();
    providerQos.setScope(ProviderScope.LOCAL);
    runtime.registerProvider(domain, provider, providerQos);
    runtime.registerProvider(domain2, provider, providerQos);
    discoveryQos = new DiscoveryQos();
    discoveryQos.setDiscoveryScope(DiscoveryScope.LOCAL_ONLY);
    discoveryQos.setDiscoveryTimeoutMs(1000);
    discoveryQos.setRetryIntervalMs(100);
    callback = new ProxyCreatedCallback<ProxyErrorsTest.TestProxyWrongVersion>() {

        @Override
        public void onProxyCreationFinished(TestProxyWrongVersion result) {
            fail("proxy creation should fail with a version exception");
        }

        @Override
        public void onProxyCreationError(JoynrRuntimeException error) {
            // adds 1 of 2 permits to the semaphore. The other is provided when the exception is caught
            waitOnExceptionAndErrorCallbackSemaphore.release();
        }
    };
}
Also used : Semaphore(java.util.concurrent.Semaphore) Properties(java.util.Properties) JoynrRuntimeException(io.joynr.exceptions.JoynrRuntimeException) ProviderQos(joynr.types.ProviderQos) DiscoveryQos(io.joynr.arbitration.DiscoveryQos) Before(org.junit.Before)

Example 40 with ProviderQos

use of joynr.types.ProviderQos 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)

Aggregations

ProviderQos (joynr.types.ProviderQos)69 Version (joynr.types.Version)43 Test (org.junit.Test)37 GlobalDiscoveryEntry (joynr.types.GlobalDiscoveryEntry)27 DiscoveryEntry (joynr.types.DiscoveryEntry)25 DiscoveryEntryWithMetaInfo (joynr.types.DiscoveryEntryWithMetaInfo)24 DiscoveryQos (io.joynr.arbitration.DiscoveryQos)21 Matchers.anyString (org.mockito.Matchers.anyString)16 ArrayList (java.util.ArrayList)15 ChannelAddress (joynr.system.RoutingTypes.ChannelAddress)13 Before (org.junit.Before)13 Callback (io.joynr.proxy.Callback)12 HashSet (java.util.HashSet)11 MqttAddress (joynr.system.RoutingTypes.MqttAddress)10 InvocationOnMock (org.mockito.invocation.InvocationOnMock)10 Address (joynr.system.RoutingTypes.Address)9 JoynrRuntimeException (io.joynr.exceptions.JoynrRuntimeException)8 MessagingQos (io.joynr.messaging.MessagingQos)8 Properties (java.util.Properties)8 DiscoveryException (io.joynr.exceptions.DiscoveryException)7