use of org.apache.jmeter.testelement.property.PropertyIterator in project jmeter by apache.
the class TestHTTPFileArgs method testAdding.
@Test
public void testAdding() throws Exception {
HTTPFileArgs files = new HTTPFileArgs();
assertEquals(0, files.getHTTPFileArgCount());
files.addHTTPFileArg("hede");
assertEquals(1, files.getHTTPFileArgCount());
assertEquals("hede", ((HTTPFileArg) files.iterator().next().getObjectValue()).getPath());
HTTPFileArg file = new HTTPFileArg("hodo");
files.addHTTPFileArg(file);
assertEquals(2, files.getHTTPFileArgCount());
PropertyIterator iter = files.iterator();
assertEquals("hede", ((HTTPFileArg) iter.next().getObjectValue()).getPath());
assertEquals("hodo", ((HTTPFileArg) iter.next().getObjectValue()).getPath());
files.addEmptyHTTPFileArg();
assertEquals(3, files.getHTTPFileArgCount());
iter = files.iterator();
assertEquals("hede", ((HTTPFileArg) iter.next().getObjectValue()).getPath());
assertEquals("hodo", ((HTTPFileArg) iter.next().getObjectValue()).getPath());
assertEquals("", ((HTTPFileArg) iter.next().getObjectValue()).getPath());
}
use of org.apache.jmeter.testelement.property.PropertyIterator in project jmeter by apache.
the class LDAPArguments method toString.
/**
* Create a string representation of the arguments.
*
* @return the string representation of the arguments
*/
@Override
public String toString() {
StringBuilder str = new StringBuilder();
PropertyIterator iter = getArguments().iterator();
while (iter.hasNext()) {
LDAPArgument arg = (LDAPArgument) iter.next().getObjectValue();
final String metaData = arg.getMetaData();
str.append(arg.getName());
if (metaData == null) {
// $NON-NLS$
str.append("=");
} else {
str.append(metaData);
}
str.append(arg.getValue());
if (iter.hasNext()) {
// $NON-NLS$
str.append("&");
}
}
return str.toString();
}
use of org.apache.jmeter.testelement.property.PropertyIterator in project jmeter by apache.
the class LDAPArguments method getArgumentsAsMap.
/**
* Get the arguments as a Map. Each argument name is used as the key, and
* its value as the value.
*
* @return a new Map with String keys and values containing the arguments
*/
public Map<String, String> getArgumentsAsMap() {
PropertyIterator iter = getArguments().iterator();
Map<String, String> argMap = new HashMap<>();
while (iter.hasNext()) {
LDAPArgument arg = (LDAPArgument) iter.next().getObjectValue();
argMap.put(arg.getName(), arg.getValue());
}
return argMap;
}
use of org.apache.jmeter.testelement.property.PropertyIterator in project jmeter by apache.
the class LDAPArgumentsPanel method configure.
/**
* A newly created component can be initialized with the contents of a Test
* Element object by calling this method. The component is responsible for
* querying the Test Element object for the relevant information to display
* in its GUI.
*
* @param el
* the TestElement to configure
*/
@Override
public void configure(TestElement el) {
super.configure(el);
if (el instanceof LDAPArguments) {
tableModel.clearData();
PropertyIterator iter = ((LDAPArguments) el).iterator();
while (iter.hasNext()) {
LDAPArgument arg = (LDAPArgument) iter.next().getObjectValue();
tableModel.addRow(arg);
}
}
checkDeleteStatus();
}
use of org.apache.jmeter.testelement.property.PropertyIterator in project jmeter by apache.
the class UserParameters method setValues.
@SuppressWarnings("SynchronizeOnNonFinalField")
private void setValues() {
synchronized (lock) {
if (log.isDebugEnabled()) {
// $NON-NLS-1$
log.debug("{} Running up named: {}", Thread.currentThread().getName(), getName());
}
PropertyIterator namesIter = getNames().iterator();
PropertyIterator valueIter = getValues().iterator();
JMeterVariables jmvars = getThreadContext().getVariables();
while (namesIter.hasNext() && valueIter.hasNext()) {
String name = namesIter.next().getStringValue();
String value = valueIter.next().getStringValue();
if (log.isDebugEnabled()) {
// $NON-NLS-1$
log.debug("{} saving variable: {}={}", Thread.currentThread().getName(), name, value);
}
jmvars.put(name, value);
}
}
}
Aggregations