1 18 19 22 package org.apache.jmeter.protocol.http.sampler; 23 24 import junit.framework.TestCase; 25 26 import org.apache.jmeter.config.Arguments; 27 import org.apache.jmeter.config.ConfigTestElement; 28 import org.apache.jmeter.protocol.http.config.gui.HttpDefaultsGui; 29 import org.apache.jmeter.protocol.http.control.gui.HttpTestSampleGui; 30 import org.apache.jmeter.protocol.http.util.HTTPArgument; 31 32 36 public class PackageTest extends TestCase 37 { 38 public PackageTest(String arg0) 39 { 40 super(arg0); 41 } 42 43 public void testConfiguring() throws Exception 44 { 45 HTTPSampler sampler = 46 (HTTPSampler) new HttpTestSampleGui().createTestElement(); 47 sampler.addArgument("arg1", "val1"); 48 ConfigTestElement config = 49 (ConfigTestElement) new HttpDefaultsGui().createTestElement(); 50 ( 51 (Arguments) config 52 .getProperty(HTTPSampler.ARGUMENTS) 53 .getObjectValue()) 54 .addArgument( 55 new HTTPArgument("config1", "configValue")); 56 config.setRunningVersion(true); 57 sampler.setRunningVersion(true); 58 sampler.setRunningVersion(true); 59 sampler.addTestElement(config); 60 assertEquals( 61 "config1=configValue", 62 sampler.getArguments().getArgument(1).toString()); 63 sampler.recoverRunningVersion(); 64 config.recoverRunningVersion(); 65 assertEquals(1, sampler.getArguments().getArgumentCount()); 66 sampler.addTestElement(config); 67 assertEquals( 68 "config1=configValue", 69 sampler.getArguments().getArgument(1).toString()); 70 } 71 } 72 | Popular Tags |