/** * {@inheritDoc} */ @Override public PropertyIterator iterator() { return value.propertyIterator(); } }
/** * Replaces ${key} by value extracted from variables if any * @param el {@link TestElement} in which values should be replaced * @throws InvalidVariableException when transforming of the variables goes awry and * the used transformer throws an {@link InvalidVariableException} */ public void undoReverseReplace(TestElement el) throws InvalidVariableException { Collection<JMeterProperty> newProps = replaceValues(el.propertyIterator(), new UndoVariableReplacement(masterFunction, variables)); setProperties(el, newProps); }
/** * Transforms strings into variable references * @param el {@link TestElement} in which the we will look for strings, that can be replaced by variable references * @throws InvalidVariableException when transforming of the strings goes awry and * the used transformer throws an {@link InvalidVariableException} */ public void reverseReplace(TestElement el) throws InvalidVariableException { Collection<JMeterProperty> newProps = replaceValues(el.propertyIterator(), new ReplaceFunctionsWithStrings(masterFunction, variables)); setProperties(el, newProps); }
/** * Transforms strings into variable references using regexp matching if regexMatch is <code>true</code> * @param el {@link TestElement} in which the we will look for strings, that can be replaced by variable references * @param regexMatch when <code>true</code> variable substitution will be done in regexp matching mode * @throws InvalidVariableException when transforming of the strings goes awry and * the used transformer throws an {@link InvalidVariableException} */ public void reverseReplace(TestElement el, boolean regexMatch) throws InvalidVariableException { Collection<JMeterProperty> newProps = replaceValues(el.propertyIterator(), new ReplaceFunctionsWithStrings(masterFunction, variables, regexMatch)); setProperties(el, newProps); }
/** * 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); } }
/** * Replaces TestElement StringProperties containing functions with their Function properties equivalent, example: * ${__time()}_${__threadNum()}_${__machineName()} will become a FunctionProperty of * a CompoundVariable containing 3 functions * @param el {@link TestElement} in which the values should be replaced * @throws InvalidVariableException when transforming of the variables goes awry and * the used transformer throws an {@link InvalidVariableException} */ public void replaceValues(TestElement el) throws InvalidVariableException { Collection<JMeterProperty> newProps = replaceValues(el.propertyIterator(), new ReplaceStringWithFunctions(masterFunction, variables)); setProperties(el, newProps); }
PropertyIterator it = el.propertyIterator(); while (it.hasNext()) { JMeterProperty obj = it.next();
/** {@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) )) { writeItem(jmp, context, writer); } } } }
/** * Get values from element to fill propertyMap and setup customizer * @param element TestElement */ private void setValues(TestElement element) { // Copy all property values into the map: for (PropertyIterator jprops = element.propertyIterator(); jprops.hasNext();) { JMeterProperty jprop = jprops.next(); propertyMap.put(jprop.getName(), jprop.getObjectValue()); } if (customizer != null) { customizer.setObject(propertyMap); } else { if (initialized){ remove(customizerIndexInPanel); } Customizer c = customizers.get(element); if (c == null) { c = createCustomizer(); c.setObject(propertyMap); customizers.put(element, c); } add((Component) c, BorderLayout.CENTER); } }
/** * 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. * <p> * This implementation retrieves all key/value pairs from the TestElement * object and sets these values in the GUI. * * @param el * the TestElement to configure */ @Override public void configure(TestElement el) { super.configure(el); tableModel.clearData(); PropertyIterator iter = el.propertyIterator(); while (iter.hasNext()) { JMeterProperty prop = iter.next(); tableModel.addRow(new Object[] { prop.getName(), prop.getStringValue() }); } checkDeleteStatus(); }