Package org.apache.jmeter.protocol.http.util

Examples of org.apache.jmeter.protocol.http.util.HTTPFileArgs


        String paramName = getFileFieldProperty();
        String mimeType = getMimetypeProperty();
        HTTPFileArg file = new HTTPFileArg(fileName, paramName, mimeType);
        if(file.isNotEmpty()) {
            // Now deal with any additional file arguments
            final HTTPFileArgs fileArgs = getHTTPFileArgs();
            if(fileArgs != null) {
                outFiles = new HTTPFileArg[1+fileArgs.getHTTPFileArgCount()];
                outFiles[0] = file; // first file
                HTTPFileArg[] infiles = fileArgs.asArray();
                for (int i = 0; i < infiles.length; i++){
                    outFiles[i+1] = infiles[i];
                }
            } else {
                outFiles = new HTTPFileArg[]{file}; // just one file
View Full Code Here


            HTTPFileArg file = nonEmptyFile[0];
            setFilenameProperty(file.getPath());
            setFileFieldProperty(file.getParamName());
            setMimetypeProperty(file.getMimeType());
            if (filesFound > 1){
                HTTPFileArgs fileArgs = new HTTPFileArgs();
                boolean empty=true;
                for(int i=1; i < filesFound; i++){
                    final HTTPFileArg fileArg = nonEmptyFile[i];
                    if (fileArg.isNotEmpty()){
                        fileArgs.addHTTPFileArg(fileArg);
                        empty=false;
                    }
                }
                if (!empty){
                    setHTTPFileArgs(fileArgs);
View Full Code Here

      + "\n"
      + "file content\n"
      + "\n";
    MultipartUrlConfig muc = new MultipartUrlConfig("7d159c1302d0y0");
    muc.parseArguments(queryString);
    HTTPFileArgs files = muc.getHTTPFileArgs();
    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(2, args.getArgumentCount());
View Full Code Here

  }

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

     * If there are no valid file entries, then an empty list is returned.
     *
     * @return an array of file arguments (never null)
     */
    public HTTPFileArg[] getHTTPFiles() {
        final HTTPFileArgs fileArgs = getHTTPFileArgs();
        return fileArgs == null ? new HTTPFileArg[] {} : fileArgs.asArray();
    }
View Full Code Here

     * Any additional files are saved in the FILE_ARGS array.
     *
     * @param files list of files to save
     */
    public void setHTTPFiles(HTTPFileArg[] files) {
        HTTPFileArgs fileArgs = new HTTPFileArgs();
        // Weed out the empty files
        if (files.length > 0) {
            for(int i=0; i < files.length; i++){
                HTTPFileArg file = files[i];
                if (file.isNotEmpty()){
                    fileArgs.addHTTPFileArg(file);
                }
            }
        }
        setHTTPFileArgs(fileArgs);
    }
View Full Code Here

        JMeterProperty fileName = getProperty(FILE_NAME);
        JMeterProperty paramName = getProperty(FILE_FIELD);
        JMeterProperty mimeType = getProperty(MIMETYPE);
        HTTPFileArg oldStyleFile = new HTTPFileArg(fileName, paramName, mimeType);

        HTTPFileArgs fileArgs = getHTTPFileArgs();

        HTTPFileArgs allFileArgs = new HTTPFileArgs();
        if(oldStyleFile.isNotEmpty()) { // OK, we have an old-style file definition
            allFileArgs.addHTTPFileArg(oldStyleFile); // save it
            // Now deal with any additional file arguments
            if(fileArgs != null) {
                HTTPFileArg[] infiles = fileArgs.asArray();
                for (int i = 0; i < infiles.length; i++){
                    allFileArgs.addHTTPFileArg(infiles[i]);
                }
            }
        } else {
            if(fileArgs != null) { // for new test plans that don't have FILE/PARAM/MIME properties
                allFileArgs = fileArgs;
View Full Code Here

     * If there are no valid file entries, then an empty list is returned.
     *
     * @return an array of file arguments (never null)
     */
    public HTTPFileArg[] getHTTPFiles() {
        final HTTPFileArgs fileArgs = getHTTPFileArgs();
        return fileArgs == null ? new HTTPFileArg[] {} : fileArgs.asArray();
    }
View Full Code Here

     * Any additional files are saved in the FILE_ARGS array.
     *
     * @param files list of files to save
     */
    public void setHTTPFiles(HTTPFileArg[] files) {
        HTTPFileArgs fileArgs = new HTTPFileArgs();
        // Weed out the empty files
        if (files.length > 0) {
            for(int i=0; i < files.length; i++){
                HTTPFileArg file = files[i];
                if (file.isNotEmpty()){
                    fileArgs.addHTTPFileArg(file);
                }
            }
        }
        setHTTPFileArgs(fileArgs);
    }
View Full Code Here

        JMeterProperty fileName = getProperty(FILE_NAME);
        JMeterProperty paramName = getProperty(FILE_FIELD);
        JMeterProperty mimeType = getProperty(MIMETYPE);
        HTTPFileArg oldStyleFile = new HTTPFileArg(fileName, paramName, mimeType);

        HTTPFileArgs fileArgs = getHTTPFileArgs();

        HTTPFileArgs allFileArgs = new HTTPFileArgs();
        if(oldStyleFile.isNotEmpty()) { // OK, we have an old-style file definition
            allFileArgs.addHTTPFileArg(oldStyleFile); // save it
            // Now deal with any additional file arguments
            if(fileArgs != null) {
                HTTPFileArg[] infiles = fileArgs.asArray();
                for (int i = 0; i < infiles.length; i++){
                    allFileArgs.addHTTPFileArg(infiles[i]);
                }
            }
        } else {
            if(fileArgs != null) { // for new test plans that don't have FILE/PARAM/MIME properties
                allFileArgs = fileArgs;
View Full Code Here

TOP

Related Classes of org.apache.jmeter.protocol.http.util.HTTPFileArgs

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.