Search in sources :

Example 26 with Argument

use of org.apache.jmeter.config.Argument in project jmeter by apache.

the class SmtpPanel method setHeaderFields.

public void setHeaderFields(CollectionProperty fields) {
    clearHeaderFields();
    for (int i = 0; i < fields.size(); i++) {
        Argument argument = (Argument) fields.get(i).getObjectValue();
        String name = argument.getName();
        JButton removeButton = addHeaderActionPerformed(null);
        JTextField nameTF = removeButtons.get(removeButton);
        nameTF.setText(name);
        JTextField valueTF = headerFields.get(nameTF);
        valueTF.setText(argument.getValue());
    }
    validate();
}
Also used : Argument(org.apache.jmeter.config.Argument) JButton(javax.swing.JButton) JTextField(javax.swing.JTextField)

Example 27 with Argument

use of org.apache.jmeter.config.Argument in project jmeter by apache.

the class SendMailCommand method addHeader.

/**
     * Adds a header-part to current HashMap of headers - to be called by
     * SmtpSampler-object
     *
     * @param headerName
     *            Key for current header
     * @param headerValue
     *            Value for current header
     */
public void addHeader(String headerName, String headerValue) {
    if (this.headerFields == null) {
        this.headerFields = new CollectionProperty();
    }
    Argument argument = new Argument(headerName, headerValue);
    this.headerFields.addItem(argument);
}
Also used : CollectionProperty(org.apache.jmeter.testelement.property.CollectionProperty) Argument(org.apache.jmeter.config.Argument)

Example 28 with Argument

use of org.apache.jmeter.config.Argument in project jmeter by apache.

the class HTTPArgument method convertArgumentsToHTTP.

/**
     * Converts all {@link Argument} entries in the collection to {@link HTTPArgument} entries.
     * 
     * @param args collection of {@link Argument} and/or {@link HTTPArgument} entries
     */
public static void convertArgumentsToHTTP(Arguments args) {
    List<Argument> newArguments = new LinkedList<>();
    for (JMeterProperty jMeterProperty : args.getArguments()) {
        Argument arg = (Argument) jMeterProperty.getObjectValue();
        if (!(arg instanceof HTTPArgument)) {
            newArguments.add(new HTTPArgument(arg));
        } else {
            newArguments.add(arg);
        }
    }
    args.removeAllArguments();
    args.setArguments(newArguments);
}
Also used : JMeterProperty(org.apache.jmeter.testelement.property.JMeterProperty) Argument(org.apache.jmeter.config.Argument) LinkedList(java.util.LinkedList)

Aggregations

Argument (org.apache.jmeter.config.Argument)28 Arguments (org.apache.jmeter.config.Arguments)13 JMeterProperty (org.apache.jmeter.testelement.property.JMeterProperty)11 Test (org.junit.Test)7 PropertyIterator (org.apache.jmeter.testelement.property.PropertyIterator)4 IOException (java.io.IOException)3 ArrayList (java.util.ArrayList)3 BasicAttribute (javax.naming.directory.BasicAttribute)3 CollectionProperty (org.apache.jmeter.testelement.property.CollectionProperty)3 File (java.io.File)2 BasicAttributes (javax.naming.directory.BasicAttributes)2 JTextField (javax.swing.JTextField)2 HTTPSampleResult (org.apache.jmeter.protocol.http.sampler.HTTPSampleResult)2 HTTPSamplerBase (org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase)2 HTTPFileArg (org.apache.jmeter.protocol.http.util.HTTPFileArg)2 HTTPFileArgs (org.apache.jmeter.protocol.http.util.HTTPFileArgs)2 SampleResult (org.apache.jmeter.samplers.SampleResult)2 Sampler (org.apache.jmeter.samplers.Sampler)2 UnsupportedFlavorException (java.awt.datatransfer.UnsupportedFlavorException)1 BufferedInputStream (java.io.BufferedInputStream)1