Class 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 Detail

      • TEST_DB_NAME_PREFIX

        public static final java.lang.String TEST_DB_NAME_PREFIX
        See Also:
        Constant Field Values
    • Constructor Detail

      • TemporaryDatabaseHsqldb

        public TemporaryDatabaseHsqldb()
      • TemporaryDatabaseHsqldb

        public TemporaryDatabaseHsqldb​(java.lang.String testDatabase)
    • Method Detail

      • getDataSource

        public javax.sql.DataSource getDataSource()
      • setDataSource

        public void setDataSource​(javax.sql.DataSource dataSource)
      • afterPropertiesSet

        public void afterPropertiesSet()
        Specified by:
        afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
      • getConnection

        public java.sql.Connection getConnection()
                                          throws java.sql.SQLException
        Specified by:
        getConnection in interface javax.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 interface javax.sql.DataSource
        Throws:
        java.sql.SQLException
      • getParentLogger

        public java.util.logging.Logger getParentLogger()
                                                 throws java.sql.SQLFeatureNotSupportedException
        Specified by:
        getParentLogger in interface javax.sql.CommonDataSource
        Throws:
        java.sql.SQLFeatureNotSupportedException
      • getLogWriter

        public java.io.PrintWriter getLogWriter()
                                         throws java.sql.SQLException
        Specified by:
        getLogWriter in interface javax.sql.CommonDataSource
        Specified by:
        getLogWriter in interface javax.sql.DataSource
        Specified by:
        getLogWriter in interface javax.sql.XADataSource
        Throws:
        java.sql.SQLException
      • setLogWriter

        public void setLogWriter​(java.io.PrintWriter out)
                          throws java.sql.SQLException
        Specified by:
        setLogWriter in interface javax.sql.CommonDataSource
        Specified by:
        setLogWriter in interface javax.sql.DataSource
        Specified by:
        setLogWriter in interface javax.sql.XADataSource
        Throws:
        java.sql.SQLException
      • setLoginTimeout

        public void setLoginTimeout​(int seconds)
                             throws java.sql.SQLException
        Specified by:
        setLoginTimeout in interface javax.sql.CommonDataSource
        Specified by:
        setLoginTimeout in interface javax.sql.DataSource
        Specified by:
        setLoginTimeout in interface javax.sql.XADataSource
        Throws:
        java.sql.SQLException
      • getLoginTimeout

        public int getLoginTimeout()
                            throws java.sql.SQLException
        Specified by:
        getLoginTimeout in interface javax.sql.CommonDataSource
        Specified by:
        getLoginTimeout in interface javax.sql.DataSource
        Specified by:
        getLoginTimeout in interface javax.sql.XADataSource
        Throws:
        java.sql.SQLException
      • unwrap

        public <T> T unwrap​(java.lang.Class<T> iface)
                     throws java.sql.SQLException
        Specified by:
        unwrap in interface java.sql.Wrapper
        Throws:
        java.sql.SQLException
      • isWrapperFor

        public boolean isWrapperFor​(java.lang.Class<?> iface)
                             throws java.sql.SQLException
        Specified by:
        isWrapperFor in interface java.sql.Wrapper
        Throws:
        java.sql.SQLException
      • getPopulateSchema

        public boolean getPopulateSchema()
      • countRows

        public int countRows​(java.lang.String sql,
                             java.lang.Object... values)
        Specified by:
        countRows in interface TemporaryDatabase
      • 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 interface javax.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 interface javax.sql.XADataSource
        Throws:
        java.sql.SQLException