Package org.opennms.core.test.db
Class TemporaryDatabaseHsqldb
- java.lang.Object
-
- org.opennms.core.test.db.TemporaryDatabaseHsqldb
-
- All Implemented Interfaces:
Wrapper
,CommonDataSource
,DataSource
,XADataSource
,TemporaryDatabase
,org.springframework.beans.factory.InitializingBean
public class TemporaryDatabaseHsqldb extends Object implements TemporaryDatabase, org.springframework.beans.factory.InitializingBean
-
-
Field Summary
Fields Modifier and Type Field Description static String
TEST_DB_NAME_PREFIX
-
Fields inherited from interface org.opennms.core.test.db.TemporaryDatabase
ADMIN_PASSWORD_PROPERTY, ADMIN_USER_PROPERTY, DEFAULT_ADMIN_PASSWORD, DEFAULT_ADMIN_USER, DEFAULT_DRIVER, DEFAULT_URL, DRIVER_PROPERTY, URL_PROPERTY
-
-
Constructor Summary
Constructors Constructor Description TemporaryDatabaseHsqldb()
TemporaryDatabaseHsqldb(String testDatabase)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
afterPropertiesSet()
int
countRows(String sql, Object... values)
void
create()
void
drop()
Connection
getConnection()
Connection
getConnection(String username, String password)
DataSource
getDataSource()
org.springframework.jdbc.core.JdbcTemplate
getJdbcTemplate()
int
getLoginTimeout()
PrintWriter
getLogWriter()
Logger
getParentLogger()
boolean
getPopulateSchema()
String
getTestDatabase()
XAConnection
getXAConnection()
TODO Implement these functions to use the XADataSource implementation from HSQLDBXAConnection
getXAConnection(String user, String password)
TODO Implement these functions to use the XADataSource implementation from HSQLDBboolean
isWrapperFor(Class<?> iface)
void
setClassName(String string)
void
setDataSource(DataSource dataSource)
void
setJdbcTemplate(org.springframework.jdbc.core.JdbcTemplate template)
void
setLoginTimeout(int seconds)
void
setLogWriter(PrintWriter out)
void
setMethodName(String string)
void
setPlpgsqlIplike(boolean iplike)
void
setPopulateSchema(boolean populate)
void
setTestDetails(String string)
<T> T
unwrap(Class<T> iface)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface javax.sql.CommonDataSource
createShardingKeyBuilder
-
Methods inherited from interface javax.sql.DataSource
createConnectionBuilder
-
Methods inherited from interface javax.sql.XADataSource
createXAConnectionBuilder
-
-
-
-
Field Detail
-
TEST_DB_NAME_PREFIX
public static final String TEST_DB_NAME_PREFIX
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
TemporaryDatabaseHsqldb
public TemporaryDatabaseHsqldb()
-
TemporaryDatabaseHsqldb
public TemporaryDatabaseHsqldb(String testDatabase)
-
-
Method Detail
-
getDataSource
public DataSource getDataSource()
-
setDataSource
public void setDataSource(DataSource dataSource)
-
afterPropertiesSet
public void afterPropertiesSet()
- Specified by:
afterPropertiesSet
in interfaceorg.springframework.beans.factory.InitializingBean
-
getConnection
public Connection getConnection() throws SQLException
- Specified by:
getConnection
in interfaceDataSource
- Throws:
SQLException
-
getConnection
public Connection getConnection(String username, String password) throws SQLException
- Specified by:
getConnection
in interfaceDataSource
- Throws:
SQLException
-
getParentLogger
public Logger getParentLogger() throws SQLFeatureNotSupportedException
- Specified by:
getParentLogger
in interfaceCommonDataSource
- Throws:
SQLFeatureNotSupportedException
-
getLogWriter
public PrintWriter getLogWriter() throws SQLException
- Specified by:
getLogWriter
in interfaceCommonDataSource
- Specified by:
getLogWriter
in interfaceDataSource
- Specified by:
getLogWriter
in interfaceXADataSource
- Throws:
SQLException
-
setLogWriter
public void setLogWriter(PrintWriter out) throws SQLException
- Specified by:
setLogWriter
in interfaceCommonDataSource
- Specified by:
setLogWriter
in interfaceDataSource
- Specified by:
setLogWriter
in interfaceXADataSource
- Throws:
SQLException
-
setLoginTimeout
public void setLoginTimeout(int seconds) throws SQLException
- Specified by:
setLoginTimeout
in interfaceCommonDataSource
- Specified by:
setLoginTimeout
in interfaceDataSource
- Specified by:
setLoginTimeout
in interfaceXADataSource
- Throws:
SQLException
-
getLoginTimeout
public int getLoginTimeout() throws SQLException
- Specified by:
getLoginTimeout
in interfaceCommonDataSource
- Specified by:
getLoginTimeout
in interfaceDataSource
- Specified by:
getLoginTimeout
in interfaceXADataSource
- Throws:
SQLException
-
unwrap
public <T> T unwrap(Class<T> iface) throws SQLException
- Specified by:
unwrap
in interfaceWrapper
- Throws:
SQLException
-
isWrapperFor
public boolean isWrapperFor(Class<?> iface) throws SQLException
- Specified by:
isWrapperFor
in interfaceWrapper
- Throws:
SQLException
-
getTestDatabase
public String getTestDatabase()
- Specified by:
getTestDatabase
in interfaceTemporaryDatabase
-
getPopulateSchema
public boolean getPopulateSchema()
-
setPopulateSchema
public void setPopulateSchema(boolean populate)
- Specified by:
setPopulateSchema
in interfaceTemporaryDatabase
-
create
public void create() throws TemporaryDatabaseException
- Specified by:
create
in interfaceTemporaryDatabase
- Throws:
TemporaryDatabaseException
-
drop
public void drop() throws TemporaryDatabaseException
- Specified by:
drop
in interfaceTemporaryDatabase
- Throws:
TemporaryDatabaseException
-
countRows
public int countRows(String sql, Object... values)
- Specified by:
countRows
in interfaceTemporaryDatabase
-
getJdbcTemplate
public org.springframework.jdbc.core.JdbcTemplate getJdbcTemplate()
- Specified by:
getJdbcTemplate
in interfaceTemporaryDatabase
-
setJdbcTemplate
public void setJdbcTemplate(org.springframework.jdbc.core.JdbcTemplate template)
-
getXAConnection
public XAConnection getXAConnection() throws SQLException
TODO Implement these functions to use the XADataSource implementation from HSQLDB- Specified by:
getXAConnection
in interfaceXADataSource
- Throws:
SQLException
-
getXAConnection
public XAConnection getXAConnection(String user, String password) throws SQLException
TODO Implement these functions to use the XADataSource implementation from HSQLDB- Specified by:
getXAConnection
in interfaceXADataSource
- Throws:
SQLException
-
setClassName
public void setClassName(String string)
- Specified by:
setClassName
in interfaceTemporaryDatabase
-
setMethodName
public void setMethodName(String string)
- Specified by:
setMethodName
in interfaceTemporaryDatabase
-
setTestDetails
public void setTestDetails(String string)
- Specified by:
setTestDetails
in interfaceTemporaryDatabase
-
setPlpgsqlIplike
public void setPlpgsqlIplike(boolean iplike)
- Specified by:
setPlpgsqlIplike
in interfaceTemporaryDatabase
-
-