protected Object[] getArguments(Step step, StepImplementation implementation) {
Method method = implementation.getMethod();
Parameter[] parameters = method.getParameters();
Object[] arguments = new Object[parameters.length];
if (parameters.length > 0) {
String text = step.getText();
Pattern pattern = implementation.getPattern();
Matcher matcher = pattern.matcher(text);
checkState(matcher.find(),
"unable to locate substitution parameters for pattern %s with input %s", pattern.pattern(), text);
int groupCount = matcher.groupCount();
ConversionService conversionService = SpringPreProcessor.getBean(ConversionService.class);
for (int i = 0; i < groupCount; i++) {
String parameterAsString = matcher.group(i + 1);
Parameter parameter = parameters[i];
Class<?> parameterType = parameter.getType();
Object converted = conversionService.convert(parameterAsString, parameterType);
arguments[i] = converted;
}
}
return arguments;
}
MartiniSamplerClient.java 文件源码
java
阅读 55
收藏 0
点赞 0
评论 0
项目:martini-jmeter-extension
作者:
评论列表
文章目录