Examples of JMeterContext


Examples of org.apache.jmeter.threads.JMeterContext

     */
    public String getStringValue()
    {
        log.debug("Calling getStringValue from FunctionProperty");
        log.debug("boogedy boogedy");
        JMeterContext ctx = JMeterContextService.getContext();//Expensive, so do once
        if (!isRunningVersion()
            || !ctx.isSamplingStarted())
        {
            log.debug("Not running version, return raw function string");
            return function.getRawParameters();
        }
        else
        {
            log.debug("Running version, executing function");
            int iter =
                ctx.getVariables().getIteration();
            if (iter < testIteration)
            {
                testIteration = -1;
            }
            if (iter > testIteration || cacheValue == null)
View Full Code Here

Examples of org.apache.jmeter.threads.JMeterContext

    private final static String PATH_EXTENSION_NO_QUESTIONMARK =
        "path_extension_no_questionmark";

    public void process()
    {
      JMeterContext ctx = getThreadContext();
        Sampler sampler = ctx.getCurrentSampler();
        SampleResult responseText = ctx.getPreviousResult();
        if(responseText == null)
        {
            return;
        }
        initRegex(getArgumentName());
View Full Code Here

Examples of org.apache.jmeter.threads.JMeterContext

    /**
     * Add a cookie.
     */
    public void add(Cookie c)
    {
      JMeterContext context = getThreadContext();
        getCookies().addItem(c);
        if(context.isSamplingStarted())
        {
            context.getVariables().put(c.getName(),c.getValue());
        }
    }
View Full Code Here

Examples of org.apache.jmeter.threads.JMeterContext

    private final static String PATH_EXTENSION_NO_EQUALS =
        "path_extension_no_equals";

    public void process()
    {
      JMeterContext ctx = getThreadContext();
        Sampler sampler = ctx.getCurrentSampler();
        SampleResult responseText = ctx.getPreviousResult();
        if(responseText == null)
        {
            return;
        }
        initRegex(getArgumentName());
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();
        HTTPSampler sampler = null;
        HTTPSampleResult result = null;
        if (res == null
            || !(sam instanceof HTTPSampler)
            || !(res instanceof HTTPSampleResult))
View Full Code Here

Examples of org.apache.jmeter.threads.JMeterContext

      if (bshSet == null) // did we find BeanShell?
      {
        throw new InvalidVariableException("BeanShell not found");
      }
     
      JMeterContext jmctx = JMeterContextService.getContext();
        JMeterVariables vars = jmctx.getVariables();

        String script  = ((CompoundVariable) values[0]).execute();
        String varName = "";
        if (values.length > 1){
      varName = ((CompoundVariable) values[1]).execute();
View Full Code Here

Examples of org.apache.jmeter.threads.JMeterContext

   * string representation of the function is provided.
   *
   * @see JMeterProperty#getStringValue()
   */
  public String getStringValue() {
    JMeterContext ctx = JMeterContextService.getContext();// Expensive, so
                                // do
    // once
    if (!isRunningVersion() /*|| !ctx.isSamplingStarted()*/) {
      log.debug("Not running version, return raw function string");
      return function.getRawParameters();
    } else {
      log.debug("Running version, executing function");
      int iter = ctx.getVariables() != null ? ctx.getVariables().getIteration() : -1;
      if (iter < testIteration) {
        testIteration = -1;
      }
      if (iter > testIteration || cacheValue == null) {
        testIteration = iter;
View Full Code Here

Examples of org.apache.jmeter.threads.JMeterContext

        return INIT_FILE;
    }

     @Override
    public void process() {
        JMeterContext jmctx = JMeterContextService.getContext();

        SampleResult prev = jmctx.getPreviousResult();
        if (prev == null) {
            return; // TODO - should we skip processing here?
        }
        final BeanShellInterpreter bshInterpreter = getBeanShellInterpreter();
        if (bshInterpreter == null) {
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$

    @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) {
            return;
        }
        initRegex(getArgumentName());
        String text = responseText.getResponseDataAsString();
View Full Code Here

Examples of org.apache.jmeter.threads.JMeterContext

        StringBuilder sb = new StringBuilder(100);
        StringBuilder rd = new StringBuilder(20); // for request Data
        SampleResult sr = new SampleResult();
        sr.setSampleLabel(getName());
        sr.sampleStart();
        JMeterContext threadContext = getThreadContext();
        if (isDisplaySamplerProperties()){
            rd.append("SamplerProperties\n");
            sb.append("SamplerProperties:\n");
            formatPropertyIterator(sb, threadContext.getCurrentSampler().propertyIterator());
            sb.append("\n");
        }

        if (isDisplayJMeterVariables()){
            rd.append("JMeterVariables\n");
            sb.append("JMeterVariables:\n");
            formatSet(sb, threadContext.getVariables().entrySet());
            sb.append("\n");
        }

        if (isDisplayJMeterProperties()){
            rd.append("JMeterProperties\n");
            sb.append("JMeterProperties:\n");
            formatSet(sb, JMeterUtils.getJMeterProperties().entrySet());
            sb.append("\n");
        }

        if (isDisplaySystemProperties()){
            rd.append("SystemProperties\n");
            sb.append("SystemProperties:\n");
            formatSet(sb, System.getProperties().entrySet());
            sb.append("\n");
        }

        sr.setResponseData(sb.toString(), null);
        sr.setDataType(SampleResult.TEXT);
        sr.setSamplerData(rd.toString());
        sr.setResponseOK();
        sr.sampleEnd();
        threadContext.getPreviousResult().addSubResult(sr);
    }
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.