Package org.apache.jmeter.protocol.http.sampler

Examples of org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase$CleanerThread


            boolean inForm) {
        NamedNodeMap nodeAtts = tempNode.getAttributes();
        String tag = tempNode.getNodeName();
        try {
            if (inForm) {
                HTTPSamplerBase url = urlConfigs.getLast();
                if (tag.equalsIgnoreCase("form")) { // $NON-NLS-1$
                    try {
                        urlConfigs.add(createFormUrlConfig(tempNode, context));
                    } catch (MalformedURLException e) {
                        inForm = false;
                    }
                } else if (tag.equalsIgnoreCase("input")) { // $NON-NLS-1$
                    url.addEncodedArgument(getAttributeValue(nodeAtts, "name")// $NON-NLS-1$
                            getAttributeValue(nodeAtts, "value")); // $NON-NLS-1$
                } else if (tag.equalsIgnoreCase("textarea")) { // $NON-NLS-1$
                    try {
                        url.addEncodedArgument(getAttributeValue(nodeAtts, "name")// $NON-NLS-1$
                                tempNode.getFirstChild().getNodeValue());
                    } catch (NullPointerException e) {
                        url.addArgument(getAttributeValue(nodeAtts, "name"), ""); // $NON-NLS-1$
                    }
                } else if (tag.equalsIgnoreCase("select")) { // $NON-NLS-1$
                    selectName = getAttributeValue(nodeAtts, "name"); // $NON-NLS-1$
                } else if (tag.equalsIgnoreCase("option")) { // $NON-NLS-1$
                    String value = getAttributeValue(nodeAtts, "value"); // $NON-NLS-1$
                    if (value == null) {
                        try {
                            value = tempNode.getFirstChild().getNodeValue();
                        } catch (NullPointerException e) {
                            value = ""; // $NON-NLS-1$
                        }
                    }
                    url.addEncodedArgument(selectName, value);
                }
            } else if (tag.equalsIgnoreCase("form")) { // $NON-NLS-1$
                try {
                    urlConfigs.add(createFormUrlConfig(tempNode, context));
                    inForm = true;
View Full Code Here


     * {@inheritDoc}
     */
    @Override
    public void configure(TestElement element) {
        super.configure(element);
        final HTTPSamplerBase samplerBase = (HTTPSamplerBase) element;
        urlConfigGui.configure(element);
        getImages.setSelected(samplerBase.isImageParser());
        concurrentDwn.setSelected(samplerBase.isConcurrentDwn());
        concurrentPool.setText(samplerBase.getConcurrentPool());
        isMon.setSelected(samplerBase.isMonitor());
        useMD5.setSelected(samplerBase.useMD5());
        embeddedRE.setText(samplerBase.getEmbeddedUrlRE());
        if (!isAJP) {
            sourceIpAddr.setText(samplerBase.getIpSource());
            sourceIpType.setSelectedIndex(samplerBase.getIpSourceType());
        }
    }
View Full Code Here

    /**
     * {@inheritDoc}
     */
    @Override
    public TestElement createTestElement() {
        HTTPSamplerBase sampler = new HTTPSamplerProxy();
        modifyTestElement(sampler);
        return sampler;
    }
View Full Code Here

     */
    @Override
    public void modifyTestElement(TestElement sampler) {
        sampler.clear();
        urlConfigGui.modifyTestElement(sampler);
        final HTTPSamplerBase samplerBase = (HTTPSamplerBase) sampler;
        samplerBase.setImageParser(getImages.isSelected());
        enableConcurrentDwn(getImages.isSelected());
        samplerBase.setConcurrentDwn(concurrentDwn.isSelected());
        samplerBase.setConcurrentPool(concurrentPool.getText());
        samplerBase.setMonitor(isMon.isSelected());
        samplerBase.setMD5(useMD5.isSelected());
        samplerBase.setEmbeddedUrlRE(embeddedRE.getText());
        if (!isAJP) {
            samplerBase.setIpSource(sourceIpAddr.getText());
            samplerBase.setIpSourceType(sourceIpType.getSelectedIndex());
        }
        this.configureTestElement(sampler);
    }
View Full Code Here

        useMD5.setSelected(samplerBase.useMD5());
    embeddedRE.setText(samplerBase.getEmbeddedUrlRE());
  }

  public TestElement createTestElement() {
    HTTPSamplerBase sampler = HTTPSamplerFactory.newInstance();// create default sampler
    modifyTestElement(sampler);
    return sampler;
  }
View Full Code Here

   * @see org.apache.jmeter.gui.JMeterGUIComponent#modifyTestElement(TestElement)
   */
  public void modifyTestElement(TestElement sampler) {
    sampler.clear();
        urlConfigGui.modifyTestElement(sampler);
    final HTTPSamplerBase samplerBase = (HTTPSamplerBase) sampler;
    if (getImages.isSelected()) {
      samplerBase.setImageParser(true);
    } else {
      // The default is false, so we can remove the property to simplify JMX files
      // This also allows HTTPDefaults to work for this checkbox
      sampler.removeProperty(HTTPSamplerBase.IMAGE_PARSER);
    }
    samplerBase.setMonitor(isMon.isSelected());
        samplerBase.setMD5(useMD5.isSelected());
    samplerBase.setEmbeddedUrlRE(embeddedRE.getText());
    this.configureTestElement(sampler);
  }
View Full Code Here

  public HttpTestSampleGui2() {
    super();
  }

  public TestElement createTestElement() {
    HTTPSamplerBase sampler = HTTPSamplerFactory.newInstance(HTTPSamplerFactory.HTTP_SAMPLER_APACHE);
    modifyTestElement(sampler);
    return sampler;
  }
View Full Code Here

    init();
  }

  public void configure(TestElement element) {
    super.configure(element);
        final HTTPSamplerBase samplerBase = (HTTPSamplerBase) element;
    urlConfigGui.configure(element);
    getImages.setSelected(samplerBase.isImageParser());
    isMon.setSelected(samplerBase.isMonitor());
        useMD5.setSelected(samplerBase.useMD5());
    embeddedRE.setText(samplerBase.getEmbeddedUrlRE());
  }
View Full Code Here

  public void process() {
    Sampler entry = getThreadContext().getCurrentSampler();
    if (!(entry instanceof HTTPSamplerBase)) {
      return;
    }
    HTTPSamplerBase config = (HTTPSamplerBase) entry;
    Map currentUser = allAvailableUsers.getNextUserMods();
    PropertyIterator iter = config.getArguments().iterator();
    while (iter.hasNext()) {
      Argument arg = (Argument) iter.next().getObjectValue();
      // if parameter name exists in http request
      // then change its value
      // (Note: each jmeter thread (ie user) gets to have unique values)
View Full Code Here

   */
  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;
    } else {
      sampler = (HTTPSamplerBase) sam;
      result = (HTTPSampleResult) res;
    }
    List potentialLinks = new ArrayList();
    String responseText = ""; // $NON-NLS-1$
    responseText = result.getResponseDataAsString();
    Document html;
    int index = responseText.indexOf("<"); // $NON-NLS-1$
    if (index == -1) {
      index = 0;
    }
    if (log.isDebugEnabled()) {
        log.debug("Check for matches against: "+sampler.toString());
    }
    html = (Document) HtmlParsingUtils.getDOM(responseText.substring(index));
    addAnchorUrls(html, result, sampler, potentialLinks);
    addFormUrls(html, result, sampler, potentialLinks);
    addFramesetUrls(html, result, sampler, potentialLinks);
    if (potentialLinks.size() > 0) {
      HTTPSamplerBase url = (HTTPSamplerBase) potentialLinks.get(rand.nextInt(potentialLinks.size()));
      if (log.isDebugEnabled()) {
          log.debug("Selected: "+url.toString());
      }
      sampler.setDomain(url.getDomain());
      sampler.setPath(url.getPath());
      if (url.getMethod().equals(HTTPConstants.POST)) {
        PropertyIterator iter = sampler.getArguments().iterator();
        while (iter.hasNext()) {
          Argument arg = (Argument) iter.next().getObjectValue();
          modifyArgument(arg, url.getArguments());
        }
      } else {
        sampler.setArguments(url.getArguments());
        // config.parseArguments(url.getQueryString());
      }
      sampler.setProtocol(url.getProtocol());
      return;
    } else {
      log.debug("No matches found");
    }
    return;
View Full Code Here

TOP

Related Classes of org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase$CleanerThread

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.