Re: [appengine-java] How to get testing working with anything other than the default queue
Try this: private final LocalServiceTestHelper helper = new LocalServiceTestHelper(new LocalTaskQueueTestConfig()) { @Override protected LocalServerEnvironment newLocalServerEnvironment() { final LocalServerEnvironment lse = super.newLocalServerEnvironment(); return new LocalServerEnvironment() { public File getAppDir() { return new File("dir/with/queues.xml"); } public String getAddress() { return lse.getAddress(); } public int getPort() { return lse.getPort(); } public void waitForServerToStart() throws InterruptedException { lse.waitForServerToStart(); } }; } }; On Tue, Feb 16, 2010 at 9:35 AM, Max Ross (Google) < maxr+appeng...@google.com > wrote: > Hi Will, > > You're loading queue.xml from a different location in your unit tests? > This is a use case I didn't thoroughly consider. I can certainly fix this > for the next release but let me see if I can find a workaround for you. > > Thanks, > Max > > On Tue, Feb 16, 2010 at 9:24 AM, Will Bunker wrote: > >> Prior to version 2.01 I was able to get testing to work with other >> queues by the following code: >> >>LocalTaskQueue ltq = >> LocalTaskQueueTestConfig.getLocalTaskQueue(); >> >> >>LocalServiceContext ctx = new LocalServiceContext() { >>public File getAppDir() { >>Logger.getAnonymousLogger().info("trying to run >> getAppDir()"); >>File file = new File("war"); >>return file; >>} >>}; >> >>HashMap prop = new HashMap(); >>ltq.init(ctx, prop); >>ltq.start(); >> >> You had to tell it where to find the config file queue.xml. Now after >> upgrading and using >> >>private static LocalServiceTestHelper helper = >>new LocalServiceTestHelper(new LocalTaskQueueTestConfig()); >> >> along with: helper.setUp >> >> I am getting the old testing errors of: >> java.lang.IllegalStateException: The specified queue is unknown : >> >> How do I get the Queue environment to recognize the queues in the >> queue.xml file? >> >> -- >> 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. >> >> > -- 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.
Re: [appengine-java] How to get testing working with anything other than the default queue
Hi Will, You're loading queue.xml from a different location in your unit tests? This is a use case I didn't thoroughly consider. I can certainly fix this for the next release but let me see if I can find a workaround for you. Thanks, Max On Tue, Feb 16, 2010 at 9:24 AM, Will Bunker wrote: > Prior to version 2.01 I was able to get testing to work with other > queues by the following code: > >LocalTaskQueue ltq = > LocalTaskQueueTestConfig.getLocalTaskQueue(); > > >LocalServiceContext ctx = new LocalServiceContext() { >public File getAppDir() { >Logger.getAnonymousLogger().info("trying to run > getAppDir()"); >File file = new File("war"); >return file; >} >}; > >HashMap prop = new HashMap(); >ltq.init(ctx, prop); >ltq.start(); > > You had to tell it where to find the config file queue.xml. Now after > upgrading and using > >private static LocalServiceTestHelper helper = >new LocalServiceTestHelper(new LocalTaskQueueTestConfig()); > > along with: helper.setUp > > I am getting the old testing errors of: > java.lang.IllegalStateException: The specified queue is unknown : > > How do I get the Queue environment to recognize the queues in the > queue.xml file? > > -- > 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. > > -- 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.
[appengine-java] How to get testing working with anything other than the default queue
Prior to version 2.01 I was able to get testing to work with other queues by the following code: LocalTaskQueue ltq = LocalTaskQueueTestConfig.getLocalTaskQueue(); LocalServiceContext ctx = new LocalServiceContext() { public File getAppDir() { Logger.getAnonymousLogger().info("trying to run getAppDir()"); File file = new File("war"); return file; } }; HashMap prop = new HashMap(); ltq.init(ctx, prop); ltq.start(); You had to tell it where to find the config file queue.xml. Now after upgrading and using private static LocalServiceTestHelper helper = new LocalServiceTestHelper(new LocalTaskQueueTestConfig()); along with: helper.setUp I am getting the old testing errors of: java.lang.IllegalStateException: The specified queue is unknown : How do I get the Queue environment to recognize the queues in the queue.xml file? -- 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.