use of org.apache.jmeter.protocol.ldap.config.gui.LDAPArgument in project jmeter by apache.
the class LDAPExtSampler method getUserModAttributes.
/***************************************************************************
* Collect all the value from the table (Arguments), using this create the
* basicAttributes This will create the Basic Attributes for the User
* defined TestCase for Modify test
*
* @return The BasicAttributes
**************************************************************************/
private ModificationItem[] getUserModAttributes() {
ModificationItem[] mods = new ModificationItem[getLDAPArguments().getArguments().size()];
BasicAttribute attr;
PropertyIterator iter = getLDAPArguments().iterator();
int count = 0;
while (iter.hasNext()) {
LDAPArgument item = (LDAPArgument) iter.next().getObjectValue();
if ((item.getValue()).length() == 0) {
attr = new BasicAttribute(item.getName());
} else {
attr = getBasicAttribute(item.getName(), item.getValue());
}
final String opcode = item.getOpcode();
if ("add".equals(opcode)) {
// $NON-NLS-1$
mods[count++] = new ModificationItem(DirContext.ADD_ATTRIBUTE, attr);
} else if (// $NON-NLS-1$
"delete".equals(opcode) || "remove".equals(opcode)) {
// $NON-NLS-1$
mods[count++] = new ModificationItem(DirContext.REMOVE_ATTRIBUTE, attr);
} else if ("replace".equals(opcode)) {
// $NON-NLS-1$
mods[count++] = new ModificationItem(DirContext.REPLACE_ATTRIBUTE, attr);
} else {
log.warn("Invalid opCode: " + opcode);
}
}
return mods;
}
Aggregations