/** * Remove property from temporaryProperties * @param property {@link JMeterProperty} */ protected void clearTemporary(NetMeterProperty property) { if (temporaryProperties != null) { temporaryProperties.Remove(property); } }
/** * Add property to test element * @param property {@link JMeterProperty} to add to current Test Element * @param clone clone property */ protected void addProperty(NetMeterProperty property, bool clone) { NetMeterProperty propertyToPut = property; if (clone) { propertyToPut = property.clone(); } if (isRunningVersion()) { setTemporary(propertyToPut); } else { clearTemporary(property); } NetMeterProperty prop = getProperty(property.getName()); if (prop is NullProperty || (prop is StringProperty && prop.getStringValue().Equals(""))) { propDic.Add(property.getName(), propertyToPut); } else { prop.mergeIn(propertyToPut); } }
public override void Initialize() { Controller c = GetSamplerController(); NetMeterProperty property = c.getProperty(TestElement.NAME); property.setObjectValue(GetName()); // Copy our name into that of the controller property.setRunningVersion(property.isRunningVersion()); // otherwise name reverts c.Initialize(); }
/** * 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()) { NetMeterProperty prop = iter.next(); addProperty(prop, false); } }
/** * {@inheritDoc} */ public bool isTemporary(NetMeterProperty property) { if (temporaryProperties == null) { return(false); } else { return(temporaryProperties.Contains(property)); } }
/** * Log the properties of the test element * * @see TestElement#setProperty(JMeterProperty) */ protected void logProperties() { if (log.IsDebugEnabled) { PropertyIterator iter = propertyIterator(); while (iter.hasNext()) { NetMeterProperty prop = iter.next(); //log.debug("Property " + prop.getName() + " is temp? " + isTemporary(prop) + " and is a " + prop.getObjectValue()); } } }
/** * Add to result the values of propertyNames * @param result List<String> values of propertyNames * @param propertyNames Set<String> properties to extract */ protected sealed void addPropertiesValues(List <String> result, HashSet <String> propertyNames) { PropertyIterator iterator = propertyIterator(); while (iterator.hasNext()) { NetMeterProperty jMeterProperty = iterator.next(); if (propertyNames.Contains(jMeterProperty.getName())) { result.Add(jMeterProperty.getStringValue()); } } }
private LinkedList <NetMeterProperty> ReplaceValues(PropertyIterator iter, ValueTransformer transform) { LinkedList <NetMeterProperty> props = new LinkedList <NetMeterProperty>(); while (iter.hasNext()) { NetMeterProperty val = iter.next(); if (log.IsDebugEnabled) { log.Debug("About to replace in property of type: " + val.GetType() + ": " + val); } if (typeof(StringProperty).IsAssignableFrom(val.GetType())) { // Must not convert TestElement.gui_class etc if (!val.getName().Equals(TestElement.GUI_CLASS) && !val.getName().Equals(TestElement.TEST_CLASS)) { val = transform.transformValue(val); if (log.IsDebugEnabled) { log.Debug("Replacement result: " + val); } } } else if (typeof(MultiProperty).IsAssignableFrom(val.GetType())) { MultiProperty multiVal = (MultiProperty)val; LinkedList <NetMeterProperty> newValues = ReplaceValues(multiVal.iterator(), transform); multiVal.Clear(); foreach (NetMeterProperty jmp in newValues) { multiVal.addProperty(jmp); } if (log.IsDebugEnabled) { log.Debug("Replacement result: " + multiVal); } } else { if (log.IsDebugEnabled) { log.Debug("Won't replace " + val); } } props.AddLast(val); } return(props); }
/** * {@inheritDoc} */ public void setTemporary(NetMeterProperty property) { if (temporaryProperties == null) { temporaryProperties = new HashSet <NetMeterProperty>(); } temporaryProperties.Add(property); if (property is MultiProperty) { PropertyIterator iter = ((MultiProperty)property).iterator(); while (iter.hasNext()) { setTemporary(iter.next()); } } }
protected void TraverseProperty(TestElementTraverser traverser, NetMeterProperty value) { traverser.startProperty(value); if (value is TestElementProperty) { ((TestElement)value.getObjectValue()).Traverse(traverser); } else if (value is CollectionProperty) { traverseCollection((CollectionProperty)value, traverser); } else if (value is MapProperty) { TraverseMap((MapProperty)value, traverser); } traverser.endProperty(value); }
/** * {@inheritDoc}} */ public List <String> getSearchableTokens() { List <String> result = new List <String>(25); foreach (String res in result) { } PropertyIterator iterator = propertyIterator(); while (iterator.hasNext()) { NetMeterProperty jMeterProperty = iterator.next(); result.Add(jMeterProperty.getName()); result.Add(jMeterProperty.getStringValue()); } return(result); }
public void SetProperty(NetMeterProperty property) { if (isRunningVersion()) { if (getProperty(property.getName()) is NullProperty) { addProperty(property); } else { getProperty(property.getName()).setObjectValue(property.getObjectValue()); } } else { propDic.Add(property.getName(), property); } }
protected void TraverseProperty(TestElementTraverser traverser, NetMeterProperty value) { traverser.startProperty(value); if (value is TestElementProperty) { ((TestElement) value.getObjectValue()).Traverse(traverser); } else if (value is CollectionProperty) { traverseCollection((CollectionProperty) value, traverser); } else if (value is MapProperty) { TraverseMap((MapProperty) value, traverser); } traverser.endProperty(value); }
/** * Add property to test element without cloning it * @param property {@link JMeterProperty} */ protected void addProperty(NetMeterProperty property) { addProperty(property, false); }
/** * Add property to test element * @param property {@link JMeterProperty} to add to current Test Element * @param clone clone property */ protected void addProperty(NetMeterProperty property, bool clone) { NetMeterProperty propertyToPut = property; if(clone) { propertyToPut = property.clone(); } if (isRunningVersion()) { setTemporary(propertyToPut); } else { clearTemporary(property); } NetMeterProperty prop = getProperty(property.getName()); if (prop is NullProperty || (prop is StringProperty && prop.getStringValue().Equals(""))) { propDic.Add(property.getName(), propertyToPut); } else { prop.mergeIn(propertyToPut); } }
/** * {@inheritDoc} */ public void setTemporary(NetMeterProperty property) { if (temporaryProperties == null) { temporaryProperties = new HashSet<NetMeterProperty>(); } temporaryProperties.Add(property); if (property is MultiProperty) { PropertyIterator iter = ((MultiProperty) property).iterator(); while (iter.hasNext()) { setTemporary(iter.next()); } } }
/** * {@inheritDoc} */ public bool isTemporary(NetMeterProperty property) { if (temporaryProperties == null) { return false; } else { return temporaryProperties.Contains(property); } }
public int getPropertyAsInt(String key, int defaultValue) { NetMeterProperty jmp = getProperty(key); return(jmp is NullProperty ? defaultValue : jmp.getIntValue()); }
public bool getPropertyAsBoolean(String key, bool defaultVal) { NetMeterProperty jmp = getProperty(key); return(jmp is NullProperty ? defaultVal : jmp.getBooleanValue()); }
public Int64 getPropertyAsLong(String key, Int64 defaultValue) { NetMeterProperty jmp = getProperty(key); return(jmp is NullProperty ? defaultValue : jmp.getLongValue()); }
public String getPropertyAsString(String key, String defaultValue) { NetMeterProperty jmp = getProperty(key); return(jmp is NullProperty ? defaultValue : jmp.getStringValue()); }