Search in sources :

Example 21 with ProviderRuntimeException

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);
}
Also used : joynr.tests.testProxy(joynr.tests.testProxy) DeferredVoid(io.joynr.provider.DeferredVoid) ProviderRuntimeException(joynr.exceptions.ProviderRuntimeException) JoynrRuntimeException(io.joynr.exceptions.JoynrRuntimeException) JoynrIllegalStateException(io.joynr.exceptions.JoynrIllegalStateException) JoynrTimeoutException(io.joynr.exceptions.JoynrTimeoutException) DiscoveryException(io.joynr.exceptions.DiscoveryException) JoynrWaitExpiredException(io.joynr.exceptions.JoynrWaitExpiredException) ApplicationException(joynr.exceptions.ApplicationException) ProviderRuntimeException(joynr.exceptions.ProviderRuntimeException) Test(org.junit.Test)

Example 22 with ProviderRuntimeException

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);
}
Also used : joynr.tests.testProxy(joynr.tests.testProxy) DeferredVoid(io.joynr.provider.DeferredVoid) ProviderRuntimeException(joynr.exceptions.ProviderRuntimeException) JoynrRuntimeException(io.joynr.exceptions.JoynrRuntimeException) JoynrIllegalStateException(io.joynr.exceptions.JoynrIllegalStateException) JoynrTimeoutException(io.joynr.exceptions.JoynrTimeoutException) DiscoveryException(io.joynr.exceptions.DiscoveryException) JoynrWaitExpiredException(io.joynr.exceptions.JoynrWaitExpiredException) ApplicationException(joynr.exceptions.ApplicationException) ProviderRuntimeException(joynr.exceptions.ProviderRuntimeException) Test(org.junit.Test)

Example 23 with ProviderRuntimeException

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);
}
Also used : joynr.tests.testProxy(joynr.tests.testProxy) DeferredVoid(io.joynr.provider.DeferredVoid) ProviderRuntimeException(joynr.exceptions.ProviderRuntimeException) JoynrRuntimeException(io.joynr.exceptions.JoynrRuntimeException) JoynrIllegalStateException(io.joynr.exceptions.JoynrIllegalStateException) JoynrTimeoutException(io.joynr.exceptions.JoynrTimeoutException) DiscoveryException(io.joynr.exceptions.DiscoveryException) JoynrWaitExpiredException(io.joynr.exceptions.JoynrWaitExpiredException) ApplicationException(joynr.exceptions.ApplicationException) ProviderRuntimeException(joynr.exceptions.ProviderRuntimeException) Test(org.junit.Test)

Example 24 with ProviderRuntimeException

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());
    }
}
Also used : joynr.tests.testProxy(joynr.tests.testProxy) ProviderRuntimeException(joynr.exceptions.ProviderRuntimeException) JoynrRuntimeException(io.joynr.exceptions.JoynrRuntimeException) JoynrIllegalStateException(io.joynr.exceptions.JoynrIllegalStateException) JoynrTimeoutException(io.joynr.exceptions.JoynrTimeoutException) DiscoveryException(io.joynr.exceptions.DiscoveryException) JoynrWaitExpiredException(io.joynr.exceptions.JoynrWaitExpiredException) ApplicationException(joynr.exceptions.ApplicationException) ProviderRuntimeException(joynr.exceptions.ProviderRuntimeException) Test(org.junit.Test)

Example 25 with ProviderRuntimeException

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);
}
Also used : Promise(io.joynr.provider.Promise) ExtendedExtendedBaseStruct(joynr.interlanguagetest.namedTypeCollection2.ExtendedExtendedBaseStruct) BaseStructWithoutElements(joynr.interlanguagetest.namedTypeCollection2.BaseStructWithoutElements) ProviderRuntimeException(joynr.exceptions.ProviderRuntimeException)

Aggregations

ProviderRuntimeException (joynr.exceptions.ProviderRuntimeException)67 Promise (io.joynr.provider.Promise)27 ApplicationException (joynr.exceptions.ApplicationException)23 Test (org.junit.Test)21 MapStringString (joynr.interlanguagetest.namedTypeCollection2.MapStringString)19 JoynrRuntimeException (io.joynr.exceptions.JoynrRuntimeException)13 DiscoveryException (io.joynr.exceptions.DiscoveryException)10 DeferredVoid (io.joynr.provider.DeferredVoid)10 JoynrIllegalStateException (io.joynr.exceptions.JoynrIllegalStateException)8 JoynrTimeoutException (io.joynr.exceptions.JoynrTimeoutException)8 JoynrWaitExpiredException (io.joynr.exceptions.JoynrWaitExpiredException)8 joynr.tests.testProxy (joynr.tests.testProxy)8 ExtendedExtendedBaseStruct (joynr.interlanguagetest.namedTypeCollection2.ExtendedExtendedBaseStruct)6 InvocationTargetException (java.lang.reflect.InvocationTargetException)5 JoynrException (io.joynr.exceptions.JoynrException)4 ExtendedBaseStruct (joynr.interlanguagetest.namedTypeCollection2.ExtendedBaseStruct)4 JoynrVersion (io.joynr.JoynrVersion)3 DiscoveryQos (io.joynr.arbitration.DiscoveryQos)3 Deferred (io.joynr.provider.Deferred)3 PromiseListener (io.joynr.provider.PromiseListener)3