Have you thought about using dependency injection framework to cater for
this ?

A 

-----Original Message-----
From: Jose Gonzalez Gomez [mailto:[EMAIL PROTECTED] 
Sent: 11 July 2006 12:53
To: Maven Users List
Subject: Best practices in testing Hibernate/EJB3 POJOs (or doing
database tests)

Hi there,

I would like to hear about what you're doing to test your Hibernate/EJB3
POJOs (if you're doing at all). I have a project with some of them, and
I have the following concerns:

First of all, I may test them just ignoring persistence (already done).
No problem here, just a bunch of TestNG tests running smoothly under
Maven2. I think this is important, as I'm developing a library mainly
intended to be used as annotated Hibernated POJOs, but maybe people
using it prefer another persistence api. What do you think?

Then I thought about testing the library including the persistence
stuff, but this brings some problems:

Problem 1: Whenver building the project, publishing the site, etc. you
must have access to a runnning database in order to perform the tests.
I'm currently running a postgresql database, but it may be cumbersome
for users wanting to download and hack the sources. Maybe this could be
solved using some kind of embeddable database? Or maybe I could create
several profiles (never done this) and activate database tests only
under demand?

Problem 2: Having database tests involves having configuration data
written down in some configuration file (the jdbc URL, user, password,
etc.
hibernate.cfg.xml) or even in the pom (jdbc driver dependency). It's
kind of putting in the sources of the library some information that may
be only of interest to me in my current environment. How to solve this?
Again using some kind of embeddable datasource for tests? Using source
filters? (again, I haven't done this before, so I don't know if it's
suitable)

Best regards
Jose

Visit our website at http://www.ubs.com

This message contains confidential information and is intended only
for the individual named.  If you are not the named addressee you
should not disseminate, distribute or copy this e-mail.  Please
notify the sender immediately by e-mail if you have received this
e-mail by mistake and delete this e-mail from your system.

E-mail transmission cannot be guaranteed to be secure or error-free
as information could be intercepted, corrupted, lost, destroyed,
arrive late or incomplete, or contain viruses.  The sender therefore
does not accept liability for any errors or omissions in the contents
of this message which arise as a result of e-mail transmission.  If
verification is required please request a hard-copy version.  This
message is provided for informational purposes and should not be
construed as a solicitation or offer to buy or sell any securities or
related financial instruments.


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

Reply via email to