コード例 #1
0
 /**
  * Remove property from temporaryProperties
  * @param property {@link JMeterProperty}
  */
 protected void clearTemporary(NetMeterProperty property)
 {
     if (temporaryProperties != null)
     {
         temporaryProperties.Remove(property);
     }
 }
コード例 #2
0
        /**
         * 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);
            }
        }
コード例 #3
0
        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();
        }
コード例 #4
0
        /**
         * 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);
            }
        }
コード例 #5
0
 /**
  * {@inheritDoc}
  */
 public bool isTemporary(NetMeterProperty property)
 {
     if (temporaryProperties == null)
     {
         return(false);
     }
     else
     {
         return(temporaryProperties.Contains(property));
     }
 }
コード例 #6
0
 /**
  * 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());
         }
     }
 }
コード例 #7
0
        /**
         * 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());
                }
            }
        }
コード例 #8
0
        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);
        }
コード例 #9
0
 /**
  * {@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());
         }
     }
 }
コード例 #10
0
 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);
 }
コード例 #11
0
        /**
         * {@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);
        }
コード例 #12
0
 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);
     }
 }
コード例 #13
0
 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);
 }
コード例 #14
0
 /**
  * Remove property from temporaryProperties
  * @param property {@link JMeterProperty}
  */
 protected void clearTemporary(NetMeterProperty property)
 {
     if (temporaryProperties != null)
     {
         temporaryProperties.Remove(property);
     }
 }
コード例 #15
0
 /**
  * Add property to test element without cloning it
  * @param property {@link JMeterProperty}
  */
 protected void addProperty(NetMeterProperty property)
 {
     addProperty(property, false);
 }
コード例 #16
0
        /**
         * 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);
            }
        }
コード例 #17
0
 /**
  * {@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());
         }
     }
 }
コード例 #18
0
 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);
     }
 }
コード例 #19
0
 /**
  * {@inheritDoc}
  */
 public bool isTemporary(NetMeterProperty property)
 {
     if (temporaryProperties == null) {
         return false;
     } else {
         return temporaryProperties.Contains(property);
     }
 }
コード例 #20
0
        public int getPropertyAsInt(String key, int defaultValue)
        {
            NetMeterProperty jmp = getProperty(key);

            return(jmp is NullProperty ? defaultValue : jmp.getIntValue());
        }
コード例 #21
0
        public bool getPropertyAsBoolean(String key, bool defaultVal)
        {
            NetMeterProperty jmp = getProperty(key);

            return(jmp is NullProperty ? defaultVal : jmp.getBooleanValue());
        }
コード例 #22
0
        public Int64 getPropertyAsLong(String key, Int64 defaultValue)
        {
            NetMeterProperty jmp = getProperty(key);

            return(jmp is NullProperty ? defaultValue : jmp.getLongValue());
        }
コード例 #23
0
        public String getPropertyAsString(String key, String defaultValue)
        {
            NetMeterProperty jmp = getProperty(key);

            return(jmp is NullProperty ? defaultValue : jmp.getStringValue());
        }
コード例 #24
0
 /**
  * Add property to test element without cloning it
  * @param property {@link JMeterProperty}
  */
 protected void addProperty(NetMeterProperty property)
 {
     addProperty(property, false);
 }