org.apache.jmeter.timers.ConstantTimer Java Examples

The following examples show how to use org.apache.jmeter.timers.ConstantTimer. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JmeterTestPlanTask.java    From ambari-metrics with Apache License 2.0 4 votes vote down vote up
private ConstantTimer createConstantTimer(int delay) {
  ConstantTimer timer = new ConstantTimer();
  timer.setDelay("" + delay);
  return timer;
}
 
Example #2
Source File: ConcurrencyThreadGroupTest.java    From jmeter-plugins with Apache License 2.0 4 votes vote down vote up
private Object[] createTestPlan() {
    JMeterContextService.getContext().setVariables(new JMeterVariables());

    TestSampleListener listener = new TestSampleListener();

    DebugSampler sampler = new DebugSampler();
    sampler.setName("Sampler");

    ConstantTimer timer = new ConstantTimer();
    timer.setDelay("2000");
    timer.setName("timer");

    LoopController loopController = new LoopController();
    loopController.setContinueForever(true);
    loopController.setLoops(-1);
    loopController.setName("loop c");

    ConcurrencyThreadGroupExt ctg = new ConcurrencyThreadGroupExt();
    ctg.setName("CTG");
    ctg.setRampUp("5");
    ctg.setTargetLevel("3");
    ctg.setSteps("1");
    ctg.setHold("10"); // TODO: increase this value for debugging
    ctg.setIterationsLimit("");
    ctg.setUnit("S");


    ListedHashTree loopTree = new ListedHashTree();
    loopTree.add(loopController, timer);
    loopTree.add(loopController, sampler);
    loopTree.add(loopController, listener);

    ListedHashTree hashTree = new ListedHashTree();
    hashTree.add(ctg, loopTree);
    TestCompiler compiler = new TestCompiler(hashTree);
    // this hashTree can be save to *jmx
    hashTree.traverse(compiler);

    return new Object[] {
            hashTree,
            ctg
    };
}