Search in sources :

Example 11 with After

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!");
    }
}
Also used : RhinoScriptRunner(net.sf.sahi.rhino.RhinoScriptRunner) BaseActionLoader(org.sakuli.loader.BaseActionLoader) After(org.aspectj.lang.annotation.After)

Example 12 with After

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;
    }
}
Also used : SakuliExceptionHandler(org.sakuli.exceptions.SakuliExceptionHandler) SakuliException(org.sakuli.exceptions.SakuliException) SakuliException(org.sakuli.exceptions.SakuliException) After(org.aspectj.lang.annotation.After)

Aggregations

After (org.aspectj.lang.annotation.After)12 LogDTO (com.tomasio.projects.trainning.dto.LogDTO)3 DAOException (com.tomasio.projects.trainning.exception.DAOException)3 Date (java.util.Date)3 CursoDAO (com.tomasio.projects.trainning.dao.CursoDAO)2 IView (com.yydcdut.note.views.IView)2 JoinPoint (org.aspectj.lang.JoinPoint)2 ProceedingJoinPoint (org.aspectj.lang.ProceedingJoinPoint)2 IPage (com.agiletec.aps.system.services.page.IPage)1 Widget (com.agiletec.aps.system.services.page.Widget)1 Content (com.agiletec.plugins.jacms.aps.system.services.content.model.Content)1 Item (com.ctrip.framework.apollo.biz.entity.Item)1 BadRequestException (com.ctrip.framework.apollo.common.exception.BadRequestException)1 JMethod (com.google.gwt.dev.jjs.ast.JMethod)1 JProgram (com.google.gwt.dev.jjs.ast.JProgram)1 ControlFlowAnalyzer (com.google.gwt.dev.jjs.impl.ControlFlowAnalyzer)1 CursoDTO (com.tomasio.projects.trainning.dto.CursoDTO)1 IndicacaoDTO (com.tomasio.projects.trainning.dto.IndicacaoDTO)1 MatriculaDTO (com.tomasio.projects.trainning.dto.MatriculaDTO)1 Pattern (java.util.regex.Pattern)1