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());
}
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());
}
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());
}
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);
}
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;
}
Aggregations