Lots of mails from me today - just trying to get on top of things....

I'm investigating the best way to deploy a JPA based application in OSGi.
I've successfully used Karaf and iPojo in combination with Camel before but
JPA seems a bit more complicated.

Using Aries components (jpa, transaction and blueprint) seems to provide the
functionality I need. However, one problem for me is how to being able to
unit test my services without having to startup a Karaf instance. In the
past I've been using Spring/Hibernate for this purpose. Spring is very
flexible in the sense that I can configure a test environment for my unit
test and still being able to test services that uses transactions.

In more detail, my problem is as follows:

I have DAO objects containing persistence logic using JPA. These are used by
my service objects that contains business logic and also  specifies
transaction requirements. I can deploy those objects in Karaf using Aries.
However, I don't know how to unit test those services since they need the
presence of Aries. I know that this might be defined as integration tests
(and not unit tests) for that reason but I would still like a convenient way
to execute these tests as part of my maven build and preferrably without
having to deploy Karaf. Is that possible?

If not, what is the recommended way (best practice) for these kind of tests?

BTW it is not easy to unit test the DAO objects either since I need to get
hold of an entity manager in completely different ways depending on if I'm
in an OSGi environment or not. I could take some advice on this subject as
well...

Best regards,

/Bengt

Reply via email to