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

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


        assertEquals("http://www.apache.org/subdir/index.html", newUrl);
    }

    public void testFailSimpleParse1() throws Exception
    {
        HTTPSampler config = makeUrlConfig(".*index.*?param2=.+1");
        HTTPSampler context =
            makeContext("http://www.apache.org/subdir/previous.html");
        String responseText =
            "<html><head><title>Test page</title></head><body>"
                + "<a href=\"/home/index.html?param1=value1\">"
                + "Goto index page</a></body></html>";
        HTTPSampleResult result = new HTTPSampleResult();
        String newUrl = config.getUrl().toString();
        result.setResponseData(responseText.getBytes());
        result.setSampleLabel(context.toString());
        result.setURL(context.getUrl());
        jmctx.setCurrentSampler(context);
        jmctx.setCurrentSampler(config);
        jmctx.setPreviousResult(result);
        parser.process();
        assertEquals(newUrl, config.getUrl().toString());
View Full Code Here


        assertEquals(newUrl, config.getUrl().toString());
    }

    public void testFailSimpleParse3() throws Exception
    {
        HTTPSampler config = makeUrlConfig("/home/index.html");
        HTTPSampler context =
            makeContext("http://www.apache.org/subdir/previous.html");
        String responseText =
            "<html><head><title>Test page</title></head><body>"
                + "<a href=\"/home/index.html?param1=value1\">"
                + "Goto index page</a></body></html>";
        HTTPSampleResult result = new HTTPSampleResult();
        String newUrl = config.getUrl().toString();
        result.setResponseData(responseText.getBytes());
        result.setSampleLabel(context.toString());
        result.setURL(context.getUrl());
        jmctx.setCurrentSampler(context);
        jmctx.setCurrentSampler(config);
        jmctx.setPreviousResult(result);
        parser.process();
        assertEquals(newUrl + "?param1=value1", config.getUrl().toString());
View Full Code Here

        assertEquals(newUrl + "?param1=value1", config.getUrl().toString());
    }

    public void testFailSimpleParse2() throws Exception
    {
        HTTPSampler config = makeUrlConfig(".*login\\.html");
        HTTPSampler context =
            makeContext("http://www.apache.org/subdir/previous.html");
        String responseText =
            "<html><head><title>Test page</title></head><body>"
                + "<a href=\"/home/index.html?param1=value1\">"
                + "Goto index page</a></body></html>";
        HTTPSampleResult result = new HTTPSampleResult();
        result.setResponseData(responseText.getBytes());
        result.setSampleLabel(context.toString());
        result.setURL(context.getUrl());
        jmctx.setCurrentSampler(context);
        jmctx.setPreviousResult(result);
        parser.process();
        String newUrl = config.getUrl().toString();
        assertTrue(
View Full Code Here

    /**
     * A unit test for JUnit.
     */
    public void testSimpleFormParse() throws Exception
    {
        HTTPSampler config = makeUrlConfig(".*index.html");
        config.addArgument("test", "g.*");
        config.setMethod(HTTPSampler.POST);
        HTTPSampler context =
            makeContext("http://www.apache.org/subdir/previous.html");
        String responseText =
            "<html><head><title>Test page</title></head><body>"
                + "<form action=\"index.html\" method=\"POST\">"
                + "<input type=\"checkbox\" name=\"test\""
                + " value=\"goto\">Goto index page</form></body></html>";
        HTTPSampleResult result = new HTTPSampleResult();
        result.setResponseData(responseText.getBytes());
        result.setSampleLabel(context.toString());
        result.setURL(context.getUrl());
        jmctx.setCurrentSampler(context);
        jmctx.setCurrentSampler(config);
        jmctx.setPreviousResult(result);
        parser.process();
        assertEquals(
View Full Code Here

    /**
     * A unit test for JUnit.
     */
    public void testBadCharParse() throws Exception
    {
        HTTPSampler config = makeUrlConfig(".*index.html");
        config.addArgument("te$st", "g.*");
        config.setMethod(HTTPSampler.POST);
        HTTPSampler context =
            makeContext("http://www.apache.org/subdir/previous.html");
        String responseText =
            "<html><head><title>Test page</title></head><body>"
                + "<form action=\"index.html\" method=\"POST\">"
                + "<input type=\"checkbox\" name=\"te$st\""
                + " value=\"goto\">Goto index page</form></body></html>";
        HTTPSampleResult result = new HTTPSampleResult();
        result.setResponseData(responseText.getBytes());
        result.setSampleLabel(context.toString());
        result.setURL(context.getUrl());
        jmctx.setCurrentSampler(context);
        jmctx.setCurrentSampler(config);
        jmctx.setPreviousResult(result);
        parser.process();
        assertEquals(
View Full Code Here

    }

    private HTTPSampler makeContext(String url) throws MalformedURLException
    {
        URL u = new URL(url);
        HTTPSampler context = new HTTPSampler();
        context.setDomain(u.getHost());
        context.setPath(u.getPath());
        context.setPort(u.getPort());
        context.setProtocol(u.getProtocol());
        context.parseArguments(u.getQuery());
        return context;
    }
View Full Code Here

        return context;
    }

    private HTTPSampler makeUrlConfig(String path)
    {
        HTTPSampler config = new HTTPSampler();
        config.setDomain("www.apache.org");
        config.setMethod(HTTPSampler.GET);
        config.setPath(path);
        config.setPort(80);
        config.setProtocol("http");
        return config;
    }
View Full Code Here

                    "value",
                    "jakarta.apache.org",
                    "/",
                    false,
                    9999999999L));
            HTTPSampler sampler = new HTTPSampler();
            sampler.setDomain("jakarta.apache.org");
            sampler.setPath("/index.html");
            sampler.setMethod(HTTPSampler.GET);
            assertNotNull(man.getCookieHeaderForURL(sampler.getUrl()));
        }
View Full Code Here

                    "value",
                    ".apache.org",
                    "/",
                    false,
                    9999999999L));
            HTTPSampler sampler = new HTTPSampler();
            sampler.setDomain("jakarta.apache.org");
            sampler.setPath("/index.html");
            sampler.setMethod(HTTPSampler.GET);
            assertNotNull(man.getCookieHeaderForURL(sampler.getUrl()));
        }
View Full Code Here

    {
        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

TOP

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

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.