@Test(dataProvider = "resultTypes") public void testDoHandleRhinoException(ResultType resultTyp) throws Exception { initMocks(); Report sahiReport = BeanLoader.loadBaseActionLoader().getSahiReport(); int lisSize = sahiReport.getListResult().size(); assertNotNull(sahiReport); sahiReport.addResult("TEST-ENTRY", resultTyp, "bla", "TEST-ENTRY"); verifySahiReport(resultTyp, lisSize); }
@Before("execution(* net.sf.sahi.report.Report.addResult(..))") public void doHandleRhinoException(JoinPoint joinPoint) { Object[] args = joinPoint.getArgs(); ResultType resultType; if (args[1] instanceof ResultType) { resultType = (ResultType) args[1]; } else { resultType = ResultType.getType((String) args[1]); } LogResult logResult = new LogResult( (String) args[0], resultType, (String) args[2], (String) args[3] ); if (logResult.getFailureMsg() == null || !logResult.getFailureMsg().contains(ALREADY_PROCESSED)) { if (ResultType.ERROR.equals(resultType) || ResultType.FAILURE.equals(resultType)) { BaseActionLoader environmentLoader = BeanLoader.loadBaseActionLoader(); environmentLoader.getExceptionHandler().handleException(logResult); } else if (logResult.getDebugInfo() == null || !logResult.getDebugInfo().startsWith("org.sakuli.actions.")) { logger.info(logResult.getMessage()); addActionsToCurrentTestCase(TestAction.createSahiTestAction(logResult.getMessage(), BeanLoader.loadBaseActionLoader().getSakuliProperties().getSahiDocBaseUrl())); } } }
RhinoAspect extends BaseSakuliAspect { @Before("execution(* net.sf.sahi.report.Report.addResult(..))") public void doHandleRhinoException(JoinPoint joinPoint) { Object[] args = joinPoint.getArgs(); ResultType resultType; if (args[1] instanceof ResultType) { resultType = (ResultType) args[1]; } else { resultType = ResultType.getType((String) args[1]); } LogResult logResult = new LogResult( (String) args[0], resultType, (String) args[2], (String) args[3] ); if (logResult.getFailureMsg() == null || !logResult.getFailureMsg().contains(ALREADY_PROCESSED)) { if (ResultType.ERROR.equals(resultType) || ResultType.FAILURE.equals(resultType)) { BaseActionLoader environmentLoader = BeanLoader.loadBaseActionLoader(); environmentLoader.getExceptionHandler().handleException(logResult); } else if (logResult.getDebugInfo() == null || !logResult.getDebugInfo().startsWith("org.sakuli.actions.")) { logger.info(logResult.getMessage()); addActionsToCurrentTestCase(TestAction.createSahiTestAction(logResult.getMessage(), BeanLoader.loadBaseActionLoader().getSakuliProperties().getSahiDocBaseUrl())); } } } }
RhinoAspect extends BaseSakuliAspect { @Before("execution(* net.sf.sahi.report.Report.addResult(..))") public void doHandleRhinoException(JoinPoint joinPoint) { Object[] args = joinPoint.getArgs(); ResultType resultType; if (args[1] instanceof ResultType) { resultType = (ResultType) args[1]; } else { resultType = ResultType.getType((String) args[1]); } LogResult logResult = new LogResult( (String) args[0], resultType, (String) args[2], (String) args[3] ); if (logResult.getFailureMsg() == null || !logResult.getFailureMsg().contains(ALREADY_PROCESSED)) { if (ResultType.ERROR.equals(resultType) || ResultType.FAILURE.equals(resultType)) { BaseActionLoader environmentLoader = BeanLoader.loadBaseActionLoader(); environmentLoader.getExceptionHandler().handleException(logResult); } else if (logResult.getDebugInfo() == null || !logResult.getDebugInfo().startsWith("org.sakuli.actions.")) { logger.info(logResult.getMessage()); addActionsToCurrentTestCase(TestAction.createSahiTestAction(logResult.getMessage(), BeanLoader.loadBaseActionLoader().getSakuliProperties().getSahiDocBaseUrl())); } } }  }
RhinoAspect extends BaseSakuliAspect { @Before("execution(* net.sf.sahi.report.Report.addResult(..))") public void doHandleRhinoException(JoinPoint joinPoint) { Object[] args = joinPoint.getArgs(); ResultType resultType; if (args[1] instanceof ResultType) { resultType = (ResultType) args[1]; } else { resultType = ResultType.getType((String) args[1]); } LogResult logResult = new LogResult( (String) args[0], resultType, (String) args[2], (String) args[3] ); if (logResult.getFailureMsg() == null || !logResult.getFailureMsg().contains(ALREADY_PROCESSED)) { if (ResultType.ERROR.equals(resultType) || ResultType.FAILURE.equals(resultType)) { BaseActionLoader environmentLoader = BeanLoader.loadBaseActionLoader(); environmentLoader.getExceptionHandler().handleException(logResult); } else if (logResult.getDebugInfo() == null || !logResult.getDebugInfo().startsWith("org.sakuli.actions.")) { logger.info(logResult.getMessage()); addActionsToCurrentTestCase(TestAction.createSahiTestAction(logResult.getMessage(), BeanLoader.loadBaseActionLoader().getSakuliProperties().getSahiDocBaseUrl())); } } }  @After("execution(* net.sf.sahi.rhino.RhinoScriptRunner.setReporter*(*))") void getRhinoScriptRunner(JoinPoint joinPoint); @Before("execution(* org.sakuli.actions.*.*(..)) &&" + "@annotation(logToResult)") void doTestCaseActionLog(JoinPoint joinPoint, LogToResult logToResult); @Before("execution(* org.sakuli.actions.screenbased.*.*(..)) &&" + "@annotation(logToResult)") void doScreenBasedActionLog(JoinPoint joinPoint, LogToResult logToResult); @Before("execution(* org.sakuli.actions.environment.*.*(..)) &&" + "@annotation(logToResult)") void doEnvironmentLog(JoinPoint joinPoint, LogToResult logToResult); @Before("execution(* org.sakuli.actions.logging.*.*(..)) &&" + "@annotation(logToResult)") void doLoggingLog(JoinPoint joinPoint, LogToResult logToResult); @Before("execution(* net.sf.sahi.report.Report.addResult(..))") void doHandleRhinoException(JoinPoint joinPoint); }
RhinoAspect extends BaseSakuliAspect { @Before("execution(* net.sf.sahi.report.Report.addResult(..))") public void doHandleRhinoException(JoinPoint joinPoint) { Object[] args = joinPoint.getArgs(); ResultType resultType; if (args[1] instanceof ResultType) { resultType = (ResultType) args[1]; } else { resultType = ResultType.getType((String) args[1]); } LogResult logResult = new LogResult( (String) args[0], resultType, (String) args[2], (String) args[3] ); if (logResult.getFailureMsg() == null || !logResult.getFailureMsg().contains(ALREADY_PROCESSED)) { if (ResultType.ERROR.equals(resultType) || ResultType.FAILURE.equals(resultType)) { BaseActionLoader environmentLoader = BeanLoader.loadBaseActionLoader(); environmentLoader.getExceptionHandler().handleException(logResult); } else if (logResult.getDebugInfo() == null || !logResult.getDebugInfo().startsWith("org.sakuli.actions.")) { logger.info(logResult.getMessage()); addActionsToCurrentTestCase(TestAction.createSahiTestAction(logResult.getMessage(), BeanLoader.loadBaseActionLoader().getSakuliProperties().getSahiDocBaseUrl())); } } }  @After("execution(* net.sf.sahi.rhino.RhinoScriptRunner.setReporter*(*))") void getRhinoScriptRunner(JoinPoint joinPoint); @Before("execution(* org.sakuli.actions.*.*(..)) &&" + "@annotation(logToResult)") void doTestCaseActionLog(JoinPoint joinPoint, LogToResult logToResult); @Before("execution(* org.sakuli.actions.screenbased.*.*(..)) &&" + "@annotation(logToResult)") void doScreenBasedActionLog(JoinPoint joinPoint, LogToResult logToResult); @Before("execution(* org.sakuli.actions.environment.*.*(..)) &&" + "@annotation(logToResult)") void doEnvironmentLog(JoinPoint joinPoint, LogToResult logToResult); @Before("execution(* org.sakuli.actions.logging.*.*(..)) &&" + "@annotation(logToResult)") void doLoggingLog(JoinPoint joinPoint, LogToResult logToResult); @Before("execution(* net.sf.sahi.report.Report.addResult(..))") void doHandleRhinoException(JoinPoint joinPoint); static final String ALREADY_PROCESSED; }