Examples of HTTPSamplerBase


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

            String html =
                "<a href=\"#\" onclick=\"$(\'frame\').src=\'/index?param1=bla&sessionid=xyzxyzxyz\\'";
            response = new SampleResult();
            response.setResponseData(html, null);
            mod.setArgumentName("sessionid");
            HTTPSamplerBase sampler = createSampler();
            sampler.addArgument("sessionid", "xyzxyzxyz");
            context.setCurrentSampler(sampler);
            context.setPreviousResult(response);
            mod.process();
            Arguments args = sampler.getArguments();
            assertEquals("xyzxyzxyz", ((Argument) args.getArguments().get(0).getObjectValue())
                    .getValue());
        }
View Full Code Here

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

            newMod.setArgumentName("sid");
            newMod.setPathExtension(false);
            for (int i = 0; i < html.length; i++) {
                response = new SampleResult();
                response.setResponseData(html[i], null);
                HTTPSamplerBase sampler = createSampler();
                context.setCurrentSampler(sampler);
                context.setPreviousResult(response);
                newMod.process();
                Arguments args = sampler.getArguments();
                assertEquals("For case i=" + i, "myId",
                        ((Argument) args.getArguments().get(0).getObjectValue()).getValue());
            }
        }
View Full Code Here

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

            newMod.setPathExtension(false);
            newMod.setShouldCache(false);
            for (int i = 0; i < html.length/2; i++) {
                response = new SampleResult();
                response.setResponseData(html[i*2], null);
                HTTPSamplerBase sampler = createSampler();
                context.setCurrentSampler(sampler);
                context.setPreviousResult(response);
                newMod.process();
                Arguments args = sampler.getArguments();
                assertEquals("For case i=" + i, html[i*2+1],
                        ((Argument) args.getArguments().get(0).getObjectValue()).getValue());
            }
        }
View Full Code Here

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

            jmctx = JMeterContextService.getContext();
            parser.setThreadContext(jmctx);
        }

        public void testProcessingHTMLFile(String HTMLFileName) throws Exception {
            HTTPSamplerBase config = (HTTPSamplerBase) SaveService.loadTree(
                    new FileInputStream(System.getProperty("user.dir") + "/testfiles/load_bug_list.jmx")).getArray()[0];
            config.setRunningVersion(true);
            HTTPSampleResult result = new HTTPSampleResult();
            HTTPSamplerBase context = (HTTPSamplerBase) SaveService.loadTree(
                    new FileInputStream(System.getProperty("user.dir") + "/testfiles/Load_JMeter_Page.jmx")).getArray()[0];
            jmctx.setCurrentSampler(context);
            jmctx.setCurrentSampler(config);
            result.setResponseData(new TextFile(System.getProperty("user.dir") + HTMLFileName).getText(), null);
            result.setSampleLabel(context.toString());
            result.setSamplerData(context.toString());
            result.setURL(new URL("http://issues.apache.org/fakepage.html"));
            jmctx.setPreviousResult(result);
            AnchorModifier modifier = new AnchorModifier();
            modifier.setThreadContext(jmctx);
            modifier.process();
View Full Code Here

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

        public void testModifySamplerWithBaseHRef() throws Exception {
            testProcessingHTMLFile("/testfiles/jmeter_home_page_with_base_href.html");
        }

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

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

            assertEquals("http://www.apache.org/subdir/index.html", config.getUrl().toString());
        }
       
        // Test https works too
        public void testSimpleParse1() throws Exception {
            HTTPSamplerBase config = makeUrlConfig(".*/index\\.html");
            config.setProtocol(HTTPSamplerBase.PROTOCOL_HTTPS);
            config.setPort(HTTPSamplerBase.DEFAULT_HTTPS_PORT);
            HTTPSamplerBase context = makeContext("https://www.apache.org/subdir/previous.html");
            String responseText = "<html><head><title>Test page</title></head><body>"
                    + "<a href=\"index.html\">Goto index page</a></body></html>";
            HTTPSampleResult result = new HTTPSampleResult();
            jmctx.setCurrentSampler(context);
            jmctx.setCurrentSampler(config);
            result.setResponseData(responseText, null);
            result.setSampleLabel(context.toString());
            result.setSamplerData(context.toString());
            result.setURL(context.getUrl());
            jmctx.setPreviousResult(result);
            parser.process();
            assertEquals("https://www.apache.org/subdir/index.html", config.getUrl().toString());
        }
View Full Code Here

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

            parser.process();
            assertEquals("https://www.apache.org/subdir/index.html", config.getUrl().toString());
        }

        public void testSimpleParse2() throws Exception {
            HTTPSamplerBase config = makeUrlConfig("/index\\.html");
            HTTPSamplerBase context = makeContext("http://www.apache.org/subdir/previous.html");
            String responseText = "<html><head><title>Test page</title></head><body>"
                    + "<a href=\"/index.html\">Goto index page</a>" + "hfdfjiudfjdfjkjfkdjf"
                    + "<b>bold text</b><a href=lowerdir/index.html>lower</a>" + "</body></html>";
            HTTPSampleResult result = new HTTPSampleResult();
            result.setResponseData(responseText, null);
            result.setSampleLabel(context.toString());
            result.setURL(context.getUrl());
            jmctx.setCurrentSampler(context);
            jmctx.setCurrentSampler(config);
            jmctx.setPreviousResult(result);
            parser.process();
            String newUrl = config.getUrl().toString();
View Full Code Here

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

            assertTrue("http://www.apache.org/index.html".equals(newUrl)
                    || "http://www.apache.org/subdir/lowerdir/index.html".equals(newUrl));
        }

        public void testSimpleParse3() throws Exception {
            HTTPSamplerBase config = makeUrlConfig(".*index.*");
            config.getArguments().addArgument("param1", "value1");
            HTTPSamplerBase 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, null);
            result.setSampleLabel(context.toString());
            result.setURL(context.getUrl());
            jmctx.setCurrentSampler(context);
            jmctx.setCurrentSampler(config);
            jmctx.setPreviousResult(result);
            parser.process();
            String newUrl = config.getUrl().toString();
View Full Code Here

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

            String newUrl = config.getUrl().toString();
            assertEquals("http://www.apache.org/home/index.html?param1=value1", newUrl);
        }

        public void testSimpleParse4() throws Exception {
            HTTPSamplerBase config = makeUrlConfig("/subdir/index\\..*");
            HTTPSamplerBase context = makeContext("http://www.apache.org/subdir/previous.html");
            String responseText = "<html><head><title>Test page</title></head><body>"
                    + "<A HREF=\"index.html\">Goto index page</A></body></html>";
            HTTPSampleResult result = new HTTPSampleResult();
            result.setResponseData(responseText, null);
            result.setSampleLabel(context.toString());
            result.setURL(context.getUrl());
            jmctx.setCurrentSampler(context);
            jmctx.setCurrentSampler(config);
            jmctx.setPreviousResult(result);
            parser.process();
            String newUrl = config.getUrl().toString();
View Full Code Here

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

            String newUrl = config.getUrl().toString();
            assertEquals("http://www.apache.org/subdir/index.html", newUrl);
        }

        public void testSimpleParse5() throws Exception {
            HTTPSamplerBase config = makeUrlConfig("/subdir/index\\.h.*");
            HTTPSamplerBase context = makeContext("http://www.apache.org/subdir/one/previous.html");
            String responseText = "<html><head><title>Test page</title></head><body>"
                    + "<a href=\"../index.html\">Goto index page</a></body></html>";
            HTTPSampleResult result = new HTTPSampleResult();
            result.setResponseData(responseText, null);
            result.setSampleLabel(context.toString());
            result.setURL(context.getUrl());
            jmctx.setCurrentSampler(context);
            jmctx.setCurrentSampler(config);
            jmctx.setPreviousResult(result);
            parser.process();
            String newUrl = config.getUrl().toString();
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.