private void saveOneMatch(JMeterVariables vars, String refName, List<String> matches) { if (matches.size() == 1) { // if not then invalid matchNum was likely supplied String match = matches.get(0); if (match != null) { vars.put(refName, match); } } }
private void putIntoVar(final JMeterVariables jmvars, final String name, final ResultSet resultSet) throws SQLException { if (RS_STORE_AS_OBJECT.equals(resultSetHandler)) { jmvars.putObject(name, resultSet); } else if (RS_COUNT_RECORDS.equals(resultSetHandler)) { jmvars.put(name, resultSet.toString() + " " + countRows(resultSet) + " rows"); } else { jmvars.put(name, resultSet.toString()); } }
private void saveAllMatches(JMeterVariables vars, String refName, List<String> matches) { vars.put(refName + REF_MATCH_NR, Integer.toString(matches.size())); for (int i = 0; i < matches.size(); i++) { String match = matches.get(i); if (match != null) { int varNum = i + 1; vars.put(refName + UNDERSCORE + varNum, match); } } }
private void saveRandomMatch(JMeterVariables vars, String refName, List<String> matches) { String match = matches.get(JMeterUtils.getRandomInt(matches.size())); if (match != null) { vars.put(refName, match); } }
private void placeObjectIntoVars(JMeterVariables vars, String currentRefName, List<Object> extractedValues, int matchNr) { vars.put(currentRefName, stringify(extractedValues.get(matchNr))); }
/** * {@inheritDoc} */ @Override public synchronized String execute(SampleResult previousResult, Sampler currentSampler) throws InvalidVariableException { JMeterVariables vars = getVariables(); Integer len = ((CompoundVariable) values[0]).execute().length(); if (vars != null && values.length > 1) { String varName = ((CompoundVariable) values[1]).execute().trim(); vars.put(varName, len.toString()); } return len.toString(); }
/** * {@inheritDoc} */ @Override public synchronized String execute(SampleResult previousResult, Sampler currentSampler) throws InvalidVariableException { JMeterVariables vars = getVariables(); Integer len = ((CompoundVariable) values[0]).execute().length(); if (vars != null && values.length > 1) { String varName = ((CompoundVariable) values[1]).execute().trim(); vars.put(varName, len.toString()); } return len.toString(); }
private void saveGroups(MatchResult result, String namep, JMeterVariables vars) { for (int x = 0; x < result.groups(); x++) { vars.put(namep + "_g" + x, result.group(x)); //$NON-NLS-1$ } }
/** * {@inheritDoc} */ @Override public synchronized String execute(SampleResult previousResult, Sampler currentSampler) throws InvalidVariableException { JMeterVariables vars = getVariables(); String varName = ((CompoundVariable) values[values.length - 1]).execute().trim(); int index = random.nextInt(values.length - 1); String choice = ((CompoundVariable) values[index]).execute(); if (vars != null && varName != null && varName.length() > 0) {// vars will be null on TestPlan vars.put(varName, choice); } return choice; }
private void processVariables() { final Arguments args1 = (Arguments) this.getUserDefinedVariablesAsProperty().getObjectValue(); Arguments args = (Arguments) args1.clone(); final JMeterVariables vars = JMeterContextService.getContext().getVariables(); Iterator<Entry<String, String>> it = args.getArgumentsAsMap().entrySet().iterator(); Entry<String, String> var; while (it.hasNext()) { var = it.next(); log.debug("Setting " + var.getKey() + "=" + var.getValue()); vars.put(var.getKey(), var.getValue()); } }
/** * {@inheritDoc} */ @Override public synchronized String execute(SampleResult previousResult, Sampler currentSampler) throws InvalidVariableException { JMeterVariables vars = getVariables(); String res = ((CompoundVariable) values[0]).execute().toLowerCase(); if (vars != null && values.length > 1) { String varName = ((CompoundVariable) values[1]).execute().trim(); vars.put(varName, res); } return res; }
/** * {@inheritDoc} */ @Override public synchronized String execute(SampleResult previousResult, Sampler currentSampler) throws InvalidVariableException { JMeterVariables vars = getVariables(); String res = ((CompoundVariable) values[0]).execute().toLowerCase(); if (vars != null && values.length > 1) { String varName = ((CompoundVariable) values[1]).execute().trim(); vars.put(varName, res); } return res; }
/** * {@inheritDoc} */ @Override public synchronized String execute(SampleResult previousResult, Sampler currentSampler) throws InvalidVariableException { JMeterVariables vars = getVariables(); String res = ((CompoundVariable) values[0]).execute().toUpperCase(); if (vars != null && values.length > 1) { String varName = ((CompoundVariable) values[1]).execute().trim(); vars.put(varName, res); } return res; }
@Override public synchronized String execute(SampleResult previousResult, Sampler currentSampler) throws InvalidVariableException { String totalString = getParameter(0).replaceAll(getParameter(1), getParameter(2)); JMeterVariables vars = getVariables(); if (values.length > 3) { String varName = getParameter(3); if (vars != null && varName != null && varName.length() > 0) {// vars will be null on TestPlan vars.put(varName, totalString); } } return totalString; }
@Override public synchronized String execute(SampleResult previousResult, Sampler currentSampler) throws InvalidVariableException { String fifoName = ((CompoundVariable) values[0]).execute(); int size = FifoMap.getInstance().length(fifoName); String value = Integer.toString(size); JMeterVariables vars = getVariables(); if (vars != null && values.length > 1) { String varName = ((CompoundVariable) values[1]).execute().trim(); vars.put(varName, value); } return value; }
@Override public synchronized String execute(SampleResult previousResult, Sampler currentSampler) throws InvalidVariableException { String totalString = getParameter(0).replace(getParameter(1), getParameter(2)); JMeterVariables vars = getVariables(); if (values.length > 3) { String varName = getParameter(3); if (vars != null && varName != null && varName.length() > 0) {// vars will be null on TestPlan vars.put(varName, totalString); } } return totalString; }
@Override public synchronized String execute(SampleResult previousResult, Sampler currentSampler) throws InvalidVariableException { String fifoName = ((CompoundVariable) values[0]).execute(); int size = FifoMap.getInstance().length(fifoName); String value = Integer.toString(size); JMeterVariables vars = getVariables(); if (vars != null && values.length > 1) { String varName = ((CompoundVariable) values[1]).execute().trim(); vars.put(varName, value); } return value; }
@Override public synchronized String execute(SampleResult previousResult, Sampler currentSampler) throws InvalidVariableException { String totalString = getParameter(0).replace(getParameter(1), getParameter(2)); JMeterVariables vars = getVariables(); if (values.length > 3) { String varName = getParameter(3); if (vars != null && varName != null && varName.length() > 0) {// vars will be null on TestPlan vars.put(varName, totalString); } } return totalString; }
@Override public synchronized String execute(SampleResult previousResult, Sampler currentSampler) throws InvalidVariableException { String totalString = getParameter(0).replaceAll(getParameter(1), getParameter(2)); JMeterVariables vars = getVariables(); if (values.length > 3) { String varName = getParameter(3); if (vars != null && varName != null && varName.length() > 0) {// vars will be null on TestPlan vars.put(varName, totalString); } } return totalString; }
@Override public void iterationStart(LoopIterationEvent loopIterationEvent) { if (generator == null) { generator = createGenerator(getClassName(), readFile(getFileName())); } JMeterVariables variables = JMeterContextService.getContext().getVariables(); variables.put(getVariableName(), generator.nextMessage()); }