dcsimg
Running a JPA unit test from within ANT
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Doug_H
Posted On:   Tuesday, June 7, 2011 01:28 AM

I have a JUnit test that runs loads a persistence unit from a persistence.xml file in under src/test/META-INF/persistence.xml. I'm using Hibernate/JPA. It runs fine in my IDE. My problem is: how do I get the ANT JUnit task to find this persistence.xml file? Is there a way that an ANT JUnit task will be able to load my persistence.xml file for my unit test? Currently the build gets this exception: Exception during JPA EntityManager instanciation. junit.framework.AssertionFailedError: Exception during JPA EntityManager instanciation. Which blows up when this line of code in my setUp() emFactory = Persistence.createEntityManagerFactory("JUnit");    More>>

I have a JUnit test that runs loads a persistence unit from a persistence.xml file in under src/test/META-INF/persistence.xml. I'm using Hibernate/JPA. It runs fine in my IDE. My problem is: how do I get the ANT JUnit task to find this persistence.xml file? Is there a way that an ANT JUnit task will be able to load my persistence.xml file for my unit test?

Currently the build gets this exception:

Exception during JPA EntityManager instanciation.
junit.framework.AssertionFailedError: Exception during JPA EntityManager instanciation.

Which blows up when this line of code in my setUp()

emFactory = Persistence.createEntityManagerFactory("JUnit");

   <<Less
About | Sitemap | Contact