• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java PropertyIterator类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.jmeter.testelement.property.PropertyIterator的典型用法代码示例。如果您正苦于以下问题:Java PropertyIterator类的具体用法?Java PropertyIterator怎么用?Java PropertyIterator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



PropertyIterator类属于org.apache.jmeter.testelement.property包,在下文中一共展示了PropertyIterator类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: setValues

import org.apache.jmeter.testelement.property.PropertyIterator; //导入依赖的package包/类
private void setValues() {
    synchronized (lock) {
        if (log.isDebugEnabled()) {
            log.debug(Thread.currentThread().getName() + " Running up named: " + getName());//$NON-NLS-1$
        }
        PropertyIterator namesIter = getNames().iterator();
        PropertyIterator valueIter = getValues().iterator();
        JMeterVariables jmvars = getThreadContext().getVariables();
        while (namesIter.hasNext() && valueIter.hasNext()) {
            String name = namesIter.next().getStringValue();
            String value = valueIter.next().getStringValue();
            if (log.isDebugEnabled()) {
                log.debug(Thread.currentThread().getName() + " saving variable: " + name + "=" + value);//$NON-NLS-1$
            }
            jmvars.put(name, value);
        }
    }
}
 
开发者ID:johrstrom,项目名称:cloud-meter,代码行数:19,代码来源:UserParameters.java


示例2: marshal

import org.apache.jmeter.testelement.property.PropertyIterator; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public void marshal(Object arg0, HierarchicalStreamWriter writer, MarshallingContext context) {
    TestElement el = (TestElement) arg0;
    ConversionHelp.saveSpecialProperties(el,writer);
    PropertyIterator iter = el.propertyIterator();
    while (iter.hasNext()) {
        JMeterProperty jmp=iter.next();
        // Skip special properties if required
        if (!ConversionHelp.isSpecialProperty(jmp.getName())) {
            // Don't save empty comments - except for the TestPlan (to maintain compatibility)
               if (!(
                       TestElement.COMMENTS.equals(jmp.getName())
                       && jmp.getStringValue().length()==0
                       && !el.getClass().equals(TestPlan.class)
                   ))
               {
                writeItem(jmp, context, writer);
               }
        }
    }
}
 
开发者ID:johrstrom,项目名称:cloud-meter,代码行数:23,代码来源:TestElementConverter.java


示例3: getArgumentsAsMap

import org.apache.jmeter.testelement.property.PropertyIterator; //导入依赖的package包/类
/**
 * Get the arguments as a Map. Each argument name is used as the key, and
 * its value as the value.
 *
 * @return a new Map with String keys and values containing the arguments
 */
public Map<String, String> getArgumentsAsMap() {
    PropertyIterator iter = getArguments().iterator();
    Map<String, String> argMap = new LinkedHashMap<>();
    while (iter.hasNext()) {
        Argument arg = (Argument) iter.next().getObjectValue();
        // Because CollectionProperty.mergeIn will not prevent adding two
        // properties of the same name, we need to select the first value so
        // that this element's values prevail over defaults provided by
        // configuration
        // elements:
        if (!argMap.containsKey(arg.getName())) {
            argMap.put(arg.getName(), arg.getValue());
        }
    }
    return argMap;
}
 
开发者ID:johrstrom,项目名称:cloud-meter,代码行数:23,代码来源:Arguments.java


示例4: removeMatchingCookies

import org.apache.jmeter.testelement.property.PropertyIterator; //导入依赖的package包/类
void removeMatchingCookies(Cookie newCookie){
    // Scan for any matching cookies
    PropertyIterator iter = getCookies().iterator();
    while (iter.hasNext()) {
        Cookie cookie = (Cookie) iter.next().getObjectValue();
        if (cookie == null) {// TODO is this possible?
            continue;
        }
        if (match(cookie,newCookie)) {
            if (log.isDebugEnabled()) {
                log.debug("New Cookie = " + newCookie.toString()
                          + " removing matching Cookie " + cookie.toString());
            }
            iter.remove();
        }
    }
}
 
开发者ID:johrstrom,项目名称:cloud-meter,代码行数:18,代码来源:CookieManager.java


示例5: getSendParameterValuesAsPostBody

import org.apache.jmeter.testelement.property.PropertyIterator; //导入依赖的package包/类
/**
 * Determine if none of the parameters have a name, and if that
 * is the case, it means that the parameter values should be sent
 * as the entity body
 *
 * @return true if none of the parameters have a name specified
 */
public boolean getSendParameterValuesAsPostBody() {
    if (getPostBodyRaw()) {
        return true;
    } else {
        boolean noArgumentsHasName = true;
        PropertyIterator args = getArguments().iterator();
        while (args.hasNext()) {
            HTTPArgument arg = (HTTPArgument) args.next().getObjectValue();
            if (arg.getName() != null && arg.getName().length() > 0) {
                noArgumentsHasName = false;
                break;
            }
        }
        return noArgumentsHasName;
    }
}
 
开发者ID:johrstrom,项目名称:cloud-meter,代码行数:24,代码来源:HTTPSamplerBase.java


示例6: toString

import org.apache.jmeter.testelement.property.PropertyIterator; //导入依赖的package包/类
/**
 * Create a string representation of the arguments.
 *
 * @return the string representation of the arguments
 */
@Override
public String toString() {
    StringBuilder str = new StringBuilder();
    PropertyIterator iter = getArguments().iterator();
    while (iter.hasNext()) {
        LDAPArgument arg = (LDAPArgument) iter.next().getObjectValue();
        final String metaData = arg.getMetaData();
        str.append(arg.getName());
        if (metaData == null) {
            str.append("=");  //$NON-NLS$
        } else {
            str.append(metaData);
        }
        str.append(arg.getValue());
        if (iter.hasNext()) {
            str.append("&"); //$NON-NLS$
        }
    }
    return str.toString();
}
 
开发者ID:johrstrom,项目名称:cloud-meter,代码行数:26,代码来源:LDAPArguments.java


示例7: save

import org.apache.jmeter.testelement.property.PropertyIterator; //导入依赖的package包/类
/**
 * Save the static cookie data to a file.
 * Cookies are only taken from the GUI - runtime cookies are not included.
 */
public void save(String authFile) throws IOException {
    File file = new File(authFile);
    if (!file.isAbsolute()) {
        file = new File(System.getProperty("user.dir") // $NON-NLS-1$
                + File.separator + authFile);
    }
    PrintWriter writer = new PrintWriter(new FileWriter(file)); // TODO Charset ?
    writer.println("# JMeter generated Cookie file");// $NON-NLS-1$
    PropertyIterator cookies = getCookies().iterator();
    long now = System.currentTimeMillis();
    while (cookies.hasNext()) {
        Cookie cook = (Cookie) cookies.next().getObjectValue();
        final long expiresMillis = cook.getExpiresMillis();
        if (expiresMillis == 0 || expiresMillis > now) { // only save unexpired cookies
            writer.println(cookieToString(cook));
        }
    }
    writer.flush();
    writer.close();
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:25,代码来源:CookieManager.java


示例8: getCookiesForUrl

import org.apache.jmeter.testelement.property.PropertyIterator; //导入依赖的package包/类
/**
 * Get array of valid HttpClient cookies for the URL
 *
 * @param url the target URL
 * @return array of HttpClient cookies
 *
 */
org.apache.commons.httpclient.Cookie[] getCookiesForUrl(
        CollectionProperty cookiesCP,
        URL url, 
        boolean allowVariableCookie){
    org.apache.commons.httpclient.Cookie cookies[]=
        new org.apache.commons.httpclient.Cookie[cookiesCP.size()];
    int i=0;
    for (PropertyIterator iter = cookiesCP.iterator(); iter.hasNext();) {
        Cookie jmcookie = (Cookie) iter.next().getObjectValue();
        // Set to running version, to allow function evaluation for the cookie values (bug 28715)
        if (allowVariableCookie) {
            jmcookie.setRunningVersion(true);
        }
        cookies[i++] = makeCookie(jmcookie);
        if (allowVariableCookie) {
            jmcookie.setRunningVersion(false);
        }
    }
    String host = url.getHost();
    String protocol = url.getProtocol();
    int port= HTTPSamplerBase.getDefaultPort(protocol,url.getPort());
    String path = url.getPath();
    boolean secure = HTTPSamplerBase.isSecure(protocol);
    return cookieSpec.match(host, port, path, secure, cookies);
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:33,代码来源:HC3CookieHandler.java


示例9: matchesPatterns

import org.apache.jmeter.testelement.property.PropertyIterator; //导入依赖的package包/类
private boolean matchesPatterns(String url, CollectionProperty patterns) {
    PropertyIterator iter = patterns.iterator();
    while (iter.hasNext()) {
        String item = iter.next().getStringValue();
        Pattern pattern = null;
        try {
            pattern = JMeterUtils.getPatternCache().getPattern(item, Perl5Compiler.READ_ONLY_MASK | Perl5Compiler.SINGLELINE_MASK);
            if (JMeterUtils.getMatcher().matches(url, pattern)) {
                return true;
            }
        } catch (MalformedCachePatternException e) {
            log.warn("Skipped invalid pattern: " + item, e);
        }
    }
    return false;
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:17,代码来源:ProxyControl.java


示例10: setConnectionHeaders

import org.apache.jmeter.testelement.property.PropertyIterator; //导入依赖的package包/类
/**
 * Extracts all the required headers for that particular URL request and
 * sets them in the <code>HttpURLConnection</code> passed in
 *
 * @param conn
 *            <code>HttpUrlConnection</code> which represents the URL
 *            request
 * @param u
 *            <code>URL</code> of the URL request
 * @param headerManager
 *            the <code>HeaderManager</code> containing all the cookies
 *            for this <code>UrlConfig</code>
 * @param cacheManager the CacheManager (may be null)
 */
private void setConnectionHeaders(HttpURLConnection conn, URL u, HeaderManager headerManager, CacheManager cacheManager) {
    // Add all the headers from the HeaderManager
    if (headerManager != null) {
        CollectionProperty headers = headerManager.getHeaders();
        if (headers != null) {
            PropertyIterator i = headers.iterator();
            while (i.hasNext()) {
                Header header = (Header) i.next().getObjectValue();
                String n = header.getName();
                String v = header.getValue();
                conn.addRequestProperty(n, v);
            }
        }
    }
    if (cacheManager != null){
        cacheManager.setHeaders(conn, u);
    }
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:33,代码来源:HTTPJavaImpl.java


示例11: getSendParameterValuesAsPostBody

import org.apache.jmeter.testelement.property.PropertyIterator; //导入依赖的package包/类
/**
 * Determine if none of the parameters have a name, and if that
 * is the case, it means that the parameter values should be sent
 * as the entity body
 *
 * @return true if none of the parameters have a name specified
 */
public boolean getSendParameterValuesAsPostBody() {
    if(getPostBodyRaw()) {
        return true;
    } else {
        boolean noArgumentsHasName = true;
        PropertyIterator args = getArguments().iterator();
        while (args.hasNext()) {
            HTTPArgument arg = (HTTPArgument) args.next().getObjectValue();
            if(arg.getName() != null && arg.getName().length() > 0) {
                noArgumentsHasName = false;
                break;
            }
        }
        return noArgumentsHasName;
    }
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:24,代码来源:HTTPSamplerBase.java


示例12: getUserAttributes

import org.apache.jmeter.testelement.property.PropertyIterator; //导入依赖的package包/类
/**
 * Collect all the value from the table (Arguments), using this create the
 * basicAttributes. This will create the Basic Attributes for the User
 * defined TestCase for Add Test.
 *
 * @return the BasicAttributes
 */
private BasicAttributes getUserAttributes() {
    BasicAttribute basicattribute = new BasicAttribute("objectclass"); //$NON-NLS-1$
    basicattribute.add("top"); //$NON-NLS-1$
    basicattribute.add("person"); //$NON-NLS-1$
    basicattribute.add("organizationalPerson"); //$NON-NLS-1$
    basicattribute.add("inetOrgPerson"); //$NON-NLS-1$
    BasicAttributes attrs = new BasicAttributes(true);
    attrs.put(basicattribute);
    BasicAttribute attr;
    PropertyIterator iter = getArguments().iterator();

    while (iter.hasNext()) {
        Argument item = (Argument) iter.next().getObjectValue();
        attr = getBasicAttribute(item.getName(), item.getValue());
        attrs.put(attr);
    }
    return attrs;
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:26,代码来源:LDAPSampler.java


示例13: getUserAttributes

import org.apache.jmeter.testelement.property.PropertyIterator; //导入依赖的package包/类
/***************************************************************************
 * Collect all the values from the table (Arguments), using this create the
 * Attributes, this will create the Attributes for the User
 * defined TestCase for Add Test
 *
 * @return The Attributes
 **************************************************************************/
private Attributes getUserAttributes() {
    Attributes attrs = new BasicAttributes(true);
    Attribute attr;
    PropertyIterator iter = getArguments().iterator();

    while (iter.hasNext()) {
        Argument item = (Argument) iter.next().getObjectValue();
        attr = attrs.get(item.getName());
        if (attr == null) {
            attr = getBasicAttribute(item.getName(), item.getValue());
        } else {
            attr.add(item.getValue());
        }
        attrs.put(attr);
    }
    return attrs;
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:25,代码来源:LDAPExtSampler.java


示例14: marshal

import org.apache.jmeter.testelement.property.PropertyIterator; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public void marshal(Object arg0, HierarchicalStreamWriter writer, MarshallingContext context) {
    TestElement el = (TestElement) arg0;
    if (SaveService.IS_TESTPLAN_FORMAT_22){
        ConversionHelp.saveSpecialProperties(el,writer);
    }
    PropertyIterator iter = el.propertyIterator();
    while (iter.hasNext()) {
        JMeterProperty jmp=iter.next();
        // Skip special properties if required
        if (!SaveService.IS_TESTPLAN_FORMAT_22 || !ConversionHelp.isSpecialProperty(jmp.getName())) {
            // Don't save empty comments - except for the TestPlan (to maintain compatibility)
               if (!(
                       TestElement.COMMENTS.equals(jmp.getName())
                       && jmp.getStringValue().length()==0
                       && !el.getClass().equals(TestPlan.class)
                   ))
               {
                writeItem(jmp, context, writer);
               }
        }
    }
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:25,代码来源:TestElementConverter.java


示例15: getArgumentsAsMap

import org.apache.jmeter.testelement.property.PropertyIterator; //导入依赖的package包/类
/**
 * Get the arguments as a Map. Each argument name is used as the key, and
 * its value as the value.
 *
 * @return a new Map with String keys and values containing the arguments
 */
public Map<String, String> getArgumentsAsMap() {
    PropertyIterator iter = getArguments().iterator();
    Map<String, String> argMap = new LinkedHashMap<String, String>();
    while (iter.hasNext()) {
        Argument arg = (Argument) iter.next().getObjectValue();
        // Because CollectionProperty.mergeIn will not prevent adding two
        // properties of the same name, we need to select the first value so
        // that this element's values prevail over defaults provided by
        // configuration
        // elements:
        if (!argMap.containsKey(arg.getName())) {
            argMap.put(arg.getName(), arg.getValue());
        }
    }
    return argMap;
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:23,代码来源:Arguments.java


示例16: toString

import org.apache.jmeter.testelement.property.PropertyIterator; //导入依赖的package包/类
/**
 * Create a string representation of the arguments.
 *
 * @return the string representation of the arguments
 */
@Override
public String toString() {
    StringBuilder str = new StringBuilder();
    PropertyIterator iter = getArguments().iterator();
    while (iter.hasNext()) {
        Argument arg = (Argument) iter.next().getObjectValue();
        final String metaData = arg.getMetaData();
        str.append(arg.getName());
        if (metaData == null) {
            str.append("="); //$NON-NLS-1$
        } else {
            str.append(metaData);
        }
        str.append(arg.getValue());
        if (iter.hasNext()) {
            str.append("&"); //$NON-NLS-1$
        }
    }
    return str.toString();
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:26,代码来源:Arguments.java


示例17: unwrapCollection

import org.apache.jmeter.testelement.property.PropertyIterator; //导入依赖的package包/类
private static Object unwrapCollection(MultiProperty prop,String type)
{
    if(prop instanceof CollectionProperty)
    {
        Collection<Object> values = new LinkedList<Object>();
        PropertyIterator iter = prop.iterator();
        while(iter.hasNext())
        {
            try
            {
                values.add(unwrapProperty(null,iter.next(),Class.forName(type)));
            }
            catch(Exception e)
            {
                log.error("Couldn't convert object: " + prop.getObjectValue() + " to " + type,e);
            }
        }
        return values;
    }
    return null;
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:22,代码来源:TestBeanHelper.java


示例18: setValues

import org.apache.jmeter.testelement.property.PropertyIterator; //导入依赖的package包/类
/**
 * Get values from element to fill propertyMap and setup customizer 
 * @param element TestElement
 */
private void setValues(TestElement element) {
    // Copy all property values into the map:
    for (PropertyIterator jprops = element.propertyIterator(); jprops.hasNext();) {
        JMeterProperty jprop = jprops.next();
        propertyMap.put(jprop.getName(), jprop.getObjectValue());
    }
    
    if (customizer != null) {
        customizer.setObject(propertyMap);
    } else {
        if (initialized){
            remove(customizerIndexInPanel);
        }
        Customizer c = customizers.get(element);
        if (c == null) {
            c = createCustomizer();
            c.setObject(propertyMap);
            customizers.put(element, c);
        }
        add((Component) c, BorderLayout.CENTER);
    }
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:27,代码来源:TestBeanGUI.java


示例19: actionPerformed

import org.apache.jmeter.testelement.property.PropertyIterator; //导入依赖的package包/类
@Override
public void actionPerformed(ActionEvent e) {
    StringBuilder functionCall = new StringBuilder("${");
    functionCall.append(functionList.getText());
    Arguments args = (Arguments) parameterPanel.createTestElement();
    if (args.getArguments().size() > 0) {
        functionCall.append("(");
        PropertyIterator iter = args.iterator();
        boolean first = true;
        while (iter.hasNext()) {
            Argument arg = (Argument) iter.next().getObjectValue();
            if (!first) {
                functionCall.append(",");
            }
            functionCall.append(arg.getValue());
            first = false;
        }
        functionCall.append(")");
    }
    functionCall.append("}");
    cutPasteFunction.setText(functionCall.toString());
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:23,代码来源:FunctionHelper.java


示例20: configure

import org.apache.jmeter.testelement.property.PropertyIterator; //导入依赖的package包/类
@Override
public void configure(TestElement el) {
    initTableModel();
    paramTable.setModel(tableModel);
    UserParameters params = (UserParameters) el;
    CollectionProperty names = params.getNames();
    CollectionProperty threadValues = params.getThreadLists();
    tableModel.setColumnData(0, (List<?>) names.getObjectValue());
    PropertyIterator iter = threadValues.iterator();
    if (iter.hasNext()) {
        tableModel.setColumnData(1, (List<?>) iter.next().getObjectValue());
    }
    int count = 2;
    while (iter.hasNext()) {
        String colName = getUserColName(count);
        tableModel.addNewColumn(colName, String.class);
        tableModel.setColumnData(count, (List<?>) iter.next().getObjectValue());
        count++;
    }
    setColumnWidths();
    perIterationCheck.setSelected(params.isPerIteration());
    super.configure(el);
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:24,代码来源:UserParametersGui.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ZipFileObject类代码示例发布时间:2022-05-22
下一篇:
Java RMHeartbeatHandler类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap