Package org.apache.jmeter.samplers

Examples of org.apache.jmeter.samplers.Sampler


     * Modifies an Entry object based on HTML response text.
     */
    public void process()
    {
      JMeterContext context = getThreadContext();
        Sampler sam = context.getCurrentSampler();
        SampleResult res = context.getPreviousResult();
        HTTPSampler sampler = null;
        HTTPSampleResult result = null;
        if (res == null
            || !(sam instanceof HTTPSampler)
View Full Code Here


            controller.addIterationListener(new IterationListener());
            threadContext.setSamplingStarted(true);
            threadStarted();
            while (running)
            {
                Sampler sam;
                while (running && (sam=controller.next())!=null)
                {
                    try
                    {
                        threadContext.setCurrentSampler(sam);
                        SamplePackage pack = compiler.configureSampler(sam);
                       
                        //Hack: save the package for any transaction controllers
                        threadContext.getVariables().putObject(PACKAGE_OBJECT,pack);
                       
                        delay(pack.getTimers());
                        Sampler sampler= pack.getSampler();
                        sampler.setThreadContext(threadContext);
                        sampler.setThreadName(threadName);
                        if (sampler instanceof TestBean) ((TestBean)sampler).prepare();              
                        SampleResult result = sampler.sample(null); // TODO: remove this useless Entry parameter
                        result.setThreadName(threadName);
                        threadContext.setPreviousResult(result);
                        runPostProcessors(pack.getPostProcessors());
                        checkAssertions(pack.getAssertions(), result);
                        notifyListeners(pack.getSampleListeners(), result);
View Full Code Here

     *    - if isDone is true
     *    - if its the first time this is run. The first time is special
     *       cause it is called prior the iteration even starts !
     */
    public Sampler next() {
      Sampler currentElement = super.next();

      if (!isDone()) {
          return currentElement;
      } else {
          return null;
View Full Code Here

    public Sampler next()
    {
        fireIterEvents();
        log.debug("Calling next on: " + this.getClass().getName());
        if (isDone()) return null;
        Sampler returnValue = null;
        TestElement currentElement = null;
        try
        {
            currentElement = getCurrentElement();
            setCurrentElement(currentElement);
View Full Code Here

    }

    protected Sampler nextIsAController(Controller controller)
        throws NextIsNullException
    {
        Sampler returnValue;
        Sampler sampler = controller.next();
        if (sampler == null)
        {
            currentReturnedNull(controller);
            returnValue = next();
        }
View Full Code Here

   ***************************************/
  public SamplePackage configureSampler(Sampler sampler)
  {
    currentSampler = sampler;
    SamplePackage ret = new SamplePackage();
    Sampler clonedSampler = sampler;
    SamplerConfigs configs = (SamplerConfigs)samplerConfigMap.get(sampler);
    if(sampler instanceof PerSampleClonable)
    {
      clonedSampler = (Sampler)sampler.clone();
    }
View Full Code Here

    {
      initializeThreadListeners();
      testTree.traverse(compiler);
      running = true;
      //listeners = controller.getListeners();
      Sampler entry = null;
      rampUpDelay();
      log.info("Thread "+Thread.currentThread().getName()+" started");
      while (running) {
        while (controller.hasNext() && running) {
          try
View Full Code Here

            controller.addIterationListener(new IterationListener());
            threadContext.setSamplingStarted(true);
            threadStarted();
            while (running)
            {
                Sampler sam;
                while (running && (sam=controller.next())!=null)
                {
                    try
                    {
                        threadContext.setCurrentSampler(sam);
                        SamplePackage pack = compiler.configureSampler(sam);
                       
                        //Hack: save the package for any transaction controllers
                        threadContext.getVariables().putObject(PACKAGE_OBJECT,pack);
                       
                        delay(pack.getTimers());
                        Sampler sampler= pack.getSampler();
                        sampler.setThreadContext(threadContext);
                        sampler.setThreadName(threadName);
                        if (sampler instanceof TestBean) ((TestBean)sampler).prepare();              
                        SampleResult result = sampler.sample(null); // TODO: remove this useless Entry parameter
                        result.setThreadName(threadName);
                        threadContext.setPreviousResult(result);
                        runPostProcessors(pack.getPostProcessors());
                        checkAssertions(pack.getAssertions(), result);
                        notifyListeners(pack.getSampleListeners(), result);
View Full Code Here

    private transient String savedValue = ""; // $NON-NLS-1$

    @Override
    public void process() {
        JMeterContext ctx = getThreadContext();
        Sampler sampler = ctx.getCurrentSampler();
        if (!(sampler instanceof HTTPSamplerBase)) {// Ignore non-HTTP samplers
            return;
        }
        SampleResult responseText = ctx.getPreviousResult();
        if (responseText == null) {
View Full Code Here

     * Modifies an Entry object based on HTML response text.
     */
    @Override
    public void process() {
        JMeterContext context = getThreadContext();
        Sampler sam = context.getCurrentSampler();
        SampleResult res = context.getPreviousResult();
        HTTPSamplerBase sampler = null;
        HTTPSampleResult result = null;
        if (res == null || !(sam instanceof HTTPSamplerBase) || !(res instanceof HTTPSampleResult)) {
            log.info("Can't apply HTML Link Parser when the previous" + " sampler run is not an HTTP Request.");
View Full Code Here

TOP

Related Classes of org.apache.jmeter.samplers.Sampler

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.