net.sf.jameleon.sql
Class AbstractSqlTag

java.lang.Object
  extended by org.apache.commons.jelly.TagSupport
      extended by net.sf.jameleon.LocationAwareTagSupport
          extended by net.sf.jameleon.JameleonTagSupport
              extended by net.sf.jameleon.function.FunctionTag
                  extended by net.sf.jameleon.sql.AbstractSqlTag
All Implemented Interfaces:
BreakPoint, Attributable, Storable, DynaTag, LocationAware, Tag
Direct Known Subclasses:
SqlUpdateTag

public abstract class AbstractSqlTag
extends FunctionTag

An abstract class used to execute SQL.


Field Summary
protected  String jdbcDriver
          The jdbc driver
protected  String jdbcPassword
          The jdbc password
protected  String jdbcUrl
          The jdbc url
protected  String jdbcUsername
          The jdbc username
protected  String sqlVarName
           
 
Fields inherited from class net.sf.jameleon.function.FunctionTag
addt, breakPoint, expectException, expectFailure, fResults, functionDelay, functionId, lastFileWritten, log, NO_DELAY, params, postcondition, precondition, st, state, tct, vpt
 
Fields inherited from class net.sf.jameleon.JameleonTagSupport
attributes, broker, contextVars, fp, unsupportedAttributes
 
Fields inherited from class net.sf.jameleon.LocationAwareTagSupport
columnNumber, elementTagName, lineNumber, scriptFileName
 
Fields inherited from class org.apache.commons.jelly.TagSupport
body, context, hasTrimmed, parent, shouldTrim
 
Constructor Summary
AbstractSqlTag()
           
 
Method Summary
protected  void destroy()
           
protected abstract  void executeSql(Connection conn, String sql)
           
protected  Connection getConnection()
          Gets a connection to the database desired or a CSV file.
 String getSql()
           
protected  void init()
           
 void testBlock()
          Contains the actual testing of the function point.
protected  void validate()
          This method is called before the testBlock method is called.
 
Methods inherited from class net.sf.jameleon.function.FunctionTag
addParam, addRequiredAttribute, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertFalse, assertFalse, assertMethod, assertMethodWithLevel, assertNotNull, assertNotNull, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNotSame, assertNotSame, assertNull, assertNull, assertNull, assertNull, assertRegexMatches, assertRegexMatches, assertRegexMatches, assertRegexMatches, assertSame, assertSame, assertSame, assertSame, assertTextContains, assertTextContains, assertTextContains, assertTextContains, assertTextEndsWith, assertTextEndsWith, assertTextEndsWith, assertTextEndsWith, assertTextStartsWith, assertTextStartsWith, assertTextStartsWith, assertTextStartsWith, assertTrue, assertTrue, assertTrue, assertTrue, checkParamTypes, cleanUp, cleanUpEnvironment, delay, delay, doTag, fail, fail, fail, fail, getFunctionId, getFunctionResults, getMatchingRegexText, getParam, getParamLength, getParams, getParentTags, getSessionTag, getStoreToFileName, getStringOrDefault, getTestCaseTag, getVariable, getVariableAsBoolean, getVariableAsList, getVariableAsString, isBreakPoint, isContextVariableNull, pluginTearDown, recordFunctionResult, regexMatches, removeFunctionResult, removeVariable, setDefaultVariableValue, setDefaultVariableValue, setExpectException, setExpectFailure, setFunctionDelay, setFunctionId, setup, setupEnvironment, setUpFunctionResults, setVariable, store, tearDown, traceMsg
 
Methods inherited from class net.sf.jameleon.JameleonTagSupport
cleanVariablesInContext, createAttributes, describeAttributes, getAttributeBroker, getAttributes, getAttributeType, getClassAttributes, getFunctionalPoint, getUnsupportedAttributes, loadFunctionalPoint, resetFunctionalPoint, setAttribute, setVariableInContext, testForUnsupportedAttributesCaught
 
Methods inherited from class net.sf.jameleon.LocationAwareTagSupport
getColumnNumber, getElementName, getFileName, getLineNumber, setColumnNumber, setElementName, setFileName, setLineNumber
 
Methods inherited from class org.apache.commons.jelly.TagSupport
findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, getBody, getBodyText, getBodyText, getContext, getParent, invokeBody, isEscapeText, isTrim, setBody, setContext, setEscapeText, setParent, setTrim, trimBody
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.commons.jelly.Tag
getBody, getContext, getParent, invokeBody, setBody, setContext, setParent
 

Field Detail

sqlVarName

protected String sqlVarName

jdbcDriver

protected String jdbcDriver
The jdbc driver

This attribute is recognized by Jameleon
Required: true
Context Name: jdbc.driver

jdbcUrl

protected String jdbcUrl
The jdbc url

This attribute is recognized by Jameleon
Required: true
Context Name: jdbc.url

jdbcUsername

protected String jdbcUsername
The jdbc username

This attribute is recognized by Jameleon
Required: true
Context Name: jdbc.username

jdbcPassword

protected String jdbcPassword
The jdbc password

This attribute is recognized by Jameleon
Required: false
Context Name: jdbc.password
Constructor Detail

AbstractSqlTag

public AbstractSqlTag()
Method Detail

testBlock

public void testBlock()
Description copied from class: FunctionTag
Contains the actual testing of the function point. Implement this method with any code that would make the FunctionTag unique. The default implementation does nothing. Implement this method to make your function tag useful.

Overrides:
testBlock in class FunctionTag

validate

protected void validate()
                 throws MissingAttributeException
Description copied from class: FunctionTag
This method is called before the testBlock method is called. If you want to override this method, call super first, followed by the custom validations that need to occur in your TestStep.

Overrides:
validate in class FunctionTag
Throws:
MissingAttributeException - - When a required attribute is not set.

executeSql

protected abstract void executeSql(Connection conn,
                                   String sql)
                            throws SQLException
Throws:
SQLException

getConnection

protected Connection getConnection()
                            throws SQLException
Gets a connection to the database desired or a CSV file. This properties file should define an entry for each of the following:
  1. jdbc.driver -- The driver using to connect to the datasource.
  2. jdbc.username -- The username used to connect to the datasource
  3. jdbc.password -- the password used to connect the username to the datasource
  4. jdbc.url -- The url where the database exists.

Throws:
SQLException

getSql

public String getSql()

init

protected void init()

destroy

protected void destroy()


Copyright © 2003-2008 Christian Hargraves. All Rights Reserved.