use of org.apache.jmeter.testelement.property.TestElementProperty in project jmeter by apache.
the class UrlConfigTest method setUp.
@Before
public 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, HTTPConstants.POST);
config.setProperty(new TestElementProperty(HTTPSamplerBase.ARGUMENTS, args));
defaultConfig = new HTTPNullSampler();
defaultConfig.setName("default");
defaultConfig.setProperty(HTTPSamplerBase.DOMAIN, "www.xerox.com");
defaultConfig.setProperty(HTTPSamplerBase.PATH, "default.html");
partialConfig = new HTTPNullSampler();
partialConfig.setProperty(HTTPSamplerBase.PATH, "main.jsp");
partialConfig.setProperty(HTTPSamplerBase.METHOD, HTTPConstants.GET);
}
use of org.apache.jmeter.testelement.property.TestElementProperty in project jmeter by apache.
the class PackageTest method testArguments.
@Test
public void testArguments() throws Exception {
Arguments args = new Arguments();
args.addArgument("arg1", "val1", "=");
TestElementProperty prop = new TestElementProperty("args", args);
ConfigTestElement te = new ConfigTestElement();
te.addProperty(prop);
te.setRunningVersion(true);
Arguments config = new Arguments();
config.addArgument("config1", "configValue", "=");
TestElementProperty configProp = new TestElementProperty("args", config);
ConfigTestElement te2 = new ConfigTestElement();
te2.addProperty(configProp);
te.addTestElement(te2);
assertEquals(2, args.getArgumentCount());
assertEquals("config1=configValue", args.getArgument(1).toString());
te.recoverRunningVersion();
te.addTestElement(te2);
assertEquals(2, args.getArgumentCount());
assertEquals("config1=configValue", args.getArgument(1).toString());
}
use of org.apache.jmeter.testelement.property.TestElementProperty in project jmeter by apache.
the class GuiPackage method getTestElementCheckSum.
/**
* Compute checksum of TestElement to detect changes
* the method calculates properties checksum to detect testelement
* modifications
* TODO would be better to override hashCode for TestElement, but I decided not to touch it
*
* @param el {@link TestElement}
* @return int checksum
*/
private int getTestElementCheckSum(TestElement el) {
int ret = el.getClass().hashCode();
PropertyIterator it = el.propertyIterator();
while (it.hasNext()) {
JMeterProperty obj = it.next();
if (obj instanceof TestElementProperty) {
ret ^= getTestElementCheckSum(((TestElementProperty) obj).getElement());
} else {
ret ^= obj.getName().hashCode();
String stringValue = obj.getStringValue();
if (stringValue != null) {
ret ^= stringValue.hashCode();
} else {
if (log.isDebugEnabled()) {
log.debug("obj.getStringValue() returned null for test element:" + el.getName() + " at property:" + obj.getName());
}
}
}
}
return ret;
}
use of org.apache.jmeter.testelement.property.TestElementProperty in project jmeter by apache.
the class MailerResultCollector method clear.
/** {@inheritDoc} */
@Override
public void clear() {
super.clear();
setProperty(new TestElementProperty(MAILER_MODEL, new MailerModel()));
}
use of org.apache.jmeter.testelement.property.TestElementProperty in project jmeter by apache.
the class DNSCacheManager method isStaticHost.
private boolean isStaticHost(String host) {
JMeterProperty p = getProperty(HOSTS);
if (p instanceof NullProperty) {
removeProperty(HOSTS);
return false;
}
CollectionProperty property = (CollectionProperty) p;
PropertyIterator iterator = property.iterator();
while (iterator.hasNext()) {
TestElementProperty possibleEntry = (TestElementProperty) iterator.next();
if (log.isDebugEnabled()) {
log.debug("Look for {} at {}: {}", host, possibleEntry.getObjectValue(), possibleEntry.getObjectValue().getClass());
}
StaticHost entry = (StaticHost) possibleEntry.getObjectValue();
if (entry.getName().equalsIgnoreCase(host)) {
if (log.isDebugEnabled()) {
log.debug("Found static host: {} => {}", host, entry.getAddress());
}
return true;
}
}
log.debug("No static host found for {}", host);
return false;
}
Aggregations