public class TestDatabaseCreator extends Object
Constructor and Description |
---|
TestDatabaseCreator() |
Modifier and Type | Method and Description |
---|---|
protected void |
basicResetDatabaseWithUsers()
Unfortunately, postgres does not allow the straight dropdb and createdb when tomcat is used (perhaps we leave open a connection)
|
protected void |
basicResetDatabaseWithUsers(boolean loadTestingData)
Unfortunately, postgres does not allow the straight dropdb and createdb when tomcat is used (perhaps we leave open a connection)
|
void |
createDatabase()
createDatabase.
|
void |
createDatabase(boolean loadTestingData)
createDatabase.
|
void |
dropDatabase()
dropDatabase.
|
void |
dropDatabaseWithUsers()
Drop a database schema even when users are connected to it
|
protected String |
getDEFAULT_DB_HOST() |
protected static String |
getPOSTGRE_DB() |
protected String |
getPOSTGRE_PASSWORD() |
protected String |
getPOSTGRE_USER() |
protected String |
getSEQWARE_DB() |
protected String |
getSEQWARE_PASSWORD() |
protected String |
getSEQWARE_USER() |
static void |
markDatabaseChanged()
markDatabaseChanged.
|
<T> T |
runQuery(org.apache.commons.dbutils.ResultSetHandler<T> h,
String query,
boolean update,
Object... params)
Convenient method to run a query against the test database, avoids unclosed connections.
|
<T> T |
runQuery(org.apache.commons.dbutils.ResultSetHandler<T> h,
String query,
Object... params)
Convenient method to run a query against the test database, avoids unclosed connections.
|
int |
runUpdate(String query,
Object... params)
Run an insert, update, or delete
|
protected String getDEFAULT_DB_HOST()
public void createDatabase() throws SQLException
createDatabase.
SQLException
- if any.public void createDatabase(boolean loadTestingData) throws SQLException
createDatabase.
loadTestingData
- load the provided testing dataSQLException
- if any.public <T> T runQuery(org.apache.commons.dbutils.ResultSetHandler<T> h, String query, Object... params)
T
- h
- query
- params
- public int runUpdate(String query, Object... params)
query
- params
- public <T> T runQuery(org.apache.commons.dbutils.ResultSetHandler<T> h, String query, boolean update, Object... params)
T
- h
- query
- update
- params
- public void dropDatabase() throws SQLException
dropDatabase.
SQLException
- if any.public void dropDatabaseWithUsers() throws SQLException
SQLException
- if any.public static void markDatabaseChanged()
markDatabaseChanged.
protected static String getPOSTGRE_DB()
protected String getSEQWARE_DB()
protected String getPOSTGRE_USER()
protected String getPOSTGRE_PASSWORD()
protected String getSEQWARE_USER()
protected String getSEQWARE_PASSWORD()
protected void basicResetDatabaseWithUsers()
protected void basicResetDatabaseWithUsers(boolean loadTestingData)
loadTestingData
- Copyright © 2015 SeqWare. All rights reserved.