use of joynr.tests.testAsync.MethodWithMultipleOutputParametersCallback in project joynr by bmwcarit.
the class AbstractProviderProxyEnd2EndTest method calledMethodReturnsMultipleOutputParametersAsyncCallback.
@Test(timeout = CONST_DEFAULT_TEST_TIMEOUT)
public void calledMethodReturnsMultipleOutputParametersAsyncCallback() throws Exception {
ProxyBuilder<testProxy> proxyBuilder = consumerRuntime.getProxyBuilder(domain, testProxy.class);
testProxy proxy = proxyBuilder.setMessagingQos(messagingQos).setDiscoveryQos(discoveryQos).build();
final Object untilCallbackFinished = new Object();
final Map<String, Object> result = new HashMap<String, Object>();
proxy.methodWithMultipleOutputParameters(new MethodWithMultipleOutputParametersCallback() {
@Override
public void onFailure(JoynrRuntimeException error) {
logger.error("error in calledMethodReturnsMultipleOutputParametersAsyncCallback", error);
}
@Override
public void onSuccess(String aString, Integer aNumber, GpsLocation aComplexDataType, TestEnum anEnumResult) {
result.put("receivedString", aString);
result.put("receivedNumber", aNumber);
result.put("receivedComplexDataType", aComplexDataType);
result.put("receivedEnum", anEnumResult);
synchronized (untilCallbackFinished) {
untilCallbackFinished.notify();
}
}
});
synchronized (untilCallbackFinished) {
untilCallbackFinished.wait(CONST_DEFAULT_TEST_TIMEOUT);
}
assertEquals(TEST_INTEGER, result.get("receivedNumber"));
assertEquals(TEST_STRING, result.get("receivedString"));
assertEquals(TEST_COMPLEXTYPE, result.get("receivedComplexDataType"));
assertEquals(TEST_ENUM, result.get("receivedEnum"));
}
use of joynr.tests.testAsync.MethodWithMultipleOutputParametersCallback in project joynr by bmwcarit.
the class AbstractProviderProxyEnd2EndTest method calledMethodReturnsMultipleOutputParametersAsyncFuture.
@Test(timeout = CONST_DEFAULT_TEST_TIMEOUT)
public void calledMethodReturnsMultipleOutputParametersAsyncFuture() throws Exception {
ProxyBuilder<testProxy> proxyBuilder = consumerRuntime.getProxyBuilder(domain, testProxy.class);
testProxy proxy = proxyBuilder.setMessagingQos(messagingQos).setDiscoveryQos(discoveryQos).build();
Future<MethodWithMultipleOutputParametersReturned> future = proxy.methodWithMultipleOutputParameters(new MethodWithMultipleOutputParametersCallback() {
@Override
public void onFailure(JoynrRuntimeException error) {
logger.error("error in calledMethodReturnsMultipleOutputParametersAsyncCallback", error);
}
@Override
public void onSuccess(String aString, Integer aNumber, GpsLocation aComplexDataType, TestEnum anEnumResult) {
assertEquals(TEST_INTEGER, aNumber);
assertEquals(TEST_STRING, aString);
assertEquals(TEST_COMPLEXTYPE, aComplexDataType);
assertEquals(TEST_ENUM, anEnumResult);
}
});
MethodWithMultipleOutputParametersReturned reply = future.get();
assertEquals(TEST_INTEGER, reply.aNumber);
assertEquals(TEST_STRING, reply.aString);
assertEquals(TEST_COMPLEXTYPE, reply.aComplexDataType);
assertEquals(TEST_ENUM, reply.anEnumResult);
}
Aggregations