I know that someone will arrive with a better implementation, but here goes own little code snippet used to populate our test database. It has survived five or six GAE upgrades, so glitches are expected :)
You must have two things in consideration: the appid and version must match, and you should enable datastore writes. File dbContents = new File("war/WEB-INF/appengine-generated/ local_db.bin"); LocalServiceTestHelper helper = new LocalServiceTestHelper(new LocalDatastoreServiceTestConfig() .setBackingStoreLocation(dbContents.getAbsolutePath()) .setStoreDelayMs(4000) .setNoStorage(false) ) { @Override protected Environment newEnvironment() { return createEnvironment(); } }; helper.setUp(); // ... now you can start writing your own data, and they will appear in the console public static Environment createEnvironment() { try { // retrieve application id and version from appengine-web.xml String contents = FileUtils.readFileToString(new File("war/WEB-INF/ appengine-web.xml")); final String application = StringUtils.substringBetween(contents, "<application>", "</application>"); final String version = StringUtils.substringBetween(contents, "<version>", "</version>"); // initialize GAE return new TestEnvironment() { @Override public String getAppId() { return application; } @Override public String getVersionId() { return version; } @Override public String getRequestNamespace() { return ""; } }; } catch (IOException e) { throw new RuntimeException(e); } } On Jun 23, 11:05 am, Andrés Cerezo <acerezoguil...@gmail.com> wrote: > Hi Rommel with the method listAllDomain I can see the data, there should be > a problem withhttp://127.0.0.1:8888/_ah/admin/datastoreperhaps a user roll > or something similar (in JUNIT or loggin > withhttp://127.0.0.1:8888/_ah/admin/datastore? > > Thanks. > > 2010/6/22 Ronmell Fuentes <ringe...@gmail.com> > > > Yup, for sure. > > > Let's suppose you have an entity called "domain" which has the following > > attributes: > > > 1. Key > > 2. Name > > > public void listAllDomain(){ > > List <Domain> results; > > Query query=factory.newQuery(Domain.class); > > try{ > > results=(List<Domain>) query.execute(); > > if(results.iterator().hasNext()){ > > for(int k=0;k<results.size();k++){ > > Domain dumb=results.get(k); > > System.out.println("Key: > > \t"+String.valueOf(dumb.getKey()).toString()); > > System.out.println("Domain > > Name:\t"+dumb.getDomainName()); > > } > > } > > else System.out.println("no results exist"); > > } > > finally{query.closeAll();} > > } > > > Where Domain.clas is the class type for your entity called Domain. > > besides, in the query object you can set filters for your query. > > > this method will show the data in your data Store. > > > As I can see, if the local_db.bin is getting bigger each time JUnit is ran, > > then the data must be there, so with this method you should be able to see > > all the data stored in your Data Store. you have just replace all "Domain" > > references for your Entity's. > > > Hope this is was helpful. > > > Rgds. > > > R > > > 2010/6/22 Andrés Cerezo <acerezoguil...@gmail.com> > > >> No, perhaps have yout got an example? > > >> 2010/6/22 Ronmell Fuentes <ringe...@gmail.com> > > >>> have you tried to retrieve the data from your app, I mean, not using the > >>> http..../_ah/admin console but using your own application, a class written > >>> in java to show the data, does it work?? > > >>> 2010/6/22 Andrés Cerezo <acerezoguil...@gmail.com> > > >>>> I think so, When I executed all is right, however I don't execute > >>>> teardown method because If I executed this the data are deleted. > >>>> Alsoeverytime I executed JUNIT the local_db.bin file is bigger than the > >>>> last > >>>> time so It has the data. > > >>>> 2010/6/22 Ronmell Fuentes <ringe...@gmail.com> > > >>>>> is your JUnit well configured?? > > >>>>> 2010/6/22 Andrés Cerezo <acerezoguil...@gmail.com> > > >>>>>> But I can see the data created with the servlets with > >>>>>>http://localhost:8888/_ah/admin, but not when I the data are created > >>>>>> with junit. > > >>>>>> 2010/6/22 Ronmell Fuentes <ringe...@gmail.com> > > >>>>>>> Hi Acerezo > > >>>>>>> remember the Data stored in dataStore is schemaless so, as far as I > >>>>>>> know, only GAE knows how to deal with it. > > >>>>>>> When I want to see the data from the dataStore I use the classes > >>>>>>> written in java in order to manage the data in Data Store. > >>>>>>> in the other hand, you can use Restlets running on your app in order > >>>>>>> to manage your data when deployed in GAE. > > >>>>>>> Rgds. > > >>>>>>> Ronmell > > >>>>>>> 2010/6/22 Acerezo <acerezoguil...@gmail.com> > > >>>>>>>> Hello all, > > >>>>>>>> I have been running my server locally with JUNIT all is ok but when > >>>>>>>> I > >>>>>>>> want to see the data of the local_db.bin file from localhost:8888 I > >>>>>>>> don´t see the data (entities, etc) Anyone can help me, please? > > >>>>>>>> Thanks. > > >>>>>>>> -- > >>>>>>>> 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<google-appengine-java%2bunsubscr...@googlegroups.com> > >>>>>>>> . > >>>>>>>> For more options, visit this group at > >>>>>>>>http://groups.google.com/group/google-appengine-java?hl=en. > > >>>>>>> -- > >>>>>>> ausencia de evidencia ≠ evidencia de ausencia > >>>>>>>http://culturainteractiva.blogspot.com/ > > >>>>>>> -- > >>>>>>> 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<google-appengine-java%2bunsubscr...@googlegroups.com> > >>>>>>> . > >>>>>>> For more options, visit this group at > >>>>>>>http://groups.google.com/group/google-appengine-java?hl=en. > > >>>>>> -- > >>>>>> 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<google-appengine-java%2bunsubscr...@googlegroups.com> > >>>>>> . > >>>>>> For more options, visit this group at > >>>>>>http://groups.google.com/group/google-appengine-java?hl=en. > > >>>>> -- > >>>>> ausencia de evidencia ≠ evidencia de ausencia > >>>>>http://culturainteractiva.blogspot.com/ > > >>>>> -- > >>>>> 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<google-appengine-java%2bunsubscr...@googlegroups.com> > >>>>> . > >>>>> For more options, visit this group at > >>>>>http://groups.google.com/group/google-appengine-java?hl=en. > > >>>> -- > >>>> 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<google-appengine-java%2bunsubscr...@googlegroups.com> > >>>> . > >>>> For more options, visit this group at > >>>>http://groups.google.com/group/google-appengine-java?hl=en. > > >>> -- > >>> ausencia de evidencia ≠ evidencia de ausencia > >>>http://culturainteractiva.blogspot.com/ > > >>> -- > >>> 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<google-appengine-java%2bunsubscr...@googlegroups.com> > >>> . > >>> For more options, visit this group at > >>>http://groups.google.com/group/google-appengine-java?hl=en. > > >> -- > >> 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<google-appengine-java%2bunsubscr...@googlegroups.com> > >> . > >> For more options, visit this group at > >>http://groups.google.com/group/google-appengine-java?hl=en. > > > -- > > ausencia de evidencia ≠ evidencia de ausencia > >http://culturainteractiva.blogspot.com/ > > > -- > > 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<google-appengine-java%2bunsubscr...@googlegroups.com> > > . > > For more options, visit this group at > >http://groups.google.com/group/google-appengine-java?hl=en. -- 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.