Examples of JMeterContext


Examples of org.apache.jmeter.threads.JMeterContext

        final BeanShellInterpreter bshInterpreter = getBeanShellInterpreter();
        if (bshInterpreter == null) {
            log.error("BeanShell not found");
            return;
        }
        JMeterContext jmctx = JMeterContextService.getContext();
        Sampler sam = jmctx.getCurrentSampler();
        try {
            // Add variables for access to context and variables
            bshInterpreter.set("sampler", sam);//$NON-NLS-1$
            processFileOrScript(bshInterpreter);
        } catch (JMeterException e) {
View Full Code Here

Examples of org.apache.jmeter.threads.JMeterContext

     * @see org.apache.jmeter.processor.PostProcessor#process()
     */
    @Override
    public void process() {
        initTemplate();
        JMeterContext context = getThreadContext();
        SampleResult previousResult = context.getPreviousResult();
        if (previousResult == null) {
            return;
        }
        log.debug("RegexExtractor processing result");

        // Fetch some variables
        JMeterVariables vars = context.getVariables();
        String refName = getRefName();
        int matchNumber = getMatchNumber();

        final String defaultValue = getDefaultValue();
        if (defaultValue.length() > 0){// Only replace default if it is provided
View Full Code Here

Examples of org.apache.jmeter.threads.JMeterContext

    @Override
    public boolean isDone() {
        if (loopCount >= getEndIndex()) {
            return true;
        }
        JMeterContext context = getThreadContext();
        StringBuilder builder = new StringBuilder(
                getInputVal().length()+getSeparator().length()+3);
        String inputVariable =
                builder.append(getInputVal())
                .append(getSeparator())
                .append(Integer.toString(loopCount+1)).toString();
        final JMeterVariables variables = context.getVariables();
        final Object currentVariable = variables.getObject(inputVariable);
        if (currentVariable != null) {
            variables.putObject(getReturnVal(), currentVariable);
            if (log.isDebugEnabled()) {
                log.debug("ForEach resultstring isDone=" + variables.get(getReturnVal()));
View Full Code Here

Examples of org.apache.jmeter.threads.JMeterContext

        }
        return super.isDone();
    }

    private boolean endOfArguments() {
        JMeterContext context = getThreadContext();
        String inputVariable = getInputVal() + getSeparator() + (loopCount + 1);
        if (context.getVariables().getObject(inputVariable) != null) {
            log.debug("ForEach resultstring eofArgs= false");
            return false;
        }
        log.debug("ForEach resultstring eofArgs= true");
        return true;
View Full Code Here

Examples of org.apache.jmeter.threads.JMeterContext

     * Check if there are any matching entries
     *
     * @return whether any entries in the list
     */
    private boolean emptyList() {
        JMeterContext context = getThreadContext();

        StringBuilder builder = new StringBuilder(
                getInputVal().length()+getSeparator().length()+3);
        String inputVariable =
                builder.append(getInputVal())
                .append(getSeparator())
                .append(Integer.toString(loopCount+1)).toString();
        if (context.getVariables().getObject(inputVariable) != null) {
            return false;
        }
        if (log.isDebugEnabled()) {
            log.debug("No entries found - null first entry: " + inputVariable);
        }
View Full Code Here

Examples of org.apache.jmeter.threads.JMeterContext

        }
    }

    public String execute() {
        if (isDynamic) {
            JMeterContext context = JMeterContextService.getContext();
            SampleResult previousResult = context.getPreviousResult();
            Sampler currentSampler = context.getCurrentSampler();
            return execute(previousResult, currentSampler);
        }
        return permanentResults; // $NON-NLS-1$
    }
View Full Code Here

Examples of org.apache.jmeter.threads.JMeterContext

    // PreProcessors are cloned per-thread, so this will be saved per-thread
    private transient String savedValue = ""; // $NON-NLS-1$
   
  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) {
      return;
    }
    initRegex(getArgumentName());
    String text = new String(responseText.getResponseData());
View Full Code Here

Examples of org.apache.jmeter.threads.JMeterContext

            }
      getCookies().addItem(c);
            // Store cookie as a thread variable.
            // TODO - should we add a prefix to these variables?
            // TODO - should storing cookie values be optional?
            JMeterContext context = getThreadContext();
      if (context.isSamplingStarted()) {
        context.getVariables().put(cn, cv);
      }
    }
  }
View Full Code Here

Examples of org.apache.jmeter.threads.JMeterContext

      bshInterpreter.set("ResponseCode", "200"); //$NON-NLS-1$
      bshInterpreter.set("ResponseMessage", "OK");//$NON-NLS-1$
      bshInterpreter.set("IsSuccess", true);//$NON-NLS-1$

      // Add variables for access to context and variables
      JMeterContext jmctx = JMeterContextService.getContext();
      JMeterVariables vars = jmctx.getVariables();
      bshInterpreter.set("ctx", jmctx);//$NON-NLS-1$
      bshInterpreter.set("vars", vars);//$NON-NLS-1$

            res.setDataType(SampleResult.TEXT); // assume text output - script can override if necessary
View Full Code Here

Examples of org.apache.jmeter.threads.JMeterContext

  /**
   * Modifies an Entry object based on HTML response text.
   */
  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.");
      return;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.