public JMeterProperty getSamplerSettings() { return getProperty(DATA_PROPERTY); }
private void setupSaving(String fileName) { SampleSaveConfiguration config = getSaveConfig(); JMeterPluginsUtils.doBestCSVSetup(config); setSaveConfig(config); setFilename(fileName); log.info("DbMon metrics will be stored in " + new File(fileName).getAbsolutePath()); }
@Override public void testStarted(String host) { log.debug("Start testStarted host = " + host); if(!isWorkingHost(host)) { return; } initCollector(); super.testStarted(host); log.debug("End testStarted host = " + host); }
private void initCollector() { log.debug("Start initCollector"); if (getProperty(FILENAME) == null || getProperty(FILENAME).getStringValue().trim().length() == 0) { if (autoGenerateFiles) { setupSaving(getAutoFileName()); } else { initiateConnectors(); } catch (SQLException ex) {
private void initiateConnectors() throws SQLException { JMeterProperty prop = getSamplerSettings(); dbMonSamplers.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 connectionPool = ((JMeterProperty) row.get(0)).getStringValue(); String label = ((JMeterProperty) row.get(1)).getStringValue(); boolean isDelta = ((JMeterProperty) row.get(2)).getBooleanValue(); String sql = ((JMeterProperty) row.get(3)).getStringValue(); initiateConnector(connectionPool, label, isDelta, sql); } }
@Override public TestElement createTestElement() { TestElement te = new DbMonCollector(); modifyTestElement(te); te.setComment(JMeterPluginsUtils.getWikiLinkText(getWikiPage())); return te; }
@Override public void generateSample(double value, String label) { DbMonSampleResult res = new DbMonSampleResult(); res.setSampleLabel(label); res.setValue(value); res.setSuccessful(true); SampleEvent e = new SampleEvent(res, DBMON); dbMonSampleOccurred(e); } }
private void initiateConnector(String connectionPoolName, String name, boolean delta, String sql) throws SQLException { Connection conn = findConnectionSamePoolName(connectionPoolName); if (conn == null) { log.debug("create new connection"); conn = DataSourceElement.getConnection(connectionPoolName); } else { log.debug("use same connection"); } dbMonSamplers.add(new DbMonSampler(conn, connectionPoolName, name, delta, sql)); }
@Override public void configure(TestElement te) { super.configure(te); DbMonCollector dmte = (DbMonCollector) te; JMeterProperty dbmonValues = dmte.getSamplerSettings(); if (!(dbmonValues instanceof NullProperty)) { JMeterPluginsUtils.collectionPropertyToTableModelRows((CollectionProperty) dbmonValues, tableModel, columnClasses); } else { log.warn("Received null property instead of collection"); } }
private void initCollector() { log.debug("Start initCollector"); if (getProperty(FILENAME) == null || getProperty(FILENAME).getStringValue().trim().length() == 0) { if (autoGenerateFiles) { setupSaving(getAutoFileName()); } else { initiateConnectors(); } catch (SQLException ex) {
private void initiateConnectors() throws SQLException { JMeterProperty prop = getSamplerSettings(); dbMonSamplers.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 connectionPool = ((JMeterProperty) row.get(0)).getStringValue(); String label = ((JMeterProperty) row.get(1)).getStringValue(); boolean isDelta = ((JMeterProperty) row.get(2)).getBooleanValue(); String sql = ((JMeterProperty) row.get(3)).getStringValue(); initiateConnector(connectionPool, label, isDelta, sql); } }
@Override public TestElement createTestElement() { TestElement te = new DbMonCollector(); modifyTestElement(te); te.setComment(JMeterPluginsUtils.getWikiLinkText(getWikiPage())); return te; }
@Override public void generateSample(double value, String label) { DbMonSampleResult res = new DbMonSampleResult(); res.setSampleLabel(label); res.setValue(value); res.setSuccessful(true); SampleEvent e = new SampleEvent(res, DBMON); dbMonSampleOccurred(e); } }
private void initiateConnector(String connectionPoolName, String name, boolean delta, String sql) throws SQLException { Connection conn = findConnectionSamePoolName(connectionPoolName); if (conn == null) { log.debug("create new connection"); conn = DataSourceElement.getConnection(connectionPoolName); } else { log.debug("use same connection"); } dbMonSamplers.add(new DbMonSampler(conn, connectionPoolName, name, delta, sql)); }
@Override public void configure(TestElement te) { super.configure(te); DbMonCollector dmte = (DbMonCollector) te; JMeterProperty dbmonValues = dmte.getSamplerSettings(); if (!(dbmonValues instanceof NullProperty)) { JMeterPluginsUtils.collectionPropertyToTableModelRows((CollectionProperty) dbmonValues, tableModel, columnClasses); } else { log.warn("Received null property instead of collection"); } }
private void setupSaving(String fileName) { SampleSaveConfiguration config = getSaveConfig(); JMeterPluginsUtils.doBestCSVSetup(config); setSaveConfig(config); setFilename(fileName); log.info("DbMon metrics will be stored in " + new File(fileName).getAbsolutePath()); }
@Override public void testStarted(String host) { log.debug("Start testStarted host = " + host); if(!isWorkingHost(host)) { return; } initCollector(); super.testStarted(host); log.debug("End testStarted host = " + host); }
public JMeterProperty getSamplerSettings() { return getProperty(DATA_PROPERTY); }