Thanks for the question and answer, Brendan. Can you say what getQueue()
is?
--
You received this message because you are subscribed to the Google Groups
Google App Engine for Java group.
To view this discussion on the web visit
private QueueStateInfo getQueue(String queueName) {
return
LocalTaskQueueTestConfig.getLocalTaskQueue().getQueueStateInfo().get(queueName);
}
will do. Thanks again!
--
You received this message because you are subscribed to the Google Groups
Google App Engine for Java group.
To view
This is a blast from the past. There are now official tools for unit
testing deferred tasks:
http://code.google.com/appengine/docs/java/tools/localunittesting.html#Writing_Deferred_Task_Tests
However, ignore the latch stuff - it works erratically, and if you
have an even slightly complicated
I've also tried the code below, however I get the following error on the
line client.sendRequest(request);
Perhaps I'm not encoding the task body correctly?
com.google.apphosting.utils.servlet.DeferredTaskServlet: Deferred task
failed exception:
I'm not sure what this is not working (given that it worked previously).
I'll take a look.
The task is binary data. My first guess is this:-
String queuedTask = taskInfo.getBody();
String is UTF-16 encoded while the body is a bunch of bytes. The process of
decoding and re-encoding has a
Thanks. I'll give that a try and report back.
Do you know if the first approach I tried with
LocalTaskQueueTestConfig.getLocalTaskQueue().runTask(queueName,
taskName) should ever work from a JUnit test case, or will ServletUnit
always be the way to go?
It seems like something didn't work
getBodyAsBytes() solves the problem.
The following code will run each of the queued DeferredTasks from within a
JUnit test.
String queueName = QueueFactory.getDefaultQueue().getQueueName();
ServletRunner sr = new ServletRunner();
sr.registerServlet(