use of joynr.interlanguagetest.Enumeration in project joynr by bmwcarit.
the class IltConsumerGetterSetterTest method callSetAttributeEnumeration.
@Test
public void callSetAttributeEnumeration() {
LOG.info(name.getMethodName() + "");
try {
Enumeration enumerationArg = Enumeration.ENUM_0_VALUE_2;
testInterfaceProxy.setAttributeEnumeration(enumerationArg);
} catch (Exception e) {
fail(name.getMethodName() + " - FAILED - caught unexpected exception: " + e.getMessage());
return;
}
LOG.info(name.getMethodName() + " - OK");
}
use of joynr.interlanguagetest.Enumeration in project joynr by bmwcarit.
the class IltProviderBean method methodWithMultipleEnumParameters.
/*
* methodWithMultipleEnumParameters
*
* return fixed values for now
*/
@Override
public MethodWithMultipleEnumParametersReturned methodWithMultipleEnumParameters(Enumeration enumerationArg, ExtendedTypeCollectionEnumerationInTypeCollection extendedEnumerationArg) {
logger.warn("*****************************************************");
logger.warn("* IltProvider.methodWithMultipleEnumParameters called");
logger.warn("*****************************************************");
// 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");
throw new ProviderRuntimeException("methodWithMultipleEnumParameters: received wrong argument");
}
// prepare output parameters
ExtendedEnumerationWithPartlyDefinedValues extendedEnumerationOut = ExtendedEnumerationWithPartlyDefinedValues.ENUM_2_VALUE_EXTENSION_FOR_ENUM_WITHOUT_DEFINED_VALUES;
Enumeration enumerationOut = Enumeration.ENUM_0_VALUE_1;
return new MethodWithMultipleEnumParametersReturned(extendedEnumerationOut, enumerationOut);
}
use of joynr.interlanguagetest.Enumeration in project joynr by bmwcarit.
the class IltConsumerAttributeSubscriptionTest method callSubscribeAttributeEnumeration.
@Test
public void callSubscribeAttributeEnumeration() {
Future<String> subscriptionIdFuture;
String subscriptionId;
int minIntervalMs = 0;
int maxIntervalMs = 10000;
long validityMs = 60000;
int alertAfterIntervalMs = 20000;
int publicationTtlMs = 5000;
OnChangeWithKeepAliveSubscriptionQos subscriptionQos = new OnChangeWithKeepAliveSubscriptionQos().setMinIntervalMs(minIntervalMs).setMaxIntervalMs(maxIntervalMs).setValidityMs(validityMs).setAlertAfterIntervalMs(alertAfterIntervalMs).setPublicationTtlMs(publicationTtlMs);
boolean result;
LOG.info(name.getMethodName() + "");
try {
// must set the value before it can be retrieved again via subscription
Enumeration enumerationArg = Enumeration.ENUM_0_VALUE_2;
testInterfaceProxy.setAttributeEnumeration(enumerationArg);
subscriptionIdFuture = testInterfaceProxy.subscribeToAttributeEnumeration(new AttributeSubscriptionAdapter<Enumeration>() {
@Override
public void onReceive(Enumeration value) {
if (value == Enumeration.ENUM_0_VALUE_2) {
LOG.info(name.getMethodName() + " - callback - got publication with correct value");
subscribeAttributeEnumerationCallbackResult = true;
} else {
subscribeAttributeEnumerationCallbackResult = false;
LOG.info(name.getMethodName() + " - callback - got publication with invalid value");
}
subscribeAttributeEnumerationCallbackDone = true;
}
@Override
public void onError(JoynrRuntimeException error) {
LOG.info(name.getMethodName() + " - callback - got unexpected exception");
subscribeAttributeEnumerationCallbackResult = false;
subscribeAttributeEnumerationCallbackDone = true;
}
}, subscriptionQos);
subscriptionId = subscriptionIdFuture.get(10000);
LOG.info(name.getMethodName() + " - subscription successful, subscriptionId = " + subscriptionId);
// should have been called ahead anyway
if (subscribeAttributeEnumerationCallbackDone == 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 (subscribeAttributeEnumerationCallbackDone && subscribeAttributeEnumerationCallbackResult) {
result = true;
} else {
fail(name.getMethodName() + " - FAILED - callback NOT done");
result = false;
}
// try to unsubscribe in any case
try {
testInterfaceProxy.unsubscribeFromAttributeEnumeration(subscriptionId);
LOG.info(name.getMethodName() + " - unsubscribe successful");
} catch (Exception e) {
fail(name.getMethodName() + " - FAILED - caught unexpected exception: " + e.getMessage());
result = false;
}
if (!result) {
LOG.info(name.getMethodName() + " - FAILED");
} else {
LOG.info(name.getMethodName() + " - OK");
}
return;
} catch (Exception e) {
// also catches InterruptedException from Thread.sleep() call
fail(name.getMethodName() + " - FAILED - caught unexpected exception: " + e.getMessage());
return;
}
}
use of joynr.interlanguagetest.Enumeration in project joynr by bmwcarit.
the class IltConsumerGetterSetterTest method callGetAttributeEnumeration.
@Test
public void callGetAttributeEnumeration() {
LOG.info(name.getMethodName() + "");
try {
Enumeration result;
// must set the value before it can be retrieved again
Enumeration enumerationArg = Enumeration.ENUM_0_VALUE_2;
testInterfaceProxy.setAttributeEnumeration(enumerationArg);
result = testInterfaceProxy.getAttributeEnumeration();
if (result == null) {
fail(name.getMethodName() + " - FAILED - got no result");
return;
}
if (result != Enumeration.ENUM_0_VALUE_2) {
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.Enumeration in project joynr by bmwcarit.
the class IltConsumerGetterSetterTest method callSetAttributeEnumeration.
@Test
public void callSetAttributeEnumeration() {
LOG.info(name.getMethodName() + "");
try {
Enumeration enumerationArg = Enumeration.ENUM_0_VALUE_2;
testInterfaceProxy.setAttributeEnumeration(enumerationArg);
} catch (Exception e) {
fail(name.getMethodName() + " - FAILED - caught unexpected exception: " + e.getMessage());
return;
}
LOG.info(name.getMethodName() + " - OK");
}
Aggregations