use of joynr.types.ProviderQos in project joynr by bmwcarit.
the class MyGpsProviderApplication method run.
@Override
public void run() {
ProviderQos providerQos = new ProviderQos();
provider = new MyGpsProvider();
providerQos.setPriority(System.currentTimeMillis());
runtime.registerProvider(localDomain, provider, providerQos);
ConsoleReader console;
try {
console = new ConsoleReader();
int key;
while ((key = console.readCharacter()) != 'q') {
switch(key) {
case 'l':
provider.notifyLocationUpdate();
break;
default:
LOG.info("\n\nUSAGE press\n" + " q\tto quit\n" + " l\tto update location\n");
break;
}
}
} catch (IOException e) {
LOG.error("error reading input from console", e);
}
}
use of joynr.types.ProviderQos in project joynr by bmwcarit.
the class CapabilitiesDirectoryLauncher method run.
@Override
public void run() {
// LongPollingMessagingModule is only added in main(), since the servletMessagingModule will be used otherwise
ProviderQos providerQos = new ProviderQos();
runtime.registerProvider(localDomain, capabilitiesDirectoryProvider, providerQos);
}
use of joynr.types.ProviderQos in project joynr by bmwcarit.
the class JoynrAndroidLocationProviderApplication method registerProvider.
public void registerProvider(final String domain) {
if (androidLocationProvider == null) {
logToOutput("Creating new location provider.");
androidLocationProvider = new AndroidLocationProvider(this.getApplicationContext(), output);
}
if (runtime != null) {
logToOutput("Registering provider on domain \"" + domain + "\".");
// registers the provider at the global capabilities directory
ProviderQos providerQos = new ProviderQos();
providerQos.setPriority(System.currentTimeMillis());
runtime.registerProvider(domain, androidLocationProvider, providerQos);
} else {
logToOutput("Failed to bind service. Can not register provider\n");
}
}
use of joynr.types.ProviderQos in project joynr by bmwcarit.
the class LocalCapabilitiesDirectoryTest method addLocalOnlyCapability.
@SuppressWarnings("unchecked")
@Test(timeout = 2000)
public void addLocalOnlyCapability() throws InterruptedException {
ProviderQos providerQos = new ProviderQos();
providerQos.setScope(ProviderScope.LOCAL);
globalDiscoveryEntry = new GlobalDiscoveryEntry(new Version(47, 11), "test", TestInterface.INTERFACE_NAME, "participantId", providerQos, System.currentTimeMillis(), expiryDateMs, publicKeyId, channelAddressSerialized);
localCapabilitiesDirectory.add(discoveryEntry);
Thread.sleep(1000);
verify(globalCapabilitiesClient, never()).add(any(Callback.class), any(GlobalDiscoveryEntry.class));
}
use of joynr.types.ProviderQos in project joynr by bmwcarit.
the class LocalCapabilitiesDirectoryTest method addGlobalCapFails_NextAddShallAddGlobalAgain.
@SuppressWarnings("unchecked")
@Test(timeout = 1000)
public void addGlobalCapFails_NextAddShallAddGlobalAgain() throws InterruptedException {
ProviderQos providerQos = new ProviderQos();
providerQos.setScope(ProviderScope.GLOBAL);
String participantId = LocalCapabilitiesDirectoryTest.class.getName() + ".addLocalAndThanGlobalShallWork";
String domain = "testDomain";
final DiscoveryEntry discoveryEntry = new DiscoveryEntry(new Version(47, 11), domain, TestInterface.INTERFACE_NAME, participantId, providerQos, System.currentTimeMillis(), expiryDateMs, publicKeyId);
globalDiscoveryEntry = new GlobalDiscoveryEntry(new Version(47, 11), domain, TestInterface.INTERFACE_NAME, participantId, providerQos, System.currentTimeMillis(), expiryDateMs, publicKeyId, channelAddressSerialized);
Mockito.doAnswer(createAddAnswerWithError()).when(globalCapabilitiesClient).add(any(Callback.class), eq(globalDiscoveryEntry));
Promise<DeferredVoid> promise = localCapabilitiesDirectory.add(discoveryEntry);
promise.then(new PromiseListener() {
@Override
public void onFulfillment(Object... values) {
verify(globalDiscoveryEntryCacheMock, never()).add(eq(globalDiscoveryEntry));
verify(globalCapabilitiesClient).add(any(Callback.class), eq(globalDiscoveryEntry));
reset(globalCapabilitiesClient);
localCapabilitiesDirectory.add(discoveryEntry);
verify(globalCapabilitiesClient, timeout(200)).add(any(Callback.class), eq(globalDiscoveryEntry));
}
@Override
public void onRejection(JoynrException error) {
}
});
}
Aggregations