// Path: src/main/java/com/btmatthews/maven/plugins/inmemdb/db/hsqldb/HSQLDBDatabase.java
// public final class HSQLDBDatabase extends AbstractSQLDatabase {
// 
//     /**
//      * The connection protocol for in-memory HSQLDB databases.
//      */
//     private static final String PROTOCOL = "hsqldb:hsql://localhost:{0,number,#}/";
//     /**
//      * Default port HSQLDB listens on, can be altered via setting port property
//      */
//     private static final int DEFAULT_PORT = ServerConstants.SC_DEFAULT_HSQL_SERVER_PORT;
//     private static final int PING_RETRIES = 10;
//     private static final int PING_DELAY = 100;
//     /**
//      * The loaders that are supported for loading data or executing scripts.
//      */
//     private static final Loader[] LOADERS = new Loader[]{
//             new DBUnitXMLLoader(), new DBUnitFlatXMLLoader(),
//             new DBUnitCSVLoader(), new DBUnitXLSLoader(), new SQLLoader()};
//     /**
//      * The HSQLDB server.
//      */
//     private Server server;
// 
//     /**
//      * The default constructor initializes the default database port.
//      */
//     public HSQLDBDatabase() {
//         super(DEFAULT_PORT);
//     }
// 
//     /**
//      * Get the database connection protocol.
//      *
//      * @return Always returns {@link HSQLDBDatabase#PROTOCOL}.
//      */
//     @Override
//     protected String getUrlProtocol() {
//         return MessageFormat.format(PROTOCOL, getPort());
//     }
// 
//     /**
//      * Get the data source that describes the connection to the in-memory HSQLDB
//      * database.
//      *
//      * @return Returns {@code dataSource} which was initialised by the
//      *         constructor.
//      */
//     @Override
//     public DataSource getDataSource() {
//         final JDBCDataSource dataSource = new JDBCDataSource();
//         dataSource.setUrl(getUrl());
//         dataSource.setUser(getUsername());
//         dataSource.setPassword(getPassword());
//         return dataSource;
//     }
// 
//     /**
//      * Get the loaders that are supported for loading data or executing scripts.
//      *
//      * @return Returns {@link #LOADERS}.
//      */
//     @Override
//     public Loader[] getLoaders() {
//         return LOADERS;
//     }
// 
//     /**
//      * Start the in-memory HSQLDB server.
//      *
//      * @param logger Used to report errors and raise exceptions.
//      */
//     @Override
//     public void start(final Logger logger) {
// 
//         logger.logInfo("Starting embedded HSQLDB database");
// 
//         server = new Server();
//         server.setDatabasePath(0, DatabaseURL.S_MEM + getDatabaseName());
//         server.setDatabaseName(0, getDatabaseName());
//         server.setDaemon(true);
//         server.setAddress(ServerConstants.SC_DEFAULT_ADDRESS);
//         server.setPort(getPort());
//         server.setErrWriter(null);
//         server.setLogWriter(null);
//         server.setTls(false);
//         server.setTrace(false);
//         server.setSilent(true);
//         server.setNoSystemExit(true);
//         server.setRestartOnShutdown(false);
//         server.start();
// 
//         logger.logInfo("Started embedded HSQLDB database");
//     }
// 
//     /**
//      * Shutdown the in-memory HSQLDB database by sending it a SHUTDOWN command.
//      *
//      * @param logger Used to report errors and raise exceptions.
//      */
//     @Override
//     public void stop(final Logger logger) {
// 
//         logger.logInfo("Stopping embedded HSQLDB database");
// 
//         if (server != null) {
//             server.stop();
//             server.shutdown();
//         }
// 
//         logger.logInfo("Stopping embedded HSQLDB database");
//     }
// 
//     @Override
//     public boolean isStarted(final Logger logger) {
//         if (server != null) {
//             try {
//                 server.checkRunning(true);
//                 return true;
//             } catch (final RuntimeException e) {
//                 return false;
//             }
//         }
//         return false;
//     }
// 
//     @Override
//     public boolean isStopped(final Logger logger) {
//         try {
//             server.checkRunning(false);
//             return true;
//         } catch (final RuntimeException e) {
//             return false;
//         }
//     }
// }


import com.btmatthews.maven.plugins.inmemdb.db.hsqldb.HSQLDBDatabase;
import com.btmatthews.utils.monitor.Server;
/*
 * Copyright 2011-2012 Brian Matthews
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.btmatthews.maven.plugins.inmemdb.test;


/**
 * Unit test the HSQLDB database server.
 *
 * @author <a href="mailto:brian@btmatthews.com">Brian Matthews</a>
 * @since 1.2.0
 */
public class TestHSQLDBDatabase extends AbstractTestDatabase {

    /**
     * Create the {@link HSQLDBDatabase} server test fixture.
     *
     * @return The {@link HSQLDBDatabase} server test fixture.
     */
    @Override
    protected Server createDatabaseServer() {
// Path: src/main/java/com/btmatthews/maven/plugins/inmemdb/db/hsqldb/HSQLDBDatabase.java
// public final class HSQLDBDatabase extends AbstractSQLDatabase {
// 
//     /**
//      * The connection protocol for in-memory HSQLDB databases.
//      */
//     private static final String PROTOCOL = "hsqldb:hsql://localhost:{0,number,#}/";
//     /**
//      * Default port HSQLDB listens on, can be altered via setting port property
//      */
//     private static final int DEFAULT_PORT = ServerConstants.SC_DEFAULT_HSQL_SERVER_PORT;
//     private static final int PING_RETRIES = 10;
//     private static final int PING_DELAY = 100;
//     /**
//      * The loaders that are supported for loading data or executing scripts.
//      */
//     private static final Loader[] LOADERS = new Loader[]{
//             new DBUnitXMLLoader(), new DBUnitFlatXMLLoader(),
//             new DBUnitCSVLoader(), new DBUnitXLSLoader(), new SQLLoader()};
//     /**
//      * The HSQLDB server.
//      */
//     private Server server;
// 
//     /**
//      * The default constructor initializes the default database port.
//      */
//     public HSQLDBDatabase() {
//         super(DEFAULT_PORT);
//     }
// 
//     /**
//      * Get the database connection protocol.
//      *
//      * @return Always returns {@link HSQLDBDatabase#PROTOCOL}.
//      */
//     @Override
//     protected String getUrlProtocol() {
//         return MessageFormat.format(PROTOCOL, getPort());
//     }
// 
//     /**
//      * Get the data source that describes the connection to the in-memory HSQLDB
//      * database.
//      *
//      * @return Returns {@code dataSource} which was initialised by the
//      *         constructor.
//      */
//     @Override
//     public DataSource getDataSource() {
//         final JDBCDataSource dataSource = new JDBCDataSource();
//         dataSource.setUrl(getUrl());
//         dataSource.setUser(getUsername());
//         dataSource.setPassword(getPassword());
//         return dataSource;
//     }
// 
//     /**
//      * Get the loaders that are supported for loading data or executing scripts.
//      *
//      * @return Returns {@link #LOADERS}.
//      */
//     @Override
//     public Loader[] getLoaders() {
//         return LOADERS;
//     }
// 
//     /**
//      * Start the in-memory HSQLDB server.
//      *
//      * @param logger Used to report errors and raise exceptions.
//      */
//     @Override
//     public void start(final Logger logger) {
// 
//         logger.logInfo("Starting embedded HSQLDB database");
// 
//         server = new Server();
//         server.setDatabasePath(0, DatabaseURL.S_MEM + getDatabaseName());
//         server.setDatabaseName(0, getDatabaseName());
//         server.setDaemon(true);
//         server.setAddress(ServerConstants.SC_DEFAULT_ADDRESS);
//         server.setPort(getPort());
//         server.setErrWriter(null);
//         server.setLogWriter(null);
//         server.setTls(false);
//         server.setTrace(false);
//         server.setSilent(true);
//         server.setNoSystemExit(true);
//         server.setRestartOnShutdown(false);
//         server.start();
// 
//         logger.logInfo("Started embedded HSQLDB database");
//     }
// 
//     /**
//      * Shutdown the in-memory HSQLDB database by sending it a SHUTDOWN command.
//      *
//      * @param logger Used to report errors and raise exceptions.
//      */
//     @Override
//     public void stop(final Logger logger) {
// 
//         logger.logInfo("Stopping embedded HSQLDB database");
// 
//         if (server != null) {
//             server.stop();
//             server.shutdown();
//         }
// 
//         logger.logInfo("Stopping embedded HSQLDB database");
//     }
// 
//     @Override
//     public boolean isStarted(final Logger logger) {
//         if (server != null) {
//             try {
//                 server.checkRunning(true);
//                 return true;
//             } catch (final RuntimeException e) {
//                 return false;
//             }
//         }
//         return false;
//     }
// 
//     @Override
//     public boolean isStopped(final Logger logger) {
//         try {
//             server.checkRunning(false);
//             return true;
//         } catch (final RuntimeException e) {
//             return false;
//         }
//     }
// }


// Path: src/test/java/com/btmatthews/maven/plugins/inmemdb/test/TestHSQLDBDatabase.java
import com.btmatthews.maven.plugins.inmemdb.db.hsqldb.HSQLDBDatabase;
import com.btmatthews.utils.monitor.Server;

/*
 * Copyright 2011-2012 Brian Matthews
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.btmatthews.maven.plugins.inmemdb.test;


/**
 * Unit test the HSQLDB database server.
 *
 * @author <a href="mailto:brian@btmatthews.com">Brian Matthews</a>
 * @since 1.2.0
 */
public class TestHSQLDBDatabase extends AbstractTestDatabase {

    /**
     * Create the {@link HSQLDBDatabase} server test fixture.
     *
     * @return The {@link HSQLDBDatabase} server test fixture.
     */
    @Override
    protected Server createDatabaseServer() {
        return new HSQLDBDatabase();