use of org.apache.jmeter.testelement.property.JMeterProperty in project jmeter by apache.
the class TestElementConverter method marshal.
/**
* {@inheritDoc}
*/
@Override
public void marshal(Object arg0, HierarchicalStreamWriter writer, MarshallingContext context) {
TestElement el = (TestElement) arg0;
ConversionHelp.saveSpecialProperties(el, writer);
PropertyIterator iter = el.propertyIterator();
while (iter.hasNext()) {
JMeterProperty jmp = iter.next();
// Skip special properties if required
if (!ConversionHelp.isSpecialProperty(jmp.getName())) {
// Don't save empty comments - except for the TestPlan (to maintain compatibility)
if (!(TestElement.COMMENTS.equals(jmp.getName()) && jmp.getStringValue().length() == 0 && !el.getClass().equals(TestPlan.class))) {
writeCompleteItem(jmp, context, writer);
}
}
}
}
use of org.apache.jmeter.testelement.property.JMeterProperty in project jmeter by apache.
the class AbstractTestElement method addProperty.
/**
* Add property to test element
* @param property {@link JMeterProperty} to add to current Test Element
* @param clone clone property
*/
protected void addProperty(JMeterProperty property, boolean clone) {
JMeterProperty propertyToPut = property;
if (clone) {
propertyToPut = property.clone();
}
if (isRunningVersion()) {
setTemporary(propertyToPut);
} else {
clearTemporary(property);
}
JMeterProperty prop = getProperty(property.getName());
if (prop instanceof NullProperty || (prop instanceof StringProperty && prop.getStringValue().isEmpty())) {
propMap.put(property.getName(), propertyToPut);
} else {
prop.mergeIn(propertyToPut);
}
}
use of org.apache.jmeter.testelement.property.JMeterProperty in project jmeter by apache.
the class AbstractTestElement method recoverRunningVersion.
/**
* {@inheritDoc}
*/
@Override
public void recoverRunningVersion() {
Iterator<Map.Entry<String, JMeterProperty>> iter = propMap.entrySet().iterator();
while (iter.hasNext()) {
Map.Entry<String, JMeterProperty> entry = iter.next();
JMeterProperty prop = entry.getValue();
if (isTemporary(prop)) {
iter.remove();
clearTemporary(prop);
} else {
prop.recoverRunningVersion(this);
}
}
emptyTemporary();
}
use of org.apache.jmeter.testelement.property.JMeterProperty in project jmeter by apache.
the class AbstractTestElement method mergeIn.
/**
* Add to this the properties of element (by reference)
* @param element {@link TestElement}
*/
protected void mergeIn(TestElement element) {
PropertyIterator iter = element.propertyIterator();
while (iter.hasNext()) {
JMeterProperty prop = iter.next();
addProperty(prop, false);
}
}
use of org.apache.jmeter.testelement.property.JMeterProperty in project jmeter by apache.
the class AbstractTestElement method logProperties.
/**
* Log the properties of the test element
*
* @see TestElement#setProperty(JMeterProperty)
*/
protected void logProperties() {
if (log.isDebugEnabled()) {
PropertyIterator iter = propertyIterator();
while (iter.hasNext()) {
JMeterProperty prop = iter.next();
log.debug("Property {} is temp? {} and is a {}", prop.getName(), isTemporary(prop), prop.getObjectValue());
}
}
}
Aggregations