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

Examples of org.apache.jmeter.protocol.http.sampler.HTTPSampler$Test


    {
        Arguments args = new Arguments();
        args.addArgument("username", "mstover");
        args.addArgument("password", "pass");
        args.addArgument("action", "login");
        config = new HTTPSampler();
        config.setName("Full Config");
        config.setProperty(HTTPSampler.DOMAIN, "www.lazer.com");
        config.setProperty(HTTPSampler.PATH, "login.jsp");
        config.setProperty(HTTPSampler.METHOD, HTTPSampler.POST);
        config.setProperty(
            new TestElementProperty(HTTPSampler.ARGUMENTS, args));
        defaultConfig = new HTTPSampler();
        defaultConfig.setName("default");
        defaultConfig.setProperty(HTTPSampler.DOMAIN, "www.xerox.com");
        defaultConfig.setProperty(HTTPSampler.PATH, "default.html");
        partialConfig = new HTTPSampler();
        partialConfig.setProperty(HTTPSampler.PATH, "main.jsp");
        partialConfig.setProperty(HTTPSampler.METHOD, HTTPSampler.GET);
    }
View Full Code Here


        throws MalformedURLException, IOException, ProtocolException
    {
      // Damn! A whole new GUI just to instantiate a test element?
      // Isn't there a beter way?
        HttpTestSampleGui tempGui = new HttpTestSampleGui();
        HTTPSampler result = createSampler();
        tempGui.configure(result);
        tempGui.modifyTestElement(result);
        result.setFollowRedirects(false);
        result.setUseKeepAlive(true);
        return result;
    }
View Full Code Here

    }
   
    private HTTPSampler createSampler()
    {
        MultipartUrlConfig urlConfig = null;
        HTTPSampler sampler = new HTTPSampler();
        sampler.setDomain(serverName());
        log.debug("Proxy: setting server: " + sampler.getDomain());
        sampler.setMethod(method);
        log.debug("Proxy: method server: " + sampler.getMethod());
        sampler.setPath(serverUrl());
        log.debug("Proxy: setting path: " + sampler.getPath());
        if (numberRequests){
          requestNumber++;
      sampler.setName(requestNumber + " " + sampler.getPath());
        } else {
      sampler.setName(sampler.getPath());
        }
        sampler.setPort(serverPort());
        log.debug("Proxy: setting port: " + sampler.getPort());
        if (url.indexOf("//") > -1)
        {
            String protocol = url.substring(0, url.indexOf(":"));
            log.debug("Proxy: setting protocol to : " + protocol);
            sampler.setProtocol(protocol);
        }
        else if (sampler.getPort() == 443)
        {
            sampler.setProtocol("https");
            log.debug("Proxy: setting protocol to https");
        }
        else
        {
            log.debug("Proxy setting default protocol to: http");
            sampler.setProtocol("http");
        }
        if ((urlConfig = isMultipart(getContentType())) != null)
        {
            urlConfig.parseArguments(postData);
            sampler.setArguments(urlConfig.getArguments());
            sampler.setFileField(urlConfig.getFileFieldName());
            sampler.setFilename(urlConfig.getFilename());
            sampler.setMimetype(urlConfig.getMimeType());
        }
        else
        {
            sampler.parseArguments(postData);
        }
        return sampler;
    }
View Full Code Here

                "GET http://localhost/matrix.html?"
                    + "update=yes&d=1&d=2&d=&d=&d=&d=&d=&d=1&d=2&d=1&d=" +
                        "&d= HTTP/1.0\n\n";
            HttpRequestHdr req = new HttpRequestHdr();
            req.parse(new java.io.ByteArrayInputStream(TEST_REQ.getBytes()));
            HTTPSampler s = req.getSampler();
            assertEquals(s.getArguments().getArguments().size(), 13);
        }
View Full Code Here

  /* (non-Javadoc)
   * @see org.apache.jmeter.protocol.http.util.accesslog.Generator#generateRequest()
   */
  public Object generateRequest() {
    try {
      SAMPLE = new HTTPSampler();
    } catch (NullPointerException e){
      e.printStackTrace();
    }
    return SAMPLE;
  }
View Full Code Here

                "location: http://server.com/index.html"
                    + "?session_id=jfdkjdkf%20jddkfdfjkdjfdf%22;";
            response = new SampleResult();
            response.setResponseData(html.getBytes());
            mod.setArgumentName("session_id");
            HTTPSampler sampler = createSampler();
            sampler.addArgument("session_id", "adfasdfdsafasdfasd");
            context.setCurrentSampler(sampler);
            context.setPreviousResult(response);
            mod.process();
            Arguments args = sampler.getArguments();
            assertEquals(
                "jfdkjdkf jddkfdfjkdjfdf\"",
                ((Argument) args.getArguments().get(0).getObjectValue())
                    .getValue());
            assertEquals(
                "http://server.com/index.html?"
                    + "session_id=jfdkjdkf+jddkfdfjkdjfdf%22",
                sampler.toString());
        }
View Full Code Here

                "<a href=\"http://server.com/index.html?"
                    + "session_id=jfdkjdkfjddkfdfjkdjfdf\">";
            response = new SampleResult();
            response.setResponseData(html.getBytes());
            mod.setArgumentName("session_id");
            HTTPSampler sampler = createSampler();
            context.setCurrentSampler(sampler);
            context.setPreviousResult(response);
            mod.process();
            Arguments args = sampler.getArguments();
            assertEquals(
                "jfdkjdkfjddkfdfjkdjfdf",
                ((Argument) args.getArguments().get(0).getObjectValue())
                    .getValue());
        }
View Full Code Here

                ((Argument) args.getArguments().get(0).getObjectValue())
                    .getValue());
        }
        private HTTPSampler createSampler()
        {
            HTTPSampler sampler = new HTTPSampler();
            sampler.setDomain("server.com");
            sampler.setPath("index.html");
            sampler.setMethod(HTTPSampler.GET);
            sampler.setProtocol("http");
            return sampler;
        }
View Full Code Here

        {
            String html = "href='index.html?session_id=jfdkjdkfjddkfdfjkdjfdf'";
            response = new SampleResult();
            response.setResponseData(html.getBytes());
            mod.setArgumentName("session_id");
            HTTPSampler sampler = createSampler();
            context.setCurrentSampler(sampler);
            context.setPreviousResult(response);
            mod.process();
            Arguments args = sampler.getArguments();
            assertEquals(
                "jfdkjdkfjddkfdfjkdjfdf",
                ((Argument) args.getArguments().get(0).getObjectValue())
                    .getValue());
        }
View Full Code Here

        {
            String html = "href='index.html?session_id=jfdkjdkfjddkfdfjkdjfdf\t";
            response = new SampleResult();
            response.setResponseData(html.getBytes());
            mod.setArgumentName("session_id");
            HTTPSampler sampler = createSampler();
            context.setCurrentSampler(sampler);
            context.setPreviousResult(response);
            mod.process();
            Arguments args = sampler.getArguments();
            assertEquals(
                "jfdkjdkfjddkfdfjkdjfdf",
                ((Argument) args.getArguments().get(0).getObjectValue())
                    .getValue());
        }
View Full Code Here

TOP

Related Classes of org.apache.jmeter.protocol.http.sampler.HTTPSampler$Test

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.