use of org.apache.jmeter.threads.JMeterVariables in project jmeter by apache.
the class PackageTest method setUp.
@Override
public void setUp() {
jmctx = JMeterContextService.getContext();
jmctx.setVariables(new JMeterVariables());
vars = jmctx.getVariables();
}
use of org.apache.jmeter.threads.JMeterVariables in project jmeter by apache.
the class SplitFunctionTest method setUp.
@Before
public void setUp() {
jmctx = JMeterContextService.getContext();
jmctx.setVariables(new JMeterVariables());
vars = jmctx.getVariables();
}
use of org.apache.jmeter.threads.JMeterVariables in project jmeter by apache.
the class TestWhileController method setUp.
@Before
public void setUp() {
jmctx = JMeterContextService.getContext();
jmctx.setVariables(new JMeterVariables());
jmvars = jmctx.getVariables();
}
use of org.apache.jmeter.threads.JMeterVariables in project jmeter by apache.
the class PackageTest method setUp.
@Before
public void setUp() {
jmctx = JMeterContextService.getContext();
Map<String, String> variables = new HashMap<>();
variables.put("my_regex", ".*");
variables.put("server", "jakarta.apache.org");
SampleResult result = new SampleResult();
result.setResponseData("<html>hello world</html> costs: $3.47,$5.67", null);
transformer = new ReplaceStringWithFunctions(new CompoundVariable(), variables);
jmctx.setVariables(new JMeterVariables());
jmctx.setSamplingStarted(true);
jmctx.setPreviousResult(result);
jmctx.getVariables().put("server", "jakarta.apache.org");
jmctx.getVariables().put("my_regex", ".*");
}
use of org.apache.jmeter.threads.JMeterVariables in project jmeter by apache.
the class PreCompiler method addNode.
/** {@inheritDoc} */
@Override
public void addNode(Object node, HashTree subTree) {
if (isRemote && node instanceof ResultCollector) {
try {
replacer.replaceValues((TestElement) node);
} catch (InvalidVariableException e) {
log.error("invalid variables", e);
}
}
if (isRemote) {
return;
}
if (node instanceof TestElement) {
try {
replacer.replaceValues((TestElement) node);
} catch (InvalidVariableException e) {
log.error("invalid variables", e);
}
}
if (node instanceof TestPlan) {
//A hack to make user-defined variables in the testplan element more dynamic
((TestPlan) node).prepareForPreCompile();
Map<String, String> args = ((TestPlan) node).getUserDefinedVariables();
replacer.setUserDefinedVariables(args);
JMeterVariables vars = new JMeterVariables();
vars.putAll(args);
JMeterContextService.getContext().setVariables(vars);
}
if (node instanceof Arguments) {
((Arguments) node).setRunningVersion(true);
Map<String, String> args = ((Arguments) node).getArgumentsAsMap();
replacer.addVariables(args);
JMeterContextService.getContext().getVariables().putAll(args);
}
}
Aggregations