Search in sources :

Example 1 with HttpDefaultsGui

use of org.apache.jmeter.protocol.http.config.gui.HttpDefaultsGui in project jmeter by apache.

the class PackageTest method configure.

private void configure(HTTPSamplerBase sampler) throws Exception {
    sampler.addArgument("arg1", "val1");
    ConfigTestElement config = (ConfigTestElement) new HttpDefaultsGui().createTestElement();
    ((Arguments) config.getProperty(HTTPSamplerBase.ARGUMENTS).getObjectValue()).addArgument(new HTTPArgument("config1", "configValue"));
    config.setRunningVersion(true);
    sampler.setRunningVersion(true);
    sampler.setRunningVersion(true);
    sampler.addTestElement(config);
    assertEquals("config1=configValue", sampler.getArguments().getArgument(1).toString());
    sampler.recoverRunningVersion();
    config.recoverRunningVersion();
    assertEquals(1, sampler.getArguments().getArgumentCount());
    sampler.addTestElement(config);
    assertEquals("config1=configValue", sampler.getArguments().getArgument(1).toString());
}
Also used : HTTPArgument(org.apache.jmeter.protocol.http.util.HTTPArgument) Arguments(org.apache.jmeter.config.Arguments) HttpDefaultsGui(org.apache.jmeter.protocol.http.config.gui.HttpDefaultsGui) ConfigTestElement(org.apache.jmeter.config.ConfigTestElement)

Aggregations

Arguments (org.apache.jmeter.config.Arguments)1 ConfigTestElement (org.apache.jmeter.config.ConfigTestElement)1 HttpDefaultsGui (org.apache.jmeter.protocol.http.config.gui.HttpDefaultsGui)1 HTTPArgument (org.apache.jmeter.protocol.http.util.HTTPArgument)1