Author: pmouawad Date: Fri Dec 2 23:03:10 2011 New Revision: 1209767 URL: http://svn.apache.org/viewvc?rev=1209767&view=rev Log: Bug 51876 - Functionality to search in Samplers TreeView Enable searching AbstractJDBCTestElement subclasses
Modified: jmeter/trunk/src/core/org/apache/jmeter/testelement/AbstractTestElement.java jmeter/trunk/src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/AbstractJDBCTestElement.java Modified: jmeter/trunk/src/core/org/apache/jmeter/testelement/AbstractTestElement.java URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/testelement/AbstractTestElement.java?rev=1209767&r1=1209766&r2=1209767&view=diff ============================================================================== --- jmeter/trunk/src/core/org/apache/jmeter/testelement/AbstractTestElement.java (original) +++ jmeter/trunk/src/core/org/apache/jmeter/testelement/AbstractTestElement.java Fri Dec 2 23:03:10 2011 @@ -551,4 +551,19 @@ public abstract class AbstractTestElemen result.add(getName()); return result; } + + /** + * Add to result the values of propertyNames + * @param result List<String> values of propertyNames + * @param propertyNames Set<String> properties to extract + */ + protected final void addPropertiesValues(List<String> result, Set<String> propertyNames) { + PropertyIterator iterator = propertyIterator(); + while(iterator.hasNext()) { + JMeterProperty jMeterProperty = iterator.next(); + if(propertyNames.contains(jMeterProperty.getName())) { + result.add(jMeterProperty.getStringValue()); + } + } + } } Modified: jmeter/trunk/src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/AbstractJDBCTestElement.java URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/AbstractJDBCTestElement.java?rev=1209767&r1=1209766&r2=1209767&view=diff ============================================================================== --- jmeter/trunk/src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/AbstractJDBCTestElement.java (original) +++ jmeter/trunk/src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/AbstractJDBCTestElement.java Fri Dec 2 23:03:10 2011 @@ -29,11 +29,14 @@ import java.sql.ResultSetMetaData; import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collection; import java.util.HashMap; +import java.util.HashSet; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; +import java.util.Set; import org.apache.jmeter.samplers.SampleResult; import org.apache.jmeter.save.CSVSaveService; @@ -567,6 +570,25 @@ public abstract class AbstractJDBCTestEl */ public void setResultVariable(String resultVariable) { this.resultVariable = resultVariable; - } - -} + } + + /** + * {@inheritDoc}} + */ + @Override + public List<String> getSearchableTokens() throws Exception { + List<String> result = super.getSearchableTokens(); + Set<String> properties = new HashSet<String>(); + properties.addAll(Arrays.asList(new String[]{ + "dataSource", + "query", + "queryArguments", + "queryArgumentsTypes", + "queryType", + "resultVariable", + "variableNames" + })); + addPropertiesValues(result, properties); + return result; + } +} \ No newline at end of file