Search in sources :

Example 1 with BaseStructWithoutElements

use of joynr.interlanguagetest.namedTypeCollection2.BaseStructWithoutElements in project joynr by bmwcarit.

the class IltProviderBean method methodToFireBroadcastWithMultipleStructParameters.

/*
     * methodToFireBroadcastWithMultipleStructParameters
     */
@Override
public void methodToFireBroadcastWithMultipleStructParameters() {
    logger.warn("**********************************************************************");
    logger.warn("* IltProvider.methodToFireBroadcastWithMultipleStructParameters called");
    logger.warn("**********************************************************************");
    BaseStructWithoutElements baseStructWithoutElementsOut = IltUtil.createBaseStructWithoutElements();
    ExtendedExtendedBaseStruct extendedExtendedBaseStructOut = IltUtil.createExtendedExtendedBaseStruct();
// TODO
// fireBroadcastWithMultipleStructParameters(baseStructWithoutElementsOut, extendedExtendedBaseStructOut);
}
Also used : ExtendedExtendedBaseStruct(joynr.interlanguagetest.namedTypeCollection2.ExtendedExtendedBaseStruct) BaseStructWithoutElements(joynr.interlanguagetest.namedTypeCollection2.BaseStructWithoutElements)

Example 2 with BaseStructWithoutElements

use of joynr.interlanguagetest.namedTypeCollection2.BaseStructWithoutElements in project joynr by bmwcarit.

the class IltProviderBean method methodWithMultipleStructParameters.

/*
     * methodWithMultipleStructParameters
     */
@Override
public MethodWithMultipleStructParametersReturned methodWithMultipleStructParameters(ExtendedStructOfPrimitives extendedStructOfPrimitivesArg, BaseStruct baseStructArg) {
    logger.warn("*******************************************************");
    logger.warn("* IltProvider.methodWithMultipleStructParameters called");
    logger.warn("*******************************************************");
    // check input parameter
    if (!IltUtil.checkExtendedStructOfPrimitives(extendedStructOfPrimitivesArg)) {
        throw new ProviderRuntimeException("methodWithMultipleStructParameters: invalid parameter extendedStructOfPrimitivesArg");
    }
    if (!IltUtil.checkBaseStruct(baseStructArg)) {
        throw new ProviderRuntimeException("methodWithMultipleStructParameters: invalid parameter baseStructArg");
    }
    // set output values
    BaseStructWithoutElements baseStructWithoutElementsOut = IltUtil.createBaseStructWithoutElements();
    ExtendedExtendedBaseStruct extendedExtendedBaseStructOut = IltUtil.createExtendedExtendedBaseStruct();
    return new MethodWithMultipleStructParametersReturned(baseStructWithoutElementsOut, extendedExtendedBaseStructOut);
}
Also used : ExtendedExtendedBaseStruct(joynr.interlanguagetest.namedTypeCollection2.ExtendedExtendedBaseStruct) BaseStructWithoutElements(joynr.interlanguagetest.namedTypeCollection2.BaseStructWithoutElements) ProviderRuntimeException(joynr.exceptions.ProviderRuntimeException)

Example 3 with BaseStructWithoutElements

use of joynr.interlanguagetest.namedTypeCollection2.BaseStructWithoutElements 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)

Example 4 with BaseStructWithoutElements

use of joynr.interlanguagetest.namedTypeCollection2.BaseStructWithoutElements in project joynr by bmwcarit.

the class IltConsumerAsyncMethodTest method callMethodWithMultipleStructParametersAsync.

@Test
public void callMethodWithMultipleStructParametersAsync() {
    LOG.info(name.getMethodName() + "");
    try {
        // setup input parameters
        ExtendedStructOfPrimitives extendedStructOfPrimitivesArg = IltUtil.createExtendedStructOfPrimitives();
        BaseStruct baseStructArg = IltUtil.createBaseStruct();
        MethodWithMultipleStructParametersCallback callback = new MethodWithMultipleStructParametersCallback() {

            @Override
            public void onSuccess(BaseStructWithoutElements baseStructWithoutElementsOut, ExtendedExtendedBaseStruct extendedExtendedBaseStructOut) {
                // check results
                if (!IltUtil.checkBaseStructWithoutElements(baseStructWithoutElementsOut)) {
                    methodWithMultipleStructParametersAsyncCallbackResult = false;
                    methodWithMultipleStructParametersAsyncCallbackDone = true;
                    LOG.info(name.getMethodName() + " - callback - invalid baseStructWithoutElementsOut");
                    LOG.info(name.getMethodName() + " - FAILED");
                    return;
                }
                if (!IltUtil.checkExtendedExtendedBaseStruct(extendedExtendedBaseStructOut)) {
                    methodWithMultipleStructParametersAsyncCallbackResult = false;
                    methodWithMultipleStructParametersAsyncCallbackDone = true;
                    LOG.info(name.getMethodName() + " - callback - invalid extendedExtendedBaseStructOut");
                    LOG.info(name.getMethodName() + " - FAILED");
                    return;
                }
                methodWithMultipleStructParametersAsyncCallbackResult = true;
                methodWithMultipleStructParametersAsyncCallbackDone = true;
            }

            @Override
            public void onFailure(JoynrRuntimeException error) {
                methodWithMultipleStructParametersAsyncCallbackResult = false;
                methodWithMultipleStructParametersAsyncCallbackDone = true;
                if (error instanceof JoynrRuntimeException) {
                    LOG.info(name.getMethodName() + " - callback - caught exception " + ((JoynrRuntimeException) error).getMessage());
                } else {
                    LOG.info(name.getMethodName() + " - callback - caught exception");
                }
                LOG.info(name.getMethodName() + " - FAILED");
            }
        };
        MethodWithMultipleStructParametersFuture future = testInterfaceProxy.methodWithMultipleStructParameters(callback, extendedStructOfPrimitivesArg, baseStructArg);
        try {
            long timeoutInMilliseconds = 8000;
            LOG.info(name.getMethodName() + " - about to call future.get");
            MethodWithMultipleStructParametersReturned result = future.get(timeoutInMilliseconds);
            if (result == null) {
                fail(name.getMethodName() + " - FAILED - got no result");
                return;
            }
            LOG.info(name.getMethodName() + " - returned from future.get");
            // check results from future
            if (!IltUtil.checkBaseStructWithoutElements(result.baseStructWithoutElementsOut)) {
                fail(name.getMethodName() + " - FAILED - got invalid result - baseStructWithoutElementsOut");
                return;
            }
            if (!IltUtil.checkExtendedExtendedBaseStruct(result.extendedExtendedBaseStructOut)) {
                fail(name.getMethodName() + " - FAILED - got invalid result - extendedExtendedBaseStructOut");
                return;
            }
            LOG.info(name.getMethodName() + " - future result checks OK");
            // should have been called ahead anyway
            if (methodWithMultipleStructParametersAsyncCallbackDone == false) {
                LOG.info(name.getMethodName() + " - about to wait for a second for callback");
                Thread.sleep(1000);
                LOG.info(name.getMethodName() + " - wait for callback is over");
            } else {
                LOG.info(name.getMethodName() + " - callback already done");
            }
            if (methodWithMultipleStructParametersAsyncCallbackDone == false) {
                fail(name.getMethodName() + " - FAILED - callback NOT done");
                return;
            }
            if (methodWithMultipleStructParametersAsyncCallbackResult == false) {
                fail(name.getMethodName() + " - FAILED - callback reported error");
                return;
            }
            LOG.info(name.getMethodName() + " - callback has set OK flags");
        } catch (InterruptedException | JoynrRuntimeException | ApplicationException e) {
            fail(name.getMethodName() + " - FAILED - caught unexpected exception: " + e.getMessage());
            return;
        }
    } catch (Exception e) {
        fail(name.getMethodName() + " - FAILED - caught unexpected exception: " + e.getMessage());
        return;
    }
    LOG.info(name.getMethodName() + " - OK");
}
Also used : MethodWithMultipleStructParametersFuture(joynr.interlanguagetest.TestInterfaceAsync.MethodWithMultipleStructParametersFuture) MethodWithMultipleStructParametersReturned(joynr.interlanguagetest.TestInterfaceSync.MethodWithMultipleStructParametersReturned) ExtendedExtendedBaseStruct(joynr.interlanguagetest.namedTypeCollection2.ExtendedExtendedBaseStruct) MethodWithMultipleStructParametersCallback(joynr.interlanguagetest.TestInterfaceAsync.MethodWithMultipleStructParametersCallback) JoynrRuntimeException(io.joynr.exceptions.JoynrRuntimeException) ApplicationException(joynr.exceptions.ApplicationException) ProviderRuntimeException(joynr.exceptions.ProviderRuntimeException) JoynrRuntimeException(io.joynr.exceptions.JoynrRuntimeException) ExtendedExtendedBaseStruct(joynr.interlanguagetest.namedTypeCollection2.ExtendedExtendedBaseStruct) BaseStruct(joynr.interlanguagetest.namedTypeCollection2.BaseStruct) ExtendedStructOfPrimitives(joynr.interlanguagetest.namedTypeCollection2.ExtendedStructOfPrimitives) ApplicationException(joynr.exceptions.ApplicationException) BaseStructWithoutElements(joynr.interlanguagetest.namedTypeCollection2.BaseStructWithoutElements) Test(org.junit.Test)

Example 5 with BaseStructWithoutElements

use of joynr.interlanguagetest.namedTypeCollection2.BaseStructWithoutElements in project joynr by bmwcarit.

the class IltProvider method methodToFireBroadcastWithMultipleStructParameters.

/*
     * methodToFireBroadcastWithMultipleStructParameters
     */
@Override
public Promise<DeferredVoid> methodToFireBroadcastWithMultipleStructParameters(String[] partitions) {
    logger.warn("**********************************************************************");
    logger.warn("* IltProvider.methodToFireBroadcastWithMultipleStructParameters called");
    logger.warn("**********************************************************************");
    DeferredVoid deferred = new DeferredVoid();
    BaseStructWithoutElements baseStructWithoutElementsOut = IltUtil.createBaseStructWithoutElements();
    ExtendedExtendedBaseStruct extendedExtendedBaseStructOut = IltUtil.createExtendedExtendedBaseStruct();
    fireBroadcastWithMultipleStructParameters(baseStructWithoutElementsOut, extendedExtendedBaseStructOut, partitions);
    deferred.resolve();
    return new Promise<DeferredVoid>(deferred);
}
Also used : Promise(io.joynr.provider.Promise) ExtendedExtendedBaseStruct(joynr.interlanguagetest.namedTypeCollection2.ExtendedExtendedBaseStruct) BaseStructWithoutElements(joynr.interlanguagetest.namedTypeCollection2.BaseStructWithoutElements) DeferredVoid(io.joynr.provider.DeferredVoid)

Aggregations

BaseStructWithoutElements (joynr.interlanguagetest.namedTypeCollection2.BaseStructWithoutElements)5 ExtendedExtendedBaseStruct (joynr.interlanguagetest.namedTypeCollection2.ExtendedExtendedBaseStruct)5 ProviderRuntimeException (joynr.exceptions.ProviderRuntimeException)3 Promise (io.joynr.provider.Promise)2 JoynrRuntimeException (io.joynr.exceptions.JoynrRuntimeException)1 DeferredVoid (io.joynr.provider.DeferredVoid)1 ApplicationException (joynr.exceptions.ApplicationException)1 MethodWithMultipleStructParametersCallback (joynr.interlanguagetest.TestInterfaceAsync.MethodWithMultipleStructParametersCallback)1 MethodWithMultipleStructParametersFuture (joynr.interlanguagetest.TestInterfaceAsync.MethodWithMultipleStructParametersFuture)1 MethodWithMultipleStructParametersReturned (joynr.interlanguagetest.TestInterfaceSync.MethodWithMultipleStructParametersReturned)1 BaseStruct (joynr.interlanguagetest.namedTypeCollection2.BaseStruct)1 ExtendedStructOfPrimitives (joynr.interlanguagetest.namedTypeCollection2.ExtendedStructOfPrimitives)1 Test (org.junit.Test)1