@Override public void testEnded(String host) { if (bshInterpreter == null || !hasInitFile) { return; } try { bshInterpreter.eval((new StringBuilder("testEnded(\"")) // $NON-NLS-1$ .append(host) .append("\")") // $NON-NLS-1$ .toString()); // $NON-NLS-1$ } catch (JMeterException ignored) { log.debug(getClass().getName() + " : " + ignored.getLocalizedMessage()); // $NON-NLS-1$ } }
@Override public void testStarted(String host) { if (bshInterpreter == null || !hasInitFile) { return; } try { bshInterpreter.eval((new StringBuilder("testStarted(\"")) // $NON-NLS-1$ .append(host) .append("\")") // $NON-NLS-1$ .toString()); // $NON-NLS-1$ } catch (JMeterException ignored) { log.debug(getClass().getName() + " : " + ignored.getLocalizedMessage()); // $NON-NLS-1$ } }
Object bshOut = bshInterpreter.eval(script); if (bshOut != null) { resultStr = bshOut.toString();
/** * Process the file or script from the test element. * <p> * Sets the following script variables: * <ul> * <li>FileName</li> * <li>Parameters</li> * <li>bsh.args</li> * </ul> * @param bsh the interpreter, not {@code null} * @return the result of the script, may be {@code null} * * @throws JMeterException when working with the bsh fails */ protected Object processFileOrScript(BeanShellInterpreter bsh) throws JMeterException{ String fileName = getFilename(); String params = getParameters(); bsh.set("FileName", fileName);//$NON-NLS-1$ // Set params as a single line bsh.set("Parameters", params); // $NON-NLS-1$ // and set as an array bsh.set("bsh.args",//$NON-NLS-1$ JOrphanUtils.split(params, " "));//$NON-NLS-1$ if (fileName.length() == 0) { return bsh.eval(getScript()); } return bsh.source(fileName); }