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


Java JOrphanUtils.isBlank方法代码示例

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


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

示例1: testStarted

import org.apache.jorphan.util.JOrphanUtils; //导入方法依赖的package包/类
@Override
public void testStarted() {
    this.setRunningVersion(true);
    TestBeanHelper.prepare(this);
    JMeterVariables variables = getThreadContext().getVariables();
    String poolName = getDataSource();
    if(JOrphanUtils.isBlank(poolName)) {
        throw new IllegalArgumentException("Variable Name must not be empty for element:"+getName());
    } else if (variables.getObject(poolName) != null) {
        log.error("JDBC data source already defined for: "+poolName);
    } else {
        String maxPool = getPoolMax();
        perThreadPoolSet = Collections.synchronizedSet(new HashSet<BasicDataSource>());
        if (maxPool.equals("0")){ // i.e. if we want per thread pooling
            variables.putObject(poolName, new DataSourceComponentImpl()); // pool will be created later
        } else {
            BasicDataSource src = initPool(maxPool);
            synchronized(this){
                dbcpDataSource = src;
                variables.putObject(poolName, new DataSourceComponentImpl(dbcpDataSource));
            }
        }
    }
}
 
开发者ID:johrstrom,项目名称:cloud-meter,代码行数:25,代码来源:DataSourceElement.java

示例2: getImplementation

import org.apache.jorphan.util.JOrphanUtils; //导入方法依赖的package包/类
public static HTTPAbstractImpl getImplementation(String impl, HTTPSamplerBase base){
    if (HTTPSamplerBase.PROTOCOL_FILE.equals(base.getProtocol())) {
        return new HTTPFileImpl(base);
    }
    if (JOrphanUtils.isBlank(impl)){
        impl = DEFAULT_CLASSNAME;
    }
    if (IMPL_JAVA.equals(impl) || HTTP_SAMPLER_JAVA.equals(impl)) {
        return new HTTPJavaImpl(base);
    } else if (IMPL_HTTP_CLIENT3_1.equals(impl) || HTTP_SAMPLER_APACHE.equals(impl)) {
        return new HTTPHC3Impl(base);                
    } else if (IMPL_HTTP_CLIENT4.equals(impl)) {
        return new HTTPHC4Impl(base);
    } else {
        throw new IllegalArgumentException("Unknown implementation type: '"+impl+"'");
    }
}
 
开发者ID:johrstrom,项目名称:cloud-meter,代码行数:18,代码来源:HTTPSamplerFactory.java

示例3: testStarted

import org.apache.jorphan.util.JOrphanUtils; //导入方法依赖的package包/类
@Override
@SuppressWarnings("deprecation") // call to TestBeanHelper.prepare() is intentional
public void testStarted() {
    this.setRunningVersion(true);
    TestBeanHelper.prepare(this);
    JMeterVariables variables = getThreadContext().getVariables();
    String poolName = getDataSource();
    if(JOrphanUtils.isBlank(poolName)) {
        throw new IllegalArgumentException("Variable Name must not be empty for element:"+getName());
    } else if (variables.getObject(poolName) != null) {
        log.error("JDBC data source already defined for: "+poolName);
    } else {
        String maxPool = getPoolMax();
        perThreadPoolSet = Collections.synchronizedSet(new HashSet<ResourceLimitingJdbcDataSource>());
        if (maxPool.equals("0")){ // i.e. if we want per thread pooling
            variables.putObject(poolName, new DataSourceComponentImpl()); // pool will be created later
        } else {
            ResourceLimitingJdbcDataSource src=initPool(maxPool);
            synchronized(this){
                excaliburSource = src;
                variables.putObject(poolName, new DataSourceComponentImpl(excaliburSource));
            }
        }
    }
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:26,代码来源:DataSourceElement.java

示例4: getMatchNumbersAsInt

import org.apache.jorphan.util.JOrphanUtils; //导入方法依赖的package包/类
public int[] getMatchNumbersAsInt(int arraySize) {
    
    String matchNumbersAsString = getMatchNumbers();
    int[] result = new int[arraySize];
    if (JOrphanUtils.isBlank(matchNumbersAsString)) {
        Arrays.fill(result, 0);
    } else {
        String[] matchNumbersAsStringArray = 
                matchNumbersAsString.split(SEPARATOR);
        for (int i = 0; i < matchNumbersAsStringArray.length; i++) {
            result[i] = Integer.parseInt(matchNumbersAsStringArray[i].trim());
        }
    }
    return result;
}
 
开发者ID:johrstrom,项目名称:cloud-meter,代码行数:16,代码来源:JSONPostProcessor.java

示例5: extractValue

import org.apache.jorphan.util.JOrphanUtils; //导入方法依赖的package包/类
/**
 * 
 * @param attribute Attribute to extract
 * @param element Element
 * @return String value
 */
private String extractValue(String attribute, Element element) {
    if (!JOrphanUtils.isBlank(attribute)) {
        return element.attr(attribute);
    } else {
        return element.text().trim();
    }
}
 
开发者ID:johrstrom,项目名称:cloud-meter,代码行数:14,代码来源:JSoupExtractor.java

示例6: extractValue

import org.apache.jorphan.util.JOrphanUtils; //导入方法依赖的package包/类
private String extractValue(String attribute, Node element) {
    if (!JOrphanUtils.isBlank(attribute)) {
        return element.getAttribute(attribute);
    } else {
        return element.getTextContent().trim();
    }
}
 
开发者ID:johrstrom,项目名称:cloud-meter,代码行数:8,代码来源:JoddExtractor.java

示例7: createBufferedReader

import org.apache.jorphan.util.JOrphanUtils; //导入方法依赖的package包/类
private BufferedReader createBufferedReader(FileEntry fileEntry) throws IOException {
    if (!fileEntry.file.canRead() || !fileEntry.file.isFile()) {
        throw new IllegalArgumentException("File "+ fileEntry.file.getName()+ " must exist and be readable");
    }
    FileInputStream fis = new FileInputStream(fileEntry.file);
    InputStreamReader isr = null;
    // If file encoding is specified, read using that encoding, otherwise use default platform encoding
    String charsetName = fileEntry.charSetEncoding;
    if(!JOrphanUtils.isBlank(charsetName)) {
        isr = new InputStreamReader(fis, charsetName);
    } else {
        isr = new InputStreamReader(fis);
    }
    return new BufferedReader(isr);
}
 
开发者ID:johrstrom,项目名称:cloud-meter,代码行数:16,代码来源:FileServer.java

示例8: createBufferedWriter

import org.apache.jorphan.util.JOrphanUtils; //导入方法依赖的package包/类
private BufferedWriter createBufferedWriter(FileEntry fileEntry) throws IOException {
    FileOutputStream fos = new FileOutputStream(fileEntry.file);
    OutputStreamWriter osw = null;
    // If file encoding is specified, write using that encoding, otherwise use default platform encoding
    String charsetName = fileEntry.charSetEncoding;
    if(!JOrphanUtils.isBlank(charsetName)) {
        osw = new OutputStreamWriter(fos, charsetName);
    } else {
        osw = new OutputStreamWriter(fos);
    }
    return new BufferedWriter(osw);
}
 
开发者ID:johrstrom,项目名称:cloud-meter,代码行数:13,代码来源:FileServer.java

示例9: isSkippable

import org.apache.jorphan.util.JOrphanUtils; //导入方法依赖的package包/类
/**
 * Is this parameter skippable, i.e. empty/blank string
 * or it looks like an unrecognised variable.
 *
 * @param parameterName - parameter name
 * @return true if parameter should be skipped
 */
public boolean isSkippable(String parameterName) {
    if (JOrphanUtils.isBlank(parameterName)){
        return true; // Skip parameters with a blank name (allows use of optional variables in parameter lists)
    }
    // TODO: improve this test
    if (parameterName.trim().startsWith("${") && parameterName.endsWith("}")){// $NON-NLS-1$ $NON-NLS-2$
        return true; // Missing variable name
    }
    return false;
}
 
开发者ID:johrstrom,项目名称:cloud-meter,代码行数:18,代码来源:Argument.java

示例10: 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

示例11: 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

示例12: createBufferedReader

import org.apache.jorphan.util.JOrphanUtils; //导入方法依赖的package包/类
private BufferedReader createBufferedReader(FileEntry fileEntry) throws IOException {
    FileInputStream fis = new FileInputStream(fileEntry.file);
    InputStreamReader isr = null;
    // If file encoding is specified, read using that encoding, otherwise use default platform encoding
    String charsetName = fileEntry.charSetEncoding;
    if(!JOrphanUtils.isBlank(charsetName)) {
        isr = new InputStreamReader(fis, charsetName);
    } else {
        isr = new InputStreamReader(fis);
    }
    return new BufferedReader(isr);
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:13,代码来源:FileServer.java

示例13: addFile

import org.apache.jorphan.util.JOrphanUtils; //导入方法依赖的package包/类
/**
 * Add authentication data from a file.
 *
 * @param authFile
 *            path to the file to read the authentication data from
 * @throws IOException
 *             when reading the data fails
 */
public void addFile(String authFile) throws IOException {
    File file = new File(authFile);
    if (!file.isAbsolute()) {
        file = new File(System.getProperty("user.dir") + File.separator + authFile);
    }
    if (!file.canRead()) {
        throw new IOException("The file you specified cannot be read.");
    }

    BufferedReader reader = null;
    boolean ok = true;
    try {
        reader = new BufferedReader(new FileReader(file));
        String line;
        while ((line = reader.readLine()) != null) {
            try {
                if (line.startsWith("#") || JOrphanUtils.isBlank(line)) { //$NON-NLS-1$
                    continue;
                }
                String[] tokens = line.split("\t"); //$NON-NLS-1$
                if (tokens.length >= 3) {
                    String url = tokens[0];
                    String user = tokens[1];
                    String pass = tokens[2];
                    String domain;
                    String realm;
                    if (tokens.length > 3){ // Allow for old format file without the extra columnns
                        domain = tokens[3];
                        realm = tokens[4];
                    } else {
                        domain = "";
                        realm = "";
                    }
                    Mechanism mechanism;
                    if (tokens.length > 5) { // Allow for old format file without mechanism support
                        mechanism = Mechanism.valueOf(tokens[5]);
                    } else {
                        mechanism = Mechanism.BASIC_DIGEST;
                    }
                    Authorization auth = new Authorization(url, user, pass, domain, realm, mechanism);
                    getAuthObjects().addItem(auth);
                }
            } catch (NoSuchElementException e) {
                log.error("Error parsing auth line: '" + line + "'", e);
                ok = false;
            }
        }
    } finally {
        JOrphanUtils.closeQuietly(reader);
    }
    if (!ok){
        JMeterUtils.reportErrorToUser("One or more errors found when reading the Auth file - see the log file");
    }
}
 
开发者ID:johrstrom,项目名称:cloud-meter,代码行数:63,代码来源:AuthManager.java

示例14: addFile

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

    // N.B. this must agree with the save() and cookieToString() methods
    String line;
    try {
        final CollectionProperty cookies = getCookies();
        while ((line = reader.readLine()) != null) {
            try {
                if (line.startsWith("#") || JOrphanUtils.isBlank(line)) {//$NON-NLS-1$
                    continue;
                }
                String[] st = JOrphanUtils.split(line, TAB, false);

                final int _domain = 0;
                //final int _ignored = 1;
                final int _path = 2;
                final int _secure = 3;
                final int _expires = 4;
                final int _name = 5;
                final int _value = 6;
                final int _fields = 7;
                if (st.length!=_fields) {
                    throw new IOException("Expected "+_fields+" fields, found "+st.length+" in "+line);
                }

                if (st[_path].length()==0) {
                    st[_path] = "/"; //$NON-NLS-1$
                }
                boolean secure = Boolean.parseBoolean(st[_secure]);
                long expires = Long.parseLong(st[_expires]);
                if (expires==Long.MAX_VALUE) {
                    expires=0;
                }
                //long max was used to represent a non-expiring cookie, but that caused problems
                Cookie cookie = new Cookie(st[_name], st[_value], st[_domain], st[_path], secure, expires);
                cookies.addItem(cookie);
            } catch (NumberFormatException e) {
                throw new IOException("Error parsing cookie line\n\t'" + line + "'\n\t" + e);
            }
        }
    } finally {
        reader.close();
     }
}
 
开发者ID:johrstrom,项目名称:cloud-meter,代码行数:66,代码来源:CookieManager.java

示例15: sample

import org.apache.jorphan.util.JOrphanUtils; //导入方法依赖的package包/类
@Override
    public SampleResult sample(Entry e) {
        log.debug("sampling CQL");

        SampleResult res = new SampleResult();
        res.setSampleLabel(getName());
        res.setSamplerData(toString());
        res.setDataType(SampleResult.TEXT);
        res.setContentType("text/plain"); // $NON-NLS-1$
        res.setDataEncoding(ENCODING);

        // Assume we will be successful
        res.setSuccessful(true);
        res.setResponseMessageOK();
        res.setResponseCodeOK();


        res.sampleStart();
        Session conn = null;

        try {
            if(JOrphanUtils.isBlank(getSessionName())) {
                throw new IllegalArgumentException("Variable Name must not be null in "+getName());
            }

            try {
                conn = CassandraConnection.getSession(getSessionName());
            } finally {
                res.latencyEnd(); // use latency to measure connection time
            }
            res.setResponseHeaders(conn.toString());
            res.setResponseData(execute(conn));
        }  catch (Exception ex) {
            res.setResponseMessage(ex.toString());
            res.setResponseCode("000");
            res.setResponseData(ex.getMessage().getBytes());
            res.setSuccessful(false);
        }
// Doesn't apply
//        finally {
//            close(conn);
//        }

        // TODO: process warnings? Set Code and Message to success?
        res.sampleEnd();
        return res;
    }
 
开发者ID:slowenthal,项目名称:jmeter-cassandra,代码行数:48,代码来源:CassandraSampler.java


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