use of iso.std.iso_iec._24727.tech.schema.ResponseType in project open-ecard by ecsec.
the class MessageDispatcher method deliver.
@Override
public Object deliver(Object req) throws DispatcherException, InvocationTargetException {
EventDispatcher disp = environment.getEventDispatcher();
// send API CALL STARTED event
ConnectionHandleType handle = HandlerUtils.extractHandle(req);
if (disp != null && req instanceof RequestType) {
ApiCallEventObject startEvt = new ApiCallEventObject(handle, (RequestType) req);
LOG.debug("Sending API_CALL_STARTED event.");
disp.notify(EventType.API_CALL_STARTED, startEvt);
}
try {
Class<?> reqClass = req.getClass();
Service s = getService(reqClass);
Object serviceImpl = getServiceImpl(s);
LOG.debug("Delivering message of type: {}", req.getClass().getName());
Object result = s.invoke(serviceImpl, req);
// send API CALL FINISHED event
if (disp != null && req instanceof RequestType && result instanceof ResponseType) {
ApiCallEventObject finEvt = new ApiCallEventObject(handle, (RequestType) req);
finEvt.setResponse((ResponseType) result);
LOG.debug("Sending API_CALL_FINISHED event.");
disp.notify(EventType.API_CALL_FINISHED, finEvt);
}
return result;
} catch (IllegalAccessException | IllegalArgumentException ex) {
throw new DispatcherException(ex);
}
}
use of iso.std.iso_iec._24727.tech.schema.ResponseType in project open-ecard by ecsec.
the class TinyManagementTest method testRest.
@Test
public void testRest() throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
for (Method m : instance.getClass().getDeclaredMethods()) {
// cobertura adds methods whose names start with '__cobertura'
if (m.getName().equals("initializeFramework") || m.getName().startsWith("__cobertura")) {
continue;
}
System.out.println(m.getName());
if (m.getParameterTypes().length == 1) {
Object o = m.getParameterTypes()[0].newInstance();
ResponseType result = (ResponseType) m.invoke(instance, o);
assertEquals(ECardConstants.Major.ERROR, result.getResult().getResultMajor());
}
}
}
Aggregations