appengine local datastore integration testing with spring
Posted
by mirror303
on Stack Overflow
See other posts from Stack Overflow
or by mirror303
Published on 2010-03-11T17:24:39Z
Indexed on
2010/03/11
17:34 UTC
Read the original article
Hit count: 459
Hi all,
I want to write some integration tests to see how my spring-managed DAO's behave when talking to the appengine datastore.
Following the spring manual I will be providing my test-classes with the proper annotations:
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { "classpath:applicationContext.xml" })
After a lot of browsing I found this blog post dating back to august '09 from somebody doing exactly what I want to achieve. It involves writing a TestEnvironment
class that implements ApiProxy.Environment
plus talking to ApiProxyLocalImpl
.
However, if I look at the current docs (for version 1.3.1), it seems that this has been replaced by newing an instance of the framework provided LocalDatastoreServiceTestConfig
which is passed to a LocalServiceTestHelper
. It is too bad that the appengine docs don't show an example how to do this with JPA because then the spring wiring would be trivial.
Trying to follow the route outlined in the blog posting has me running into a compiler messages telling me that classes such as ApiProxyLocalImpl
are not visible by me. Hence, there must be a new way of doing it, which probably involves the LocalServiceTestHelper.
My question: Does anybody know how? I know I will need to configure an EntityManagerFactory and provide it with the Datastore connection somehow... but how? :)
© Stack Overflow or respective owner