Package org.apache.jmeter.config

Examples of org.apache.jmeter.config.Arguments


     * Setup the form data with specified values
     *
     * @param httpSampler
     */
    private void setupFormData(HTTPSampler httpSampler, boolean isEncoded, String titleValue, String descriptionValue) {
        Arguments args = new Arguments();
        HTTPArgument argument1 = new HTTPArgument("title", titleValue, isEncoded);
        HTTPArgument argument2 = new HTTPArgument("description", descriptionValue, isEncoded);
        args.addArgument(argument1);
        args.addArgument(argument2);
        httpSampler.setArguments(args);
    }
View Full Code Here


        assertEquals(1, files.getHTTPFileArgCount());
        HTTPFileArg file = (HTTPFileArg) files.iterator().next().getObjectValue();
        assertEquals("file1", file.getPath());
        assertEquals("param1", file.getParamName());
        assertEquals("text/plain", file.getMimeType());
        Arguments args = muc.getArguments();
        assertEquals(3, args.getArgumentCount());
        Argument arg = args.getArgument(0);
        assertEquals("aa", arg.getName());
        assertEquals("bb", arg.getValue());
        arg = args.getArgument(1);
        assertEquals("xx", arg.getName());
        assertEquals("yy", arg.getValue());
        arg = args.getArgument(2);
        assertEquals("abc", arg.getName());
        assertEquals("xyz  \nxyz  ", arg.getValue());
    }
View Full Code Here

        assertEquals(1, files.getHTTPFileArgCount());
        HTTPFileArg file = (HTTPFileArg) files.iterator().next().getObjectValue();
        assertEquals("file1", file.getPath());
        assertEquals("param1", file.getParamName());
        assertEquals("text/plain", file.getMimeType());
        Arguments args = muc.getArguments();
        assertEquals(3, args.getArgumentCount());
        Argument arg = args.getArgument(0);
        assertEquals("aa", arg.getName());
        assertEquals("bb", arg.getValue());
        arg = args.getArgument(1);
        assertEquals("xx", arg.getName());
        assertEquals("yy", arg.getValue());
        arg = args.getArgument(2);
        assertEquals("abc", arg.getName());
        assertEquals("xyz  \r\nxyz  ", arg.getValue());
    }
View Full Code Here

        super(name);
    }

    @Override
    protected void setUp() {
        Arguments args = new Arguments();
        args.addArgument("username", "mstover");
        args.addArgument("password", "pass");
        args.addArgument("action", "login");
        config = new HTTPNullSampler();
        config.setName("Full Config");
        config.setProperty(HTTPSamplerBase.DOMAIN, "www.lazer.com");
        config.setProperty(HTTPSamplerBase.PATH, "login.jsp");
        config.setProperty(HTTPSamplerBase.METHOD, HTTPSamplerBase.POST);
View Full Code Here

    }

    // Parse arguments singly
    public void testParseArguments(){
        HTTPSamplerBase sampler = new HTTPNullSampler();
        Arguments args;
        Argument arg;

        args = sampler.getArguments();
        assertEquals(0,args.getArgumentCount());
        assertEquals(0,sampler.getHTTPFileCount());

        sampler.parseArguments("");
        args = sampler.getArguments();
        assertEquals(0,args.getArgumentCount());
        assertEquals(0,sampler.getHTTPFileCount());

        sampler.parseArguments("name1");
        args = sampler.getArguments();
        assertEquals(1,args.getArgumentCount());
        arg=args.getArgument(0);
        assertEquals("name1",arg.getName());
        assertEquals("",arg.getMetaData());
        assertEquals("",arg.getValue());
        assertEquals(0,sampler.getHTTPFileCount());

        sampler.parseArguments("name2=");
        args = sampler.getArguments();
        assertEquals(2,args.getArgumentCount());
        arg=args.getArgument(1);
        assertEquals("name2",arg.getName());
        assertEquals("=",arg.getMetaData());
        assertEquals("",arg.getValue());
        assertEquals(0,sampler.getHTTPFileCount());

        sampler.parseArguments("name3=value3");
        args = sampler.getArguments();
        assertEquals(3,args.getArgumentCount());
        arg=args.getArgument(2);
        assertEquals("name3",arg.getName());
        assertEquals("=",arg.getMetaData());
        assertEquals("value3",arg.getValue());
        assertEquals(0,sampler.getHTTPFileCount());
    }
View Full Code Here

    }

    // Parse arguments all at once
    public void testParseArguments2(){
        HTTPSamplerBase sampler = new HTTPNullSampler();
        Arguments args;
        Argument arg;

        args = sampler.getArguments();
        assertEquals(0,args.getArgumentCount());
        assertEquals(0,sampler.getHTTPFileCount());

        sampler.parseArguments("&name1&name2=&name3=value3");
        args = sampler.getArguments();
        assertEquals(3,args.getArgumentCount());
        assertEquals(0,sampler.getHTTPFileCount());

        arg=args.getArgument(0);
        assertEquals("name1",arg.getName());
        assertEquals("",arg.getMetaData());
        assertEquals("",arg.getValue());
        assertEquals(0,sampler.getHTTPFileCount());

        arg=args.getArgument(1);
        assertEquals("name2",arg.getName());
        assertEquals("=",arg.getMetaData());
        assertEquals("",arg.getValue());
        assertEquals(0,sampler.getHTTPFileCount());

        arg=args.getArgument(2);
        assertEquals("name3",arg.getName());
        assertEquals("=",arg.getMetaData());
        assertEquals("value3",arg.getValue());
        assertEquals(0,sampler.getHTTPFileCount());
    }
View Full Code Here

     * Save the GUI values in the sampler.
     *
     * @param element
     */
    public void modifyTestElement(TestElement element) {
        Arguments args = (Arguments) argsPanel.createTestElement();

        HTTPArgument.convertArgumentsToHTTP(args);
        element.setProperty(new TestElementProperty(HTTPSamplerBase.ARGUMENTS, args));
        element.setProperty(HTTPSamplerBase.DOMAIN, domain.getText());
        element.setProperty(HTTPSamplerBase.PORT, port.getText());
View Full Code Here


    ////////////////////// Code ///////////////////////////

    public HTTPSamplerBase() {
        setArguments(new Arguments());
    }
View Full Code Here

            // UTF-8 unsupported? You must be joking!
            log.error("UTF-8 encoding not supported!");
            throw new Error("Should not happen: " + e.toString());
        }

        final Arguments arguments = config.getArguments();
        if (query == null && arguments.getArgumentCount() > 0) {
            return false;// failed to convert query, so assume no match
        }

        final Perl5Matcher matcher = JMeterUtils.getMatcher();
        final PatternCacheLRU patternCache = JMeterUtils.getPatternCache();

        if (!isEqualOrMatches(newLink.getProtocol(), config.getProtocol(), matcher, patternCache)){
            return false;
        }

        final String domain = config.getDomain();
        if (domain != null && domain.length() > 0) {
            if (!isEqualOrMatches(newLink.getDomain(), domain, matcher, patternCache)){
                return false;
            }
        }

        final String path = config.getPath();
        if (!newLink.getPath().equals(path)
                && !matcher.matches(newLink.getPath(), patternCache.getPattern("[/]*" + path, // $NON-NLS-1$
                        Perl5Compiler.READ_ONLY_MASK))) {
            return false;
        }

        PropertyIterator iter = arguments.iterator();
        while (iter.hasNext()) {
            Argument item = (Argument) iter.next().getObjectValue();
            final String name = item.getName();
            if (query.indexOf(name + "=") == -1) { // $NON-NLS-1$
                if (!(matcher.contains(query, patternCache.getPattern(name, Perl5Compiler.READ_ONLY_MASK)))) {
View Full Code Here

        this(null);
    }

    // called by HttpRequestHdr
    public MultipartUrlConfig(String boundary) {
        args = new Arguments();
        files = new HTTPFileArgs();
        this.boundary = boundary;
    }
View Full Code Here

TOP

Related Classes of org.apache.jmeter.config.Arguments

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.