users@glassfish.java.net

Re: Running embedded test with multimodule project

From: Marina Vatkina <marina.vatkina_at_oracle.com>
Date: Thu, 17 Jun 2010 10:50:08 -0700

Did you try to just add the driver to the classpath?

thanks,
-marina

Major Péter wrote:
> Hi,
>
> I have a really specific problem, I would like to run JUnit tests on my
> multi-module enterprise application with help of glassfish-embedded-all.
>
> The project structure is the following
>
> [pom]
> + [ear-module]
> + [web-module]
> + [web-module]
> + [domain module] (jar containing the entities)
> + [ejb-module] (session beans)
> + [ejb-services] (interfaces and exceptions for the session beans)
>
> So I digged a little and found out that I need the
> glassfish-embedded-all with a custom domain.xml.
> I'm using PostgreSQL for persistence, so I've created a test database
> and a test connection pool in a custom domain.xml, the persistence.xml
> is using the test JNDI, and it uses the create-drop policy (I'm
> wondering how could I integrate Maven-SQL plugin to recreate the same
> context for every tests). The domain.xml is under
> ejb-module/src/test/resources/org/glassfish/embed folder.
>
> 1. problem: I don't know where to put the postgresql driver and the
> hibernate jars (is the EJB module a good place with test scope)?
> 2. problem when I tried to put test classes into the EJB module, then I
> always got 'Invalid ejb jar [test-classes.jar]: it contains zero ejb.'
> message probably because the entities are in a separate JAR. How could I
> resolve this?
>
> The goal at the end would be to run tests on EJB's and also on the
> webmodules too.
> Any help would be really appreciated.
>
> Regards,
> Peter Major
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>