Humm... I get a nice appengine-indexes-auto.xml after my runs. Ah yes,
don t call tear down on the helper... I don t exactly remember but,
this was clearing the local_db.bin file and maybe the indexes auto
also.

R.

On Nov 18, 7:39 pm, Jerry <jerry.morri...@gmail.com> wrote:
> Great tip but it's not working. Running the test updates the mod date
> of local_db.bin but not datastore-indexes-auto.xml.
>
> I'm also configuring a LocalUserServiceTestConfig for a logged in
> user, but that doesn't seem to affect it.
>
> Is another setup step needed?
>
> I'd like a unit test to trigger all auto-index because my app has many
> possible combinations of query filters.
>
> Thanks!
>
> On Nov 11, 11:24 am, Starman <r...@arrova.ca> wrote:
>
>
>
> > Something like the following will setup the datastore helper and
> > create the datastore-indexes-auto.xml:
>
> >             LocalDatastoreServiceTestConfig dsConfig = new
> > LocalDatastoreServiceTestConfig();
> >             File location = new File("war/WEB-INF/appengine-generated/
> > local_db.bin");
>
> > dsConfig.setBackingStoreLocation(location.getAbsolutePath());
>
> >             // And it seems that for the local ds service to be able
> > to load the local_db.bin file, the local
> >             // environment must match the app id and version as stored
> > in the file.
>
> >             String xml;
> >             try {
> >                 xml = FileUtils.readFileToString(new File("war/WEB-INF/
> > appengine-web.xml"));
> >             }
> >             catch (IOException e) {
> >                 throw new RuntimeException(e);
> >             }
> >             String application = StringUtils.substringBetween(xml,
> > "<application>", "</application>");
> >             String version = StringUtils.substringBetween(xml,
> > "<version>", "</version>");
>
> >             // Default behavior is to keep everything in RAM. Tell the
> > local services to use the file system
>
> >             dsConfig.setNoStorage(false);
>
> >             // Create the local services.
>
> >             gaeDatastoreHelper = new LocalServiceTestHelper(dsConfig);
> >             gaeDatastoreHelper.setEnvAppId(application);
> >             gaeDatastoreHelper.setEnvVersionId(version);
>
> >             // Calling setUp() will start the local ds service and
> > load the local_db.bin file.
>
> >             gaeDatastoreHelper.setUp();
>
> > This way, you can even write tests against a previously generated
> > local_db.bin if you want.

-- 
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 google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.

Reply via email to