use of org.apache.jmeter.testelement.property.TestElementProperty in project jmeter by apache.
the class BackendListener method setArguments.
/**
* Set the arguments (parameters) for the BackendListenerClient to be executed
* with.
*
* @param args
* the new arguments. These replace any existing arguments.
*/
public void setArguments(Arguments args) {
// Bug 59173 - don't save new default argument
args.removeArgument(GraphiteBackendListenerClient.USE_REGEXP_FOR_SAMPLERS_LIST, GraphiteBackendListenerClient.USE_REGEXP_FOR_SAMPLERS_LIST_DEFAULT);
setProperty(new TestElementProperty(ARGUMENTS, args));
}
use of org.apache.jmeter.testelement.property.TestElementProperty in project jmeter by apache.
the class TestElementPropertyConverter method marshal.
/** {@inheritDoc} */
@Override
public void marshal(Object arg0, HierarchicalStreamWriter writer, MarshallingContext context) {
TestElementProperty prop = (TestElementProperty) arg0;
writer.addAttribute(ConversionHelp.ATT_NAME, ConversionHelp.encode(prop.getName()));
Class<?> clazz = prop.getObjectValue().getClass();
writer.addAttribute(ConversionHelp.ATT_ELEMENT_TYPE, mapper().serializedClass(clazz));
TestElement te = (TestElement) prop.getObjectValue();
ConversionHelp.saveSpecialProperties(te, writer);
for (JMeterProperty jmp : prop) {
// Skip special properties if required
if (!ConversionHelp.isSpecialProperty(jmp.getName())) {
// Don't save empty comments
if (!(TestElement.COMMENTS.equals(jmp.getName()) && jmp.getStringValue().isEmpty())) {
writeItem(jmp, context, writer);
}
}
}
//TODO clazz is probably always the same as testclass
}
use of org.apache.jmeter.testelement.property.TestElementProperty in project jmeter by apache.
the class TestElementPropertyConverter method unmarshal.
/*
* TODO - convert to work more like upgrade.properties/NameUpdater.java
*
* Special processing is carried out for the Header Class The String
* property TestElement.name is converted to Header.name for example:
* <elementProp name="User-Agent"
* elementType="org.apache.jmeter.protocol.http.control.Header"> <stringProp
* name="Header.value">Mozilla%2F4.0+%28compatible%3B+MSIE+5.5%3B+Windows+98%29</stringProp>
* <stringProp name="TestElement.name">User-Agent</stringProp>
* </elementProp> becomes <elementProp name="User-Agent"
* elementType="org.apache.jmeter.protocol.http.control.Header"> <stringProp
* name="Header.value">Mozilla%2F4.0+%28compatible%3B+MSIE+5.5%3B+Windows+98%29</stringProp>
* <stringProp name="Header.name">User-Agent</stringProp> </elementProp>
*/
/** {@inheritDoc} */
@Override
public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context) {
try {
TestElementProperty prop = (TestElementProperty) createCollection(context.getRequiredType());
prop.setName(ConversionHelp.decode(reader.getAttribute(ConversionHelp.ATT_NAME)));
String element = reader.getAttribute(ConversionHelp.ATT_ELEMENT_TYPE);
boolean isHeader = HEADER_CLASSNAME.equals(element);
// Always decode
prop.setObjectValue(mapper().realClass(element).newInstance());
TestElement te = (TestElement) prop.getObjectValue();
// No need to check version, just process the attributes if present
ConversionHelp.restoreSpecialProperties(te, reader);
while (reader.hasMoreChildren()) {
reader.moveDown();
JMeterProperty subProp = (JMeterProperty) readItem(reader, context, prop);
if (subProp != null) {
// could be null if it has been deleted via NameUpdater
if (isHeader) {
String name = subProp.getName();
if (TestElement.NAME.equals(name)) {
// $NON-NLS-1$
subProp.setName("Header.name");
// Must be same as Header.HNAME - but that is built
// later
}
}
prop.addProperty(subProp);
}
reader.moveUp();
}
return prop;
} catch (InstantiationException | IllegalAccessException e) {
log.error("Couldn't unmarshall TestElementProperty", e);
// $NON-NLS-1$
return new TestElementProperty("ERROR", new ConfigTestElement());
}
}
use of org.apache.jmeter.testelement.property.TestElementProperty in project jmeter by apache.
the class LdapExtConfigGui method modifyTestElement.
/**
* Modifies a given TestElement to mirror the data in the gui components.
*
* @see org.apache.jmeter.gui.JMeterGUIComponent#modifyTestElement(TestElement)
*/
@Override
public void modifyTestElement(TestElement element) {
element.clear();
configureTestElement(element);
element.setProperty(LDAPExtSampler.SERVERNAME, servername.getText());
element.setProperty(LDAPExtSampler.PORT, port.getText());
element.setProperty(LDAPExtSampler.ROOTDN, rootdn.getText());
element.setProperty(LDAPExtSampler.SCOPE, String.valueOf(scope.getSelectedIndex()));
element.setProperty(LDAPExtSampler.COUNTLIM, countlim.getText());
element.setProperty(LDAPExtSampler.TIMELIM, timelim.getText());
element.setProperty(LDAPExtSampler.ATTRIBS, attribs.getText());
element.setProperty(LDAPExtSampler.RETOBJ, Boolean.toString(retobj.isSelected()));
element.setProperty(LDAPExtSampler.DEREF, Boolean.toString(deref.isSelected()));
element.setProperty(LDAPExtSampler.CONNTO, connto.getText());
element.setProperty(LDAPExtSampler.PARSEFLAG, Boolean.toString(parseflag.isSelected()));
element.setProperty(LDAPExtSampler.SECURE, Boolean.toString(secure.isSelected()));
element.setProperty(LDAPExtSampler.USERDN, userdn.getText());
element.setProperty(LDAPExtSampler.USERPW, userpw.getText());
element.setProperty(LDAPExtSampler.COMPAREDN, comparedn.getText());
element.setProperty(LDAPExtSampler.COMPAREFILT, comparefilt.getText());
element.setProperty(LDAPExtSampler.MODDDN, modddn.getText());
element.setProperty(LDAPExtSampler.NEWDN, newdn.getText());
if (addTest.isSelected()) {
element.setProperty(new StringProperty(LDAPExtSampler.TEST, LDAPExtSampler.ADD));
element.setProperty(new StringProperty(LDAPExtSampler.BASE_ENTRY_DN, add.getText()));
element.setProperty(new TestElementProperty(LDAPExtSampler.ARGUMENTS, tableAddPanel.createTestElement()));
}
if (modifyTest.isSelected()) {
element.setProperty(new StringProperty(LDAPExtSampler.TEST, LDAPExtSampler.MODIFY));
element.setProperty(new StringProperty(LDAPExtSampler.BASE_ENTRY_DN, modify.getText()));
element.setProperty(new TestElementProperty(LDAPExtSampler.LDAPARGUMENTS, tableModifyPanel.createTestElement()));
}
if (deleteTest.isSelected()) {
element.setProperty(new StringProperty(LDAPExtSampler.TEST, LDAPExtSampler.DELETE));
element.setProperty(new StringProperty(LDAPExtSampler.DELETE, delete.getText()));
}
if (searchTest.isSelected()) {
element.setProperty(new StringProperty(LDAPExtSampler.TEST, LDAPExtSampler.SEARCH));
element.setProperty(new StringProperty(LDAPExtSampler.SEARCHBASE, searchbase.getText()));
element.setProperty(new StringProperty(LDAPExtSampler.SEARCHFILTER, searchfilter.getText()));
}
if (bind.isSelected()) {
element.setProperty(new StringProperty(LDAPExtSampler.TEST, LDAPExtSampler.BIND));
}
if (sbind.isSelected()) {
element.setProperty(new StringProperty(LDAPExtSampler.TEST, LDAPExtSampler.SBIND));
}
if (compare.isSelected()) {
element.setProperty(new StringProperty(LDAPExtSampler.TEST, LDAPExtSampler.COMPARE));
}
if (rename.isSelected()) {
element.setProperty(new StringProperty(LDAPExtSampler.TEST, LDAPExtSampler.RENAME));
}
if (unbind.isSelected()) {
element.setProperty(new StringProperty(LDAPExtSampler.TEST, LDAPExtSampler.UNBIND));
}
}
use of org.apache.jmeter.testelement.property.TestElementProperty in project jmeter by apache.
the class HTTPFileArgs method addHTTPFileArg.
/**
* Add a new file.
*
* @param file
* the new file
*/
public void addHTTPFileArg(HTTPFileArg file) {
TestElementProperty newHTTPFileArg = new TestElementProperty(file.getPath(), file);
if (isRunningVersion()) {
this.setTemporary(newHTTPFileArg);
}
getHTTPFileArgsCollection().addItem(newHTTPFileArg);
}
Aggregations