I can't figure out how to point unit tests at the queue config file.
Unit Test snippet
// TaskQueue setup
LocalTaskQueueTestConfig tqConfig = new LocalTaskQueueTestConfig();
tqConfig.setQueueXmlPath("/war/WEB_INF/queue.xml");
Stack Trace
java.lang.IllegalStateException: The specified queue is unknown : zip-fetch at com.google.appengine.api.labs.taskqueue.QueueApiHelper.translateError(QueueApiHelper.java:56) at com.google.appengine.api.labs.taskqueue.QueueApiHelper.开发者_开发问答translateError(QueueApiHelper.java:111) at com.google.appengine.api.labs.taskqueue.QueueApiHelper.makeSyncCall(QueueApiHelper.java:32) at com.google.appengine.api.labs.taskqueue.QueueImpl.add(QueueImpl.java:310) at com.google.appengine.api.labs.taskqueue.QueueImpl.add(QueueImpl.java:282) at com.google.appengine.api.labs.taskqueue.QueueImpl.add(QueueImpl.java:267) at ...
LocalTaskQueueTestConfig tqConfig = new LocalTaskQueueTestConfig();
tqConfig.setQueueXmlPath("war/WEB-INF/queue.xml");
It is relative to the root of the project or an absolute path.
I had an underscore instead of a hyphen.
Per the javadoc, setQueueXmlPath must be the full path
public LocalTaskQueueTestConfig setQueueXmlPath(java.lang.String queueXmlPath) Overrides the location of queue.xml. Must be a full path, e.g. /usr/local/dev/myapp/test/queue.xml
https://developers.google.com/appengine/docs/java/tools/localunittesting/javadoc/com/google/appengine/tools/development/testing/LocalTaskQueueTestConfig#setQueueXmlPath(java.lang.String)
In order for this to work with my maven project (using GAE 1.7.3), I had to specify the full path of the test location:
LocalTaskQueueTestConfig tqConfig = new LocalTaskQueueTestConfig();
tqConfig.setQueueXmlPath("src/test/resources/queue.xml");
精彩评论