use of joynr.exceptions.ProviderRuntimeException in project joynr by bmwcarit.
the class LocalCapabilitiesDirectoryImpl method remove.
@Override
public io.joynr.provider.Promise<io.joynr.provider.DeferredVoid> remove(String participantId) {
DeferredVoid deferred = new DeferredVoid();
DiscoveryEntry entryToRemove = localDiscoveryEntryStore.lookup(participantId, Long.MAX_VALUE);
if (entryToRemove != null) {
remove(entryToRemove);
deferred.resolve();
} else {
deferred.reject(new ProviderRuntimeException("Failed to remove participantId: " + participantId));
}
return new Promise<>(deferred);
}
use of joynr.exceptions.ProviderRuntimeException in project joynr by bmwcarit.
the class IltConsumerSyncMethodTest method callMethodWithExistingErrorEnum.
@Test
public void callMethodWithExistingErrorEnum() {
LOG.info(name.getMethodName() + "");
// 1st test
try {
String wantedExceptionArg = "ProviderRuntimeException";
testInterfaceProxy.methodWithExistingErrorEnum(wantedExceptionArg);
fail(name.getMethodName() + " - FAILED - 1st - unexpected return without exception");
return;
} catch (ProviderRuntimeException e) {
if (e.getMessage() == null || !e.getMessage().endsWith("Exception from methodWithExistingErrorEnum")) {
fail(name.getMethodName() + " - FAILED - 1st - got invalid exception content");
return;
}
} catch (Exception e) {
fail(name.getMethodName() + " - FAILED - 1st - caught unexpected exception type: " + e.getMessage());
return;
}
// 2nd test
try {
String wantedExceptionArg = "ApplicationException_1";
testInterfaceProxy.methodWithExistingErrorEnum(wantedExceptionArg);
fail(name.getMethodName() + " - FAILED - 2nd - unexpected return without exception");
return;
} catch (ApplicationException e) {
if (e.getError() != ExtendedErrorEnumTc.ERROR_2_3_TC2) {
fail(name.getMethodName() + " - FAILED - 2nd - unexpected exception error enum value");
return;
}
} catch (Exception e) {
fail(name.getMethodName() + " - FAILED - caught unexpected exception: " + e.getMessage());
return;
}
// 3rd test
try {
String wantedExceptionArg = "ApplicationException_2";
testInterfaceProxy.methodWithExistingErrorEnum(wantedExceptionArg);
fail(name.getMethodName() + " - FAILED - 3rd - unexpected return without exception");
return;
} catch (ApplicationException e) {
if (e.getError() != ExtendedErrorEnumTc.ERROR_1_2_TC_2) {
fail(name.getMethodName() + " - FAILED - 3rd - unexpected exception error enum value");
return;
}
} catch (Exception e) {
fail(name.getMethodName() + " - FAILED - caught unexpected exception: " + e.getMessage());
return;
}
LOG.info(name.getMethodName() + " - OK");
}
use of joynr.exceptions.ProviderRuntimeException in project joynr by bmwcarit.
the class IltConsumerSyncMethodTest method callMethodWithoutErrorEnum.
/*
* SYNCHRONOUS METHOD CALLS WITH EXCEPTION HANDLING
*/
@Test
public void callMethodWithoutErrorEnum() {
LOG.info(name.getMethodName() + "");
try {
String wantedExceptionArg = "ProviderRuntimeException";
testInterfaceProxy.methodWithoutErrorEnum(wantedExceptionArg);
fail(name.getMethodName() + " - FAILED - unexpected return");
return;
} catch (ProviderRuntimeException e) {
if (e.getMessage() == null || !e.getMessage().endsWith("Exception from methodWithoutErrorEnum")) {
fail(name.getMethodName() + " - FAILED - invalid exception message");
return;
}
} catch (Exception e) {
fail(name.getMethodName() + " - FAILED - caught unexpected exception: " + e.getMessage());
return;
}
LOG.info(name.getMethodName() + " - OK");
}
use of joynr.exceptions.ProviderRuntimeException in project joynr by bmwcarit.
the class IltProvider method overloadedMethodWithSelector.
/*
* overloadedMethodWithSelector (2)
*/
@Override
public Promise<OverloadedMethodWithSelector1Deferred> overloadedMethodWithSelector(Boolean booleanArg) {
logger.warn("*************************************************");
logger.warn("* IltProvider.overloadedMethodWithSelector called");
logger.warn("*************************************************");
OverloadedMethodWithSelector1Deferred deferred = new OverloadedMethodWithSelector1Deferred();
// check input parameter
if (booleanArg != false) {
logger.warn("overloadedMethodWithSelector: invalid argument booleanArg");
deferred.reject(new ProviderRuntimeException("overloadedMethodWithSelector: invalid parameter booleanArg"));
return new Promise<OverloadedMethodWithSelector1Deferred>(deferred);
}
// setup output parameter
String stringOut = "Return value from overloadedMethodWithSelector 2";
deferred.resolve(stringOut);
return new Promise<OverloadedMethodWithSelector1Deferred>(deferred);
}
use of joynr.exceptions.ProviderRuntimeException in project joynr by bmwcarit.
the class IltProvider method methodWithoutErrorEnum.
/*
* methodWithoutErrorEnum
*/
@Override
public Promise<DeferredVoid> methodWithoutErrorEnum(String wantedExceptionArg) {
logger.warn("*******************************************");
logger.warn("* IltProvider.methodWithoutErrorEnum called");
logger.warn("*******************************************");
DeferredVoid deferred = new DeferredVoid();
if (wantedExceptionArg.equals("ProviderRuntimeException")) {
deferred.reject(new ProviderRuntimeException("Exception from methodWithoutErrorEnum"));
} else {
deferred.resolve();
}
return new Promise<DeferredVoid>(deferred);
}
Aggregations