• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java InvalidVariableException类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.jmeter.functions.InvalidVariableException的典型用法代码示例。如果您正苦于以下问题:Java InvalidVariableException类的具体用法?Java InvalidVariableException怎么用?Java InvalidVariableException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



InvalidVariableException类属于org.apache.jmeter.functions包,在下文中一共展示了InvalidVariableException类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: setParameters

import org.apache.jmeter.functions.InvalidVariableException; //导入依赖的package包/类
public void setParameters(String parameters) throws InvalidVariableException {
    this.rawParameters = parameters;
    if (parameters == null || parameters.length() == 0) {
        return;
    }

    compiledComponents = functionParser.compileString(parameters);
    if (compiledComponents.size() > 1 || !(compiledComponents.get(0) instanceof String)) {
        hasFunction = true;
    }
    permanentResults = null; // To be calculated and cached on first execution
    isDynamic = false;
    for (Object item : compiledComponents) {
        if (item instanceof Function || item instanceof SimpleVariable) {
            isDynamic = true;
            break;
        }
    }
}
 
开发者ID:johrstrom,项目名称:cloud-meter,代码行数:20,代码来源:CompoundVariable.java


示例2: execute

import org.apache.jmeter.functions.InvalidVariableException; //导入依赖的package包/类
@Override
public String execute(SampleResult previousResult, Sampler currentSampler) throws InvalidVariableException {
       String numberString = ((CompoundVariable) values[0]).execute().trim();
       int num;
       try{
           num = Integer.valueOf(numberString);
       } catch (Exception e){
           return null;
       }

       return String.valueOf(factorial(num));
   }
 
开发者ID:mzanthem,项目名称:Baozun_jmeter,代码行数:13,代码来源:Factorial.java


示例3: setParameters

import org.apache.jmeter.functions.InvalidVariableException; //导入依赖的package包/类
@Override
public void setParameters(Collection<CompoundVariable> parameters) throws InvalidVariableException {
    //可以检查参数数量,主要包括以下两种方法
    checkMinParameterCount(parameters, 1);
    checkParameterCount(parameters, 1, 1);
    values = parameters.toArray();
}
 
开发者ID:mzanthem,项目名称:Baozun_jmeter,代码行数:8,代码来源:Factorial.java


示例4: execute

import org.apache.jmeter.functions.InvalidVariableException; //导入依赖的package包/类
@Override
public String execute(SampleResult arg0, Sampler arg1) throws InvalidVariableException {
	StringBuffer res = new StringBuffer();
	for(int i = 0; i < 1024; i++) {
		res.append(seeds[random.nextInt(seeds.length - 1)]);
	}
	return res.toString();
}
 
开发者ID:XMeterSaaSService,项目名称:Blog_sample_project,代码行数:9,代码来源:MyRandomFunc.java


示例5: transformValue

import org.apache.jmeter.functions.InvalidVariableException; //导入依赖的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


示例6: transformValue

import org.apache.jmeter.functions.InvalidVariableException; //导入依赖的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


示例7: CompoundVariable

import org.apache.jmeter.functions.InvalidVariableException; //导入依赖的package包/类
public CompoundVariable(String parameters) {
    this();
    try {
        setParameters(parameters);
    } catch (InvalidVariableException e) {
        // TODO should level be more than debug ?
        if(log.isDebugEnabled()) {
            log.debug("Invalid variable:"+ parameters, e);
        }
    }
}
 
开发者ID:johrstrom,项目名称:cloud-meter,代码行数:12,代码来源:CompoundVariable.java


示例8: execute

import org.apache.jmeter.functions.InvalidVariableException; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public String execute(SampleResult previousResult, Sampler currentSampler) {
    if (compiledComponents == null || compiledComponents.size() == 0) {
        return ""; // $NON-NLS-1$
    }
    
    StringBuilder results = new StringBuilder();
    for (Object item : compiledComponents) {
        if (item instanceof Function) {
            try {
                results.append(((Function) item).execute(previousResult, currentSampler));
            } catch (InvalidVariableException e) {
                // TODO should level be more than debug ?
                if(log.isDebugEnabled()) {
                    log.debug("Invalid variable:"+item, e);
                }
            }
        } else if (item instanceof SimpleVariable) {
            results.append(((SimpleVariable) item).toString());
        } else {
            results.append(item);
        }
    }
    if (!isDynamic) {
        permanentResults = results.toString();
    }
    return results.toString();
}
 
开发者ID:johrstrom,项目名称:cloud-meter,代码行数:30,代码来源:CompoundVariable.java


示例9: getNamedFunction

import org.apache.jmeter.functions.InvalidVariableException; //导入依赖的package包/类
static Object getNamedFunction(String functionName) throws InvalidVariableException {
    if (functions.containsKey(functionName)) {
        try {
            return ((Class<?>) functions.get(functionName)).newInstance();
        } catch (Exception e) {
            log.error("", e); // $NON-NLS-1$
            throw new InvalidVariableException(e);
        }
    }
    return new SimpleVariable(functionName);
}
 
开发者ID:johrstrom,项目名称:cloud-meter,代码行数:12,代码来源:CompoundVariable.java


示例10: transformValue

import org.apache.jmeter.functions.InvalidVariableException; //导入依赖的package包/类
@Override
public JMeterProperty transformValue(JMeterProperty prop) throws InvalidVariableException {
    JMeterProperty newValue = prop;
    getMasterFunction().clear();
    getMasterFunction().setParameters(prop.getStringValue());
    if (getMasterFunction().hasFunction()) {
        newValue = new FunctionProperty(prop.getName(), getMasterFunction().getFunction());
    }
    return newValue;
}
 
开发者ID:johrstrom,项目名称:cloud-meter,代码行数:11,代码来源:ReplaceStringWithFunctions.java


示例11: replaceValues

import org.apache.jmeter.functions.InvalidVariableException; //导入依赖的package包/类
/**
 * Scan all test elements passed in for values matching the value of any of
 * the variables in any of the variable-holding elements in the collection.
 *
 * @param sampler   A TestElement to replace values on
 * @param configs   More TestElements to replace values on
 * @param variables Collection of Arguments to use to do the replacement, ordered
 *                  by ascending priority.
 */
private void replaceValues(TestElement sampler, TestElement[] configs, Collection<Arguments> variables)
{
    // Build the replacer from all the variables in the collection:
    ValueReplacer replacer = new ValueReplacer();
    for (Arguments variable : variables)
    {
        final Map<String, String> map = variable.getArgumentsAsMap();
        for (Iterator<String> vals = map.values().iterator(); vals.hasNext();)
        {
            final Object next = vals.next();
            if ("".equals(next))
            {// Drop any empty values (Bug 45199)
                vals.remove();
            }
        }
        replacer.addVariables(map);
    }

    try
    {
        boolean cachedRegexpMatch = regexMatch;
        replacer.reverseReplace(sampler, cachedRegexpMatch);
        for (TestElement config : configs)
        {
            if (config != null)
            {
                replacer.reverseReplace(config, cachedRegexpMatch);
            }
        }
    }
    catch (InvalidVariableException e)
    {
        LOG.warn("Invalid variables included for replacement into recorded " + "sample", e);
    }
}
 
开发者ID:d0k1,项目名称:jsflight,代码行数:45,代码来源:JMeterProxyControl.java


示例12: setParameters

import org.apache.jmeter.functions.InvalidVariableException; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public synchronized void setParameters(
        final Collection<CompoundVariable> parameters)
        throws InvalidVariableException {
    checkMinParameterCount(parameters, 2);
    values = parameters.toArray();
}
 
开发者ID:wakantanka,项目名称:get_iso_8583,代码行数:9,代码来源:ReadInterchangeMsgField.java


示例13: replaceValues

import org.apache.jmeter.functions.InvalidVariableException; //导入依赖的package包/类
/**
 * @throws InvalidVariableException not thrown currently 
 */
public void replaceValues(TestElement el) throws InvalidVariableException {
    /**
    Collection newProps = replaceValues(el.propertyIterator(), new ReplaceStringWithFunctions(masterFunction,
            variables));
    setProperties(el, newProps);
    **/
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:11,代码来源:ValueReplacer.java


示例14: reverseReplace

import org.apache.jmeter.functions.InvalidVariableException; //导入依赖的package包/类
/**
 * @throws InvalidVariableException not thrown currently 
 */
public void reverseReplace(TestElement el) throws InvalidVariableException {
    /**
    Collection newProps = replaceValues(el.propertyIterator(), new ReplaceFunctionsWithStrings(masterFunction,
            variables));
    setProperties(el, newProps);
    **/
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:11,代码来源:ValueReplacer.java


示例15: undoReverseReplace

import org.apache.jmeter.functions.InvalidVariableException; //导入依赖的package包/类
/**
 * @throws InvalidVariableException not thrown currently 
 */
public void undoReverseReplace(TestElement el) throws InvalidVariableException {
    /**
    Collection newProps = replaceValues(el.propertyIterator(), new UndoVariableReplacement(masterFunction,
            variables));
    setProperties(el, newProps);
    **/
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:11,代码来源:ValueReplacer.java


示例16: replaceValues

import org.apache.jmeter.functions.InvalidVariableException; //导入依赖的package包/类
private Collection<JMeterProperty> replaceValues(PropertyIterator iter, ValueTransformer transform) throws InvalidVariableException {
    List<JMeterProperty> props = new LinkedList<JMeterProperty>();
    while (iter.hasNext()) {
        JMeterProperty val = iter.next();
        if (log.isDebugEnabled()) {
            log.debug("About to replace in property of type: " + val.getClass() + ": " + val);
        }
        if (val instanceof StringProperty) {
            // 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 (val instanceof MultiProperty) {
            MultiProperty multiVal = (MultiProperty) val;
            Collection<JMeterProperty> newValues = replaceValues(multiVal.iterator(), transform);
            multiVal.clear();
            for (JMeterProperty jmp : newValues) {
                multiVal.addProperty(jmp);
            }
            if (log.isDebugEnabled()) {
                log.debug("Replacement result: " + multiVal);
            }
        } else {
            if (log.isDebugEnabled()) {
                log.debug("Won't replace " + val);
            }
        }
        props.add(val);
    }
    return props;
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:36,代码来源:ValueReplacer.java


示例17: transformValue

import org.apache.jmeter.functions.InvalidVariableException; //导入依赖的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


示例18: execute

import org.apache.jmeter.functions.InvalidVariableException; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public String execute(SampleResult previousResult, Sampler currentSampler) {
    if (compiledComponents == null || compiledComponents.size() == 0) {
        return ""; // $NON-NLS-1$
    }
    boolean testDynamic = false;
    StringBuilder results = new StringBuilder();
    for (Object item : compiledComponents) {
        if (item instanceof Function) {
            testDynamic = true;
            try {
                results.append(((Function) item).execute(previousResult, currentSampler));
            } catch (InvalidVariableException e) {
                // TODO should level be more than debug ?
                if(log.isDebugEnabled()) {
                    log.debug("Invalid variable:"+item, e);
                }
            }
        } else if (item instanceof SimpleVariable) {
            testDynamic = true;
            results.append(((SimpleVariable) item).toString());
        } else {
            results.append(item);
        }
    }
    if (!testDynamic) {
        isDynamic = false;
        permanentResults = results.toString();
    }
    return results.toString();
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:33,代码来源:CompoundVariable.java


示例19: setParameters

import org.apache.jmeter.functions.InvalidVariableException; //导入依赖的package包/类
public void setParameters(String parameters) throws InvalidVariableException {
    this.rawParameters = parameters;
    if (parameters == null || parameters.length() == 0) {
        return;
    }

    compiledComponents = functionParser.compileString(parameters);
    if (compiledComponents.size() > 1 || !(compiledComponents.get(0) instanceof String)) {
        hasFunction = true;
    }
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:12,代码来源:CompoundVariable.java


示例20: checkInvalidParameterCounts

import org.apache.jmeter.functions.InvalidVariableException; //导入依赖的package包/类
protected void checkInvalidParameterCounts(AbstractFunction func, int minimum)
        throws Exception {
    Collection<CompoundVariable> parms = new LinkedList<CompoundVariable>();
    for (int c = 0; c < minimum; c++) {
        try {
            func.setParameters(parms);
            fail("Should have generated InvalidVariableException for " + parms.size()
                    + " parameters");
        } catch (InvalidVariableException ignored) {
        }
        parms.add(new CompoundVariable());
    }
    func.setParameters(parms);
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:15,代码来源:JMeterTestCase.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java FileOutput类代码示例发布时间:2022-05-22
下一篇:
Java JsonUtils类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap