use of joynr.interlanguagetest.namedTypeCollection2.BaseStruct in project joynr by bmwcarit.
the class IltConsumerSyncMethodTest method callOverloadedMethodWithSelector_3.
@Test
public void callOverloadedMethodWithSelector_3() {
LOG.info(name.getMethodName() + "");
try {
OverloadedMethodWithSelectorOverloadedMethodWithSelector1Returned result;
ExtendedExtendedEnumeration[] enumArrayArg = IltUtil.createExtendedExtendedEnumerationArray();
Long int64arg = 1L;
BaseStruct baseStructArg = IltUtil.createBaseStruct();
Boolean booleanArg = false;
result = testInterfaceProxy.overloadedMethodWithSelector(enumArrayArg, int64arg, baseStructArg, booleanArg);
if (result == null) {
fail(name.getMethodName() + " - FAILED - got no result");
return;
}
if (result.doubleOut != 1.1d || !IltUtil.checkExtendedBaseStruct(result.extendedBaseStructOut) || !IltUtil.checkStringArray(result.stringArrayOut)) {
fail(name.getMethodName() + " - FAILED - got invalid result");
return;
}
} catch (Exception e) {
fail(name.getMethodName() + " - FAILED - caught unexpected exception: " + e.getMessage());
return;
}
LOG.info(name.getMethodName() + " - OK");
}
use of joynr.interlanguagetest.namedTypeCollection2.BaseStruct in project joynr by bmwcarit.
the class IltUtil method createBaseStruct.
public static BaseStruct createBaseStruct() {
BaseStruct baseStruct = new BaseStruct();
fillBaseStruct(baseStruct);
return baseStruct;
}
use of joynr.interlanguagetest.namedTypeCollection2.BaseStruct 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");
}
use of joynr.interlanguagetest.namedTypeCollection2.BaseStruct in project joynr by bmwcarit.
the class IltConsumerGetterSetterTest method callGetAttributeBaseStruct.
// no setter for attributeExtendedEnumerationReadonly
@Test
public void callGetAttributeBaseStruct() {
LOG.info(name.getMethodName() + "");
try {
BaseStruct result;
// must set the value before it can be retrieved again
BaseStruct baseStructArg = IltUtil.createBaseStruct();
testInterfaceProxy.setAttributeBaseStruct(baseStructArg);
result = testInterfaceProxy.getAttributeBaseStruct();
if (result == null) {
fail(name.getMethodName() + " - FAILED - got no result");
return;
}
if (!IltUtil.checkBaseStruct(result)) {
fail(name.getMethodName() + " - FAILED - got invalid result");
return;
}
} catch (Exception e) {
fail(name.getMethodName() + " - FAILED - caught unexpected exception: " + e.getMessage());
return;
}
LOG.info(name.getMethodName() + " - OK");
}
use of joynr.interlanguagetest.namedTypeCollection2.BaseStruct in project joynr by bmwcarit.
the class IltConsumerSyncMethodTest method callOverloadedMethod_3.
@Test
public void callOverloadedMethod_3() {
LOG.info(name.getMethodName() + "");
try {
OverloadedMethodOverloadedMethod1Returned result;
ExtendedExtendedEnumeration[] enumArrayArg = IltUtil.createExtendedExtendedEnumerationArray();
Long int64Arg = 1L;
BaseStruct baseStructArg = IltUtil.createBaseStruct();
Boolean booleanArg = false;
result = testInterfaceProxy.overloadedMethod(enumArrayArg, int64Arg, baseStructArg, booleanArg);
if (result == null) {
fail(name.getMethodName() + " - FAILED - got no result");
return;
}
if (result.doubleOut != 0d || !IltUtil.checkStringArray(result.stringArrayOut)) {
fail(name.getMethodName() + " - FAILED - got invalid result - doubleOut");
return;
}
if (!IltUtil.checkExtendedBaseStruct(result.extendedBaseStructOut)) {
fail(name.getMethodName() + " - FAILED - got invalid result - extendedBaseStructOut");
return;
}
} catch (Exception e) {
fail(name.getMethodName() + " - FAILED - caught unexpected exception: " + e.getMessage());
return;
}
LOG.info(name.getMethodName() + " - OK");
}
Aggregations