Search in sources :

Example 46 with ProviderRuntimeException

use of joynr.exceptions.ProviderRuntimeException in project joynr by bmwcarit.

the class IltProvider method methodWithMultiplePrimitiveParameters.

/*
     * methodWithMultiplePrimitiveParameters
     *
     * the 'float' of France is delivered as Double here, just return it as 'double'
     * and return the integer argument as string
     */
@Override
public Promise<MethodWithMultiplePrimitiveParametersDeferred> methodWithMultiplePrimitiveParameters(Integer int32Arg, Float floatArg, Boolean booleanArg) {
    logger.warn("**********************************************************");
    logger.warn("* IltProvider.methodWithMultiplePrimitiveParameters called");
    logger.warn("**********************************************************");
    MethodWithMultiplePrimitiveParametersDeferred deferred = new MethodWithMultiplePrimitiveParametersDeferred();
    // check input parameters
    if (int32Arg != 2147483647 || !IltUtil.cmpFloat(floatArg, 47.11f) || booleanArg != false) {
        logger.warn("methodWithMultiplePrimitiveParameters: invalid argument int32Arg, floatArg or booleanArg");
        deferred.reject(new ProviderRuntimeException("methodWithMultiplePrimitiveParameters: received wrong argument"));
        return new Promise<MethodWithMultiplePrimitiveParametersDeferred>(deferred);
    }
    // prepare output parameters
    Double doubleOut = (double) floatArg;
    String stringOut = int32Arg.toString();
    deferred.resolve(doubleOut, stringOut);
    return new Promise<MethodWithMultiplePrimitiveParametersDeferred>(deferred);
}
Also used : Promise(io.joynr.provider.Promise) MapStringString(joynr.interlanguagetest.namedTypeCollection2.MapStringString) ProviderRuntimeException(joynr.exceptions.ProviderRuntimeException)

Example 47 with ProviderRuntimeException

use of joynr.exceptions.ProviderRuntimeException in project joynr by bmwcarit.

the class IltProvider method methodWithExtendedErrorEnum.

/*
     * methodWithExtendedErrorEnum
     */
@Override
public Promise<MethodWithExtendedErrorEnumDeferred> methodWithExtendedErrorEnum(String wantedExceptionArg) {
    logger.warn("************************************************");
    logger.warn("* IltProvider.methodWithExtendedErrorEnum called");
    logger.warn("************************************************");
    MethodWithExtendedErrorEnumDeferred deferred = new MethodWithExtendedErrorEnumDeferred();
    if (wantedExceptionArg.equals("ProviderRuntimeException")) {
        deferred.reject(new ProviderRuntimeException("Exception from methodWithExtendedErrorEnum"));
    } else if (wantedExceptionArg.equals("ApplicationException_1")) {
        deferred.reject(MethodWithExtendedErrorEnumErrorEnum.ERROR_3_3_NTC);
    } else if (wantedExceptionArg.equals("ApplicationException_2")) {
        deferred.reject(MethodWithExtendedErrorEnumErrorEnum.ERROR_2_1_TC2);
    } else {
        deferred.resolve();
    }
    return new Promise<MethodWithExtendedErrorEnumDeferred>(deferred);
}
Also used : Promise(io.joynr.provider.Promise) ProviderRuntimeException(joynr.exceptions.ProviderRuntimeException)

Example 48 with ProviderRuntimeException

use of joynr.exceptions.ProviderRuntimeException in project joynr by bmwcarit.

the class IltProvider method methodWithMultipleEnumParameters.

/*
     * methodWithMultipleEnumParameters
     *
     * return fixed values for now
     */
@Override
public Promise<MethodWithMultipleEnumParametersDeferred> methodWithMultipleEnumParameters(Enumeration enumerationArg, ExtendedTypeCollectionEnumerationInTypeCollection extendedEnumerationArg) {
    logger.warn("*****************************************************");
    logger.warn("* IltProvider.methodWithMultipleEnumParameters called");
    logger.warn("*****************************************************");
    MethodWithMultipleEnumParametersDeferred deferred = new MethodWithMultipleEnumParametersDeferred();
    // check input parameters
    if (enumerationArg != joynr.interlanguagetest.Enumeration.ENUM_0_VALUE_3 || extendedEnumerationArg != ExtendedTypeCollectionEnumerationInTypeCollection.ENUM_2_VALUE_EXTENSION_FOR_TYPECOLLECTION) {
        logger.warn("methodWithMultipleEnumParameters: invalid argument enumerationArg or extendedEnumerationArg");
        deferred.reject(new ProviderRuntimeException("methodWithMultipleEnumParameters: received wrong argument"));
        return new Promise<MethodWithMultipleEnumParametersDeferred>(deferred);
    }
    // prepare output parameters
    ExtendedEnumerationWithPartlyDefinedValues extendedEnumerationOut = ExtendedEnumerationWithPartlyDefinedValues.ENUM_2_VALUE_EXTENSION_FOR_ENUM_WITHOUT_DEFINED_VALUES;
    Enumeration enumerationOut = Enumeration.ENUM_0_VALUE_1;
    deferred.resolve(extendedEnumerationOut, enumerationOut);
    return new Promise<MethodWithMultipleEnumParametersDeferred>(deferred);
}
Also used : Promise(io.joynr.provider.Promise) Enumeration(joynr.interlanguagetest.Enumeration) ExtendedExtendedEnumeration(joynr.interlanguagetest.namedTypeCollection2.ExtendedExtendedEnumeration) ExtendedEnumerationWithPartlyDefinedValues(joynr.interlanguagetest.namedTypeCollection2.ExtendedEnumerationWithPartlyDefinedValues) ProviderRuntimeException(joynr.exceptions.ProviderRuntimeException)

Example 49 with ProviderRuntimeException

use of joynr.exceptions.ProviderRuntimeException in project joynr by bmwcarit.

the class IltProvider method methodWithExistingErrorEnum.

/*
     * methodWithExistingErrorEnum
     */
@Override
public Promise<MethodWithExistingErrorEnumDeferred> methodWithExistingErrorEnum(String wantedExceptionArg) {
    logger.warn("************************************************");
    logger.warn("* IltProvider.methodWithExistingErrorEnum called");
    logger.warn("************************************************");
    MethodWithExistingErrorEnumDeferred deferred = new MethodWithExistingErrorEnumDeferred();
    if (wantedExceptionArg.equals("ProviderRuntimeException")) {
        deferred.reject(new ProviderRuntimeException("Exception from methodWithExistingErrorEnum"));
    } else if (wantedExceptionArg.equals("ApplicationException_1")) {
        deferred.reject(ExtendedErrorEnumTc.ERROR_2_3_TC2);
    } else if (wantedExceptionArg.equals("ApplicationException_2")) {
        deferred.reject(ExtendedErrorEnumTc.ERROR_1_2_TC_2);
    } else {
        deferred.resolve();
    }
    return new Promise<MethodWithExistingErrorEnumDeferred>(deferred);
}
Also used : Promise(io.joynr.provider.Promise) ProviderRuntimeException(joynr.exceptions.ProviderRuntimeException)

Example 50 with ProviderRuntimeException

use of joynr.exceptions.ProviderRuntimeException in project joynr by bmwcarit.

the class IltProviderBean method methodWithAnonymousErrorEnum.

/*
     * methodWithAnonymousErrorEnum
     */
@Override
public void methodWithAnonymousErrorEnum(String wantedExceptionArg) throws ApplicationException {
    logger.warn("*************************************************");
    logger.warn("* IltProvider.methodWithAnonymousErrorEnum called");
    logger.warn("*************************************************");
    if (wantedExceptionArg.equals("ProviderRuntimeException")) {
        throw new ProviderRuntimeException("Exception from methodWithAnonymousErrorEnum");
    } else if (wantedExceptionArg.equals("ApplicationException")) {
        throw new ApplicationException(MethodWithAnonymousErrorEnumErrorEnum.ERROR_3_1_NTC);
    }
}
Also used : ApplicationException(joynr.exceptions.ApplicationException) 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