本文整理了Java中org.apache.jmeter.threads.JMeterVariables.put()
方法的一些代码示例,展示了JMeterVariables.put()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JMeterVariables.put()
方法的具体详情如下:
包路径:org.apache.jmeter.threads.JMeterVariables
类名称:JMeterVariables
方法名:put
[英]Creates or updates a variable with a String value.
[中]使用字符串值创建或更新变量。
代码示例来源:origin: org.apache.jmeter/ApacheJMeter_components
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);
}
}
}
代码示例来源:origin: org.apache.jmeter/ApacheJMeter_jdbc
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());
}
}
代码示例来源:origin: org.apache.jmeter/ApacheJMeter_components
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);
}
}
}
代码示例来源:origin: org.apache.jmeter/ApacheJMeter_components
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);
}
}
代码示例来源:origin: org.apache.jmeter/ApacheJMeter_components
private void placeObjectIntoVars(JMeterVariables vars, String currentRefName,
List<Object> extractedValues, int matchNr) {
vars.put(currentRefName,
stringify(extractedValues.get(matchNr)));
}
代码示例来源:origin: undera/jmeter-plugins
/**
* {@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();
}
代码示例来源:origin: kg.apc/jmeter-plugins-standard
/**
* {@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();
}
代码示例来源:origin: org.apache.jmeter/ApacheJMeter_functions
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$
}
}
代码示例来源:origin: undera/jmeter-plugins
/**
* {@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;
}
代码示例来源:origin: undera/jmeter-plugins
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());
}
}
代码示例来源:origin: kg.apc/jmeter-plugins-standard
/**
* {@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;
}
代码示例来源:origin: undera/jmeter-plugins
/**
* {@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;
}
代码示例来源:origin: undera/jmeter-plugins
/**
* {@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;
}
代码示例来源:origin: undera/jmeter-plugins
@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;
}
代码示例来源:origin: undera/jmeter-plugins
@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;
}
代码示例来源:origin: undera/jmeter-plugins
@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;
}
代码示例来源:origin: kg.apc/jmeter-plugins-standard
@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;
}
代码示例来源:origin: kg.apc/jmeter-plugins-standard
@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;
}
代码示例来源:origin: kg.apc/jmeter-plugins-standard
@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;
}
代码示例来源:origin: BrightTag/kafkameter
@Override
public void iterationStart(LoopIterationEvent loopIterationEvent) {
if (generator == null) {
generator = createGenerator(getClassName(), readFile(getFileName()));
}
JMeterVariables variables = JMeterContextService.getContext().getVariables();
variables.put(getVariableName(), generator.nextMessage());
}
内容来源于网络,如有侵权,请联系作者删除!