Hi I'm building my first GAE app, starting from the bottom up (i.e.
datastore first). AppEngine SDK 1.4.3 via Google Plugin for Eclipse
Helios 3.6.1, with Objectify 2.2.3 to abstract datastore interactions.

I haven't yet used the dev server as I haven't yet built the web front-
end that will use this first DAO I've developed. This is largely
because of the discovery in the AppEngine docs of the "Local Unit
Testing" capabilities, in particular:

com.google.appengine.tools.development.testing.LocalServiceTestHelper
and
com.google.appengine.tools.development.testing.LocalDatastoreServiceTestConfig

(http://code.google.com/appengine/docs/java/tools/
localunittesting.html)

Short story for the uninitiated is that instead of running the dev
server and having dev data progressively persisted to disk (i.e. the
"Dev" datastore), the "Test" datastore is by default in-memory only
and its contents cleared between JUnit @Test cases.

My problem is that the "Test" datastore does not seem to honour the /
war/WEB-INF/datastore-indexes.xml file. My DAO includes a method that
queries an entity using a composite (2 field) index, which is
specified in the index config file, but the query through Objectify to
the "Test" datastore doesn't find the record.

HOWEVER, if I individually index the two columns that make up my
composite index (done in Objectify by adding the @Indexed annotation
to the corresponding fields within an @Unindexed entity), the query
through Objectify that filters on both these fields successfully
returns the record from the "Test" datastore.

So whilst I can work around it, this will result in needing two
indexes to support the one query when I should be able to get it to
work with one pre-specified in the index config. Not a major issue
now, but inevitably there will be a large entity set that I will need
to query with many columns and unnecessarily duplicating these indexes
just so my JUnits can work is not desirable.

I'm now re-evaluating whether this "Test" datastore is worth investing
any more effort in pursuing. This is a shame because the concept is
spot on.

Other suspicions I have about the completeness of the implementation
of the LocalDatastoreServiceTestConfig with respect to pre-configured
indexes are:
1. A call to LocalDatastoreServiceTestConfig.setNoIndexAutoGen(false)
forces the local environment to write the Auto Index Configuration
file, however even when I had no datastore-indexes.xml file, and
performed this 2-field filtering query, the contents of the datastore-
indexes-auto.xml file that was written was an empty <datastore-
indexes /> root element.
2. The location of the datastore-indexes-auto.xml file written in #1
above was to /WEB-INF/appengine-generated in my workspace, whereas the
docs (http://code.google.com/appengine/docs/java/config/
indexconfig.html) indicates the dev server would write this to /war/
WEB-INF/appengine-generated

Has anyone had any success in using composite indexes with the "Test"
Datastore, or with the generation of the Auto Index Configuration?

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" 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?hl=en.

Reply via email to