public class TemporaryDatabasePostgreSQL extends Object implements TemporaryDatabase
Modifier and Type | Field and Description |
---|---|
protected static int |
MAX_DATABASE_DROP_ATTEMPTS |
ADMIN_PASSWORD_PROPERTY, ADMIN_USER_PROPERTY, DEFAULT_ADMIN_PASSWORD, DEFAULT_ADMIN_USER, DEFAULT_DRIVER, DEFAULT_URL, DRIVER_PROPERTY, TEST_DB_NAME_PREFIX, URL_PROPERTY
Constructor and Description |
---|
TemporaryDatabasePostgreSQL() |
TemporaryDatabasePostgreSQL(String testDatabase) |
TemporaryDatabasePostgreSQL(String testDatabase,
boolean useExisting) |
TemporaryDatabasePostgreSQL(String testDatabase,
String driver,
String url,
String adminUser,
String adminPassword) |
TemporaryDatabasePostgreSQL(String testDatabase,
String driver,
String url,
String adminUser,
String adminPassword,
boolean useExisting) |
Modifier and Type | Method and Description |
---|---|
int |
countRows(String sql,
Object... values) |
void |
create() |
void |
drop() |
static void |
dumpThreads() |
protected File |
findIpLikeLibrary() |
DataSource |
getAdminDataSource() |
XADataSource |
getAdminXADataSource() |
Connection |
getConnection() |
Connection |
getConnection(String username,
String password) |
protected String |
getCreateSqlLocation() |
DataSource |
getDataSource() |
String |
getDriver() |
org.springframework.jdbc.core.JdbcTemplate |
getJdbcTemplate() |
int |
getLoginTimeout() |
PrintWriter |
getLogWriter() |
protected Integer |
getNextId(String nxtIdStmt) |
String |
getNextSequenceValStatement(String seqName) |
Logger |
getParentLogger() |
protected String |
getStoredProcDirectory() |
String |
getTestDatabase() |
String |
getUrl() |
XAConnection |
getXAConnection() |
XAConnection |
getXAConnection(String user,
String password) |
XADataSource |
getXADataSource() |
boolean |
isSetupIpLike() |
boolean |
isWrapperFor(Class<?> iface)
Returns true if this either implements the interface argument or is directly or indirectly a wrapper
for an object that does.
|
void |
setAdminDataSource(DataSource adminDataSource) |
void |
setDataSource(DataSource dataSource) |
void |
setJdbcTemplate(org.springframework.jdbc.core.JdbcTemplate jdbcTemplate) |
void |
setLoginTimeout(int seconds) |
void |
setLogWriter(PrintWriter out) |
void |
setPopulateSchema(boolean populateSchema) |
void |
setSetupIpLike(boolean setupIpLike) |
void |
setupDatabase() |
String |
toString() |
<T> T |
unwrap(Class<T> iface)
Returns an object that implements the given interface to allow access to
non-standard methods, or standard methods not exposed by the proxy.
|
void |
update(String stmt,
Object... values) |
protected static final int MAX_DATABASE_DROP_ATTEMPTS
public TemporaryDatabasePostgreSQL(String testDatabase) throws Exception
Exception
public TemporaryDatabasePostgreSQL(String testDatabase, boolean useExisting) throws Exception
Exception
public TemporaryDatabasePostgreSQL(String testDatabase, String driver, String url, String adminUser, String adminPassword) throws Exception
Exception
public void setPopulateSchema(boolean populateSchema)
setPopulateSchema
in interface TemporaryDatabase
public void create() throws TemporaryDatabaseException
create
in interface TemporaryDatabase
TemporaryDatabaseException
protected String getStoredProcDirectory()
protected String getCreateSqlLocation()
public boolean isSetupIpLike()
public void setSetupIpLike(boolean setupIpLike)
protected File findIpLikeLibrary()
public void setupDatabase() throws TemporaryDatabaseException
TemporaryDatabaseException
public void drop() throws TemporaryDatabaseException
drop
in interface TemporaryDatabase
TemporaryDatabaseException
public static void dumpThreads()
public Connection getConnection() throws SQLException
getConnection
in interface DataSource
SQLException
public int countRows(String sql, Object... values)
countRows
in interface TemporaryDatabase
public Connection getConnection(String username, String password) throws SQLException
getConnection
in interface DataSource
SQLException
public PrintWriter getLogWriter() throws SQLException
getLogWriter
in interface CommonDataSource
SQLException
public void setLogWriter(PrintWriter out) throws SQLException
setLogWriter
in interface CommonDataSource
SQLException
public void setLoginTimeout(int seconds) throws SQLException
setLoginTimeout
in interface CommonDataSource
SQLException
public int getLoginTimeout() throws SQLException
getLoginTimeout
in interface CommonDataSource
SQLException
public Logger getParentLogger() throws SQLFeatureNotSupportedException
getParentLogger
in interface CommonDataSource
SQLFeatureNotSupportedException
public org.springframework.jdbc.core.JdbcTemplate getJdbcTemplate()
getJdbcTemplate
in interface TemporaryDatabase
public void setJdbcTemplate(org.springframework.jdbc.core.JdbcTemplate jdbcTemplate)
public DataSource getAdminDataSource()
public XADataSource getAdminXADataSource()
public void setAdminDataSource(DataSource adminDataSource)
public DataSource getDataSource()
public XADataSource getXADataSource()
public void setDataSource(DataSource dataSource)
public String getTestDatabase()
getTestDatabase
in interface TemporaryDatabase
public <T> T unwrap(Class<T> iface) throws SQLException
unwrap
recursively on the wrapped object
or a proxy for that result. If the receiver is not a
wrapper and does not implement the interface, then an SQLException
is thrown.unwrap
in interface Wrapper
iface
- A Class defining an interface that the result must implement.SQLException
- If no object found that implements the interfacepublic boolean isWrapperFor(Class<?> iface) throws SQLException
isWrapperFor
on the wrapped
object. If this does not implement the interface and is not a wrapper, return false.
This method should be implemented as a low-cost operation compared to unwrap
so that
callers can use this method to avoid expensive unwrap
calls that may fail. If this method
returns true then calling unwrap
with the same argument should succeed.isWrapperFor
in interface Wrapper
iface
- a Class defining an interface.SQLException
- if an error occurs while determining whether this is a wrapper
for an object with the given interface.public String getDriver()
public String getUrl()
public XAConnection getXAConnection() throws SQLException
getXAConnection
in interface XADataSource
SQLException
public XAConnection getXAConnection(String user, String password) throws SQLException
getXAConnection
in interface XADataSource
SQLException
Copyright © 2016. All rights reserved.