com.appperfect.loadtester.script
Interface JDBCScript

All Superinterfaces:
IScript

public interface JDBCScript
extends IScript

A request object which can be executed by IScriptEngine.execute(request) method.

An object of this class is created using createDatabaseQueryRequest method of IScriptEngine. Once the object is created, it should be populated as per the requirements of the JDBC protocol and then executed using IScriptEngine.

See Also:
IScriptEngine, IScriptEngine.createDatabaseQueryRequest(int, String)

Method Summary
 void addThinkTime(int virtualUser, int type, int startValue, int endValue, int valueType)
 Delay in seconds before the task is actually executed.
 boolean assertColumn(java.lang.String colName, java.lang.String dataType, java.lang.String value)
 Once the task is executed, this method can be used to validate the column present in the result set.
 boolean assertColumn(java.lang.String colName, java.lang.String dataType, java.lang.String[] values)
 Once the task is executed, this method can be used to validate the column present in the result set.
 boolean assertColumnNames(java.lang.String[] colNames, boolean inOrder)
 Once the task is executed, this method can be used to validate the columns present in the result set.
 boolean assertRow(int rowIndex, java.lang.String[] dataTypes, java.lang.String[] values)
 Once the task is executed, this method can be used to validate the all the columns present in the result set at the specified row.
 boolean assertRowCount(int count)
 Once the task is executed, this method can be used to validate the no of rows present in the result set.
 java.sql.CallableStatement getCallableStatement()
 Callable statement created using the stored procedure
 java.lang.Object getOutputValue(int parameterIndex)
 This method returns value of the OUT type of Stored procedure after the task is executed
 int getResponseCode()
 Get Response Code for the task execution
 long getResponseTime()
 Get the response time of executed task
 boolean isStoredProcedure()
 Whether this task will fire a stored procedure
 java.lang.String loadQueryFromFile(java.lang.String fileName)
 This method sets the file name from which the query is read and executed when the task is executed
 void registerStoredProcedureParameter(int parameterIndex, boolean in, boolean out, int parameterType)
 Register parameters of a Stored procedure
 void replaceParameterInQuery(java.lang.String parameterName, java.lang.String parameterValue)
 Application supports parameterized queries.
 void replaceParameterInQuery(java.lang.String parameterName, java.lang.String parameterValue, java.lang.String encodeChar)
 Application supports parameterized queries.
 void setInputValue(int parameterIndex, java.lang.String value)
 Sets the value of the IN type of the stored procedure parameters
 java.lang.String setQuery(java.lang.String query)
 This method sets the SQL query to be executed when the task is executed
 java.lang.String setQuery(java.lang.String query, java.lang.String paramEncodeChar)
  
 void setResponseTime(long responseTimeInMillis)
 This can be used to set value of session parameter.
 void setStoredProcedure(boolean storedProc)
 Whether this task will fire a stored procedure
 
Methods inherited from interface com.appperfect.devcommon.script.IScript
getReasonForFailure, isIgnored, isTaskSuccessful, isTaskTimedOut, setIgnored, setReasonForFailure, setTaskSuccessful, setTaskTimedout, setThinkTime, setTimeout
 

Method Detail

addThinkTime

void addThinkTime(int virtualUser,
                  int type,
                  int startValue,
                  int endValue,
                  int valueType)
Delay in seconds before the task is actually executed.

Parameters:
virtualUser - % Virtual User who should use this think time setting
type - Type of value whether its Fixed (0) value or Random Value (1)
startValue - Think time value
endValue - End value of think time in case of random value
valueType - Whether value specified is in seconds (0) or in milliseconds (1)

assertColumn

boolean assertColumn(java.lang.String colName,
                     java.lang.String dataType,
                     java.lang.String value)
Once the task is executed, this method can be used to validate the column present in the result set. It validates the column name, its data type and value at the current row

Parameters:
colName - name of the column
dataType - data type of the column
value - value in the column at current row
Returns:
true if the validation matches the expected results; false otherwise

assertColumn

boolean assertColumn(java.lang.String colName,
                     java.lang.String dataType,
                     java.lang.String[] values)
Once the task is executed, this method can be used to validate the column present in the result set. It validates the column name, its data type and values in all the rows

Parameters:
colName - name of the column
dataType - data type of the column
values - coma seperated values for that column
Returns:
true if the validation matches the expected results; false otherwise

assertColumnNames

boolean assertColumnNames(java.lang.String[] colNames,
                          boolean inOrder)
Once the task is executed, this method can be used to validate the columns present in the result set.

Parameters:
colNames - list of column names
inOrder - true if order of columns is required; false otherwise
Returns:
true if the validation matches the expected column names; false otherwise

assertRow

boolean assertRow(int rowIndex,
                  java.lang.String[] dataTypes,
                  java.lang.String[] values)
Once the task is executed, this method can be used to validate the all the columns present in the result set at the specified row. It validates the data type and values in all the columns

Parameters:
rowIndex - row index. Index starts with 1, 2, 3 ...
dataTypes - list of column data types
values - list of values in each column
Returns:
true if the validation matches the expected results; false otherwise

assertRowCount

boolean assertRowCount(int count)
Once the task is executed, this method can be used to validate the no of rows present in the result set.

Parameters:
count - expected number of rows
Returns:
true if the number of rows in the result set matches count; false otherwise

getCallableStatement

java.sql.CallableStatement getCallableStatement()
Callable statement created using the stored procedure

Returns:
returns Callable statement

getOutputValue

java.lang.Object getOutputValue(int parameterIndex)
This method returns value of the OUT type of Stored procedure after the task is executed

Parameters:
parameterIndex - index in the stored procedure sql statement
Returns:
value of the OUT type of Stored procedure after the task is executed

getResponseCode

int getResponseCode()
Get Response Code for the task execution

Returns:
response code

getResponseTime

long getResponseTime()
Get the response time of executed task

Returns:
the response time of executed task

isStoredProcedure

boolean isStoredProcedure()
Whether this task will fire a stored procedure

Returns:
true if its a stored procedure else false

loadQueryFromFile

java.lang.String loadQueryFromFile(java.lang.String fileName)
This method sets the file name from which the query is read and executed when the task is executed

Parameters:
fileName - containing the query to be executed returns the query read from the file

registerStoredProcedureParameter

void registerStoredProcedureParameter(int parameterIndex,
                                      boolean in,
                                      boolean out,
                                      int parameterType)
Register parameters of a Stored procedure

Parameters:
parameterIndex - index in the stored procedure sql statement
in - true if its an IN parameter
out - true if its an OUT parameter
parameterType - type of the parameter java.sql.Types

replaceParameterInQuery

void replaceParameterInQuery(java.lang.String parameterName,
                             java.lang.String parameterValue)
Application supports parameterized queries. A parameter in the query is replaced by its value using this method.

Parameters:
parameterName - name of the parameter
parameterValue - value of the parameter

replaceParameterInQuery

void replaceParameterInQuery(java.lang.String parameterName,
                             java.lang.String parameterValue,
                             java.lang.String encodeChar)
Application supports parameterized queries. A parameter in the query is replaced by its value using this method.

Parameters:
parameterName - name of the parameter
parameterValue - value of the parameter
encodeChar - character used to enclose parameter name

setInputValue

void setInputValue(int parameterIndex,
                   java.lang.String value)
Sets the value of the IN type of the stored procedure parameters

Parameters:
parameterIndex - index in the stored procedure sql statement
value - of the IN type parameter

setQuery

java.lang.String setQuery(java.lang.String query)
This method sets the SQL query to be executed when the task is executed

Parameters:
query - to be executed
Returns:
returns the modified query after replacing test parameters if any with desired values

setQuery

java.lang.String setQuery(java.lang.String query,
                          java.lang.String paramEncodeChar)
Parameters:
query - to be executed
paramEncodeChar - character to be used for enclosing TestParameter if any in the query, by default @ is used for enclosing TestParameter within query
Returns:
returns the modified query after replacing test parameters if any with desired values

setResponseTime

void setResponseTime(long responseTimeInMillis)
This can be used to set value of session parameter.

Parameters:
responseTimeInMillis -

setStoredProcedure

void setStoredProcedure(boolean storedProc)
Whether this task will fire a stored procedure

Parameters:
storedProc - true if its a stored procedure else false


Copyright © 2003-2016 AppPerfect Corporation. All Rights Reserved.