Re: Unit testing with Hypersonic

2004-08-08 Thread Trygve Laugstøl
I always create and drop the database from the setUp() method of my unit
tests.

A typical setUp() method looks like:
 
http://cvs.continuum.codehaus.org/continuum/continuum-hibernate-store/src/test/java/org/codehaus/continuum/store/hibernate/HibernateContinuumStoreTest.java?rev=1.5view=auto

This method makes it much easier to run the tests from anything, including
your IDE. It also makes yours test independent of maven.

--
Trygve

On Thu, Aug 05, 2004 at 10:19:22AM -0500, Eric Hauser wrote:
 I running some unit tests with Maven during my build process using 
 Hypersonic in-memory mode as the datasource.  I generating the schema 
 from Hibernate and then loading the schema in a preGoal for test:test 
 using the ant:sql tags.  The problem that I am having is every time the 
 unit test runs, Hypersonic cannot seem to find the tables that I just 
 loaded.  Anyone have an example code that does something similar? Thanks.
 
 -- 
 Eric W. Hauser
 Application Developer
 accessIndiana...linking hoosiers to government
 http://www.IN.gov
 10 W. Market St., Suite 600
 Indianapolis, IN 46204
 Phone: (317) 233-4007
 Fax: (317) 233-2011
 
 **
 CONFIDENTIALITY NOTICE:
 This E-mail and any attachments are confidential.  If you are not the 
 intended recipient, you do not have permission to disclose, copy, 
 distribute, or open any attachments.  If you have received this E-mail
 in error, please notify us immediately by returning it to the sender and 
 delete this copy from your system. Thank you.
 accessIndiana, MyLocal.IN.gov, CivicNet
 ** 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 


signature.asc
Description: Digital signature


Re: Unit testing with Hypersonic

2004-08-08 Thread Dion Gillard
Yuck.

Haven't you heard of dbunit?

On Thu, 5 Aug 2004 11:51:05 -0400, Trygve Laugstøl [EMAIL PROTECTED] wrote:
 I always create and drop the database from the setUp() method of my unit
 tests.
 
 A typical setUp() method looks like:
  
 http://cvs.continuum.codehaus.org/continuum/continuum-hibernate-store/src/test/java/org/codehaus/continuum/store/hibernate/HibernateContinuumStoreTest.java?rev=1.5view=auto
 
 This method makes it much easier to run the tests from anything, including
 your IDE. It also makes yours test independent of maven.
 
 --
 Trygve
 
 
 
 On Thu, Aug 05, 2004 at 10:19:22AM -0500, Eric Hauser wrote:
  I running some unit tests with Maven during my build process using
  Hypersonic in-memory mode as the datasource.  I generating the schema
  from Hibernate and then loading the schema in a preGoal for test:test
  using the ant:sql tags.  The problem that I am having is every time the
  unit test runs, Hypersonic cannot seem to find the tables that I just
  loaded.  Anyone have an example code that does something similar? Thanks.
 
  --
  Eric W. Hauser
  Application Developer
  accessIndiana...linking hoosiers to government
  http://www.IN.gov
  10 W. Market St., Suite 600
  Indianapolis, IN 46204
  Phone: (317) 233-4007
  Fax: (317) 233-2011
 
  **
  CONFIDENTIALITY NOTICE:
  This E-mail and any attachments are confidential.  If you are not the
  intended recipient, you do not have permission to disclose, copy,
  distribute, or open any attachments.  If you have received this E-mail
  in error, please notify us immediately by returning it to the sender and
  delete this copy from your system. Thank you.
  accessIndiana, MyLocal.IN.gov, CivicNet
  **
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 


-- 
http://www.multitask.com.au/people/dion/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Unit testing with Hypersonic

2004-08-08 Thread Trygve Laugstøl
On Mon, Aug 09, 2004 at 10:58:18AM +1000, Dion Gillard wrote:
 Yuck.
 
 Haven't you heard of dbunit?

How would that look?

--
Trygve

 
 On Thu, 5 Aug 2004 11:51:05 -0400, Trygve Laugstøl [EMAIL PROTECTED] wrote:
  I always create and drop the database from the setUp() method of my unit
  tests.
  
  A typical setUp() method looks like:
   
  http://cvs.continuum.codehaus.org/continuum/continuum-hibernate-store/src/test/java/org/codehaus/continuum/store/hibernate/HibernateContinuumStoreTest.java?rev=1.5view=auto
  
  This method makes it much easier to run the tests from anything, including
  your IDE. It also makes yours test independent of maven.
  
  --
  Trygve
  
  
  
  On Thu, Aug 05, 2004 at 10:19:22AM -0500, Eric Hauser wrote:
   I running some unit tests with Maven during my build process using
   Hypersonic in-memory mode as the datasource.  I generating the schema
   from Hibernate and then loading the schema in a preGoal for test:test
   using the ant:sql tags.  The problem that I am having is every time the
   unit test runs, Hypersonic cannot seem to find the tables that I just
   loaded.  Anyone have an example code that does something similar? Thanks.
  
   --
   Eric W. Hauser
   Application Developer
   accessIndiana...linking hoosiers to government
   http://www.IN.gov
   10 W. Market St., Suite 600
   Indianapolis, IN 46204
   Phone: (317) 233-4007
   Fax: (317) 233-2011
  
   **
   CONFIDENTIALITY NOTICE:
   This E-mail and any attachments are confidential.  If you are not the
   intended recipient, you do not have permission to disclose, copy,
   distribute, or open any attachments.  If you have received this E-mail
   in error, please notify us immediately by returning it to the sender and
   delete this copy from your system. Thank you.
   accessIndiana, MyLocal.IN.gov, CivicNet
   **
  
  
   -
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]
  
  
  
  
 
 
 -- 
 http://www.multitask.com.au/people/dion/
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 


signature.asc
Description: Digital signature


Re: Unit testing with Hypersonic

2004-08-08 Thread Brett Porter
About the same, but you'd need some external config. DBUnit is useful
when you need to prepopulate a database with specific table data. I
doubt it is very practical if you are using Hibernate to actually
create the database.

I use DBUnit at work where the database schema is already defined.

- Brett

On Sun, 8 Aug 2004 21:04:59 -0400, Trygve Laugstøl [EMAIL PROTECTED] wrote:
 On Mon, Aug 09, 2004 at 10:58:18AM +1000, Dion Gillard wrote:
  Yuck.
 
  Haven't you heard of dbunit?
 
 How would that look?
 
 --
 Trygve
 
 
 
 
  On Thu, 5 Aug 2004 11:51:05 -0400, Trygve Laugstøl [EMAIL PROTECTED] wrote:
   I always create and drop the database from the setUp() method of my unit
   tests.
  
   A typical setUp() method looks like:

   http://cvs.continuum.codehaus.org/continuum/continuum-hibernate-store/src/test/java/org/codehaus/continuum/store/hibernate/HibernateContinuumStoreTest.java?rev=1.5view=auto
  
   This method makes it much easier to run the tests from anything, including
   your IDE. It also makes yours test independent of maven.
  
   --
   Trygve
  
  
  
   On Thu, Aug 05, 2004 at 10:19:22AM -0500, Eric Hauser wrote:
I running some unit tests with Maven during my build process using
Hypersonic in-memory mode as the datasource.  I generating the schema
from Hibernate and then loading the schema in a preGoal for test:test
using the ant:sql tags.  The problem that I am having is every time the
unit test runs, Hypersonic cannot seem to find the tables that I just
loaded.  Anyone have an example code that does something similar? Thanks.
   
--
Eric W. Hauser
Application Developer
accessIndiana...linking hoosiers to government
http://www.IN.gov
10 W. Market St., Suite 600
Indianapolis, IN 46204
Phone: (317) 233-4007
Fax: (317) 233-2011
   
**
CONFIDENTIALITY NOTICE:
This E-mail and any attachments are confidential.  If you are not the
intended recipient, you do not have permission to disclose, copy,
distribute, or open any attachments.  If you have received this E-mail
in error, please notify us immediately by returning it to the sender and
delete this copy from your system. Thank you.
accessIndiana, MyLocal.IN.gov, CivicNet
**
   
   
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
   
  
  
  
 
 
  --
  http://www.multitask.com.au/people/dion/
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Unit testing with Hypersonic

2004-08-08 Thread Dion Gillard
With DbUnit, you wouldn't need to be creating and dropping the
database all the time, you'd set it up once and each test could
add/remove it's own data as necessary.

On Sun, 8 Aug 2004 22:18:51 -0400, Brett Porter [EMAIL PROTECTED] wrote:
 About the same, but you'd need some external config. DBUnit is useful
 when you need to prepopulate a database with specific table data. I
 doubt it is very practical if you are using Hibernate to actually
 create the database.
 
 I use DBUnit at work where the database schema is already defined.
 
 - Brett
 
 On Sun, 8 Aug 2004 21:04:59 -0400, Trygve Laugstøl [EMAIL PROTECTED] wrote:
  On Mon, Aug 09, 2004 at 10:58:18AM +1000, Dion Gillard wrote:
   Yuck.
  
   Haven't you heard of dbunit?
  
  How would that look?
 
  --
  Trygve
 
 
 
 
 
  
   On Thu, 5 Aug 2004 11:51:05 -0400, Trygve Laugstøl [EMAIL PROTECTED] wrote:
I always create and drop the database from the setUp() method of my unit
tests.
   
A typical setUp() method looks like:
 
http://cvs.continuum.codehaus.org/continuum/continuum-hibernate-store/src/test/java/org/codehaus/continuum/store/hibernate/HibernateContinuumStoreTest.java?rev=1.5view=auto
   
This method makes it much easier to run the tests from anything, including
your IDE. It also makes yours test independent of maven.
   
--
Trygve
   
   
   
On Thu, Aug 05, 2004 at 10:19:22AM -0500, Eric Hauser wrote:
 I running some unit tests with Maven during my build process using
 Hypersonic in-memory mode as the datasource.  I generating the schema
 from Hibernate and then loading the schema in a preGoal for test:test
 using the ant:sql tags.  The problem that I am having is every time the
 unit test runs, Hypersonic cannot seem to find the tables that I just
 loaded.  Anyone have an example code that does something similar? Thanks.

 --
 Eric W. Hauser
 Application Developer
 accessIndiana...linking hoosiers to government
 http://www.IN.gov
 10 W. Market St., Suite 600
 Indianapolis, IN 46204
 Phone: (317) 233-4007
 Fax: (317) 233-2011

 **
 CONFIDENTIALITY NOTICE:
 This E-mail and any attachments are confidential.  If you are not the
 intended recipient, you do not have permission to disclose, copy,
 distribute, or open any attachments.  If you have received this E-mail
 in error, please notify us immediately by returning it to the sender and
 delete this copy from your system. Thank you.
 accessIndiana, MyLocal.IN.gov, CivicNet
 **


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]

   
   
   
  
  
   --
   http://www.multitask.com.au/people/dion/
  
   -
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]
  
 
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 


-- 
http://www.multitask.com.au/people/dion/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Unit testing with Hypersonic

2004-08-06 Thread Ben Walding
You should find that the system property baseDir is the root of the 
active project being built.

eg System.getProperty(baseDir)
Cheers,
Ben
Craig S. Cottingham wrote:
On Aug 5, 2004, at 10:19, Eric Hauser wrote:
I running some unit tests with Maven during my build process using 
Hypersonic in-memory mode as the datasource.  I generating the schema 
from Hibernate and then loading the schema in a preGoal for test:test 
using the ant:sql tags.  The problem that I am having is every time 
the unit test runs, Hypersonic cannot seem to find the tables that I 
just loaded.  Anyone have an example code that does something 
similar? Thanks.

We don't generate the database schema as part of the test goal; 
instead, the Hypersonic database script is an original source and 
stored in version control. Other than that, I think we're doing 
something similar to what you're trying to do.

The problem we ran into was that Maven has no well-defined current 
directory from which to specify a relative path to the database 
script. Normally, this would mean that you'd have to specify an 
absolute path, which is generally a Bad Idea.

I got around this by modifying the datasource configuration properties 
file in a pregoal for test:test:

  preGoal name=test:test
ant:copy todir=${maven.build.dir}/test-classes overwrite=true 
  ant:fileset dir=${maven.src.dir}/test/conf
ant:include name=datasource.properties /
  /ant:fileset
  ant:filterset
ant:filter token=BUILDDIR value=${maven.build.dir} /
  /ant:filterset
/ant:copy
  /preGoal
The datasource configuration properties file contains (in part):
  testPool.jdbc.driver=org.hsqldb.jdbcDriver
  testPool.jdbc.url=jdbc:hsqldb:@BUILDDIR@/testdb
The glue between the datasource configuration properties and the code 
that uses the datasource I can't show you, unfortunately. But as long 
as you're defining the connection parameters in a configuration file 
(and you should be :-), you should be able to do something similar.

Hope this helps.
--
Craig S. Cottingham
[EMAIL PROTECTED]
OpenPGP key available from:
http://pgp.mit.edu:11371/pks/lookup?op=getsearch=0x7977F79C
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Unit testing with Hypersonic

2004-08-06 Thread Jason van Zyl
On Fri, 2004-08-06 at 06:51, Ben Walding wrote:
 You should find that the system property baseDir is the root of the 
 active project being built.
 
 eg System.getProperty(baseDir)

System.getProperty(basedir) // no capital on the d

-- 
jvz.

Jason van Zyl
[EMAIL PROTECTED]
http://maven.apache.org

believe nothing, no matter where you read it,
or who has said it,
not even if i have said it,
unless it agrees with your own reason
and your own common sense.

 -- Buddha


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Unit testing with Hypersonic

2004-08-05 Thread Eric Hauser
I running some unit tests with Maven during my build process using 
Hypersonic in-memory mode as the datasource.  I generating the schema 
from Hibernate and then loading the schema in a preGoal for test:test 
using the ant:sql tags.  The problem that I am having is every time the 
unit test runs, Hypersonic cannot seem to find the tables that I just 
loaded.  Anyone have an example code that does something similar? Thanks.

--
Eric W. Hauser
Application Developer
accessIndiana...linking hoosiers to government
http://www.IN.gov
10 W. Market St., Suite 600
Indianapolis, IN 46204
Phone: (317) 233-4007
Fax: (317) 233-2011
**
CONFIDENTIALITY NOTICE:
This E-mail and any attachments are confidential.  If you are not the intended recipient, you do not have permission to disclose, copy, distribute, or open any attachments.  If you have received this E-mail
in error, please notify us immediately by returning it to the sender and delete this copy from your system. 
Thank you.
accessIndiana, MyLocal.IN.gov, CivicNet
** 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


RE: Unit testing with Hypersonic

2004-08-05 Thread Göschl,Siegfried
Hi Eric,

Are you sure that your ant:sql could possibly work with in-memory mode?! I think you 
would have to use the server mode for that ...

Cheers,

Siegfried Goeschl

-Original Message-
From: Eric Hauser [mailto:[EMAIL PROTECTED] 
Sent: Donnerstag, 05. August 2004 17:19
To: Maven Users List
Subject: Unit testing with Hypersonic


I running some unit tests with Maven during my build process using 
Hypersonic in-memory mode as the datasource.  I generating the schema 
from Hibernate and then loading the schema in a preGoal for test:test 
using the ant:sql tags.  The problem that I am having is every time the 
unit test runs, Hypersonic cannot seem to find the tables that I just 
loaded.  Anyone have an example code that does something similar? Thanks.

-- 
Eric W. Hauser
Application Developer
accessIndiana...linking hoosiers to government http://www.IN.gov 10 W. Market St., 
Suite 600 Indianapolis, IN 46204
Phone: (317) 233-4007
Fax: (317) 233-2011

**
CONFIDENTIALITY NOTICE:
This E-mail and any attachments are confidential.  If you are not the intended 
recipient, you do not have permission to disclose, copy, distribute, or open any 
attachments.  If you have received this E-mail in error, please notify us immediately 
by returning it to the sender and delete this copy from your system. 
Thank you.
accessIndiana, MyLocal.IN.gov, CivicNet
** 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Unit testing with Hypersonic

2004-08-05 Thread Craig S . Cottingham
On Aug 5, 2004, at 10:19, Eric Hauser wrote:
I running some unit tests with Maven during my build process using 
Hypersonic in-memory mode as the datasource.  I generating the schema 
from Hibernate and then loading the schema in a preGoal for test:test 
using the ant:sql tags.  The problem that I am having is every time 
the unit test runs, Hypersonic cannot seem to find the tables that I 
just loaded.  Anyone have an example code that does something similar? 
Thanks.
We don't generate the database schema as part of the test goal; 
instead, the Hypersonic database script is an original source and 
stored in version control. Other than that, I think we're doing 
something similar to what you're trying to do.

The problem we ran into was that Maven has no well-defined current 
directory from which to specify a relative path to the database script. 
Normally, this would mean that you'd have to specify an absolute path, 
which is generally a Bad Idea.

I got around this by modifying the datasource configuration properties 
file in a pregoal for test:test:

  preGoal name=test:test
ant:copy todir=${maven.build.dir}/test-classes overwrite=true 
  ant:fileset dir=${maven.src.dir}/test/conf
ant:include name=datasource.properties /
  /ant:fileset
  ant:filterset
ant:filter token=BUILDDIR value=${maven.build.dir} /
  /ant:filterset
/ant:copy
  /preGoal
The datasource configuration properties file contains (in part):
  testPool.jdbc.driver=org.hsqldb.jdbcDriver
  testPool.jdbc.url=jdbc:hsqldb:@BUILDDIR@/testdb
The glue between the datasource configuration properties and the code 
that uses the datasource I can't show you, unfortunately. But as long 
as you're defining the connection parameters in a configuration file 
(and you should be :-), you should be able to do something similar.

Hope this helps.
--
Craig S. Cottingham
[EMAIL PROTECTED]
OpenPGP key available from:
http://pgp.mit.edu:11371/pks/lookup?op=getsearch=0x7977F79C
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


RE: Unit testing with Hypersonic

2004-08-05 Thread Carlos Sanchez
Hi Eric,

I've used Hypersonic in-memory with Hibernate, but instead of manually
importing the schema I've configured Hibernate to create tables itself and
everything worked fine.

The problem that you may have is that the junit tests are running in a new
virtual machine and the in-memory database is shutdown (removing tables)
after ant:sql.

Regards

Carlos Sanchez
A Coruña, Spain

Oness Project
http://oness.sourceforge.net


 -Original Message-
 From: Eric Hauser [mailto:[EMAIL PROTECTED] 
 Sent: Thursday, August 05, 2004 5:19 PM
 To: Maven Users List
 Subject: Unit testing with Hypersonic
 
 I running some unit tests with Maven during my build process 
 using Hypersonic in-memory mode as the datasource.  I 
 generating the schema from Hibernate and then loading the 
 schema in a preGoal for test:test using the ant:sql tags.  
 The problem that I am having is every time the unit test 
 runs, Hypersonic cannot seem to find the tables that I just 
 loaded.  Anyone have an example code that does something 
 similar? Thanks.
 
 --
 Eric W. Hauser
 Application Developer
 accessIndiana...linking hoosiers to government
 http://www.IN.gov
 10 W. Market St., Suite 600
 Indianapolis, IN 46204
 Phone: (317) 233-4007
 Fax: (317) 233-2011
 
 **
 CONFIDENTIALITY NOTICE:
 This E-mail and any attachments are confidential.  If you are 
 not the intended recipient, you do not have permission to 
 disclose, copy, distribute, or open any attachments.  If you 
 have received this E-mail in error, please notify us 
 immediately by returning it to the sender and delete this 
 copy from your system. 
 Thank you.
 accessIndiana, MyLocal.IN.gov, CivicNet
 **
  
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Unit testing with Hypersonic

2004-08-05 Thread Eric Hauser
I switched from using the memory only mode to using Hypersonic in server 
mode instead.  I fired off server mode from the command line, changed 
the datasource URL, and everything seemed to work fine.  I didn't have 
to change anything regarding the loading of the schema export using 
ant:sql.  Of course, now the issue is that if I want this to be 
completely automated I have to find a way to get Maven to start up 
Hypersonic in server mode for me.  Here's what I'm trying:

postGoal name=java:compile
 !-- Generate schema for the database --
 ant:path id=schemaexport.classpath
  ant:path refid=maven.dependency.classpath /
  ant:pathelement location=${maven.build.dir}/classes /
 /ant:path
 ant:taskdef name=schemaexport 
classname=net.sf.hibernate.tool.hbm2ddl.SchemaExportTask 
classpathref=schemaexport.classpath /
 ant:schemaexport properties=etc/hibernate-unit-test.properties 
delimiter=; text=yes output=${maven.build.dir}/${pom.name}.ddl
  ant:fileset dir=${maven.build.dest}
   ant:include name=**/*.hbm.xml /
  /ant:fileset
 /ant:schemaexport
/postGoal

preGoal name=test:compile
 ant:copy file=${maven.war.src}/WEB-INF/applicationContext.xml  
todir=${basedir}/target/test-classes/ filtering=on
  ant:filterset
ant:filter token=hibernate.dialect 
value=net.sf.hibernate.dialect.HSQLDialect /
  /ant:filterset
 /ant:copy
/preGoal

preGoal name=test:test
 !-- need to startup the database  here --
 ant:java classpathref=maven.dependency.classpath fork=true 
spawn=true classname=org.hsqldb.Server
   arg value=-database /
   arg value=testdb /
 /ant:java
 !-- Load schema into hsqldb for unit testing --
 ant:sql driver=org.hsqldb.jdbcDriver 
url=jdbc:hsqldb:hsql://testdb userid=sa password= 
src=${maven.build.dir}/${pom.name}.ddl onerror=continue
   ant:classpath refid=maven.dependency.classpath /
 /ant:sql
/preGoal

I left in the ant:java code which does not work.  I seem to remember 
having this problem before, but I don't think Maven allows for the 
spawning on a new process properly.  How are you firing off Hypersonic?

Craig S. Cottingham wrote:
On Aug 5, 2004, at 10:19, Eric Hauser wrote:
I running some unit tests with Maven during my build process using 
Hypersonic in-memory mode as the datasource.  I generating the schema 
from Hibernate and then loading the schema in a preGoal for test:test 
using the ant:sql tags.  The problem that I am having is every time 
the unit test runs, Hypersonic cannot seem to find the tables that I 
just loaded.  Anyone have an example code that does something 
similar? Thanks.

We don't generate the database schema as part of the test goal; 
instead, the Hypersonic database script is an original source and 
stored in version control. Other than that, I think we're doing 
something similar to what you're trying to do.

The problem we ran into was that Maven has no well-defined current 
directory from which to specify a relative path to the database 
script. Normally, this would mean that you'd have to specify an 
absolute path, which is generally a Bad Idea.

I got around this by modifying the datasource configuration properties 
file in a pregoal for test:test:

  preGoal name=test:test
ant:copy todir=${maven.build.dir}/test-classes overwrite=true 
  ant:fileset dir=${maven.src.dir}/test/conf
ant:include name=datasource.properties /
  /ant:fileset
  ant:filterset
ant:filter token=BUILDDIR value=${maven.build.dir} /
  /ant:filterset
/ant:copy
  /preGoal
The datasource configuration properties file contains (in part):
  testPool.jdbc.driver=org.hsqldb.jdbcDriver
  testPool.jdbc.url=jdbc:hsqldb:@BUILDDIR@/testdb
The glue between the datasource configuration properties and the code 
that uses the datasource I can't show you, unfortunately. But as long 
as you're defining the connection parameters in a configuration file 
(and you should be :-), you should be able to do something similar.

Hope this helps.
--
Craig S. Cottingham
[EMAIL PROTECTED]
OpenPGP key available from:
http://pgp.mit.edu:11371/pks/lookup?op=getsearch=0x7977F79C
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

--
Eric W. Hauser
Application Developer
accessIndiana...linking hoosiers to government
http://www.IN.gov
10 W. Market St., Suite 600
Indianapolis, IN 46204
Phone: (317) 233-4007
Fax: (317) 233-2011
**
CONFIDENTIALITY NOTICE:
This E-mail and any attachments are confidential.  If you are not the intended recipient, you do not have permission to disclose, copy, distribute, or open any attachments.  If you have received this E-mail
in error, please notify us immediately by returning it to the sender and delete this copy from your system. 
Thank you.
accessIndiana, MyLocal.IN.gov, CivicNet
** 


Re: Unit testing with Hypersonic

2004-08-05 Thread Craig S . Cottingham
On Aug 5, 2004, at 10:55, Eric Hauser wrote:
I switched from using the memory only mode to using Hypersonic in 
server mode instead.  I fired off server mode from the command line, 
changed the datasource URL, and everything seemed to work fine.  I 
didn't have to change anything regarding the loading of the schema 
export using ant:sql.  Of course, now the issue is that if I want this 
to be completely automated I have to find a way to get Maven to start 
up Hypersonic in server mode for me.  Here's what I'm trying:
[snip]
I left in the ant:java code which does not work.  I seem to remember 
having this problem before, but I don't think Maven allows for the 
spawning on a new process properly.  How are you firing off 
Hypersonic?
We run Hypersonic in-memory. Since the database schema is stored in 
src/test/conf instead of being generated by Maven at test time, we 
don't have the problem of schema changes being made and then dropped 
before the tests run.

--
Craig S. Cottingham
[EMAIL PROTECTED]
OpenPGP key available from:
http://pgp.mit.edu:11371/pks/lookup?op=getsearch=0x7977F79C
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Unit testing with Hypersonic

2004-08-05 Thread Eric Hauser
Thanks everyone for the suggestions.  I found that Carlos' method seems 
to be the best choice for me.  I'm just running the SQL to create the 
tables in the static initialzer for my base test case.  Assuming the 
schema file has already been generated, this allows me to run the unit 
tests inside of Eclipse as well as with Maven.  Thanks again.

Craig S. Cottingham wrote:
On Aug 5, 2004, at 10:55, Eric Hauser wrote:
I switched from using the memory only mode to using Hypersonic in 
server mode instead.  I fired off server mode from the command line, 
changed the datasource URL, and everything seemed to work fine.  I 
didn't have to change anything regarding the loading of the schema 
export using ant:sql.  Of course, now the issue is that if I want 
this to be completely automated I have to find a way to get Maven to 
start up Hypersonic in server mode for me.  Here's what I'm trying:

[snip]
I left in the ant:java code which does not work.  I seem to remember 
having this problem before, but I don't think Maven allows for the 
spawning on a new process properly.  How are you firing off Hypersonic?

We run Hypersonic in-memory. Since the database schema is stored in 
src/test/conf instead of being generated by Maven at test time, we 
don't have the problem of schema changes being made and then dropped 
before the tests run.

--
Craig S. Cottingham
[EMAIL PROTECTED]
OpenPGP key available from:
http://pgp.mit.edu:11371/pks/lookup?op=getsearch=0x7977F79C
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

--
Eric W. Hauser
Application Developer
accessIndiana...linking hoosiers to government
http://www.IN.gov
10 W. Market St., Suite 600
Indianapolis, IN 46204
Phone: (317) 233-4007
Fax: (317) 233-2011
**
CONFIDENTIALITY NOTICE:
This E-mail and any attachments are confidential.  If you are not the intended recipient, you do not have permission to disclose, copy, distribute, or open any attachments.  If you have received this E-mail
in error, please notify us immediately by returning it to the sender and delete this copy from your system. 
Thank you.
accessIndiana, MyLocal.IN.gov, CivicNet
** 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


RE: Unit testing with Hypersonic

2004-08-05 Thread Carlos Sanchez
Hi Eric,

Do you know the Hibernate property hibernate.hbm2ddl.auto? There's no need
for a static initializer.

http://www.hibernate.org/hib_docs/reference/en/html_single/#configuration-op
tional

Automatically export schema DDL to the database when the SessionFactory is
created. With create-drop, the database schema will be dropped when the
SessionFactory is closed explicitely. 
eg. update | create | create-drop 


Regards

Carlos Sanchez
A Coruña, Spain

Oness Project
http://oness.sourceforge.net


 -Original Message-
 From: Eric Hauser [mailto:[EMAIL PROTECTED] 
 Sent: Thursday, August 05, 2004 8:20 PM
 To: Maven Users List
 Subject: Re: Unit testing with Hypersonic
 
 Thanks everyone for the suggestions.  I found that Carlos' 
 method seems to be the best choice for me.  I'm just running 
 the SQL to create the tables in the static initialzer for my 
 base test case.  Assuming the schema file has already been 
 generated, this allows me to run the unit tests inside of 
 Eclipse as well as with Maven.  Thanks again.
 
 Craig S. Cottingham wrote:
 
  On Aug 5, 2004, at 10:55, Eric Hauser wrote:
 
  I switched from using the memory only mode to using Hypersonic in 
  server mode instead.  I fired off server mode from the 
 command line, 
  changed the datasource URL, and everything seemed to work fine.  I 
  didn't have to change anything regarding the loading of the schema 
  export using ant:sql.  Of course, now the issue is that if I want 
  this to be completely automated I have to find a way to 
 get Maven to 
  start up Hypersonic in server mode for me.  Here's what I'm trying:
 
 
  [snip]
 
  I left in the ant:java code which does not work.  I seem 
 to remember 
  having this problem before, but I don't think Maven allows for the 
  spawning on a new process properly.  How are you firing 
 off Hypersonic?
 
 
  We run Hypersonic in-memory. Since the database schema is stored in 
  src/test/conf instead of being generated by Maven at test time, we 
  don't have the problem of schema changes being made and 
 then dropped 
  before the tests run.
 
  --
  Craig S. Cottingham
  [EMAIL PROTECTED]
  OpenPGP key available from:
  http://pgp.mit.edu:11371/pks/lookup?op=getsearch=0x7977F79C
 
 
  
 -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 --
 Eric W. Hauser
 Application Developer
 accessIndiana...linking hoosiers to government
 http://www.IN.gov
 10 W. Market St., Suite 600
 Indianapolis, IN 46204
 Phone: (317) 233-4007
 Fax: (317) 233-2011
 
 **
 CONFIDENTIALITY NOTICE:
 This E-mail and any attachments are confidential.  If you are 
 not the intended recipient, you do not have permission to 
 disclose, copy, distribute, or open any attachments.  If you 
 have received this E-mail in error, please notify us 
 immediately by returning it to the sender and delete this 
 copy from your system. 
 Thank you.
 accessIndiana, MyLocal.IN.gov, CivicNet
 **
  
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]