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


Java JOrphanUtils.split方法代码示例

本文整理汇总了Java中org.apache.jorphan.util.JOrphanUtils.split方法的典型用法代码示例。如果您正苦于以下问题:Java JOrphanUtils.split方法的具体用法?Java JOrphanUtils.split怎么用?Java JOrphanUtils.split使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.jorphan.util.JOrphanUtils的用法示例。


在下文中一共展示了JOrphanUtils.split方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getIconMappings

import org.apache.jorphan.util.JOrphanUtils; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override
public String[][] getIconMappings() {
    String iconProp = JMeterUtils.getPropDefault("jmeter.icons", "org/apache/jmeter/images/icon.properties");
    Properties p = JMeterUtils.loadProperties(iconProp);
    if (p == null) {
        log.info(iconProp + " not found - using default icon set");
        return DEFAULT_ICONS;
    }
    log.info("Loaded icon properties from " + iconProp);
    String[][] iconlist = new String[p.size()][3];
    Enumeration<Object> pe = p.keys();
    int i = 0;
    while (pe.hasMoreElements()) {
        String key = (String) pe.nextElement();
        String icons[] = JOrphanUtils.split(p.getProperty(key), " ");
        iconlist[i][0] = key;
        iconlist[i][1] = icons[0];
        if (icons.length > 1){
            iconlist[i][2] = icons[1];
        }
        i++;
    }
    return iconlist;
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:26,代码来源:JMeterReport.java

示例2: JMeterMenuBar

import org.apache.jorphan.util.JOrphanUtils; //导入方法依赖的package包/类
public JMeterMenuBar() {
    // List for recent files menu items
    file_load_recent_files = new LinkedList<JComponent>();
    // Lists for remote engines menu items
    remote_engine_start = new LinkedList<JMenuItem>();
    remote_engine_stop = new LinkedList<JMenuItem>();
    remote_engine_shut = new LinkedList<JMenuItem>();
    remote_engine_exit = new LinkedList<JMenuItem>();
    remoteHosts = JOrphanUtils.split(JMeterUtils.getPropDefault("remote_hosts", ""), ","); //$NON-NLS-1$
    if (remoteHosts.length == 1 && remoteHosts[0].equals("")) {
        remoteHosts = new String[0];
    }
    this.getRemoteItems();
    createMenuBar();
    JMeterUtils.addLocaleChangeListener(this);
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:17,代码来源:JMeterMenuBar.java

示例3: populateBindings

import org.apache.jorphan.util.JOrphanUtils; //导入方法依赖的package包/类
/**
 * Populate variables to be passed to scripts
 * @param bindings Bindings
 */
protected void populateBindings(Bindings bindings) {
    final String label = getName();
    final String fileName = getFilename();
    final String scriptParameters = getParameters();
    // Use actual class name for log
    final Logger logger =  LoggerFactory.getLogger(JSR223TestElement.class);
    bindings.put("log", logger); // $NON-NLS-1$ (this name is fixed)
    bindings.put("Label", label); // $NON-NLS-1$ (this name is fixed)
    bindings.put("FileName", fileName); // $NON-NLS-1$ (this name is fixed)
    bindings.put("Parameters", scriptParameters); // $NON-NLS-1$ (this name is fixed)
    String [] args=JOrphanUtils.split(scriptParameters, " ");//$NON-NLS-1$
    bindings.put("args", args); // $NON-NLS-1$ (this name is fixed)
    // Add variables for access to context and variables
    JMeterContext jmctx = JMeterContextService.getContext();
    bindings.put("ctx", jmctx); // $NON-NLS-1$ (this name is fixed)
    JMeterVariables vars = jmctx.getVariables();
    bindings.put("vars", vars); // $NON-NLS-1$ (this name is fixed)
    Properties props = JMeterUtils.getJMeterProperties();
    bindings.put("props", props); // $NON-NLS-1$ (this name is fixed)
    // For use in debugging:
    bindings.put("OUT", System.out); // $NON-NLS-1$ (this name is fixed)

    // Most subclasses will need these:
    Sampler sampler = jmctx.getCurrentSampler();
    bindings.put("sampler", sampler); // $NON-NLS-1$ (this name is fixed)
    SampleResult prev = jmctx.getPreviousResult();
    bindings.put("prev", prev); // $NON-NLS-1$ (this name is fixed)
}
 
开发者ID:johrstrom,项目名称:cloud-meter,代码行数:33,代码来源:JSR223TestElement.java

示例4: initManager

import org.apache.jorphan.util.JOrphanUtils; //导入方法依赖的package包/类
protected void initManager(BSFManager mgr) throws BSFException{
        final String label = getName();
        final String fileName = getFilename();
        final String scriptParameters = getParameters();
        // Use actual class name for log
//        final Logger logger = LoggingManager.getLoggerForShortName(getClass().getName());
        mgr.declareBean("log", log, Logger.class); // $NON-NLS-1$
        mgr.declareBean("Label",label, String.class); // $NON-NLS-1$
        mgr.declareBean("FileName",fileName, String.class); // $NON-NLS-1$
        mgr.declareBean("Parameters", scriptParameters, String.class); // $NON-NLS-1$
        String [] args=JOrphanUtils.split(scriptParameters, " ");//$NON-NLS-1$
        mgr.declareBean("args",args,args.getClass());//$NON-NLS-1$
        // Add variables for access to context and variables
        JMeterContext jmctx = JMeterContextService.getContext();
        JMeterVariables vars = jmctx.getVariables();
        Properties props = JMeterUtils.getJMeterProperties();

        mgr.declareBean("ctx", jmctx, jmctx.getClass()); // $NON-NLS-1$
        mgr.declareBean("vars", vars, vars.getClass()); // $NON-NLS-1$
        mgr.declareBean("props", props, props.getClass()); // $NON-NLS-1$
        // For use in debugging:
        mgr.declareBean("OUT", System.out, PrintStream.class); // $NON-NLS-1$

        // Most subclasses will need these:
        Sampler sampler = jmctx.getCurrentSampler();
        mgr.declareBean("sampler", sampler, Sampler.class);
        SampleResult prev = jmctx.getPreviousResult();
        mgr.declareBean("prev", prev, SampleResult.class);
    }
 
开发者ID:johrstrom,项目名称:cloud-meter,代码行数:30,代码来源:BSFTestElement.java

示例5: initLocale

import org.apache.jorphan.util.JOrphanUtils; //导入方法依赖的package包/类
/**
 * Initialise the JMeter Locale
 */
public static void initLocale() {
    String loc = appProperties.getProperty("language"); // $NON-NLS-1$
    if (loc != null) {
        String []parts = JOrphanUtils.split(loc,"_");// $NON-NLS-1$
        if (parts.length==2) {
            setLocale(new Locale(parts[0], parts[1]));
        } else {
            setLocale(new Locale(loc, "")); // $NON-NLS-1$
        }

    } else {
        setLocale(Locale.getDefault());
    }
}
 
开发者ID:johrstrom,项目名称:cloud-meter,代码行数:18,代码来源:JMeterUtils.java

示例6: addFile

import org.apache.jorphan.util.JOrphanUtils; //导入方法依赖的package包/类
/**
 * Add header data from a file.
 *
 * @param headerFile
 *            name of the file to read headers from. If name is relative the
 *            system property <code>user.dir</code> will be prepended
 * @throws IOException
 *             if reading headers fails
 */
public void addFile(String headerFile) throws IOException {
    File file = new File(headerFile);
    if (!file.isAbsolute()) {
        file = new File(System.getProperty("user.dir")// $NON-NLS-1$
                + File.separator + headerFile);
    }
    if (!file.canRead()) {
        throw new IOException("The file you specified cannot be read.");
    }

    BufferedReader reader = null;
    try {
        reader = new BufferedReader(new FileReader(file)); // TODO Charset ?
        String line;
        while ((line = reader.readLine()) != null) {
            try {
                if (line.startsWith("#") || JOrphanUtils.isBlank(line)) {// $NON-NLS-1$
                    continue;
                }
                String[] st = JOrphanUtils.split(line, "\t", " ");// $NON-NLS-1$ $NON-NLS-2$
                int name = 0;
                int value = 1;
                Header header = new Header(st[name], st[value]);
                getHeaders().addItem(header);
            } catch (Exception e) {
                throw new IOException("Error parsing header line\n\t'" + line + "'\n\t" + e);
            }
        }
    } finally {
        IOUtils.closeQuietly(reader);
    }
}
 
开发者ID:johrstrom,项目名称:cloud-meter,代码行数:42,代码来源:HeaderManager.java

示例7: execute

import org.apache.jorphan.util.JOrphanUtils; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override
public String execute(SampleResult previousResult, Sampler currentSampler)
        throws InvalidVariableException {
    JMeterVariables vars = getVariables();

    String stringToSplit = ((CompoundVariable) values[0]).execute();
    String varNamePrefix = ((CompoundVariable) values[1]).execute().trim();
    String splitString = ",";

    if (values.length > 2) { // Split string provided
        splitString = ((CompoundVariable) values[2]).execute();
    }
    if (log.isDebugEnabled()){
        log.debug("Split "+stringToSplit+ " using "+ splitString+ " into "+varNamePrefix);
    }
    String[] parts = JOrphanUtils.split(stringToSplit, splitString, "?");// $NON-NLS-1$

    vars.put(varNamePrefix, stringToSplit);
    vars.put(varNamePrefix + "_n", Integer.toString(parts.length));// $NON-NLS-1$ 
    for (int i = 1; i <= parts.length; i++) {
        if (log.isDebugEnabled()){
            log.debug(parts[i-1]);
        }
        vars.put(varNamePrefix + "_" + i, parts[i - 1]);// $NON-NLS-1$
    }
    vars.remove(varNamePrefix + "_" + (parts.length+1));
    return stringToSplit;

}
 
开发者ID:johrstrom,项目名称:cloud-meter,代码行数:31,代码来源:SplitFunction.java

示例8: addFile

import org.apache.jorphan.util.JOrphanUtils; //导入方法依赖的package包/类
/**
 * Add header data from a file.
 */
public void addFile(String headerFile) throws IOException {
    File file = new File(headerFile);
    if (!file.isAbsolute()) {
        file = new File(System.getProperty("user.dir")// $NON-NLS-1$
                + File.separator + headerFile);
    }
    if (!file.canRead()) {
        throw new IOException("The file you specified cannot be read.");
    }

    BufferedReader reader = null;
    try {
        reader = new BufferedReader(new FileReader(file)); // TODO Charset ?
        String line;
        while ((line = reader.readLine()) != null) {
            try {
                if (line.startsWith("#") || JOrphanUtils.isBlank(line)) {// $NON-NLS-1$
                    continue;
                }
                String[] st = JOrphanUtils.split(line, "\t", " ");// $NON-NLS-1$ $NON-NLS-2$
                int name = 0;
                int value = 1;
                Header header = new Header(st[name], st[value]);
                getHeaders().addItem(header);
            } catch (Exception e) {
                throw new IOException("Error parsing header line\n\t'" + line + "'\n\t" + e);
            }
        }
    } finally {
        IOUtils.closeQuietly(reader);
    }
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:36,代码来源:HeaderManager.java

示例9: ReportMenuBar

import org.apache.jorphan.util.JOrphanUtils; //导入方法依赖的package包/类
public ReportMenuBar() {
    remote_engine_start = new LinkedList<JMenuItem>();
    remote_engine_stop = new LinkedList<JMenuItem>();
    remote_engine_exit = new LinkedList<JMenuItem>();
    remoteHosts = JOrphanUtils.split(JMeterUtils.getPropDefault("remote_hosts", ""), ",");
    if (remoteHosts.length == 1 && remoteHosts[0].equals("")) {
        remoteHosts = new String[0];
    }
    this.getRemoteItems();
    createMenuBar();
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:12,代码来源:ReportMenuBar.java

示例10: execute

import org.apache.jorphan.util.JOrphanUtils; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override
public synchronized String execute(SampleResult previousResult, Sampler currentSampler)
        throws InvalidVariableException {
    JMeterVariables vars = getVariables();

    String stringToSplit = ((CompoundVariable) values[0]).execute();
    String varNamePrefix = ((CompoundVariable) values[1]).execute().trim();
    String splitString = ",";

    if (values.length > 2) { // Split string provided
        splitString = ((CompoundVariable) values[2]).execute();
    }
    if (log.isDebugEnabled()){
        log.debug("Split "+stringToSplit+ " using "+ splitString+ " into "+varNamePrefix);
    }
    String parts[] = JOrphanUtils.split(stringToSplit, splitString, "?");// $NON-NLS-1$

    vars.put(varNamePrefix, stringToSplit);
    vars.put(varNamePrefix + "_n", Integer.toString(parts.length));// $NON-NLS-1$ 
    for (int i = 1; i <= parts.length; i++) {
        if (log.isDebugEnabled()){
            log.debug(parts[i-1]);
        }
        vars.put(varNamePrefix + "_" + i, parts[i - 1]);// $NON-NLS-1$
    }
    vars.remove(varNamePrefix + "_" + (parts.length+1));
    return stringToSplit;

}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:31,代码来源:SplitFunction.java

示例11: getIconMappings

import org.apache.jorphan.util.JOrphanUtils; //导入方法依赖的package包/类
@Override
public String[][] getIconMappings() {
    final String defaultIconProp = "org/apache/jmeter/images/icon.properties"; //$NON-NLS-1$
    String iconProp = JMeterUtils.getPropDefault("jmeter.icons", defaultIconProp);//$NON-NLS-1$
    Properties p = JMeterUtils.loadProperties(iconProp);
    if (p == null && !iconProp.equals(defaultIconProp)) {
        log.info(iconProp + " not found - using " + defaultIconProp);
        iconProp = defaultIconProp;
        p = JMeterUtils.loadProperties(iconProp);
    }
    if (p == null) {
        log.info(iconProp + " not found - using inbuilt icon set");
        return DEFAULT_ICONS;
    }
    log.info("Loaded icon properties from " + iconProp);
    String[][] iconlist = new String[p.size()][3];
    Enumeration<?> pe = p.keys();
    int i = 0;
    while (pe.hasMoreElements()) {
        String key = (String) pe.nextElement();
        String icons[] = JOrphanUtils.split(p.getProperty(key), " ");//$NON-NLS-1$
        iconlist[i][0] = key;
        iconlist[i][1] = icons[0];
        if (icons.length > 1) {
            iconlist[i][2] = icons[1];
        }
        i++;
    }
    return iconlist;
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:31,代码来源:JMeter.java

示例12: populateBindings

import org.apache.jorphan.util.JOrphanUtils; //导入方法依赖的package包/类
/**
 * Populate variables to be passed to scripts
 * @param bindings Bindings
 */
protected void populateBindings(Bindings bindings) {
    final String label = getName();
    final String fileName = getFilename();
    final String scriptParameters = getParameters();
    // Use actual class name for log
    final Logger logger = LoggingManager.getLoggerForShortName(getClass().getName());
    bindings.put("log", logger);
    bindings.put("Label", label);
    bindings.put("FileName", fileName);
    bindings.put("Parameters", scriptParameters);
    String [] args=JOrphanUtils.split(scriptParameters, " ");//$NON-NLS-1$
    bindings.put("args", args);
    // Add variables for access to context and variables
    JMeterContext jmctx = JMeterContextService.getContext();
    bindings.put("ctx", jmctx);
    JMeterVariables vars = jmctx.getVariables();
    bindings.put("vars", vars);
    Properties props = JMeterUtils.getJMeterProperties();
    bindings.put("props", props);
    // For use in debugging:
    bindings.put("OUT", System.out);

    // Most subclasses will need these:
    Sampler sampler = jmctx.getCurrentSampler();
    bindings.put("sampler", sampler);
    SampleResult prev = jmctx.getPreviousResult();
    bindings.put("prev", prev);
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:33,代码来源:JSR223TestElement.java

示例13: initManager

import org.apache.jorphan.util.JOrphanUtils; //导入方法依赖的package包/类
protected void initManager(BSFManager mgr) throws BSFException{
    final String label = getName();
    final String fileName = getFilename();
    final String scriptParameters = getParameters();
    // Use actual class name for log
    final Logger logger = LoggingManager.getLoggerForShortName(getClass().getName());
    mgr.declareBean("log", logger, Logger.class); // $NON-NLS-1$
    mgr.declareBean("Label",label, String.class); // $NON-NLS-1$
    mgr.declareBean("FileName",fileName, String.class); // $NON-NLS-1$
    mgr.declareBean("Parameters", scriptParameters, String.class); // $NON-NLS-1$
    String [] args=JOrphanUtils.split(scriptParameters, " ");//$NON-NLS-1$
    mgr.declareBean("args",args,args.getClass());//$NON-NLS-1$
    // Add variables for access to context and variables
    JMeterContext jmctx = JMeterContextService.getContext();
    JMeterVariables vars = jmctx.getVariables();
    Properties props = JMeterUtils.getJMeterProperties();

    mgr.declareBean("ctx", jmctx, jmctx.getClass()); // $NON-NLS-1$
    mgr.declareBean("vars", vars, vars.getClass()); // $NON-NLS-1$
    mgr.declareBean("props", props, props.getClass()); // $NON-NLS-1$
    // For use in debugging:
    mgr.declareBean("OUT", System.out, PrintStream.class); // $NON-NLS-1$

    // Most subclasses will need these:
    Sampler sampler = jmctx.getCurrentSampler();
    mgr.declareBean("sampler", sampler, Sampler.class);
    SampleResult prev = jmctx.getPreviousResult();
    mgr.declareBean("prev", prev, SampleResult.class);
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:30,代码来源:BSFTestElement.java

示例14: getDestinationVariableKeys

import org.apache.jorphan.util.JOrphanUtils; //导入方法依赖的package包/类
public String[] getDestinationVariableKeys() {
    String vars = getVariableNames();
    return hasVariablesNames() ?
            JOrphanUtils.split(vars, ",") :
            getReader().getHeader();
}
 
开发者ID:Blazemeter,项目名称:jmeter-bzm-plugins,代码行数:7,代码来源:RandomCSVDataSetConfig.java

示例15: getTestPlanClasspathArray

import org.apache.jorphan.util.JOrphanUtils; //导入方法依赖的package包/类
@JsonIgnore
public String[] getTestPlanClasspathArray() {
    return JOrphanUtils.split(this.getTestPlanClasspath(),CLASSPATH_SEPARATOR);
}
 
开发者ID:johrstrom,项目名称:cloud-meter,代码行数:5,代码来源:TestPlan.java


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