use of org.apache.jmeter.testelement.property.CollectionProperty in project jmeter-plugins by undera.
the class JMXMonCollector method initiateConnectors.
private void initiateConnectors() {
JMeterProperty prop = getSamplerSettings();
jmxMonSamplers.clear();
if (!(prop instanceof CollectionProperty)) {
log.warn("Got unexpected property: " + prop);
return;
}
CollectionProperty rows = (CollectionProperty) prop;
for (int i = 0; i < rows.size(); i++) {
ArrayList<Object> row = (ArrayList<Object>) rows.get(i).getObjectValue();
String label = ((JMeterProperty) row.get(0)).getStringValue();
JMeterProperty jmxUrl = (JMeterProperty) row.get(1);
String username = ((JMeterProperty) row.get(2)).getStringValue();
String password = ((JMeterProperty) row.get(3)).getStringValue();
String objectName = ((JMeterProperty) row.get(4)).getStringValue();
String attribute = ((JMeterProperty) row.get(5)).getStringValue();
String key = ((JMeterProperty) row.get(6)).getStringValue();
boolean isDelta = ((JMeterProperty) row.get(7)).getBooleanValue();
boolean canRetry = ((JMeterProperty) row.get(8)).getBooleanValue();
try {
Hashtable attributes = new Hashtable();
String[] buffer = { username, password };
attributes.put("jmx.remote.credentials", (String[]) buffer);
initiateConnector(attributes, jmxUrl, label, isDelta, objectName, attribute, key, canRetry);
} catch (MalformedURLException ex) {
// throw new RuntimeException(ex);
log.error("Malformed JMX url", ex);
} catch (IOException ex) {
log.error("IOException reading JMX", ex);
}
}
}
use of org.apache.jmeter.testelement.property.CollectionProperty in project jmeter-plugins by undera.
the class JMXMonGui method modifyTestElement.
@Override
public void modifyTestElement(TestElement te) {
super.modifyTestElement(te);
if (grid.isEditing()) {
grid.getCellEditor().stopCellEditing();
}
if (te instanceof JMXMonCollector) {
JMXMonCollector dmte = (JMXMonCollector) te;
CollectionProperty rows = JMeterPluginsUtils.tableModelRowsToCollectionProperty(tableModel, JMXMonCollector.DATA_PROPERTY);
dmte.setData(rows);
}
super.configureTestElement(te);
}
use of org.apache.jmeter.testelement.property.CollectionProperty in project jmeter-plugins by undera.
the class JMeterPluginsUtils method tableModelRowsToCollectionPropertyEval.
public static CollectionProperty tableModelRowsToCollectionPropertyEval(PowerTableModel model, String propname) {
CollectionProperty rows = new CollectionProperty(propname, new ArrayList<>());
for (int row = 0; row < model.getRowCount(); row++) {
List<Object> item = getArrayListForArrayEval(model.getRowData(row));
rows.addItem(item);
}
return rows;
}
use of org.apache.jmeter.testelement.property.CollectionProperty in project jmeter-plugins by undera.
the class FreeFormArrivalsThreadStarterTest method getRow.
private CollectionProperty getRow(int i, int i1, int i2) {
CollectionProperty row = new CollectionProperty();
row.addProperty(new StringProperty("", String.valueOf(i)));
row.addProperty(new StringProperty("", String.valueOf(i1)));
row.addProperty(new StringProperty("", String.valueOf(i2)));
return row;
}
use of org.apache.jmeter.testelement.property.CollectionProperty in project jmeter-plugins by undera.
the class FreeFormArrivalsThreadStarterTest method testSchedule.
@Test
public void testSchedule() throws Exception {
CollectionProperty sched = new CollectionProperty(FreeFormArrivalsThreadGroup.SCHEDULE, new LinkedHashSet<>());
sched.addProperty(getRow(1, 10, 30));
sched.addProperty(getRow(0, 0, 5));
sched.addProperty(getRow(10, 1, 15));
FreeFormArrivalsThreadGroup atg = new FreeFormArrivalsThreadGroup();
atg.setProperty(sched);
FreeFormArrivalsThreadStarterEmul obj = new FreeFormArrivalsThreadStarterEmul(atg);
for (int n = 0; n < 60; n++) {
log.info("Rate " + n + ": " + obj.getCurrentRate());
obj.addRollingTime(1000);
}
}
Aggregations