use of joynr.exceptions.ProviderRuntimeException in project joynr by bmwcarit.
the class AbstractProviderProxyEnd2EndTest method asyncMethodCallReturnsThrownException.
@Test(timeout = CONST_DEFAULT_TEST_TIMEOUT)
public void asyncMethodCallReturnsThrownException() {
ProxyBuilder<testProxy> proxyBuilder = consumerRuntime.getProxyBuilder(domain, testProxy.class);
testProxy proxy = proxyBuilder.setMessagingQos(messagingQos).setDiscoveryQos(discoveryQos).build();
ProviderRuntimeException expected = new ProviderRuntimeException(new IllegalArgumentException("thrownException").toString());
Future<Void> future = proxy.methodWithThrownException(callbackVoid);
try {
future.get();
fail("Should throw ProviderRuntimeException");
} catch (ProviderRuntimeException e) {
assertEquals(expected, e);
} catch (Exception e) {
fail(e.toString());
}
verify(callbackVoid).onFailure(expected);
}
use of joynr.exceptions.ProviderRuntimeException in project joynr by bmwcarit.
the class AbstractProviderProxyEnd2EndTest method asyncSetAttributeWithThrownException.
@Test(timeout = CONST_DEFAULT_TEST_TIMEOUT)
public void asyncSetAttributeWithThrownException() {
ProxyBuilder<testProxy> proxyBuilder = consumerRuntime.getProxyBuilder(domain, testProxy.class);
testProxy proxy = proxyBuilder.setMessagingQos(messagingQos).setDiscoveryQos(discoveryQos).build();
ProviderRuntimeException expected = new ProviderRuntimeException(new IllegalArgumentException("thrownException").toString());
Future<Void> future = proxy.setAttributeWithProviderRuntimeException(callbackVoid, 42);
try {
future.get();
fail("Should throw ProviderRuntimeException");
} catch (ProviderRuntimeException e) {
assertEquals(expected, e);
} catch (Exception e) {
fail(e.toString());
}
verify(callbackVoid).onFailure(expected);
}
use of joynr.exceptions.ProviderRuntimeException in project joynr by bmwcarit.
the class AbstractProviderProxyEnd2EndTest method asyncMethodCallReturnsProviderRuntimeException.
@Test(timeout = CONST_DEFAULT_TEST_TIMEOUT)
public void asyncMethodCallReturnsProviderRuntimeException() {
ProxyBuilder<testProxy> proxyBuilder = consumerRuntime.getProxyBuilder(domain, testProxy.class);
testProxy proxy = proxyBuilder.setMessagingQos(messagingQos).setDiscoveryQos(discoveryQos).build();
ProviderRuntimeException expected = new ProviderRuntimeException("ProviderRuntimeException");
Future<Void> future = proxy.methodWithProviderRuntimeException(callbackVoid);
try {
future.get();
fail("Should throw ProviderRuntimeException");
} catch (ProviderRuntimeException e) {
assertEquals(expected, e);
} catch (Exception e) {
fail(e.toString());
}
verify(callbackVoid).onFailure(expected);
}
use of joynr.exceptions.ProviderRuntimeException in project joynr by bmwcarit.
the class AbstractProviderProxyEnd2EndTest method syncMethodCallReturnsProviderRuntimeException.
@Test(timeout = CONST_DEFAULT_TEST_TIMEOUT)
public void syncMethodCallReturnsProviderRuntimeException() {
ProxyBuilder<testProxy> proxyBuilder = consumerRuntime.getProxyBuilder(domain, testProxy.class);
testProxy proxy = proxyBuilder.setMessagingQos(messagingQos).setDiscoveryQos(discoveryQos).build();
try {
proxy.methodWithProviderRuntimeException();
fail("Should throw ProviderRuntimeException");
} catch (ProviderRuntimeException e) {
ProviderRuntimeException expected = new ProviderRuntimeException("ProviderRuntimeException");
assertEquals(expected, e);
} catch (Exception e) {
fail(e.toString());
}
}
use of joynr.exceptions.ProviderRuntimeException in project joynr by bmwcarit.
the class IltProvider method methodWithMultipleStructParameters.
/*
* methodWithMultipleStructParameters
*/
@Override
public Promise<MethodWithMultipleStructParametersDeferred> methodWithMultipleStructParameters(ExtendedStructOfPrimitives extendedStructOfPrimitivesArg, BaseStruct baseStructArg) {
MethodWithMultipleStructParametersDeferred deferred = new MethodWithMultipleStructParametersDeferred();
logger.warn("*******************************************************");
logger.warn("* IltProvider.methodWithMultipleStructParameters called");
logger.warn("*******************************************************");
// check input parameter
if (!IltUtil.checkExtendedStructOfPrimitives(extendedStructOfPrimitivesArg)) {
deferred.reject(new ProviderRuntimeException("methodWithMultipleStructParameters: invalid parameter extendedStructOfPrimitivesArg"));
return new Promise<MethodWithMultipleStructParametersDeferred>(deferred);
}
if (!IltUtil.checkBaseStruct(baseStructArg)) {
deferred.reject(new ProviderRuntimeException("methodWithMultipleStructParameters: invalid parameter baseStructArg"));
return new Promise<MethodWithMultipleStructParametersDeferred>(deferred);
}
// set output values
BaseStructWithoutElements baseStructWithoutElementsOut = IltUtil.createBaseStructWithoutElements();
ExtendedExtendedBaseStruct extendedExtendedBaseStructOut = IltUtil.createExtendedExtendedBaseStruct();
deferred.resolve(baseStructWithoutElementsOut, extendedExtendedBaseStructOut);
return new Promise<MethodWithMultipleStructParametersDeferred>(deferred);
}
Aggregations