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

Java Argument类代码示例

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

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



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

示例1: getUserAttributes

import org.apache.jmeter.config.Argument; //导入依赖的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;

    for (JMeterProperty jMeterProperty : getArguments()) {
        Argument item = (Argument) jMeterProperty.getObjectValue();
        attr = getBasicAttribute(item.getName(), item.getValue());
        attrs.put(attr);
    }
    return attrs;
}
 
开发者ID:johrstrom,项目名称:cloud-meter,代码行数:25,代码来源:LDAPSampler.java


示例2: getUserAttributes

import org.apache.jmeter.config.Argument; //导入依赖的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;

    for (JMeterProperty jMeterProperty : getArguments()) {
        Argument item = (Argument) jMeterProperty.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:johrstrom,项目名称:cloud-meter,代码行数:24,代码来源:LDAPExtSampler.java


示例3: getUserAttributes

import org.apache.jmeter.config.Argument; //导入依赖的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


示例4: getUserAttributes

import org.apache.jmeter.config.Argument; //导入依赖的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


示例5: actionPerformed

import org.apache.jmeter.config.Argument; //导入依赖的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


示例6: testGrabSessionIdFromForm

import org.apache.jmeter.config.Argument; //导入依赖的package包/类
public void testGrabSessionIdFromForm() throws Exception {
    String[] html = new String[] { 
            "<input name=\"sid\" value=\"myId\">", 
            "<input name='sid' value='myId'>",
            "<input value=\"myId\" NAME='sid'>",
            "<input VALUE='myId' name=\"sid\">",
            "<input blah blah value=\"myId\" yoda yoda NAME='sid'>",
            "<input type=\"HIDDEN\" name=\"sid\"      value=\"myId\">",
            "<input type=\"HIDDEN\" name=\"sid\"\tvalue=\"myId\">",
            };
    for (int i = 0; i < html.length; i++) {
        response = new SampleResult();
        response.setResponseData(html[i], null);
        URLRewritingModifier newMod = new URLRewritingModifier();
        newMod.setThreadContext(context);
        newMod.setArgumentName("sid");
        newMod.setPathExtension(false);
        HTTPSamplerBase sampler = createSampler();
        context.setCurrentSampler(sampler);
        context.setPreviousResult(response);
        newMod.process();
        Arguments args = sampler.getArguments();
        assertEquals("For case i=" + i, "myId", 
                ((Argument) args.getArguments().get(0).getObjectValue()).getValue());
    }
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:27,代码来源:TestURLRewritingModifier.java


示例7: testCache

import org.apache.jmeter.config.Argument; //导入依赖的package包/类
public void testCache() throws Exception {
    String[] html = new String[] { 
            "<input name=\"sid\" value=\"myId\">", 
            "<html></html>", // No entry; check it is still present
            };
    URLRewritingModifier newMod = new URLRewritingModifier();
    newMod.setShouldCache(true);
    newMod.setThreadContext(context);
    newMod.setArgumentName("sid");
    newMod.setPathExtension(false);
    for (int i = 0; i < html.length; i++) {
        response = new SampleResult();
        response.setResponseData(html[i], null);
        HTTPSamplerBase sampler = createSampler();
        context.setCurrentSampler(sampler);
        context.setPreviousResult(response);
        newMod.process();
        Arguments args = sampler.getArguments();
        assertEquals("For case i=" + i, "myId", 
                ((Argument) args.getArguments().get(0).getObjectValue()).getValue());
    }
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:23,代码来源:TestURLRewritingModifier.java


示例8: testNoCache

import org.apache.jmeter.config.Argument; //导入依赖的package包/类
public void testNoCache() throws Exception {
    String[] html = new String[] { 
            "<input name=\"sid\" value=\"myId\">",  "myId",
            "<html></html>", "",
            };
    URLRewritingModifier newMod = new URLRewritingModifier();
    newMod.setThreadContext(context);
    newMod.setArgumentName("sid");
    newMod.setPathExtension(false);
    newMod.setShouldCache(false);
    for (int i = 0; i < html.length/2; i++) {
        response = new SampleResult();
        response.setResponseData(html[i*2], null);
        HTTPSamplerBase sampler = createSampler();
        context.setCurrentSampler(sampler);
        context.setPreviousResult(response);
        newMod.process();
        Arguments args = sampler.getArguments();
        assertEquals("For case i=" + i, html[i*2+1], 
                ((Argument) args.getArguments().get(0).getObjectValue()).getValue());
    }
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:23,代码来源:TestURLRewritingModifier.java


示例9: setDefaults

import org.apache.jmeter.config.Argument; //导入依赖的package包/类
private void setDefaults(TestElement element, Arguments defaults) {
	for (JMeterProperty property : defaults) {
		Object o = property.getObjectValue();
		Argument argument = Argument.class.cast(o);
		String name = argument.getName();
		String value = argument.getValue();
		element.setProperty(name, value);
	}
}
 
开发者ID:qas-guru,项目名称:martini-jmeter-extension,代码行数:10,代码来源:AbstractMartiniPreProcessorGui.java


示例10: process

import org.apache.jmeter.config.Argument; //导入依赖的package包/类
@Override
public void process() {
    if (log.isDebugEnabled()) {
        log.debug(Thread.currentThread().getName() + " Running up named: " + getName());//$NON-NLS-1$
    }
    Sampler entry = getThreadContext().getCurrentSampler();
    if (!(entry instanceof HTTPSamplerBase)) {
        return;
    }

    Map<String, String> paramMap = buildParamsMap();
    if(paramMap == null || paramMap.isEmpty()){
        log.info("RegExUserParameters element:"+getName()+" => Referenced RegExp was not found, no parameter will be changed");
        return;
    }

    HTTPSamplerBase sampler = (HTTPSamplerBase) entry;
    for (JMeterProperty jMeterProperty : sampler.getArguments()) {
        Argument arg = (Argument) jMeterProperty.getObjectValue();
        String oldValue = arg.getValue();
        // if parameter name exists in http request
        // then change its value with value obtained with regular expression
        String val = paramMap.get(arg.getName());
        if (val != null) {
            arg.setValue(val);
        }
        if (log.isDebugEnabled()) {
            log.debug("RegExUserParameters element:" + getName() + " => changed parameter: " + arg.getName() + " = " + arg.getValue() + ", was:" + oldValue);
        }
    }
}
 
开发者ID:johrstrom,项目名称:cloud-meter,代码行数:32,代码来源:RegExUserParameters.java


示例11: convertArgumentsToHTTP

import org.apache.jmeter.config.Argument; //导入依赖的package包/类
/**
 * Converts all {@link Argument} entries in the collection to {@link HTTPArgument} entries.
 * 
 * @param args collection of {@link Argument} and/or {@link HTTPArgument} entries
 */
public static void convertArgumentsToHTTP(Arguments args) {
    List<Argument> newArguments = new LinkedList<>();
    for (JMeterProperty jMeterProperty : args.getArguments()) {
        Argument arg = (Argument) jMeterProperty.getObjectValue();
        if (!(arg instanceof HTTPArgument)) {
            newArguments.add(new HTTPArgument(arg));
        } else {
            newArguments.add(arg);
        }
    }
    args.removeAllArguments();
    args.setArguments(newArguments);
}
 
开发者ID:johrstrom,项目名称:cloud-meter,代码行数:19,代码来源:HTTPArgument.java


示例12: getUserModAttributes

import org.apache.jmeter.config.Argument; //导入依赖的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 Modify test.
 *
 * @return the BasicAttributes
 */
private ModificationItem[] getUserModAttributes() {
    ModificationItem[] mods = new ModificationItem[getArguments().getArguments().size()];
    BasicAttribute attr;
    PropertyIterator iter = getArguments().iterator();
    int count = 0;
    while (iter.hasNext()) {
        Argument item = (Argument) iter.next().getObjectValue();
        attr = getBasicAttribute(item.getName(), item.getValue());
        mods[count] = new ModificationItem(DirContext.REPLACE_ATTRIBUTE, attr);
        count = +1;
    }
    return mods;
}
 
开发者ID:johrstrom,项目名称:cloud-meter,代码行数:21,代码来源:LDAPSampler.java


示例13: getHeaderFields

import org.apache.jmeter.config.Argument; //导入依赖的package包/类
public CollectionProperty getHeaderFields() {
    CollectionProperty result = new CollectionProperty();
    result.setName(SmtpSampler.HEADER_FIELDS);
    for (Iterator<JTextField> iterator = headerFields.keySet().iterator(); iterator.hasNext();) {
        JTextField headerName = iterator.next();
        String name = headerName.getText();
        String value = headerFields.get(headerName).getText();
        Argument argument = new Argument(name, value);
        result.addItem(argument);
    }
    return result;
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:13,代码来源:SmtpPanel.java


示例14: setHeaderFields

import org.apache.jmeter.config.Argument; //导入依赖的package包/类
public void setHeaderFields(CollectionProperty fields) {
    clearHeaderFields();
    for (int i = 0; i < fields.size(); i++) {
        Argument argument = (Argument)((TestElementProperty)fields.get(i)).getObjectValue();
        String name = argument.getName();
        JButton removeButton = addHeaderActionPerformed(null);
        JTextField nameTF = removeButtons.get(removeButton);
        nameTF.setText(name);
        JTextField valueTF = headerFields.get(nameTF);
        valueTF.setText(argument.getValue());
    }
    validate();
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:14,代码来源:SmtpPanel.java


示例15: modifyArgument

import org.apache.jmeter.config.Argument; //导入依赖的package包/类
/**
 * Helper method for {@link #modifyEntry} Replaces a parameter's value if
 * the parameter name matches the mask name and the value is a '*'.
 *
 * @param arg
 *            an {@link Argument} representing a http parameter
 * @return <code>true</code>if the value was replaced
 */
private boolean modifyArgument(Argument arg) {
    // if a mask for this argument exists
    if (arg.getName().equals(getMask().getFieldName())) {
        // values to be masked must be set in the WebApp to "*"
        if ("*".equals(arg.getValue())) {
            arg.setValue(getMask().getNextValue());
            return true;
        }
    }
    return false;
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:20,代码来源:ParamModifier.java


示例16: process

import org.apache.jmeter.config.Argument; //导入依赖的package包/类
@Override
public void process() {
    if (log.isDebugEnabled()) {
        log.debug(Thread.currentThread().getName() + " Running up named: " + getName());//$NON-NLS-1$
    }
    Sampler entry = getThreadContext().getCurrentSampler();
    if (!(entry instanceof HTTPSamplerBase)) {
        return;
    }

    Map<String, String> paramMap = buildParamsMap();
    if(paramMap == null || paramMap.isEmpty()){
        log.info("RegExUserParameters element:"+getName()+" => Referenced RegExp was not found, no parameter will be changed");
        return;
    }

    HTTPSamplerBase sampler = (HTTPSamplerBase) entry;
    PropertyIterator iter = sampler.getArguments().iterator();
    while (iter.hasNext()) {
        Argument arg = (Argument) iter.next().getObjectValue();
        String oldValue = arg.getValue();
        // if parameter name exists in http request
        // then change its value with value obtained with regular expression
        String val = paramMap.get(arg.getName());
        if (val != null) {
            arg.setValue(val);
        }
        if (log.isDebugEnabled()){
            log.debug("RegExUserParameters element:"+getName()+" => changed parameter: "+arg.getName() +" = "+ arg.getValue()+", was:"+oldValue);
        }
    }
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:33,代码来源:RegExUserParameters.java


示例17: convertArgumentsToHTTP

import org.apache.jmeter.config.Argument; //导入依赖的package包/类
/**
 * Converts all {@link Argument} entries in the collection to {@link HTTPArgument} entries.
 * 
 * @param args collection of {@link Argument} and/or {@link HTTPArgument} entries
 */
public static void convertArgumentsToHTTP(Arguments args) {
    List<Argument> newArguments = new LinkedList<Argument>();
    PropertyIterator iter = args.getArguments().iterator();
    while (iter.hasNext()) {
        Argument arg = (Argument) iter.next().getObjectValue();
        if (!(arg instanceof HTTPArgument)) {
            newArguments.add(new HTTPArgument(arg));
        } else {
            newArguments.add(arg);
        }
    }
    args.removeAllArguments();
    args.setArguments(newArguments);
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:20,代码来源:HTTPArgument.java


示例18: makeArgumentsPanel

import org.apache.jmeter.config.Argument; //导入依赖的package包/类
/**
 * @return JPanel Arguments Panel
 */
private JPanel makeArgumentsPanel() {
    argsPanel = new ArgumentsPanel(JMeterUtils.getResString("arguments_panel_title"), null, true, false ,  // $NON-NLS-1$
            new ObjectTableModel(new String[] { ArgumentsPanel.COLUMN_RESOURCE_NAMES_1 },
                    Argument.class,
                    new Functor[] {
                    new Functor("getValue") },  // $NON-NLS-1$
                    new Functor[] {
                    new Functor("setValue") }, // $NON-NLS-1$
                    new Class[] {String.class }));
    return argsPanel;
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:15,代码来源:SystemSamplerGui.java


示例19: configure

import org.apache.jmeter.config.Argument; //导入依赖的package包/类
/**
 * A newly created component can be initialized with the contents of a Test
 * Element object by calling this method. The component is responsible for
 * querying the Test Element object for the relevant information to display
 * in its GUI.
 *
 * @param el
 *            the TestElement to configure
 */
@Override
public void configure(TestElement el) {
    super.configure(el);
    if (el instanceof Arguments) {
        tableModel.clearData();
        PropertyIterator iter = ((Arguments) el).iterator();
        while (iter.hasNext()) {
            Argument arg = (Argument) iter.next().getObjectValue();
            tableModel.addRow(arg);
        }
    }
    checkDeleteStatus();
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:23,代码来源:ArgumentsPanel.java


示例20: addFromClipboard

import org.apache.jmeter.config.Argument; //导入依赖的package包/类
/**
 * Add values from the clipboard
 */
protected void addFromClipboard() {
    GuiUtils.stopTableEditing(table);
    int rowCount = table.getRowCount();
    try {
        String clipboardContent = GuiUtils.getPastedText();
        String[] clipboardLines = clipboardContent.split("\n");
        for (String clipboardLine : clipboardLines) {
            String[] clipboardCols = clipboardLine.split("\t");
            if (clipboardCols.length > 0) {
                Argument argument = makeNewArgument();
                argument.setName(clipboardCols[0]);
                if (clipboardCols.length > 1) {
                    argument.setValue(clipboardCols[1]);
                    if (clipboardCols.length > 2) {
                        argument.setDescription(clipboardCols[2]);
                    }
                }
                tableModel.addRow(argument);
            }
        }
        if (table.getRowCount() > rowCount) {
            // Enable DELETE (which may already be enabled, but it won't hurt)
            delete.setEnabled(true);

            // Highlight (select) the appropriate rows.
            int rowToSelect = tableModel.getRowCount() - 1;
            table.setRowSelectionInterval(rowCount, rowToSelect);
        }
    } catch (IOException ioe) {
        JOptionPane.showMessageDialog(this,
                "Could not add read arguments from clipboard:\n" + ioe.getLocalizedMessage(), "Error",
                JOptionPane.ERROR_MESSAGE);
    } catch (UnsupportedFlavorException ufe) {
        JOptionPane.showMessageDialog(this,
                "Could not add retrieve " + DataFlavor.stringFlavor.getHumanPresentableName()
                        + " from clipboard" + ufe.getLocalizedMessage(), "Error", JOptionPane.ERROR_MESSAGE);
    }
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:42,代码来源:ArgumentsPanel.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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