本文整理汇总了Java中org.apache.jmeter.threads.JMeterContext.setVariables方法的典型用法代码示例。如果您正苦于以下问题:Java JMeterContext.setVariables方法的具体用法?Java JMeterContext.setVariables怎么用?Java JMeterContext.setVariables使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.jmeter.threads.JMeterContext
的用法示例。
在下文中一共展示了JMeterContext.setVariables方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testBug54467
import org.apache.jmeter.threads.JMeterContext; //导入方法依赖的package包/类
public void testBug54467() throws Exception {
JMeterContext jmctx = JMeterContextService.getContext();
LoopController loop = new LoopController();
Map<String, String> variables = new HashMap<String, String>();
ReplaceStringWithFunctions transformer = new ReplaceStringWithFunctions(new CompoundVariable(), variables);
jmctx.setVariables(new JMeterVariables());
StringProperty prop = new StringProperty(LoopController.LOOPS,"${__Random(1,12,)}");
JMeterProperty newProp = transformer.transformValue(prop);
newProp.setRunningVersion(true);
loop.setProperty(newProp);
loop.addTestElement(new TestSampler("random run"));
loop.setRunningVersion(true);
loop.initialize();
int loops = loop.getLoops();
for (int i = 0; i < loops; i++) {
Sampler s = loop.next();
assertNotNull(s);
}
assertNull(loop.next());
}
示例2: setup
import org.apache.jmeter.threads.JMeterContext; //导入方法依赖的package包/类
@Before
public void setup() throws IOException {
zkServer = new EmbeddedZookeeper();
String zkConnect = ZKHOST + ":" + zkServer.port();
zkClient = new ZkClient(zkConnect, 30000, 30000, ZKStringSerializer$.MODULE$);
ZkUtils zkUtils = ZkUtils.apply(zkClient, false);
Properties brokerProps = new Properties();
brokerProps.setProperty("zookeeper.connect", zkConnect);
brokerProps.setProperty("broker.id", "0");
brokerProps.setProperty("log.dirs", Files.createTempDirectory("kafka-").toAbsolutePath().toString());
brokerProps.setProperty("listeners", "PLAINTEXT://" + BROKERHOST +":" + BROKERPORT);
KafkaConfig config = new KafkaConfig(brokerProps);
Time mock = new MockTime();
kafkaServer = TestUtils.createServer(config, mock);
//AdminUtils.createTopic(zkUtils, TOPIC, 1, 1, new Properties(), RackAwareMode.Disabled$.MODULE$);
JMeterContext jmcx = JMeterContextService.getContext();
jmcx.setVariables(new JMeterVariables());
}
示例3: setUp
import org.apache.jmeter.threads.JMeterContext; //导入方法依赖的package包/类
@Override
public void setUp(){
JMeterContext jmcx = JMeterContextService.getContext();
jmcx.setVariables(new JMeterVariables());
threadVars = jmcx.getVariables();
threadVars.put("b", "value");
}
示例4: setUp
import org.apache.jmeter.threads.JMeterContext; //导入方法依赖的package包/类
@Override
public void setUp() throws MalformedURLException {
JMeterContext jmctx = JMeterContextService.getContext();
assertion = new ResponseAssertion();
assertion.setThreadContext(jmctx);
sample = new SampleResult();
JMeterVariables vars = new JMeterVariables();
jmctx.setVariables(vars);
jmctx.setPreviousResult(sample);
sample.setResponseData("response Data\nline 2\n\nEOF", null);
sample.setURL(new URL("http://localhost/Sampler/Data/"));
sample.setResponseCode("401");
sample.setResponseHeaders("X-Header: abcd");
}
示例5: setUp
import org.apache.jmeter.threads.JMeterContext; //导入方法依赖的package包/类
@Override
public void setUp() {
JMeterContext jmctx = JMeterContextService.getContext();
assertion = new SizeAssertion();
assertion.setThreadContext(jmctx);
assertion.setTestFieldResponseBody();
JMeterVariables vars = new JMeterVariables();
jmctx.setVariables(vars);
sample0 = new SampleResult();
sample1 = new SampleResult();
sample1.setResponseData(data1, null);
}
示例6: setUp
import org.apache.jmeter.threads.JMeterContext; //导入方法依赖的package包/类
@BeforeClass
public static void setUp(){
JMeterContext jmcx = JMeterContextService.getContext();
jmcx.setVariables(new JMeterVariables());
}