Search in sources :

Example 21 with CollectionProperty

use of org.apache.jmeter.testelement.property.CollectionProperty in project jmeter-plugins by undera.

the class PageDataExtractorOverTimeGui method add.

@Override
public void add(SampleResult res) {
    super.add(res);
    if (regExps == null && cmdRegExps == null) {
        return;
    }
    String pageBody = res.getResponseDataAsString();
    long time = normalizeTime(res.getEndTime());
    if (cmdRegExps == null) {
        PropertyIterator iter = regExps.iterator();
        while (iter.hasNext()) {
            CollectionProperty props = (CollectionProperty) iter.next();
            String label = props.get(0).getStringValue();
            String regExpValue = props.get(1).getStringValue();
            Boolean isDelta = props.get(2).getBooleanValue();
            Boolean isLabelRegExp = props.get(3).getBooleanValue();
            if (isLabelRegExp) {
                processPageRegExpLabel(pageBody, label, regExpValue, isDelta, time);
            } else {
                processPageLabel(pageBody, label, regExpValue, isDelta, time);
            }
        }
    } else {
        Iterator<Object> regExpIter = cmdRegExps.iterator();
        while (regExpIter.hasNext()) {
            String label = (String) regExpIter.next();
            String regExpValue = (String) regExpIter.next();
            boolean isDelta = (Boolean) regExpIter.next();
            boolean isLabelRegExp = (Boolean) regExpIter.next();
            if (isLabelRegExp) {
                processPageRegExpLabel(pageBody, label, regExpValue, isDelta, time);
            } else {
                processPageLabel(pageBody, label, regExpValue, isDelta, time);
            }
        }
    }
    updateGui(null);
}
Also used : CollectionProperty(org.apache.jmeter.testelement.property.CollectionProperty) PropertyIterator(org.apache.jmeter.testelement.property.PropertyIterator)

Example 22 with CollectionProperty

use of org.apache.jmeter.testelement.property.CollectionProperty in project jmeter-plugins by undera.

the class FirefoxDriverConfig method addExtensions.

private void addExtensions(FirefoxProfile profile) {
    JMeterProperty property = getProperty(EXTENSIONS_TO_LOAD);
    if (property instanceof NullProperty) {
        return;
    }
    CollectionProperty rows = (CollectionProperty) property;
    for (int i = 0; i < rows.size(); i++) {
        ArrayList row = (ArrayList) rows.get(i).getObjectValue();
        String filename = ((JMeterProperty) row.get(0)).getStringValue();
        try {
            profile.addExtension(new File(filename));
        } catch (IOException e) {
            log.error("Failed to add extension " + filename, e);
        }
    }
}
Also used : JMeterProperty(org.apache.jmeter.testelement.property.JMeterProperty) CollectionProperty(org.apache.jmeter.testelement.property.CollectionProperty) NullProperty(org.apache.jmeter.testelement.property.NullProperty) ArrayList(java.util.ArrayList) IOException(java.io.IOException) File(java.io.File)

Example 23 with CollectionProperty

use of org.apache.jmeter.testelement.property.CollectionProperty in project jmeter-plugins by undera.

the class VariableThroughputTimerGui method configure.

@Override
public void configure(TestElement tg) {
    // log.info("Configure");
    super.configure(tg);
    VariableThroughputTimer utg = (VariableThroughputTimer) tg;
    JMeterProperty threadValues = utg.getData();
    if (threadValues instanceof NullProperty) {
        log.warn("Received null property instead of collection");
        return;
    }
    CollectionProperty columns = (CollectionProperty) threadValues;
    tableModel.removeTableModelListener(this);
    JMeterPluginsUtils.collectionPropertyToTableModelRows(columns, tableModel);
    tableModel.addTableModelListener(this);
    buttons.checkDeleteButtonStatus();
    updateUI();
}
Also used : JMeterProperty(org.apache.jmeter.testelement.property.JMeterProperty) CollectionProperty(org.apache.jmeter.testelement.property.CollectionProperty) NullProperty(org.apache.jmeter.testelement.property.NullProperty)

Example 24 with CollectionProperty

use of org.apache.jmeter.testelement.property.CollectionProperty in project jmeter-plugins by undera.

the class VariableThroughputTimerGuiTest method testConfigure.

/**
 */
@Test
public void testConfigure() {
    System.out.println("configure");
    VariableThroughputTimer tg = new VariableThroughputTimer();
    CollectionProperty rows = JMeterPluginsUtils.tableModelRowsToCollectionProperty(dataModel, VariableThroughputTimer.DATA_PROPERTY);
    tg.setData(rows);
    VariableThroughputTimerGui instance = new VariableThroughputTimerGui();
    // tg.setProperty(new ObjectProperty(AbstractThreadGroup.MAIN_CONTROLLER, tg));
    instance.configure(tg);
    Assert.assertEquals(4, instance.tableModel.getRowCount());
    Assert.assertEquals(4, instance.grid.getRowCount());
}
Also used : CollectionProperty(org.apache.jmeter.testelement.property.CollectionProperty)

Example 25 with CollectionProperty

use of org.apache.jmeter.testelement.property.CollectionProperty in project jmeter-plugins by undera.

the class VariableThroughputTimerTest method testGetData.

/**
 * Test of getData method, of class VariableThroughputTimer.
 */
@Test
public void testGetData() {
    System.out.println("getData");
    VariableThroughputTimer instance = new VariableThroughputTimer();
    instance.setData(new CollectionProperty(VariableThroughputTimer.DATA_PROPERTY, new LinkedList()));
    JMeterProperty result = instance.getData();
    // System.err.println(result.getClass().getCanonicalName());
    assertTrue(result instanceof CollectionProperty);
}
Also used : CollectionProperty(org.apache.jmeter.testelement.property.CollectionProperty) JMeterProperty(org.apache.jmeter.testelement.property.JMeterProperty) LinkedList(java.util.LinkedList) Test(org.junit.Test)

Aggregations

CollectionProperty (org.apache.jmeter.testelement.property.CollectionProperty)91 JMeterProperty (org.apache.jmeter.testelement.property.JMeterProperty)29 ArrayList (java.util.ArrayList)19 NullProperty (org.apache.jmeter.testelement.property.NullProperty)13 Test (org.junit.Test)11 PropertyIterator (org.apache.jmeter.testelement.property.PropertyIterator)8 Test (org.junit.jupiter.api.Test)7 IOException (java.io.IOException)5 List (java.util.List)4 StringProperty (org.apache.jmeter.testelement.property.StringProperty)4 File (java.io.File)3 Argument (org.apache.jmeter.config.Argument)3 PowerTableModel (org.apache.jmeter.gui.util.PowerTableModel)3 TestPlan (org.apache.jmeter.testelement.TestPlan)3 UnsupportedEncodingException (java.io.UnsupportedEncodingException)2 Field (java.lang.reflect.Field)2 MalformedURLException (java.net.MalformedURLException)2 URL (java.net.URL)2 UnknownHostException (java.net.UnknownHostException)2 LinkedList (java.util.LinkedList)2