-
1. Re: Good starting point for testing CDI + JPA data layer?
aslak Jan 20, 2010 7:41 AM (in response to sboscarine)Sorry for the late response, Steven.
I started writing a JPA/EJB3 example, but ran into a couple of issues:
https://jira.jboss.org/jira/browse/ARQ-55
.. and a deployment error with JPA on JBoss 6.0 M1, same example works fine on JBoss 5.1 tho.
I will commit the example tonight and post back with more info..
-
2. Re: Good starting point for testing CDI + JPA data layer?
aslak Jan 20, 2010 5:00 PM (in response to sboscarine)1 of 1 people found this helpfulOne way of doing it:
[Fisheye changeset|http://fisheye.jboss.org/changelog/JBossCommon/?cs=3937]
At the moment this only runs under the jboss-remote-51 profile...
-
3. Re: Good starting point for testing CDI + JPA data layer?
sboscarine Jan 31, 2010 8:02 PM (in response to aslak)If it's running in JBoss 5.1, it would have to be JPA 1.0, correct?
Would I have to wait until JBoss 6.0 profile is functioning before I could test JPA 2.0 and EJB 3.1?
I haven't yet planned on using any JPA 2.0 features, but I was planning on using @Stateless in an war without an interface. I would prefer to provide a close simulation of a Java EE 6 container so I can catch my mistakes in continuous integration instead of waiting for a customer to find it.
-
4. Re: Good starting point for testing CDI + JPA data layer?
aslak Feb 1, 2010 3:44 AM (in response to sboscarine)JBoss 5.1 is JPA 1 correct. As far as i know there should be no problem putting the latest Hibernate 3.5 release in JBoss 5.1 and have it work. Last I heard they had most JPA 2.0 features ready.
Hibernate 3.5 with JPA 2.0 is up for inclusion in the JBoss 6.0 M2 release that will be out the next weeks. I will update the Arquillian JBoss 6.0 integration to point to M2 when time is ready. (Hopefully by then the deployment issue will be fixed as well..
-
5. Re: Good starting point for testing CDI + JPA data layer?
dan.j.allen Feb 5, 2010 6:57 PM (in response to sboscarine)Would I have to wait until JBoss 6.0 profile is functioning before I could test JPA 2.0 and EJB 3.1?
I haven't yet planned on using any JPA 2.0 features, but I was planning on using @Stateless in an war without an interface. I would prefer to provide a close simulation of a Java EE 6 container so I can catch my mistakes in continuous integration instead of waiting for a customer to find it.
I just wrote a test for the widget repository in a project created using the weld-jsf-jee archetype and I can confirm that the Arquillian JBoss AS 6.0 profile does in fact work. JBoss AS 6.0 M1 does support deploying EJBs in a WAR, but it doesn't not support no-interface EJBs. The soon to be released JBoss AS 6.0 M2 is expected to support no-interface EJBs, if I'm not mistaken. -
6. Re: Good starting point for testing CDI + JPA data layer?
dan.j.allen Feb 5, 2010 7:00 PM (in response to aslak)I started writing a JPA/EJB3 example, but ran into a couple of issues:
https://jira.jboss.org/jira/browse/ARQ-55
.. and a deployment error with JPA on JBoss 6.0 M1, same example works fine on JBoss 5.1 tho.
While the dependsOnMethod is important to have, it is still possible to get tests written without it. So folks should still move forward experimenting with Arquillian for testing JPA and EJB 3. -
7. Re: Good starting point for testing CDI + JPA data layer?
dan.j.allen Feb 5, 2010 7:10 PM (in response to sboscarine)1 of 1 people found this helpfulIn the past, I've used Spring and moved all of my database config to a single file and loaded it via AbstractTestNGSpringContextTests. Is there an equivalent in Arquillian I should look at?
Since your testing "in container" you should setup your database configurating the same way you would in a real Java EE application.
First, you would either setup a data source in JNDI ahead of time or add a *-ds.xml file to your ShrinkWrap-built EAR that has a data source definition in it. See Using other Databases in the JBoss AS getting started guide for details.
Then, you would include a persistence.xml file as a manifest resource in the ShrinkWrap-built EAR. That will boot up the persistence unit and allow you to inject an EntityManager. From there, you can query the database.
If you want to run your tests in a standalone CDI environment (Weld SE), then you need to write a bean that will manually load the persistence unit using the Java SE API of JPA: http://java.sun.com/javaee/6/docs/api/javax/persistence/Persistence.html