Hi all,

I would like to test my JPA repository/dao components locally and I'm
running into a dead end. I'm on SDK 1.3.1.

I have read the documentation at 
http://code.google.com/appengine/docs/java/tools/localunittesting.html.

This documentation deals with how to get access to the lower level
datastore API. I suppose I can compare that with a JDBC connection in
a conventional application. What I don't understand is how to write a
local unit test that talks to the JPA EntityManagerFactory. I found
some useful blog postings (http://objectuser.wordpress.com/2009/08/02/
google-app-engine-testing-with-spring/) but it seems the API version
used by the author of that posting is now outdated.

So my question is: how do I bridge the gap between the lower level
datastore factory and my JPA DAO implementation, e.g. how do I
configure JPA's EntityManagerFactory to use the local datastore
environment when running tests? I am aware my EntityManagerFactory
looks for persistence.xml on the classpath, which configures a
org.datanucleus.store.appengine.jpa.DatastorePersistenceProvider, for
which I can not find the javadoc anywhere.

Also, I found a posting on this group,
http://groups.google.com/group/google-appengine-java/browse_thread/thread/90f60cc91cce5a9b/c3080e2709a6fb9e.

The solution there is to setup the environment *inside* the actual
test implementation. That will make testing kind of troublesome, and
it seems to use the ApiProxyLocalImpl that I can not get a hand of in
the current SDK version.

A side note: considering the fact that the vast majority of people
will be accessing the datastore through either JDO or JPA, shouldn't
the testing documentation provide examples for that (instead of the
lower level API which seems to me sort of a niche)

Regards,
Hans

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.

Reply via email to