Exemplo n.º 1
0
 /**
  * Record the execution sequence.
  *
  * @param pSession
  */
 public void record(RecordingSession pSession) {
   if (pSession == null) {
     _supervisor.echo("Empty Recording Session at " + getDefiningClassSignature());
     return;
   }
   try {
     pSession.recording();
   } catch (ExecutionException ignore) {
     _supervisor.echo("Error Recording at " + getDefiningClassSignature());
   }
 }
Exemplo n.º 2
0
 /**
  * Capture the execution as an invocation.
  *
  * @param proxy
  * @param method
  * @param args
  * @return
  */
 public Object captureExecution(Object proxy, Method method, Object[] args) {
   Object _caller = _callerStack.peek();
   Invocation invocation = new Invocation(_caller, proxy, method, args, null);
   _supervisor._invocations.add(invocation);
   _callerStack.push(proxy);
   _supervisor.echo("Capturing " + invocation.getString());
   Object target = _supervisor._attachments.getTarget(proxy);
   if (target == null) {
     String message = "No Target Attached at " + getCallingClassSignature();
     _supervisor.echo(message);
     throw new ExecutionException(message);
   }
   Object theReturnValue = executeMethod(target, method, args);
   invocation._result = new InvocationResult();
   invocation._result.setReturn(theReturnValue);
   _callerStack.pop();
   return theReturnValue;
 }
Exemplo n.º 3
0
 /**
  * Execute the method on the attached target.
  *
  * @param pObject
  * @param pMethod
  * @param pArgs
  * @return
  */
 Object executeMethod(Object pObject, Method pMethod, Object[] pArgs) {
   Object result = null;
   try {
     result = pMethod.invoke(pObject, pArgs);
   } catch (Exception e) {
     String message;
     message = "Error Capturing " + getCallingClassSignature();
     _supervisor.echo(message);
     throw new ExecutionException(message);
   }
   return result;
 }