Exemplo n.º 1
0
 @Override
 public Object getSymbol(String symbolName) {
   MethodExecutionResult result = context.getVariable(symbolName);
   if (result == null) {
     return null;
   }
   return result.returnValue();
 }
Exemplo n.º 2
0
 @Override
 public Object callAndAssign(
     String variable, String instanceName, String methodName, Object... args)
     throws SlimException {
   try {
     MethodExecutionResult result = getMethodExecutionResult(instanceName, methodName, args);
     context.setVariable(variable, result);
     checkForPatternOfFixturesHandlingSymbols(variable);
     return result.returnValue();
   } catch (Throwable e) { // NOSONAR
     checkExceptionForStop(e);
     throw new SlimException(e);
   }
 }
Exemplo n.º 3
0
 private MethodExecutionResult getMethodExecutionResult(
     String instanceName, String methodName, Object... args) throws Throwable {
   MethodExecutionResults results = new MethodExecutionResults();
   Boolean ignoreSymbols = ignoreSymbols(instanceName, methodName);
   if (!ignoreSymbols) {
     args = context.replaceSymbols(args);
   }
   for (MethodExecutor anExecutorChain : executorChain) {
     MethodExecutionResult result = anExecutorChain.execute(instanceName, methodName, args);
     if (result.hasResult()) {
       return result;
     }
     results.add(result);
   }
   return results.getFirstResult();
 }
Exemplo n.º 4
0
  private void checkForPatternOfFixturesHandlingSymbols(String symbolName) {
    if (!SLIM_AGENT_FIXTURE_HANDLES_SYMBOLS.equals(symbolName)) return;
    // Special Symbol Name need to update
    try {
      MethodExecutionResult mer = context.getVariable(SLIM_AGENT_FIXTURE_HANDLES_SYMBOLS);
      if (mer == null) return;

      try {
        if (mer.returnValue() == null) {
          patternOfFixturesHandlingSymbols = null;
        } else {
          patternOfFixturesHandlingSymbols = Pattern.compile(mer.returnValue().toString());
        }
      } catch (Exception e) {
        patternOfFixturesHandlingSymbols = null;
      }

    } catch (Exception e) {
      return;
    }
  }