public void setVariable(String name, Object value) { setVariable(name, new MethodExecutionResult(value, Object.class)); }
@Override public Object getSymbolObject(String symbolName) { MethodExecutionResult result = context.getVariable(symbolName); if (result == null) { return null; } return result.getObject(); }
private MethodExecutionResult findSystemUnderTest(String methodName, Object instance, Class<?> k, Object[] args) throws Throwable{ Field[] fields = k.getDeclaredFields(); for (Field field : fields) { if (isSystemUnderTest(field)) { Object systemUnderTest = field.get(instance); MethodExecutionResult res = findAndInvoke(methodName, args, systemUnderTest); if (res.hasResult()) { return res; } } } return MethodExecutionResult.noMethod(methodName, instance.getClass(), args.length); }
@Override public Object getSymbol(String symbolName) { MethodExecutionResult result = context.getVariable(symbolName); if (result == null) { return null; } return result.returnValue(); }
@Override public MethodExecutionResult execute(String instanceName, String methodName, Object[] args) throws Throwable { Object instance; try { instance = context.getInstance(instanceName); } catch (SlimError e) { return MethodExecutionResult.noInstance(instanceName + "." + methodName); } return findSystemUnderTest(methodName, instance, instance.getClass(), args); }
@Override public MethodExecutionResult execute(String instanceName, String methodName, Object[] args) throws Throwable { List<Library> libraries = context.getLibraries(); for (int i = (libraries.size() - 1); i >= 0; i--) { MethodExecutionResult result = findAndInvoke(methodName, args, libraries.get(i).instance); if (result.hasResult()) { return result; } } return MethodExecutionResult.NO_METHOD_IN_LIBRARIES; } }
public Object returnValue() { if (type == List.class && value instanceof List) { return value; } else { return toString(); } }
@Override public MethodExecutionResult findAndInvoke(String methodName, Object instance, Object... args) throws Throwable { Method method = findMatchingMethod(methodName, instance, args); if (method != null) { return this.invokeMethod(instance, method, args); } return MethodExecutionResult.noMethod(methodName, instance.getClass(), args.length); }
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; } }
@Override public MethodExecutionResult execute(String instanceName, String methodName, Object[] args) throws Throwable { Object instance; try { instance = context.getInstance(instanceName); } catch (SlimError e) { return MethodExecutionResult.noInstance(instanceName + "." + methodName); } return findSystemUnderTest(methodName, instance, instance.getClass(), args); }
@Override public MethodExecutionResult execute(String instanceName, String methodName, Object[] args) throws Throwable { List<Library> libraries = context.getLibraries(); for (int i = (libraries.size() - 1); i >= 0; i--) { MethodExecutionResult result = findAndInvoke(methodName, args, libraries.get(i).instance); if (result.hasResult()) { return result; } } return MethodExecutionResult.NO_METHOD_IN_LIBRARIES; } }
public Object returnValue() { if (type == List.class && value instanceof List) { return value; } else { return toString(); } }
@Override public MethodExecutionResult findAndInvoke(String methodName, Object instance, Object... args) throws Throwable { Method method = findMatchingMethod(methodName, instance, args); if (method != null) { return this.invokeMethod(instance, method, args); } return MethodExecutionResult.noMethod(methodName, instance.getClass(), args.length); }
@Override public Object getSymbol(String symbolName) { MethodExecutionResult result = context.getVariable(symbolName); if (result == null) { return null; } return result.returnValue(); }
private MethodExecutionResult findSystemUnderTest(String methodName, Object instance, Class<?> k, Object[] args) throws Throwable{ Field[] fields = k.getDeclaredFields(); for (Field field : fields) { if (isSystemUnderTest(field)) { Object systemUnderTest = field.get(instance); MethodExecutionResult res = findAndInvoke(methodName, args, systemUnderTest); if (res.hasResult()) { return res; } } } return MethodExecutionResult.noMethod(methodName, instance.getClass(), args.length); }
public void setVariable(String name, Object value) { setVariable(name, new MethodExecutionResult(value, Object.class)); }
@Override public Object getSymbolObject(String symbolName) { MethodExecutionResult result = context.getVariable(symbolName); if (result == null) { return null; } return result.getObject(); }
@Override public MethodExecutionResult execute(String instanceName, String methodName, Object[] args) throws Throwable { Object instance; try { instance = context.getInstance(instanceName); } catch (SlimError e) { return MethodExecutionResult.noInstance(instanceName + "." + methodName); } return findAndInvoke(methodName, args, instance); } }
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(); }
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; } }