use of io.joynr.exceptions.JoynrRuntimeException in project joynr by bmwcarit.
the class AbstractProviderProxyEnd2EndTest method asyncMethodCallReturnsErrorEnum.
@Test(timeout = CONST_DEFAULT_TEST_TIMEOUT)
public void asyncMethodCallReturnsErrorEnum() {
ProxyBuilder<testProxy> proxyBuilder = consumerRuntime.getProxyBuilder(domain, testProxy.class);
testProxy proxy = proxyBuilder.setMessagingQos(messagingQos).setDiscoveryQos(discoveryQos).build();
ApplicationException expected = new ApplicationException(ErrorEnumBase.BASE_ERROR_TYPECOLLECTION);
Future<Void> future = proxy.methodWithErrorEnum(callbackWithApplicationExceptionErrorEnumBase);
try {
future.get();
fail("Should throw ApplicationException");
} catch (JoynrRuntimeException | InterruptedException e) {
fail(e.toString());
} catch (ApplicationException e) {
assertEquals(expected, e);
}
verify(callbackWithApplicationExceptionErrorEnumBase).onFailure((ErrorEnumBase) (expected.getError()));
}
use of io.joynr.exceptions.JoynrRuntimeException in project joynr by bmwcarit.
the class AbstractProviderProxyEnd2EndTest method syncMethodCallReturnsImplicitErrorEnum.
@Test(timeout = CONST_DEFAULT_TEST_TIMEOUT)
public void syncMethodCallReturnsImplicitErrorEnum() {
ProxyBuilder<testProxy> proxyBuilder = consumerRuntime.getProxyBuilder(domain, testProxy.class);
testProxy proxy = proxyBuilder.setMessagingQos(messagingQos).setDiscoveryQos(discoveryQos).build();
try {
proxy.methodWithImplicitErrorEnum();
fail("Should throw ApplicationException");
} catch (JoynrRuntimeException e) {
fail(e.toString());
} catch (ApplicationException e) {
ApplicationException expected = new ApplicationException(MethodWithImplicitErrorEnumErrorEnum.IMPLICIT_ERROR);
assertEquals(expected, e);
}
}
use of io.joynr.exceptions.JoynrRuntimeException 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 io.joynr.exceptions.JoynrRuntimeException in project joynr by bmwcarit.
the class AbstractProviderProxyEnd2EndTest method asyncMethodCallWithByteBuffer.
@Test(timeout = CONST_DEFAULT_TEST_TIMEOUT)
public void asyncMethodCallWithByteBuffer() throws JoynrWaitExpiredException, JoynrRuntimeException, InterruptedException, ApplicationException {
ProxyBuilder<testProxy> proxyBuilder = consumerRuntime.getProxyBuilder(domain, testProxy.class);
testProxy proxy = proxyBuilder.setMessagingQos(messagingQos).setDiscoveryQos(discoveryQos).build();
Byte[] input = { 1, 2, 3 };
Future<Byte[]> future = proxy.methodWithByteBuffer(new Callback<Byte[]>() {
@Override
public void onFailure(JoynrRuntimeException error) {
fail("byteBuffer was not returned correctly");
}
@Override
public void onSuccess(Byte[] result) {
}
}, input);
Byte[] result = future.get();
assertArrayEquals(input, result);
}
use of io.joynr.exceptions.JoynrRuntimeException in project joynr by bmwcarit.
the class GlobalCapabilitiesDirectoryClientTest method testLookupDomainsOnFailure.
@Test
public void testLookupDomainsOnFailure() {
@SuppressWarnings("unchecked") Callback<List<GlobalDiscoveryEntry>> callbackListOfGlobalDiscoveryEntriesMock = (Callback<List<GlobalDiscoveryEntry>>) mock(Callback.class);
Callback<GlobalDiscoveryEntry[]> callback = lookupDomainsHelper(callbackListOfGlobalDiscoveryEntriesMock);
JoynrRuntimeException error = new JoynrRuntimeException();
callback.onFailure(error);
verify(callbackListOfGlobalDiscoveryEntriesMock).onFailure(eq(error));
verify(callbackListOfGlobalDiscoveryEntriesMock, times(0)).onSuccess(anyListOf(GlobalDiscoveryEntry.class));
}
Aggregations