Examples of HTTPSamplerBase


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 testFailSimpleParse1() throws Exception {
            HTTPSamplerBase config = makeUrlConfig(".*index.*?param2=.+1");
            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();
            String newUrl = config.getUrl().toString();
            result.setResponseData(responseText, null);
            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

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

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

        public void testFailSimpleParse3() throws Exception {
            HTTPSamplerBase config = makeUrlConfig("/home/index.html");
            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();
            String newUrl = config.getUrl().toString();
            result.setResponseData(responseText, null);
            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

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

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

        public void testFailSimpleParse2() throws Exception {
            HTTPSamplerBase config = makeUrlConfig(".*login\\.html");
            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.setPreviousResult(result);
            parser.process();
            String newUrl = config.getUrl().toString();
            assertTrue(!"http://www.apache.org/home/index.html?param1=value1".equals(newUrl));
View Full Code Here

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

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

        public void testSimpleFormParse() throws Exception {
            HTTPSamplerBase config = makeUrlConfig(".*index.html");
            config.addArgument("test", "g.*");
            config.setMethod(HTTPSamplerBase.POST);
            HTTPSamplerBase 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, null);
            result.setSampleLabel(context.toString());
            result.setURL(context.getUrl());
            jmctx.setCurrentSampler(context);
            jmctx.setCurrentSampler(config);
            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());
            assertEquals("test=goto", config.getQueryString());
        }

        public void testBadCharParse() throws Exception {
            HTTPSamplerBase config = makeUrlConfig(".*index.html");
            config.addArgument("te$st", "g.*");
            config.setMethod(HTTPSamplerBase.POST);
            HTTPSamplerBase 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, null);
            result.setSampleLabel(context.toString());
            result.setURL(context.getUrl());
            jmctx.setCurrentSampler(context);
            jmctx.setCurrentSampler(config);
            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

        public void testSpecialCharParse() throws Exception {
        String specialChars = "-_.!~*'()%25";// These are some of the special characters
        String htmlEncodedFixture = URLEncoder.encode(specialChars, "UTF-8");
       
        HTTPSamplerBase config = makeUrlConfig(".*index.html");
        config.addArgument("test", ".*");
        config.setMethod(HTTPSamplerBase.POST);
        HTTPSamplerBase 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=\"hidden\" name=\"test\""
            + " value=\"" + htmlEncodedFixture + "\">Goto index page</form></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();
        assertEquals("http://www.apache.org/subdir/index.html", config.getUrl().toString());
View Full Code Here

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

      }

       
        private HTTPSamplerBase makeContext(String url) throws MalformedURLException {
            URL u = new URL(url);
            HTTPSamplerBase context = new HTTPNullSampler();
            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

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

            context.parseArguments(u.getQuery());
            return context;
        }

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

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

        public void setUp() {
            gui = new HttpTestSampleGui();
        }

        public void testCloneSampler() throws Exception {
            HTTPSamplerBase sampler = (HTTPSamplerBase) gui.createTestElement();
            sampler.addArgument("param", "value");
            HTTPSamplerBase clonedSampler = (HTTPSamplerBase) sampler.clone();
            clonedSampler.setRunningVersion(true);
            sampler.getArguments().getArgument(0).setValue("new value");
            assertEquals("Sampler didn't clone correctly", "new value", sampler.getArguments().getArgument(0)
                    .getValue());
        }
View Full Code Here

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

            argp = new Argument("test", "a.*e");
            assertFalse(HtmlParsingUtils.isArgumentMatched(arg, argp));
        }
       
        public void testIsAnchorMatched() throws Exception {
            HTTPSamplerBase target=new HTTPNullSampler();
            HTTPSamplerBase pattern=new HTTPNullSampler();

            assertTrue(HtmlParsingUtils.isAnchorMatched(target, pattern));

            target.setProtocol("http:");
            assertFalse(HtmlParsingUtils.isAnchorMatched(target, pattern));

            pattern.setProtocol(".*");
            assertTrue(HtmlParsingUtils.isAnchorMatched(target, pattern));
           
            target.setDomain("a.b.c");
            assertTrue(HtmlParsingUtils.isAnchorMatched(target, pattern));

            pattern.setDomain(".*");
            assertTrue(HtmlParsingUtils.isAnchorMatched(target, pattern));
           
            target.setPath("/abc");
            assertFalse(HtmlParsingUtils.isAnchorMatched(target, pattern));

            pattern.setPath(".*");
            assertTrue(HtmlParsingUtils.isAnchorMatched(target, pattern));
           
            target.addArgument("param2", "value2", "=");
            assertTrue(HtmlParsingUtils.isAnchorMatched(target, pattern));
           
            pattern.addArgument("param1", ".*", "=");
            assertFalse(HtmlParsingUtils.isAnchorMatched(target, pattern));
           
            target.addArgument("param1", "value1", "=");
            assertTrue(HtmlParsingUtils.isAnchorMatched(target, pattern));
        }
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.