当前位置: 首页>>代码示例>>Java>>正文


Java JMeterProperty.getStringValue方法代码示例

本文整理汇总了Java中org.apache.jmeter.testelement.property.JMeterProperty.getStringValue方法的典型用法代码示例。如果您正苦于以下问题:Java JMeterProperty.getStringValue方法的具体用法?Java JMeterProperty.getStringValue怎么用?Java JMeterProperty.getStringValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.jmeter.testelement.property.JMeterProperty的用法示例。


在下文中一共展示了JMeterProperty.getStringValue方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: transformValue

import org.apache.jmeter.testelement.property.JMeterProperty; //导入方法依赖的package包/类
@Override
public JMeterProperty transformValue(JMeterProperty prop) throws InvalidVariableException {
    String input = prop.getStringValue();
    for (Map.Entry<String, String> entry : getVariables().entrySet()) {
        String key = entry.getKey();
        String value = entry.getValue();
        input = StringUtilities.substitute(input, "${" + key + "}", value);
    }
    return new StringProperty(prop.getName(), input);
}
 
开发者ID:johrstrom,项目名称:cloud-meter,代码行数:11,代码来源:UndoVariableReplacement.java

示例2: transformValue

import org.apache.jmeter.testelement.property.JMeterProperty; //导入方法依赖的package包/类
@Override
public JMeterProperty transformValue(JMeterProperty prop) throws InvalidVariableException {
    PatternMatcher pm = JMeterUtils.getMatcher();
    Pattern pattern = null;
    PatternCompiler compiler = new Perl5Compiler();
    String input = prop.getStringValue();
    if(input == null) {
        return prop;
    }
    for(Entry<String, String> entry : getVariables().entrySet()){
        String key = entry.getKey();
        String value = entry.getValue();
        if (regexMatch) {
            try {
                pattern = compiler.compile(constructPattern(value));
                input = Util.substitute(pm, pattern,
                        new StringSubstitution(FUNCTION_REF_PREFIX + key + FUNCTION_REF_SUFFIX),
                        input, Util.SUBSTITUTE_ALL);
            } catch (MalformedPatternException e) {
                log.warn("Malformed pattern " + value);
            }
        } else {
            input = StringUtilities.substitute(input, value, FUNCTION_REF_PREFIX + key + FUNCTION_REF_SUFFIX);
        }
    }
    return new StringProperty(prop.getName(), input);
}
 
开发者ID:johrstrom,项目名称:cloud-meter,代码行数:28,代码来源:ReplaceFunctionsWithStrings.java

示例3: removeValuesFromSampler

import org.apache.jmeter.testelement.property.JMeterProperty; //导入方法依赖的package包/类
/**
 * Remove from the sampler all values which match the one provided by the
 * first configuration in the given collection which provides a value for
 * that property.
 *
 * @param sampler
 *            Sampler to remove values from.
 * @param configurations
 *            ConfigTestElements in descending priority.
 */
private void removeValuesFromSampler(HTTPSamplerBase sampler, Collection<ConfigTestElement> configurations) {
    for (PropertyIterator props = sampler.propertyIterator(); props.hasNext();) {
        JMeterProperty prop = props.next();
        String name = prop.getName();
        String value = prop.getStringValue();

        // There's a few properties which are excluded from this processing:
        if (name.equals(TestElement.ENABLED) || name.equals(TestElement.GUI_CLASS) || name.equals(TestElement.NAME)
                || name.equals(TestElement.TEST_CLASS)) {
            continue; // go on with next property.
        }

        for (Iterator<ConfigTestElement> configs = configurations.iterator(); configs.hasNext();) {
            ConfigTestElement config = configs.next();

            String configValue = config.getPropertyAsString(name);

            if (configValue != null && configValue.length() > 0) {
                if (configValue.equals(value)) {
                    sampler.setProperty(name, ""); // $NON-NLS-1$
                }
                // Property was found in a config element. Whether or not
                // it matched the value in the sampler, we're done with
                // this property -- don't look at lower-priority configs:
                break;
            }
        }
    }
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:40,代码来源:ProxyControl.java

示例4: transformValue

import org.apache.jmeter.testelement.property.JMeterProperty; //导入方法依赖的package包/类
@Override
public JMeterProperty transformValue(JMeterProperty prop) throws InvalidVariableException {
    PatternMatcher pm = JMeterUtils.getMatcher();
    Pattern pattern = null;
    PatternCompiler compiler = new Perl5Compiler();
    String input = prop.getStringValue();
    if(input == null) {
        return prop;
    }
    for(Entry<String, String> entry : getVariables().entrySet()){
        String key = entry.getKey();
        String value = entry.getValue();
        if (regexMatch) {
            try {
                pattern = compiler.compile("\\b("+value+")\\b");
                input = Util.substitute(pm, pattern,
                        new StringSubstitution(FUNCTION_REF_PREFIX + key + FUNCTION_REF_SUFFIX),
                        input, Util.SUBSTITUTE_ALL);
            } catch (MalformedPatternException e) {
                log.warn("Malformed pattern " + value);
            }
        } else {
            input = StringUtilities.substitute(input, value, FUNCTION_REF_PREFIX + key + FUNCTION_REF_SUFFIX);
        }
    }
    return new StringProperty(prop.getName(), input);
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:28,代码来源:ReplaceFunctionsWithStrings.java

示例5: setProperty

import org.apache.jmeter.testelement.property.JMeterProperty; //导入方法依赖的package包/类
/**
 * Override the setProperty method in order to convert
 * the original String shareMode property.
 * This used the locale-dependent display value, so caused
 * problems when the language was changed. 
 * If the "shareMode" value matches a resource value then it is converted
 * into the resource key.
 * To reduce the need to look up resources, we only attempt to
 * convert values with spaces in them, as these are almost certainly
 * not variables (and they are definitely not resource keys).
 */
@Override
public void setProperty(JMeterProperty property) {
    if (property instanceof StringProperty) {
        final String propName = property.getName();
        if (propName.equals("shareMode")) { // The original name of the property
            final String propValue = property.getStringValue();
            if (propValue.contains(" ")){ // variables are unlikely to contain spaces, so most likely a translation
                try {
                    final BeanInfo beanInfo = Introspector.getBeanInfo(this.getClass());
                    final ResourceBundle rb = (ResourceBundle) beanInfo.getBeanDescriptor().getValue(GenericTestBeanCustomizer.RESOURCE_BUNDLE);
                    for(String resKey : CSVDataSetBeanInfo.SHARE_TAGS) {
                        if (propValue.equals(rb.getString(resKey))) {
                            if (log.isDebugEnabled()) {
                                log.debug("Converted " + propName + "=" + propValue + " to " + resKey  + " using Locale: " + rb.getLocale());
                            }
                            ((StringProperty) property).setValue(resKey); // reset the value
                            super.setProperty(property);
                            return;                                        
                        }
                    }
                    // This could perhaps be a variable name
                    log.warn("Could not translate " + propName + "=" + propValue + " using Locale: " + rb.getLocale());
                } catch (IntrospectionException e) {
                    log.error("Could not find BeanInfo; cannot translate shareMode entries", e);
                }
            }
        }
    }
    super.setProperty(property);        
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:42,代码来源:CSVDataSet.java

示例6: getCondition

import org.apache.jmeter.testelement.property.JMeterProperty; //导入方法依赖的package包/类
/**
 * @return the condition
 */
public String getCondition() {
    JMeterProperty prop=getProperty(CONDITION);
    prop.recoverRunningVersion(this);
    return prop.getStringValue();
}
 
开发者ID:johrstrom,项目名称:cloud-meter,代码行数:9,代码来源:WhileController.java

示例7: getPropertyAsString

import org.apache.jmeter.testelement.property.JMeterProperty; //导入方法依赖的package包/类
@Override
public String getPropertyAsString(String key, String defaultValue) {
    JMeterProperty jmp = getProperty(key);
    return jmp instanceof NullProperty ? defaultValue : jmp.getStringValue();
}
 
开发者ID:johrstrom,项目名称:cloud-meter,代码行数:6,代码来源:AbstractTestElement.java


注:本文中的org.apache.jmeter.testelement.property.JMeterProperty.getStringValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。