Apache JMeter

org.apache.jmeter.protocol.jdbc
Class AbstractJDBCTestElement

java.lang.Object
  extended by org.apache.jmeter.testelement.AbstractTestElement
      extended by org.apache.jmeter.protocol.jdbc.AbstractJDBCTestElement
All Implemented Interfaces:
Serializable, Cloneable, Searchable, TestElement, TestStateListener
Direct Known Subclasses:
AbstractJDBCProcessor, JDBCSampler

public abstract class AbstractJDBCTestElement
extends AbstractTestElement
implements TestStateListener

A base class for all JDBC test elements handling the basics of a SQL request.

See Also:
Serialized Form

Field Summary
protected static String ENCODING
           
 
Fields inherited from interface org.apache.jmeter.testelement.TestElement
COMMENTS, ENABLED, GUI_CLASS, NAME, TEST_CLASS
 
Constructor Summary
protected AbstractJDBCTestElement()
          Creates a JDBCSampler.
 
Method Summary
static void close(Connection c)
           
static void close(ResultSet rs)
           
static void close(Statement s)
           
protected  byte[] execute(Connection conn)
          Execute the test element.
 String getDataSource()
           
 String getQuery()
           
 String getQueryArguments()
           
 String getQueryArgumentsTypes()
           
 String getQueryType()
           
 String getResultVariable()
           
 List<String> getSearchableTokens()
          }}
 String getVariableNames()
           
 void setDataSource(String dataSource)
           
 void setQuery(String query)
           
 void setQueryArguments(String queryArguments)
           
 void setQueryArgumentsTypes(String queryArgumentsType)
           
 void setQueryType(String queryType)
           
 void setResultVariable(String resultVariable)
           
 void setVariableNames(String variableNames)
           
 void testEnded()
          

Called once for all threads after the end of a test.

 void testEnded(String host)
          

Called once for all threads after the end of a test.

 void testStarted()
          

Called just before the start of the test from the main engine thread.

 void testStarted(String host)
          

Called just before the start of the test from the main engine thread.

 String toString()
           
 
Methods inherited from class org.apache.jmeter.testelement.AbstractTestElement
addPropertiesValues, addProperty, addProperty, addTestElement, canRemove, clear, clearTemporary, clearTestElementChildren, clone, emptyTemporary, equals, getComment, getName, getProperty, getPropertyAsBoolean, getPropertyAsBoolean, getPropertyAsDouble, getPropertyAsFloat, getPropertyAsInt, getPropertyAsInt, getPropertyAsLong, getPropertyAsLong, getPropertyAsString, getPropertyAsString, getThreadContext, getThreadName, hashCode, isEnabled, isRunningVersion, isTemporary, logProperties, mergeIn, propertyIterator, recoverRunningVersion, removeProperty, setComment, setName, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setRunningVersion, setTemporary, setThreadContext, setThreadName, traverse, traverseCollection, traverseMap, traverseProperty
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ENCODING

protected static final String ENCODING
See Also:
Constant Field Values
Constructor Detail

AbstractJDBCTestElement

protected AbstractJDBCTestElement()
Creates a JDBCSampler.

Method Detail

execute

protected byte[] execute(Connection conn)
                  throws SQLException,
                         UnsupportedEncodingException,
                         IOException,
                         UnsupportedOperationException
Execute the test element.

Parameters:
conn - a SampleResult in case the test should sample; null if only execution is requested
Throws:
UnsupportedOperationException - if the user provided incorrect query type
SQLException
UnsupportedEncodingException
IOException

close

public static void close(Connection c)

close

public static void close(Statement s)

close

public static void close(ResultSet rs)

getQuery

public String getQuery()

toString

public String toString()
Overrides:
toString in class Object

setQuery

public void setQuery(String query)
Parameters:
query - The query to set.

getDataSource

public String getDataSource()
Returns:
Returns the dataSource.

setDataSource

public void setDataSource(String dataSource)
Parameters:
dataSource - The dataSource to set.

getQueryType

public String getQueryType()
Returns:
Returns the queryType.

setQueryType

public void setQueryType(String queryType)
Parameters:
queryType - The queryType to set.

getQueryArguments

public String getQueryArguments()

setQueryArguments

public void setQueryArguments(String queryArguments)

getQueryArgumentsTypes

public String getQueryArgumentsTypes()

setQueryArgumentsTypes

public void setQueryArgumentsTypes(String queryArgumentsType)

getVariableNames

public String getVariableNames()
Returns:
the variableNames

setVariableNames

public void setVariableNames(String variableNames)
Parameters:
variableNames - the variableNames to set

getResultVariable

public String getResultVariable()
Returns:
the resultVariable

setResultVariable

public void setResultVariable(String resultVariable)
Parameters:
resultVariable - the variable name in which results will be stored

getSearchableTokens

public List<String> getSearchableTokens()
                                 throws Exception
}}

Specified by:
getSearchableTokens in interface Searchable
Overrides:
getSearchableTokens in class AbstractTestElement
Returns:
List of searchable tokens
Throws:
Exception

testStarted

public void testStarted()

Called just before the start of the test from the main engine thread. This is before the test elements are cloned. Note that not all the test variables will have been set up at this point.

N.B. testStarted() and testEnded() are called from different threads.

Specified by:
testStarted in interface TestStateListener
See Also:
TestStateListener.testStarted()

testStarted

public void testStarted(String host)

Called just before the start of the test from the main engine thread. This is before the test elements are cloned. Note that not all the test variables will have been set up at this point.

N.B. testStarted() and testEnded() are called from different threads.

Specified by:
testStarted in interface TestStateListener
Parameters:
host - name of host
See Also:
TestStateListener.testStarted(java.lang.String)

testEnded

public void testEnded()

Called once for all threads after the end of a test. This will use the same element instances as at the start of the test.

N.B. testStarted() and testEnded() are called from different threads.

Specified by:
testEnded in interface TestStateListener
See Also:
TestStateListener.testEnded()

testEnded

public void testEnded(String host)

Called once for all threads after the end of a test. This will use the same element instances as at the start of the test.

N.B. testStarted() and testEnded() are called from different threads.

Specified by:
testEnded in interface TestStateListener
Parameters:
host - name of host
See Also:
TestStateListener.testEnded(java.lang.String)

Apache JMeter

Copyright © 1998-2012 Apache Software Foundation. All Rights Reserved.