use of io.joynr.runtime.JoynrRuntime in project joynr by bmwcarit.
the class DefaultJoynrRuntimeFactoryTest method testNoOverrideForManuallyAddedParticipantIds.
@Test
public void testNoOverrideForManuallyAddedParticipantIds() throws Exception {
Properties joynrProperties = new Properties();
String key = (ParticipantIdKeyUtil.JOYNR_PARTICIPANT_PREFIX + LOCAL_DOMAIN + "." + MyService.INTERFACE_NAME).toLowerCase().replace("/", ".");
joynrProperties.setProperty(key, "myvalue");
createFixture(joynrProperties);
JoynrRuntime joynrRuntime = fixture.create(Sets.newHashSet(MyServiceSync.class));
assertNotNull(joynrRuntime);
Properties properties = fixture.getInjector().getInstance(Key.get(Properties.class, Names.named(MessagingPropertyKeys.JOYNR_PROPERTIES)));
assertNotNull(properties);
assertTrue(properties.containsKey(key));
String value = properties.getProperty(key);
assertNotNull(value);
assertEquals("myvalue", value);
}
use of io.joynr.runtime.JoynrRuntime in project joynr by bmwcarit.
the class JoynrAndroidRuntime method unregisterProvider.
@Override
public void unregisterProvider(String domain, Object provider) {
// this will block until the runtime is created successfully
// TODO since the caller expects the unregister call to be async, we need to check if
// this will not block to long
JoynrRuntime runtime = getJoynrRuntime();
runtime.unregisterProvider(domain, provider);
}
use of io.joynr.runtime.JoynrRuntime in project joynr by bmwcarit.
the class AbstractProviderProxyEnd2EndTest method tearDown.
@After
public void tearDown() throws InterruptedException {
if (providerRuntime != null) {
providerRuntime.unregisterProvider(domain, provider);
providerRuntime.unregisterProvider(domainAsync, provider);
// wait grace period for the unregister (remove) message to get
// sent to global discovery
Thread.sleep(1000);
providerRuntime.shutdown(true);
}
if (consumerRuntime != null) {
consumerRuntime.shutdown(true);
}
// do not shutdown runtimes twice
createdRuntimes.remove(providerRuntime);
createdRuntimes.remove(consumerRuntime);
for (JoynrRuntime createdRuntime : createdRuntimes) {
createdRuntime.shutdown(true);
}
}
use of io.joynr.runtime.JoynrRuntime in project joynr by bmwcarit.
the class RoutingTableOverwriteEnd2EndTest method testProviderAddressCanBeOverwrittenAfterDiscovery.
@Test
public void testProviderAddressCanBeOverwrittenAfterDiscovery() throws Exception {
// Tests that if a provider's address is changed in the discovery directory and a new proxy is
// created for the provider, the routing table of the proxy's runtime will also be updated as long as
// a new arbitration (cache max age = 0) is performed.
final String providerDomain = "testDomain";
final Properties fixedParticipantIdProperty = createFixedParticipantIdProperties(providerDomain, DefaulttestProvider.class, "fixedParticipantId");
DiscoveryQos discoveryQos = new DiscoveryQos();
discoveryQos.setArbitrationStrategy(ArbitrationStrategy.HighestPriority);
discoveryQos.setCacheMaxAgeMs(0);
JoynrRuntime runtimeProxy = createRuntime("proxy", null);
JoynrRuntime runtimeProvider1 = createRuntime("provider_initial", fixedParticipantIdProperty);
DefaulttestProvider provider1 = Mockito.spy(DefaulttestProvider.class);
runtimeProvider1.registerProvider(providerDomain, provider1, createProviderQos()).get();
testProxy proxy1 = runtimeProxy.getProxyBuilder(providerDomain, testProxy.class).setMessagingQos(new MessagingQos(2000)).setDiscoveryQos(discoveryQos).build();
proxy1.addNumbers(1, 2, 3);
verify(provider1).addNumbers(1, 2, 3);
reset(provider1);
JoynrRuntime runtimeProvider2 = createRuntime("provider_override", fixedParticipantIdProperty);
DefaulttestProvider provider2 = Mockito.spy(DefaulttestProvider.class);
runtimeProvider2.registerProvider(providerDomain, provider2, createProviderQos()).get();
testProxy proxy2 = runtimeProxy.getProxyBuilder(providerDomain, testProxy.class).setMessagingQos(new MessagingQos(2000)).setDiscoveryQos(discoveryQos).build();
proxy2.addNumbers(1, 2, 3);
verify(provider1, never()).addNumbers(1, 2, 3);
verify(provider2).addNumbers(1, 2, 3);
}
use of io.joynr.runtime.JoynrRuntime in project joynr by bmwcarit.
the class DefaultJoynrRuntimeFactoryTest method testClusterableParticipantIdsAdded.
@Test
public void testClusterableParticipantIdsAdded() throws Exception {
createFixture();
JoynrRuntime joynrRuntime = fixture.create(Sets.newHashSet(MyServiceSync.class));
assertNotNull(joynrRuntime);
Properties properties = fixture.getInjector().getInstance(Key.get(Properties.class, Names.named(MessagingPropertyKeys.JOYNR_PROPERTIES)));
assertNotNull(properties);
String key = (ParticipantIdKeyUtil.JOYNR_PARTICIPANT_PREFIX + LOCAL_DOMAIN + "." + MyService.INTERFACE_NAME).toLowerCase().replace("/", ".");
assertTrue(properties.containsKey(key));
String value = properties.getProperty(key);
assertNotNull(value);
assertEquals((LOCAL_DOMAIN + "." + CHANNEL_ID + "." + MyService.INTERFACE_NAME).replace("/", "."), value);
}
Aggregations