org.apache.jmeter.gui.util.PowerTableModel Java Examples
The following examples show how to use
org.apache.jmeter.gui.util.PowerTableModel.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ButtonPanelAddCopyRemove.java From jmeter-plugins with Apache License 2.0 | 6 votes |
public ButtonPanelAddCopyRemove(JTable grid, PowerTableModel tableModel, Object[] defaultValues) { setLayout(new GridLayout(1, 2)); JButton addRowButton = new JButton("Add Row"); JButton copyRowButton = new JButton("Copy Row"); deleteRowButton = new JButton("Delete Row"); addRowButton.addActionListener(new AddRowAction(this, grid, tableModel, deleteRowButton, defaultValues)); copyRowButton.addActionListener(new CopyRowAction(this, grid, tableModel, deleteRowButton)); deleteRowButton.addActionListener(new DeleteRowAction(this, grid, tableModel, deleteRowButton)); add(addRowButton); add(copyRowButton); add(deleteRowButton); this.tableModel = tableModel; }
Example #2
Source File: VariableThroughputTimerGuiTest.java From jmeter-plugins with Apache License 2.0 | 6 votes |
@Before public void setUp() { dataModel = new PowerTableModel(VariableThroughputTimer.columnIdentifiers, VariableThroughputTimer.columnClasses); dataModel.addRow(new Integer[]{ 1, 10, 3 }); dataModel.addRow(new Integer[]{ 15, 15, 3 }); dataModel.addRow(new Integer[]{ 15, 1, 3 }); dataModel.addRow(new Integer[]{ 1, 1, 1 }); }
Example #3
Source File: VariableThroughputTimer.java From jmeter-plugins with Apache License 2.0 | 6 votes |
private void trySettingLoadFromProperty() { String loadProp = JMeterUtils.getProperty(DATA_PROPERTY); log.debug("Loading property: {}={}", DATA_PROPERTY, loadProp); if (!StringUtils.isEmpty(loadProp)) { log.info("GUI load profile will be ignored as property {} is defined", DATA_PROPERTY); PowerTableModel dataModel = new PowerTableModel(VariableThroughputTimer.columnIdentifiers, VariableThroughputTimer.columnClasses); String[] chunks = loadProp.split("\\)"); for (String chunk : chunks) { try { parseChunk(chunk, dataModel); } catch (RuntimeException e) { log.warn("Wrong load chunk {} will be ignored", chunk, e); } } log.info("Setting load profile from property {}: {}", DATA_PROPERTY, loadProp); overrideProp = JMeterPluginsUtils.tableModelRowsToCollectionProperty(dataModel, VariableThroughputTimer.DATA_PROPERTY); } }
Example #4
Source File: WeightedSwitchControllerTest.java From jmeter-bzm-plugins with Apache License 2.0 | 6 votes |
@Test public void testGeneric() { WeightedSwitchController obj = new WeightedSwitchController(); obj.addTestElement(getSampler("0")); obj.addTestElement(getSampler("1")); obj.addTestElement(getSampler("2")); obj.addTestElement(getSampler("5")); PowerTableModel mdl = new PowerTableModel(new String[]{"name", WeightedSwitchController.WEIGHTS}, new Class[]{String.class, String.class}); mdl.addRow(new String[]{"0", "0"}); mdl.addRow(new String[]{"1", "1"}); mdl.addRow(new String[]{"2", "2"}); mdl.addRow(new String[]{"5", "5"}); obj.setData(mdl); for (int n = 0; n < 800; n++) { Sampler s = obj.next(); log.info("Sampler: " + s.getName()); assertNotNull(s); assertNull(obj.next()); assertNotEquals(s.getName(), "0"); } }
Example #5
Source File: UltimateThreadGroupTest.java From jmeter-plugins with Apache License 2.0 | 6 votes |
public static PowerTableModel getTestModel() { PowerTableModel ret = new PowerTableModel(UltimateThreadGroupGui.columnIdentifiers, UltimateThreadGroupGui.columnClasses); ret.addRow(new Integer[] { 1, 2, 3, 4, 44 }); ret.addRow(new Integer[] { 5, 6, 7, 8, 88 }); ret.addRow(new Integer[] { 9, 10, 11, 12, 122 }); return ret; }
Example #6
Source File: UltimateThreadGroup.java From jmeter-plugins with Apache License 2.0 | 6 votes |
private static void parseChunk(String chunk, PowerTableModel model) { log.debug("Parsing chunk: " + chunk); String[] parts = chunk.split("[(,]"); String loadVar = parts[0].trim(); if (loadVar.equalsIgnoreCase("spawn")) { Integer[] row = new Integer[5]; row[START_THREADS_CNT_FIELD_NO] = Integer.parseInt(parts[1].trim()); row[INIT_DELAY_FIELD_NO] = JMeterPluginsUtils.getSecondsForShortString(parts[2]); row[STARTUP_TIME_FIELD_NO] = JMeterPluginsUtils.getSecondsForShortString(parts[3]); row[HOLD_LOAD_FOR_FIELD_NO] = JMeterPluginsUtils.getSecondsForShortString(parts[4]); row[SHUTDOWN_TIME_FIELD_NO] = JMeterPluginsUtils.getSecondsForShortString(parts[5]); model.addRow(row); } else { throw new RuntimeException("Unknown load type: " + parts[0]); } }
Example #7
Source File: UltimateThreadGroup.java From jmeter-plugins with Apache License 2.0 | 6 votes |
private CollectionProperty getLoadFromExternalProperty() { String loadProp = JMeterUtils.getProperty(EXTERNAL_DATA_PROPERTY); log.debug("Profile prop: " + loadProp); if (loadProp != null && loadProp.length() > 0) { //expected format : threads_schedule="spawn(1,1s,1s,1s,1s) spawn(2,1s,3s,1s,2s)" log.info("GUI threads profile will be ignored"); PowerTableModel dataModel = new PowerTableModel(UltimateThreadGroupGui.columnIdentifiers, UltimateThreadGroupGui.columnClasses); String[] chunks = loadProp.split("\\)"); for (String chunk : chunks) { try { parseChunk(chunk, dataModel); } catch (RuntimeException e) { log.warn("Wrong chunk ignored: " + chunk, e); } } log.info("Setting threads profile from property " + EXTERNAL_DATA_PROPERTY + ": " + loadProp); return JMeterPluginsUtils.tableModelRowsToCollectionProperty(dataModel, UltimateThreadGroup.DATA_PROPERTY); } return null; }
Example #8
Source File: JMeterPluginsUtils.java From jmeter-plugins with Apache License 2.0 | 6 votes |
public static void collectionPropertyToTableModelRows(CollectionProperty prop, PowerTableModel model, Class[] columnClasses) { model.clearData(); for (int rowN = 0; rowN < prop.size(); rowN++) { ArrayList<StringProperty> rowStrings = (ArrayList<StringProperty>) prop.get(rowN).getObjectValue(); ArrayList<Object> rowObject = new ArrayList<>(rowStrings.size()); for (int i = 0; i < columnClasses.length && i < rowStrings.size(); i++) { rowObject.add(convertToClass(rowStrings.get(i), columnClasses[i])); } //for now work only if new fields are added at the end... //needed for retro compatibility if new fields added if (rowObject.size() < columnClasses.length) { for (int i = rowObject.size(); i < columnClasses.length; i++) { rowObject.add(new Object()); } } model.addRow(rowObject.toArray()); } model.fireTableDataChanged(); }
Example #9
Source File: JMXMonTest.java From jmeter-plugins with Apache License 2.0 | 5 votes |
@Before public void setUp() { TestJMeterUtils.createJmeterEnv(); dataModel = new PowerTableModel(JMXMonGui.columnIdentifiers, JMXMonGui.columnClasses); dataModel.addRow(new Object[]{PROBE1, URL, USERNAME, PASSWORD, OBJ_NAME1, ATTRIBUTE1, "", false, false}); dataModel.addRow(new Object[]{PROBE2, URL, USERNAME, PASSWORD, OBJ_NAME2, ATTRIBUTE2, "", true, false}); }
Example #10
Source File: Grid.java From jmeter-plugins with Apache License 2.0 | 5 votes |
private JTable createGrid(String[] columnIdentifiers, Class<?>[] columnClasses) { tableModel = new PowerTableModel(columnIdentifiers, columnClasses); grid.setModel(tableModel); grid.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); grid.setMinimumSize(new Dimension(200, 100)); return grid; }
Example #11
Source File: JMeterPluginsUtilsTest.java From jmeter-plugins with Apache License 2.0 | 5 votes |
private PowerTableModel getTestModel() { String[] headers = {"col1", "col2"}; Class[] classes = {String.class, String.class}; PowerTableModel model = new PowerTableModel(headers, classes); String[] row1 = {"1", "2"}; String[] row2 = {"3", "4"}; model.addRow(row1); model.addRow(row2); return model; }
Example #12
Source File: JMeterPluginsUtilsTest.java From jmeter-plugins with Apache License 2.0 | 5 votes |
@Test public void testCollectionPropertyToTableModelRows() { System.out.println("collectionPropertyToTableModelRows"); String propname = "prop"; PowerTableModel modelSrc = getTestModel(); CollectionProperty propExp = JMeterPluginsUtils.tableModelRowsToCollectionProperty(modelSrc, propname); PowerTableModel modelDst = getTestModel(); modelDst.clearData(); JMeterPluginsUtils.collectionPropertyToTableModelRows(propExp, modelDst); CollectionProperty propRes = JMeterPluginsUtils.tableModelRowsToCollectionProperty(modelDst, propname); assertEquals(propExp.toString(), propRes.toString()); }
Example #13
Source File: JMeterPluginsUtilsTest.java From jmeter-plugins with Apache License 2.0 | 5 votes |
@Test public void testTableModelRowsToCollectionPropertyEval() { System.out.println("tableModelRowsToCollectionPropertyEval"); PowerTableModel model = getTestModel(); String propname = "prop"; CollectionProperty result = JMeterPluginsUtils.tableModelRowsToCollectionPropertyEval(model, propname); assertEquals(2, result.size()); assertEquals("[[1, 2], [3, 4]]", result.toString()); }
Example #14
Source File: CopyRowActionTest.java From jmeter-plugins with Apache License 2.0 | 5 votes |
/** * Test of actionPerformed method, of class CopyRowAction. */ @Test public void testActionPerformed() { System.out.println("actionPerformed"); ActionEvent e = null; CopyRowAction instance = new CopyRowAction(new JPanel(), new JTable(), new PowerTableModel(TableModelEmul.columnIdentifiers, TableModelEmul.columnClasses), new JButton()); instance.actionPerformed(e); }
Example #15
Source File: AddRowActionTest.java From jmeter-plugins with Apache License 2.0 | 5 votes |
/** * Test of actionPerformed method, of class AddRowAction. */ @Test public void testActionPerformed() { System.out.println("actionPerformed"); AddRowAction instance = new AddRowAction( new JPanel(), new JTable(), new PowerTableModel(TableModelEmul.columnIdentifiers, TableModelEmul.columnClasses), new JButton(), TableModelEmul.defaultValues); instance.actionPerformed(null); }
Example #16
Source File: DeleteRowActionTest.java From jmeter-plugins with Apache License 2.0 | 5 votes |
/** * Test of actionPerformed method, of class DeleteRowAction. */ @Test public void testActionPerformed() { System.out.println("actionPerformed"); ActionEvent e = null; DeleteRowAction instance = new DeleteRowAction(new JPanel(), new JTable(), new PowerTableModel(TableModelEmul.columnIdentifiers, TableModelEmul.columnClasses), new JButton()); instance.actionPerformed(e); }
Example #17
Source File: JMeterPluginsUtilsTest.java From jmeter-plugins with Apache License 2.0 | 5 votes |
@Test public void testTableModelRowsToCollectionProperty() { System.out.println("tableModelRowsToCollectionProperty"); PowerTableModel model = getTestModel(); String propname = "prop"; CollectionProperty result = JMeterPluginsUtils.tableModelRowsToCollectionProperty(model, propname); assertEquals(2, result.size()); assertEquals("[[1, 2], [3, 4]]", result.toString()); }
Example #18
Source File: DbmonTest.java From jmeter-plugins with Apache License 2.0 | 5 votes |
@Before public void setUp() { TestJMeterUtils.createJmeterEnv(); JMeterContextService.getContext().getVariables().putObject(TEST_CONNECTION, new TestDataSource()); dataModel = new PowerTableModel(DbMonGui.columnIdentifiers, DbMonGui.columnClasses); dataModel.addRow(new Object[]{TEST_CONNECTION, PROBE1, false, QUERY1}); dataModel.addRow(new Object[]{TEST_CONNECTION, PROBE2, true, QUERY2}); }
Example #19
Source File: VariableThroughputTimerTest.java From jmeter-plugins with Apache License 2.0 | 5 votes |
@Before public void setUp() { dataModel = new PowerTableModel(VariableThroughputTimer.columnIdentifiers, VariableThroughputTimer.columnClasses); dataModel.addRow(new Integer[]{ 1, 10, 3 }); dataModel.addRow(new Integer[]{ 15, 15, 3 }); dataModel.addRow(new Integer[]{ 15, 1, 3 }); }
Example #20
Source File: AddRowAction.java From jmeter-plugins with Apache License 2.0 | 5 votes |
public AddRowAction(JComponent aSender, JTable grid, PowerTableModel tableModel, JButton deleteRowButton, Object[] defaultValues) { this.grid = grid; this.tableModel = tableModel; this.deleteRowButton = deleteRowButton; this.defaultValues = defaultValues; this.sender = aSender; }
Example #21
Source File: ParallelHTTPSamplerTest.java From jmeter-bzm-plugins with Apache License 2.0 | 5 votes |
@Test public void sample() throws Exception { ParallelHTTPSampler obj = new ParallelHTTPSamplerMock(); obj.setName("parent"); //obj.setConcurrentDwn(false); //FIXME: remove or comment this PowerTableModel dataModel = new PowerTableModel(ParallelHTTPSampler.columnIdentifiers, ParallelHTTPSampler.columnClasses); dataModel.addRow(new String[]{"http://localhost:8000/rtimes/const?delay=1"}); dataModel.addRow(new String[]{"http://localhost:8000/rtimes/const?delay=2"}); CollectionProperty prop = JMeterPluginsUtils.tableModelRowsToCollectionProperty(dataModel, ParallelHTTPSampler.DATA_PROPERTY); obj.setData(prop); SampleResult res = obj.sample(); assertTrue(res.isSuccessful()); assertEquals(2, res.getSubResults().length); }
Example #22
Source File: JMeterPluginsUtils.java From jmeter-plugins with Apache License 2.0 | 5 votes |
public static void collectionPropertyToTableModelRows(CollectionProperty prop, PowerTableModel model) { model.clearData(); for (int rowN = 0; rowN < prop.size(); rowN++) { ArrayList<String> rowObject = (ArrayList<String>) prop.get(rowN).getObjectValue(); model.addRow(rowObject.toArray()); } model.fireTableDataChanged(); }
Example #23
Source File: JMeterPluginsUtils.java From jmeter-plugins with Apache License 2.0 | 5 votes |
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; }
Example #24
Source File: JMeterPluginsUtils.java From jmeter-plugins with Apache License 2.0 | 5 votes |
public static CollectionProperty tableModelRowsToCollectionProperty(PowerTableModel model, String propname) { CollectionProperty rows = new CollectionProperty(propname, new ArrayList<>()); for (int row = 0; row < model.getRowCount(); row++) { List<Object> item = getArrayListForArray(model.getRowData(row)); rows.addItem(item); } return rows; }
Example #25
Source File: FirefoxDriverConfig.java From jmeter-plugins-webdriver with Apache License 2.0 | 4 votes |
public void setPreferences(PowerTableModel model) { CollectionProperty prop = JMeterPluginsUtils.tableModelRowsToCollectionProperty(model, PREFERENCES); setProperty(prop); }
Example #26
Source File: CopyRowAction.java From jmeter-plugins with Apache License 2.0 | 4 votes |
public CopyRowAction(JComponent aSender, JTable grid, PowerTableModel tableModel, JButton deleteRowButton) { this.grid = grid; this.tableModel = tableModel; this.deleteRowButton = deleteRowButton; this.sender = aSender; }
Example #27
Source File: ParallelHTTPSamplerGui.java From jmeter-bzm-plugins with Apache License 2.0 | 4 votes |
private void createTableModel() { tableModel = new PowerTableModel(ParallelHTTPSampler.columnIdentifiers, ParallelHTTPSampler.columnClasses); tableModel.addTableModelListener(this); grid.setModel(tableModel); }
Example #28
Source File: VariableThroughputTimerGui.java From jmeter-plugins with Apache License 2.0 | 4 votes |
private void createTableModel() { tableModel = new PowerTableModel(VariableThroughputTimer.columnIdentifiers, VariableThroughputTimer.columnClasses); tableModel.addTableModelListener(this); grid.setModel(tableModel); }
Example #29
Source File: WeightedSwitchController.java From jmeter-bzm-plugins with Apache License 2.0 | 4 votes |
public void setData(PowerTableModel model) { CollectionProperty prop = JMeterPluginsUtils.tableModelRowsToCollectionProperty(model, WEIGHTS); // log.warn("Set prop from model: " + prop); setProperty(prop); }
Example #30
Source File: DbMonGui.java From jmeter-plugins with Apache License 2.0 | 4 votes |
private void createTableModel() { tableModel = new PowerTableModel(columnIdentifiers, columnClasses); grid.setModel(tableModel); }