[jboss-user] [JBoss Seam] - Re: Uni testing and datasource problem

jagin do-not-reply at jboss.com
Tue Jan 8 02:22:55 EST 2008


At the first time I tried to do a simple unit testing without SeamTest (the same test as in my first post but without 'extends SeamTest' takeoff on JBoss Seam 2.0.0.GA Reference book page 293-294). But i got error Could not find datasource: java:/DefaultDS because the line emf = Persistence.createEntityManagerFactory("ezapp"); was called before the JBoss Embedded was initialized. Somewhere on the forum i have found that @BeforeClass in testng test is called before initializing the JBoss Embeded.
So i do the trick with extending SeamTest and overriding init and cleanup as in my 4-th post.

Lastly i have noticed that the error is triggered when this unit test is the first test in the *Test.xml package. If there is any test before which initialize embedded environment everything is ok.

Did you try to do a simple test like discribed in my 2-nd post or as in http://docs.jboss.org/seam/2.0.1.CR1/reference/en/html/testing.html#d0e19771 with clean app generated by seam-gen? It won't go because of @BeforeClass and the problem above.

As I said i'm new in JBoss Seam and there is a lot to learn for me so i'm trying to solve some problems with mist over my eyes.

Regards

Jarek

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4117801#4117801

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4117801



More information about the jboss-user mailing list