Package org.opennms.core.test.db
Class TemporaryDatabaseHsqldb
- java.lang.Object
-
- org.opennms.core.test.db.TemporaryDatabaseHsqldb
-
- All Implemented Interfaces:
java.sql.Wrapper
,javax.sql.CommonDataSource
,javax.sql.DataSource
,javax.sql.XADataSource
,TemporaryDatabase
,org.springframework.beans.factory.InitializingBean
public class TemporaryDatabaseHsqldb extends java.lang.Object implements TemporaryDatabase, org.springframework.beans.factory.InitializingBean
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.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(java.lang.String testDatabase)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
afterPropertiesSet()
int
countRows(java.lang.String sql, java.lang.Object... values)
void
create()
void
drop()
java.sql.Connection
getConnection()
java.sql.Connection
getConnection(java.lang.String username, java.lang.String password)
javax.sql.DataSource
getDataSource()
org.springframework.jdbc.core.JdbcTemplate
getJdbcTemplate()
int
getLoginTimeout()
java.io.PrintWriter
getLogWriter()
java.util.logging.Logger
getParentLogger()
boolean
getPopulateSchema()
java.lang.String
getTestDatabase()
javax.sql.XAConnection
getXAConnection()
TODO Implement these functions to use the XADataSource implementation from HSQLDBjavax.sql.XAConnection
getXAConnection(java.lang.String user, java.lang.String password)
TODO Implement these functions to use the XADataSource implementation from HSQLDBboolean
isWrapperFor(java.lang.Class<?> iface)
void
setClassName(java.lang.String string)
void
setDataSource(javax.sql.DataSource dataSource)
void
setJdbcTemplate(org.springframework.jdbc.core.JdbcTemplate template)
void
setLoginTimeout(int seconds)
void
setLogWriter(java.io.PrintWriter out)
void
setMethodName(java.lang.String string)
void
setPlpgsqlIplike(boolean iplike)
void
setPopulateSchema(boolean populate)
void
setTestDetails(java.lang.String string)
<T> T
unwrap(java.lang.Class<T> iface)
-
-
-
Field Detail
-
TEST_DB_NAME_PREFIX
public static final java.lang.String TEST_DB_NAME_PREFIX
- See Also:
- Constant Field Values
-
-
Method Detail
-
getDataSource
public javax.sql.DataSource getDataSource()
-
setDataSource
public void setDataSource(javax.sql.DataSource dataSource)
-
afterPropertiesSet
public void afterPropertiesSet()
- Specified by:
afterPropertiesSet
in interfaceorg.springframework.beans.factory.InitializingBean
-
getConnection
public java.sql.Connection getConnection() throws java.sql.SQLException
- Specified by:
getConnection
in interfacejavax.sql.DataSource
- Throws:
java.sql.SQLException
-
getConnection
public java.sql.Connection getConnection(java.lang.String username, java.lang.String password) throws java.sql.SQLException
- Specified by:
getConnection
in interfacejavax.sql.DataSource
- Throws:
java.sql.SQLException
-
getParentLogger
public java.util.logging.Logger getParentLogger() throws java.sql.SQLFeatureNotSupportedException
- Specified by:
getParentLogger
in interfacejavax.sql.CommonDataSource
- Throws:
java.sql.SQLFeatureNotSupportedException
-
getLogWriter
public java.io.PrintWriter getLogWriter() throws java.sql.SQLException
- Specified by:
getLogWriter
in interfacejavax.sql.CommonDataSource
- Specified by:
getLogWriter
in interfacejavax.sql.DataSource
- Specified by:
getLogWriter
in interfacejavax.sql.XADataSource
- Throws:
java.sql.SQLException
-
setLogWriter
public void setLogWriter(java.io.PrintWriter out) throws java.sql.SQLException
- Specified by:
setLogWriter
in interfacejavax.sql.CommonDataSource
- Specified by:
setLogWriter
in interfacejavax.sql.DataSource
- Specified by:
setLogWriter
in interfacejavax.sql.XADataSource
- Throws:
java.sql.SQLException
-
setLoginTimeout
public void setLoginTimeout(int seconds) throws java.sql.SQLException
- Specified by:
setLoginTimeout
in interfacejavax.sql.CommonDataSource
- Specified by:
setLoginTimeout
in interfacejavax.sql.DataSource
- Specified by:
setLoginTimeout
in interfacejavax.sql.XADataSource
- Throws:
java.sql.SQLException
-
getLoginTimeout
public int getLoginTimeout() throws java.sql.SQLException
- Specified by:
getLoginTimeout
in interfacejavax.sql.CommonDataSource
- Specified by:
getLoginTimeout
in interfacejavax.sql.DataSource
- Specified by:
getLoginTimeout
in interfacejavax.sql.XADataSource
- Throws:
java.sql.SQLException
-
unwrap
public <T> T unwrap(java.lang.Class<T> iface) throws java.sql.SQLException
- Specified by:
unwrap
in interfacejava.sql.Wrapper
- Throws:
java.sql.SQLException
-
isWrapperFor
public boolean isWrapperFor(java.lang.Class<?> iface) throws java.sql.SQLException
- Specified by:
isWrapperFor
in interfacejava.sql.Wrapper
- Throws:
java.sql.SQLException
-
getTestDatabase
public java.lang.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(java.lang.String sql, java.lang.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 javax.sql.XAConnection getXAConnection() throws java.sql.SQLException
TODO Implement these functions to use the XADataSource implementation from HSQLDB- Specified by:
getXAConnection
in interfacejavax.sql.XADataSource
- Throws:
java.sql.SQLException
-
getXAConnection
public javax.sql.XAConnection getXAConnection(java.lang.String user, java.lang.String password) throws java.sql.SQLException
TODO Implement these functions to use the XADataSource implementation from HSQLDB- Specified by:
getXAConnection
in interfacejavax.sql.XADataSource
- Throws:
java.sql.SQLException
-
setClassName
public void setClassName(java.lang.String string)
- Specified by:
setClassName
in interfaceTemporaryDatabase
-
setMethodName
public void setMethodName(java.lang.String string)
- Specified by:
setMethodName
in interfaceTemporaryDatabase
-
setTestDetails
public void setTestDetails(java.lang.String string)
- Specified by:
setTestDetails
in interfaceTemporaryDatabase
-
setPlpgsqlIplike
public void setPlpgsqlIplike(boolean iplike)
- Specified by:
setPlpgsqlIplike
in interfaceTemporaryDatabase
-
-