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


Java SampleSaveConfiguration.setVarCount方法代码示例

本文整理汇总了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;
}
 
开发者ID:johrstrom,项目名称:cloud-meter,代码行数:65,代码来源:CSVSaveService.java

示例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;
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:66,代码来源:CSVSaveService.java


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