use of org.aspectj.lang.annotation.After in project sakuli by ConSol.
the class RhinoAspect method getRhinoScriptRunner.
/**
* Aspect to fetch the {@link RhinoScriptRunner} at the start of a test case script. The {@link RhinoScriptRunner}
* will then saved in the {@link BaseActionLoaderImpl} for forther usage.
*
* @param joinPoint injected joinPoint of the execution
*/
@After("execution(* net.sf.sahi.rhino.RhinoScriptRunner.setReporter*(*))")
public void getRhinoScriptRunner(JoinPoint joinPoint) {
BaseActionLoader environmentLoader = BeanLoader.loadBaseActionLoader();
if (joinPoint.getTarget() instanceof RhinoScriptRunner) {
logger.info("Add RhinoScriptRunner to the JavaBackEnd");
environmentLoader.setRhinoScriptRunner((RhinoScriptRunner) joinPoint.getTarget());
} else {
logger.warn(joinPoint.getTarget().getClass().getName() + " could not added to the JavaBackEnd!");
}
}
use of org.aspectj.lang.annotation.After in project sakuli by ConSol.
the class ExceptionHandlerAspect method processJavaException.
/**
* Throw the handled Exception after {@link SakuliExceptionHandler#processException(Exception)} to stop the current
* test case execution of an JAVA test.
*/
@After("execution(* org.sakuli.exceptions.SakuliExceptionHandler.processException(..)) ")
public void processJavaException(JoinPoint joinPoint) throws Exception {
Object[] args = joinPoint.getArgs();
if (args != null && args.length == 1) {
Object e = args[0];
SakuliExceptionHandler exceptionHandler = BeanLoader.loadBaseActionLoader().getExceptionHandler();
if (e instanceof SakuliException && exceptionHandler.resumeToTestExecution(((SakuliException) e).castTo())) {
return;
}
throw (Exception) e;
}
}
Aggregations