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


Java JMeterUtils.getPropDefault方法代码示例

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


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

示例1: setupTest

import org.apache.jmeter.util.JMeterUtils; //导入方法依赖的package包/类
@Override
public void setupTest(BackendListenerContext context) throws Exception {
    try {
        this.index        = context.getParameter(ES_INDEX);
        this.bulkSize     = Integer.parseInt(context.getParameter(ES_BULK_SIZE));
        this.timeoutMs = JMeterUtils.getPropDefault(ES_TIMEOUT_MS, DEFAULT_TIMEOUT_MS);
        this.buildNumber  = (JMeterUtils.getProperty(ElasticsearchBackend.BUILD_NUMBER) != null 
                && JMeterUtils.getProperty(ElasticsearchBackend.BUILD_NUMBER).trim() != "") 
                ? Integer.parseInt(JMeterUtils.getProperty(ElasticsearchBackend.BUILD_NUMBER)) : 0;
        String host         = context.getParameter(ES_HOST);
        int port         = Integer.parseInt(context.getParameter(ES_PORT));
        this.client       = new RestHighLevelClient(
                    RestClient.builder(
                        new HttpHost(host, port, context.getParameter(ES_SCHEME, "http")))
                    .setRequestConfigCallback(requestConfigBuilder -> 
                         requestConfigBuilder
                                    .setConnectTimeout(5000)
                                    .setSocketTimeout((int)timeoutMs))
                    .setMaxRetryTimeoutMillis(60000));
        this.bulkRequest = new BulkRequest().timeout(TimeValue.timeValueMillis(timeoutMs));
        super.setupTest(context);
    } catch (Exception e) {
        throw new IllegalStateException("Unable to setup connectivity to ES", e);
    }
}
 
开发者ID:delirius325,项目名称:jmeter-elasticsearch-backend-listener,代码行数:26,代码来源:ElasticsearchBackend.java

示例2: updatePath

import org.apache.jmeter.util.JMeterUtils; //导入方法依赖的package包/类
private void updatePath(String property, String sep, boolean cp) {
    String userpath= JMeterUtils.getPropDefault(property,"");// $NON-NLS-1$
    if (userpath.length() <= 0) { return; }
    log.info(property+"="+userpath); //$NON-NLS-1$
    StringTokenizer tok = new StringTokenizer(userpath, sep);
    while(tok.hasMoreTokens()) {
        String path=tok.nextToken();
        File f=new File(path);
        if (!f.canRead() && !f.isDirectory()) {
            log.warn("Can't read "+path);
        } else {
            if (cp) {
                log.info("Adding to classpath and loader: "+path);
                try {
                    NewDriver.addPath(path);
                } catch (MalformedURLException e) {
                    log.warn("Error adding: "+path+" "+e.getLocalizedMessage());
                }
            } else {
                log.info("Adding to loader: "+path);
                NewDriver.addURL(path);
            }
        }
    }
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:26,代码来源:JMeter.java

示例3: createHTTPClient

import org.apache.jmeter.util.JMeterUtils; //导入方法依赖的package包/类
private static AbstractHttpClient createHTTPClient() {
    AbstractHttpClient client = new DefaultHttpClient();
    String proxyHost = System.getProperty("https.proxyHost", "");
    if (!proxyHost.isEmpty()) {
        int proxyPort = Integer.parseInt(System.getProperty("https.proxyPort", "-1"));
        log.info("Using proxy " + proxyHost + ":" + proxyPort);
        HttpParams params = client.getParams();
        HttpHost proxy = new HttpHost(proxyHost, proxyPort);
        params.setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy);

        String proxyUser = System.getProperty(JMeter.HTTP_PROXY_USER, JMeterUtils.getProperty(JMeter.HTTP_PROXY_USER));
        if (proxyUser != null) {
            log.info("Using authenticated proxy with username: " + proxyUser);
            String proxyPass = System.getProperty(JMeter.HTTP_PROXY_PASS, JMeterUtils.getProperty(JMeter.HTTP_PROXY_PASS));

            String localHost;
            try {
                localHost = InetAddress.getLocalHost().getCanonicalHostName();
            } catch (Throwable e) {
                log.error("Failed to get local host name, defaulting to 'localhost'", e);
                localHost = "localhost";
            }

            AuthScope authscope = new AuthScope(proxyHost, proxyPort);
            String proxyDomain = JMeterUtils.getPropDefault("http.proxyDomain", "");
            NTCredentials credentials = new NTCredentials(proxyUser, proxyPass, localHost, proxyDomain);
            client.getCredentialsProvider().setCredentials(authscope, credentials);
        }
    }
    return client;
}
 
开发者ID:Blazemeter,项目名称:jmeter-bzm-plugins,代码行数:32,代码来源:HttpUtils.java

示例4: initProxyConfiguration

import org.apache.jmeter.util.JMeterUtils; //导入方法依赖的package包/类
static void initProxyConfiguration() {
    proxyHost = System.getProperty("http.proxyHost",null);
    proxyPort = Integer.parseInt(System.getProperty("http.proxyPort","0"));
    List<String> nonProxyHostList = Arrays.asList(System.getProperty("http.nonProxyHosts","").split("\\|"));
    nonProxyHosts = nonProxyHostList.stream().filter(h -> !h.startsWith("*")).collect(Collectors.toList());
    nonProxyWildcards = nonProxyHostList.stream().filter(h -> h.startsWith("*")).map(w -> w.substring(1)).collect(Collectors.toList());
    proxyUsername = JMeterUtils.getPropDefault(JMeter.HTTP_PROXY_USER,null);
    proxyPassword = JMeterUtils.getPropDefault(JMeter.HTTP_PROXY_PASS,null);
}
 
开发者ID:ptrd,项目名称:jmeter-websocket-samplers,代码行数:10,代码来源:WebsocketSampler.java

示例5: execute

import org.apache.jmeter.util.JMeterUtils; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override
public String execute(SampleResult previousResult, Sampler currentSampler)
        throws InvalidVariableException {
    String propertyName = ((CompoundVariable) values[0]).execute();
    String propertyDefault = propertyName;
    if (values.length > 2) { // We have a 3rd parameter
        propertyDefault = ((CompoundVariable) values[2]).execute();
    }
    String propertyValue = JMeterUtils.getPropDefault(propertyName, propertyDefault);
    if (values.length > 1) {
        String variableName = ((CompoundVariable) values[1]).execute();
        if (variableName.length() > 0) {// Allow for empty name
            final JMeterVariables variables = getVariables();
            if (variables != null) {
                variables.put(variableName, propertyValue);
            }
        }
    }
    return propertyValue;

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

示例6: execute

import org.apache.jmeter.util.JMeterUtils; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override
public String execute(SampleResult previousResult, Sampler currentSampler)
        throws InvalidVariableException {
    String propertyName = ((CompoundVariable) values[0]).execute();

    String propertyDefault = "1"; //$NON-NLS-1$
    if (values.length > 1) { // We have a default
        propertyDefault = ((CompoundVariable) values[1]).execute();
    }

    String propertyValue = JMeterUtils.getPropDefault(propertyName, propertyDefault);

    return propertyValue;

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

示例7: initKeyStore

import org.apache.jmeter.util.JMeterUtils; //导入方法依赖的package包/类
private void initKeyStore() throws IOException, GeneralSecurityException {
    switch(KEYSTORE_MODE) {
    case DYNAMIC_KEYSTORE:
        storePassword = getPassword();
        keyPassword = getPassword();
        initDynamicKeyStore();
        break;
    case JMETER_KEYSTORE:
        storePassword = getPassword();
        keyPassword = getPassword();
        initJMeterKeyStore();
        break;
    case USER_KEYSTORE:
        storePassword = JMeterUtils.getPropDefault("proxy.cert.keystorepass", DEFAULT_PASSWORD); // $NON-NLS-1$;
        keyPassword = JMeterUtils.getPropDefault("proxy.cert.keypassword", DEFAULT_PASSWORD); // $NON-NLS-1$;
        log.info("HTTP(S) Test Script Recorder will use the keystore '"+ CERT_PATH_ABS + "' with the alias: '" + CERT_ALIAS + "'");
        initUserKeyStore();
        break;
    default:
        throw new IllegalStateException("Impossible case: " + KEYSTORE_MODE);
    }
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:23,代码来源:ProxyControl.java

示例8: getIconMappings

import org.apache.jmeter.util.JMeterUtils; //导入方法依赖的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

示例9: execute

import org.apache.jmeter.util.JMeterUtils; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override
public synchronized String execute(SampleResult previousResult, Sampler currentSampler)
        throws InvalidVariableException {
    String propertyName = ((CompoundVariable) values[0]).execute();
    String propertyDefault = propertyName;
    if (values.length > 2) { // We have a 3rd parameter
        propertyDefault = ((CompoundVariable) values[2]).execute();
    }
    String propertyValue = JMeterUtils.getPropDefault(propertyName, propertyDefault);
    if (values.length > 1) {
        String variableName = ((CompoundVariable) values[1]).execute();
        if (variableName.length() > 0) {// Allow for empty name
            final JMeterVariables variables = getVariables();
            if (variables != null) {
                variables.put(variableName, propertyValue);
            }
        }
    }
    return propertyValue;

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

示例10: execute

import org.apache.jmeter.util.JMeterUtils; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override
public synchronized String execute(SampleResult previousResult, Sampler currentSampler)
        throws InvalidVariableException {
    String propertyName = ((CompoundVariable) values[0]).execute();

    String propertyDefault = "1"; //$NON-NLS-1$
    if (values.length > 1) { // We have a default
        propertyDefault = ((CompoundVariable) values[1]).execute();
    }

    String propertyValue = JMeterUtils.getPropDefault(propertyName, propertyDefault);

    return propertyValue;

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

示例11: startNonGui

import org.apache.jmeter.util.JMeterUtils; //导入方法依赖的package包/类
private void startNonGui(String testFile, String logFile, CLOption remoteStart)
        throws IllegalUserActionException {
    // add a system property so samplers can check to see if JMeter
    // is running in NonGui mode
    System.setProperty(JMETER_NON_GUI, "true");// $NON-NLS-1$
    JMeter driver = new JMeter();// TODO - why does it create a new instance?
    driver.remoteProps = this.remoteProps;
    driver.remoteStop = this.remoteStop;
    driver.parent = this;
    PluginManager.install(this, false);

    String remote_hosts_string = null;
    if (remoteStart != null) {
        remote_hosts_string = remoteStart.getArgument();
        if (remote_hosts_string == null) {
            remote_hosts_string = JMeterUtils.getPropDefault(
                    "remote_hosts", //$NON-NLS-1$
                    "127.0.0.1");//$NON-NLS-1$
        }
    }
    if (testFile == null) {
        throw new IllegalUserActionException("Non-GUI runs require a test plan");
    }
    driver.runNonGui(testFile, logFile, remoteStart != null, remote_hosts_string);
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:26,代码来源:JMeter.java

示例12: startUdpDdaemon

import org.apache.jmeter.util.JMeterUtils; //导入方法依赖的package包/类
private static void startUdpDdaemon(final List<JMeterEngine> engines) {
    int port = JMeterUtils.getPropDefault("jmeterengine.nongui.port", UDP_PORT_DEFAULT); // $NON-NLS-1$
    int maxPort = JMeterUtils.getPropDefault("jmeterengine.nongui.maxport", 4455); // $NON-NLS-1$
    if (port > 1000){
        final DatagramSocket socket = getSocket(port, maxPort);
        if (socket != null) {
            Thread waiter = new Thread("UDP Listener"){
                @Override
                public void run() {
                    waitForSignals(engines, socket);
                }
            };
            waiter.setDaemon(true);
            waiter.start();
        } else {
            System.out.println("Failed to create UDP port");
        }
    }
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:20,代码来源:JMeter.java

示例13: process

import org.apache.jmeter.util.JMeterUtils; //导入方法依赖的package包/类
@Override
public void process() {
    SampleResult prev = getThreadContext().getPreviousResult();
    if (prev == null) return;

    String xml = prev.getResponseDataAsString();
    if (xml == null) return;

    try {
        log.debug("Parsing xml response");
        Document doc = stringToDocument(xml);

        log.debug("Processing WSS header");
        doc = this.process(doc); // Delegate in abstract method

        prev.setResponseData(documentToString(doc), prev.getDataEncodingWithDefault());
    }
    catch (Exception e) {
        log.error("Processing failed! ", e);
        if (e instanceof WSSecurityException && JMeterUtils.getPropDefault(FAIL_ON_WSS_EXCEPTION, true)) {
            AssertionResult assertionResult = new AssertionResult("WSSecurityException").setResultForFailure(e.getMessage());
            assertionResult.setError(true);
            assertionResult.setFailure(true);
            prev.addAssertionResult(assertionResult);
            prev.setSuccessful(false);
        }
    }
}
 
开发者ID:tilln,项目名称:jmeter-wssecurity,代码行数:29,代码来源:AbstractWSSecurityPostProcessor.java

示例14: initThreadStopPolicy

import org.apache.jmeter.util.JMeterUtils; //导入方法依赖的package包/类
static void initThreadStopPolicy() {
    String propertyValue = JMeterUtils.getPropDefault(WS_THREAD_STOP_POLICY_PROPERTY, "none");
    try {
        threadStopPolicy = ThreadStopPolicy.valueOf(propertyValue.trim().toUpperCase());
    }
    catch (IllegalArgumentException e) {
    }
}
 
开发者ID:ptrd,项目名称:jmeter-websocket-samplers,代码行数:9,代码来源:WebsocketSampler.java

示例15: RenderAsBinary

import org.apache.jmeter.util.JMeterUtils; //导入方法依赖的package包/类
public RenderAsBinary() {
    maxDisplaySize = JMeterUtils.getPropDefault("view.results.tree.max_binary_size", -1);
    if (maxDisplaySize == -1)
        maxDisplaySize = 1024 * 1024;  // 1 MB
    else if (maxDisplaySize < 64)
        maxDisplaySize = 64;
}
 
开发者ID:ptrd,项目名称:jmeter-websocket-samplers,代码行数:8,代码来源:RenderAsBinary.java


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