org.mule.tck.util
Class MuleDerbyTestDatabase

java.lang.Object
  extended by org.mule.tck.util.MuleDerbyTestDatabase

public class MuleDerbyTestDatabase
extends Object

Helper class for creating a derby database.


Field Summary
static String DERBY_PROPERTIES_FILE
           
 
Constructor Summary
MuleDerbyTestDatabase(String databaseNameProperty)
           
 
Method Summary
 void emptyTestTable()
          Remove all the rows from TEST table.
 List execSqlQuery(String sql)
          Executes a query against the database.
 int execSqlUpdate(String sql)
          Executes an SQL statement against the database.
 Connection getConnection()
           
 void insertIntoTest(String data, int type)
          Inserts a record in the TEST table.
 void startDatabase()
          Creates an empty database with a table named TEST.
 void stopDatabase()
          Stops the created database.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DERBY_PROPERTIES_FILE

public static final String DERBY_PROPERTIES_FILE
See Also:
Constant Field Values
Constructor Detail

MuleDerbyTestDatabase

public MuleDerbyTestDatabase(String databaseNameProperty)
Parameters:
databaseNameProperty - name of the property with the database name in derby.properties file. To add a new database change derby.properties file.
Method Detail

startDatabase

public void startDatabase()
                   throws Exception
Creates an empty database with a table named TEST.

Throws:
Exception

stopDatabase

public void stopDatabase()
                  throws SQLException
Stops the created database.

Throws:
SQLException

emptyTestTable

public void emptyTestTable()
                    throws Exception
Remove all the rows from TEST table.

Throws:
SQLException
Exception

insertIntoTest

public void insertIntoTest(String data,
                           int type)
Inserts a record in the TEST table.


getConnection

public Connection getConnection()
                         throws Exception
Returns:
a new Connection to access the database.
Throws:
Exception

execSqlQuery

public List execSqlQuery(String sql)
                  throws Exception
Executes a query against the database.

Parameters:
sql - SQL query
Returns:
Throws:
Exception

execSqlUpdate

public int execSqlUpdate(String sql)
                  throws Exception
Executes an SQL statement against the database. For queries use execSqlQuery.

Parameters:
sql - SQL query
Returns:
Throws:
Exception


Copyright © 2003-2014 MuleSoft, Inc.. All Rights Reserved.