Search in sources :

Example 1 with UserParameters

use of org.apache.jmeter.modifiers.UserParameters in project jmeter by apache.

the class UserParametersGui method configure.

@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);
}
Also used : UserParameters(org.apache.jmeter.modifiers.UserParameters) CollectionProperty(org.apache.jmeter.testelement.property.CollectionProperty) PropertyIterator(org.apache.jmeter.testelement.property.PropertyIterator)

Example 2 with UserParameters

use of org.apache.jmeter.modifiers.UserParameters in project jmeter by apache.

the class UserParametersGui method modifyTestElement.

/**
     * Modifies a given TestElement to mirror the data in the gui components.
     *
     * @see org.apache.jmeter.gui.JMeterGUIComponent#modifyTestElement(TestElement)
     */
@Override
public void modifyTestElement(TestElement params) {
    GuiUtils.stopTableEditing(paramTable);
    UserParameters userParams = (UserParameters) params;
    userParams.setNames(new CollectionProperty(UserParameters.NAMES, tableModel.getColumnData(NAME_COL_RESOURCE)));
    CollectionProperty threadLists = new CollectionProperty(UserParameters.THREAD_VALUES, new ArrayList<>());
    log.debug("making threadlists from gui");
    for (int col = 1; col < tableModel.getColumnCount(); col++) {
        threadLists.addItem(tableModel.getColumnData(getUserColName(col)));
        if (log.isDebugEnabled()) {
            log.debug("Adding column to threadlist: {}", tableModel.getColumnData(getUserColName(col)));
            log.debug("Threadlists now = {}", threadLists);
        }
    }
    if (log.isDebugEnabled()) {
        log.debug("In the end, threadlists = {}", threadLists);
    }
    userParams.setThreadLists(threadLists);
    userParams.setPerIteration(perIterationCheck.isSelected());
    super.configureTestElement(params);
}
Also used : UserParameters(org.apache.jmeter.modifiers.UserParameters) CollectionProperty(org.apache.jmeter.testelement.property.CollectionProperty)

Example 3 with UserParameters

use of org.apache.jmeter.modifiers.UserParameters in project jmeter by apache.

the class UserParametersGui method createTestElement.

/**
     * @see org.apache.jmeter.gui.JMeterGUIComponent#createTestElement()
     */
@Override
public TestElement createTestElement() {
    UserParameters params = new UserParameters();
    modifyTestElement(params);
    return params;
}
Also used : UserParameters(org.apache.jmeter.modifiers.UserParameters)

Aggregations

UserParameters (org.apache.jmeter.modifiers.UserParameters)3 CollectionProperty (org.apache.jmeter.testelement.property.CollectionProperty)2 PropertyIterator (org.apache.jmeter.testelement.property.PropertyIterator)1