当前位置: 首页>>代码示例>>Java>>正文


Java JMeterContext.setVariables方法代码示例

本文整理汇总了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());    
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:23,代码来源:TestLoopController.java

示例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());

}
 
开发者ID:GSLabDev,项目名称:pepper-box,代码行数:24,代码来源:PepperBoxSamplerTest.java

示例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");
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:8,代码来源:TestCVSDataSet.java

示例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");
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:15,代码来源:ResponseAssertionTest.java

示例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);
  }
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:13,代码来源:SizeAssertionTest.java

示例6: setUp

import org.apache.jmeter.threads.JMeterContext; //导入方法依赖的package包/类
@BeforeClass
public static void setUp(){
    JMeterContext jmcx = JMeterContextService.getContext();
    jmcx.setVariables(new JMeterVariables());
}
 
开发者ID:GSLabDev,项目名称:pepper-box,代码行数:6,代码来源:PepperBoxConfigElementTest.java


注:本文中的org.apache.jmeter.threads.JMeterContext.setVariables方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。