Search in sources :

Example 6 with CollectionProperty

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

the class UltimateThreadGroupGuiTest method testModifyTestElement.

/**
 */
@Test
public void testModifyTestElement() {
    System.out.println("modifyTestElement");
    UltimateThreadGroup tg = new UltimateThreadGroup();
    UltimateThreadGroupGui instance = new UltimateThreadGroupGui();
    instance.tableModel = UltimateThreadGroupTest.getTestModel();
    instance.modifyTestElement(tg);
    CollectionProperty data = (CollectionProperty) tg.getData();
    assertEquals(3, data.size());
    assertEquals("[[1, 2, 3, 4, 44], [5, 6, 7, 8, 88], [9, 10, 11, 12, 122]]", data.toString());
}
Also used : CollectionProperty(org.apache.jmeter.testelement.property.CollectionProperty) Test(org.junit.Test)

Example 7 with CollectionProperty

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

the class UltimateThreadGroupTest method testScheduleThread.

@Test
public void testScheduleThread() {
    System.out.println("scheduleThread");
    HashTree hashtree = new HashTree();
    hashtree.add(new LoopController());
    JMeterThread thread = new JMeterThread(hashtree, null, null);
    CollectionProperty prop = JMeterPluginsUtils.tableModelRowsToCollectionProperty(dataModel, UltimateThreadGroup.DATA_PROPERTY);
    instance.setData(prop);
    instance.testStarted();
    instance.scheduleThread(thread);
    assertTrue(thread.getStartTime() > 0);
    assertTrue(thread.getEndTime() > thread.getStartTime());
}
Also used : HashTree(org.apache.jorphan.collections.HashTree) CollectionProperty(org.apache.jmeter.testelement.property.CollectionProperty) JMeterThread(org.apache.jmeter.threads.JMeterThread) LoopController(org.apache.jmeter.control.LoopController)

Example 8 with CollectionProperty

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

the class UltimateThreadGroupTest method testGetData_broken_rename.

@Test
public void testGetData_broken_rename() {
    CollectionProperty prop = JMeterPluginsUtils.tableModelRowsToCollectionProperty(dataModel, UltimateThreadGroup.EXTERNAL_DATA_PROPERTY);
    instance.setProperty(prop);
    JMeterProperty result = instance.getData();
    assertNotNull(instance.getProperty(UltimateThreadGroup.DATA_PROPERTY));
    assertTrue(instance.getProperty(UltimateThreadGroup.EXTERNAL_DATA_PROPERTY) instanceof NullProperty);
    assertFalse(result instanceof NullProperty);
    assertEquals(prop.getStringValue(), result.getStringValue());
}
Also used : CollectionProperty(org.apache.jmeter.testelement.property.CollectionProperty) JMeterProperty(org.apache.jmeter.testelement.property.JMeterProperty) NullProperty(org.apache.jmeter.testelement.property.NullProperty)

Example 9 with CollectionProperty

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

the class UltimateThreadGroupTest method testGetNumThreads.

@Test
public void testGetNumThreads() {
    System.out.println("getNumThreads");
    CollectionProperty prop = JMeterPluginsUtils.tableModelRowsToCollectionProperty(dataModel, UltimateThreadGroup.DATA_PROPERTY);
    instance.setData(prop);
    instance.testStarted();
    int expResult = 15;
    int result = instance.getNumThreads();
    assertEquals(expResult, result);
}
Also used : CollectionProperty(org.apache.jmeter.testelement.property.CollectionProperty)

Example 10 with CollectionProperty

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

the class UltimateThreadGroup method getNumThreads.

@Override
public int getNumThreads() {
    int result = 0;
    JMeterProperty threadValues = getData();
    if (!(threadValues instanceof NullProperty)) {
        CollectionProperty columns = (CollectionProperty) threadValues;
        List<?> rows = (List<?>) columns.getObjectValue();
        for (Object row1 : rows) {
            CollectionProperty prop = (CollectionProperty) row1;
            ArrayList<JMeterProperty> row = (ArrayList<JMeterProperty>) prop.getObjectValue();
            // log.info(prop.getStringValue());
            result += row.get(0).getIntValue();
        }
    }
    return result;
}
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) ArrayList(java.util.ArrayList) List(java.util.List)

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