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


Java InvalidVariableException类代码示例

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


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


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