net.sourceforge.sqlunit.tools
Class ToolUtils

java.lang.Object
  extended by net.sourceforge.sqlunit.tools.ToolUtils

public final class ToolUtils
extends java.lang.Object

Provides methods for common functionality used by the tools.

Version:
$Revision: 1.11 $
Author:
Sujit Pal (spal@users.sourceforge.net)

Method Summary
static java.util.Properties getConfiguration(java.lang.String resource)
          Parses the configuration property map to get configuration name value pairs and returns it as a Properties object.
static java.sql.Connection getConnection(java.util.Properties props)
          Returns a reference to a database Connection using values in the properties object.
static void makeTest(java.lang.String sql, Param[] params, java.lang.String testName, java.util.Properties config)
          Runs a database query with the specified Connection object and the Properties file passed in.
static void releaseConnection()
          Releases the connection object after the test is complete.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getConfiguration

public static java.util.Properties getConfiguration(java.lang.String resource)
                                             throws java.lang.Exception
Parses the configuration property map to get configuration name value pairs and returns it as a Properties object. The resource may be specified as a relative or absolute path to a file or as a resource in the classpath.

Parameters:
resource - the name of the resource file to use.
Returns:
a Properties object containing configuration properties.
Throws:
java.lang.Exception - if there was a problem.

getConnection

public static java.sql.Connection getConnection(java.util.Properties props)
                                         throws java.lang.Exception
Returns a reference to a database Connection using values in the properties object.

Parameters:
props - a Properties object.
Returns:
a database Connection.
Throws:
java.lang.Exception - if there was a problem.

releaseConnection

public static void releaseConnection()
Releases the connection object after the test is complete.


makeTest

public static void makeTest(java.lang.String sql,
                            Param[] params,
                            java.lang.String testName,
                            java.util.Properties config)
                     throws java.lang.Exception
Runs a database query with the specified Connection object and the Properties file passed in.

Parameters:
sql - the JDOM Element representing the SQL to execute.
params - an array of Param objects.
testName - the name of the test to use.
config - the Properties object.
Throws:
java.lang.Exception - if there was a problem.