starting and stopping hsqldb from unit tests

Posted by Casey on Stack Overflow See other posts from Stack Overflow or by Casey
Published on 2010-06-10T20:06:59Z Indexed on 2010/06/10 20:22 UTC
Read the original article Hit count: 388

Filed under:
|
|
|

I'm trying to create integration tests using hsqldb in an in memory mode. At the moment, I have to start the hsqldb server from the command line before running the unit tests. I would like to be able to be able to control the hsqldb server from my integration tests. I can't seem to get this to all work out though from code.

Thanks, Casey

Update:

This appears to work along with having a hibernate.cfg.xml file in the classpath:

org.hsqldb.Server.main(new String[]{});

and in my hibernate.cfg.xml file:

<property name="connection.driver_class">org.hsqldb.jdbcDriver</property>
    <property name="connection.url">jdbc:hsqldb:mem:ww</property>
    <property name="connection.username">sa</property>
    <property name="connection.password"></property>
    <property name="connection.pool_size">1</property>
    <property name="dialect">org.hibernate.dialect.HSQLDialect</property>
    <property name="current_session_context_class">thread</property>
    <property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
    <property name="hbm2ddl.auto">update</property>

© Stack Overflow or respective owner

Related posts about java

Related posts about unit-testing