本文整理汇总了Java中org.apache.jmeter.samplers.SampleSaveConfiguration.setVarCount方法的典型用法代码示例。如果您正苦于以下问题:Java SampleSaveConfiguration.setVarCount方法的具体用法?Java SampleSaveConfiguration.setVarCount怎么用?Java SampleSaveConfiguration.setVarCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.jmeter.samplers.SampleSaveConfiguration
的用法示例。
在下文中一共展示了SampleSaveConfiguration.setVarCount方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getSampleSaveConfiguration
import org.apache.jmeter.samplers.SampleSaveConfiguration; //导入方法依赖的package包/类
/**
* Parse a CSV header line
*
* @param headerLine
* from CSV file
* @param filename
* name of file (for log message only)
* @return config corresponding to the header items found or null if not a
* header line
*/
public static SampleSaveConfiguration getSampleSaveConfiguration(
String headerLine, String filename) {
String[] parts = splitHeader(headerLine, _saveConfig.getDelimiter()); // Try
// default
// delimiter
String delim = null;
if (parts == null) {
Perl5Matcher matcher = JMeterUtils.getMatcher();
PatternMatcherInput input = new PatternMatcherInput(headerLine);
Pattern pattern = JMeterUtils.getPatternCache()
// This assumes the header names are all single words with no spaces
// word followed by 0 or more repeats of (non-word char + word)
// where the non-word char (\2) is the same
// e.g. abc|def|ghi but not abd|def~ghi
.getPattern("\\w+((\\W)\\w+)?(\\2\\w+)*(\\2\"\\w+\")*", // $NON-NLS-1$
// last entries may be quoted strings
Perl5Compiler.READ_ONLY_MASK);
if (matcher.matches(input, pattern)) {
delim = matcher.getMatch().group(2);
parts = splitHeader(headerLine, delim);// now validate the
// result
}
}
if (parts == null) {
return null; // failed to recognise the header
}
// We know the column names all exist, so create the config
SampleSaveConfiguration saveConfig = new SampleSaveConfiguration(false);
int varCount = 0;
for (String label : parts) {
if (isVariableName(label)) {
varCount++;
} else {
Functor set = (Functor) headerLabelMethods.get(label);
set.invoke(saveConfig, new Boolean[]{Boolean.TRUE});
}
}
if (delim != null) {
log.warn("Default delimiter '" + _saveConfig.getDelimiter()
+ "' did not work; using alternate '" + delim
+ "' for reading " + filename);
saveConfig.setDelimiter(delim);
}
saveConfig.setVarCount(varCount);
return saveConfig;
}
示例2: getSampleSaveConfiguration
import org.apache.jmeter.samplers.SampleSaveConfiguration; //导入方法依赖的package包/类
/**
* Parse a CSV header line
*
* @param headerLine
* from CSV file
* @param filename
* name of file (for log message only)
* @return config corresponding to the header items found or null if not a
* header line
*/
public static SampleSaveConfiguration getSampleSaveConfiguration(
String headerLine, String filename) {
String[] parts = splitHeader(headerLine, _saveConfig.getDelimiter()); // Try
// default
// delimiter
String delim = null;
if (parts == null) {
Perl5Matcher matcher = JMeterUtils.getMatcher();
PatternMatcherInput input = new PatternMatcherInput(headerLine);
Pattern pattern = JMeterUtils.getPatternCache()
// This assumes the header names are all single words with no spaces
// word followed by 0 or more repeats of (non-word char + word)
// where the non-word char (\2) is the same
// e.g. abc|def|ghi but not abd|def~ghi
.getPattern("\\w+((\\W)\\w+)?(\\2\\w+)*(\\2\"\\w+\")*", // $NON-NLS-1$
// last entries may be quoted strings
Perl5Compiler.READ_ONLY_MASK);
if (matcher.matches(input, pattern)) {
delim = matcher.getMatch().group(2);
parts = splitHeader(headerLine, delim);// now validate the
// result
}
}
if (parts == null) {
return null; // failed to recognise the header
}
// We know the column names all exist, so create the config
SampleSaveConfiguration saveConfig = new SampleSaveConfiguration(false);
int varCount = 0;
for (int i = 0; i < parts.length; i++) {
String label = parts[i];
if (isVariableName(label)) {
varCount++;
} else {
Functor set = (Functor) headerLabelMethods.get(label);
set.invoke(saveConfig, new Boolean[] { Boolean.TRUE });
}
}
if (delim != null) {
log.warn("Default delimiter '" + _saveConfig.getDelimiter()
+ "' did not work; using alternate '" + delim
+ "' for reading " + filename);
saveConfig.setDelimiter(delim);
}
saveConfig.setVarCount(varCount);
return saveConfig;
}