PageRenderTime 376ms CodeModel.GetById 214ms app.highlight 3ms RepoModel.GetById 109ms app.codeStats 0ms

/src/test/java/com/google/ie/test/LocalTaskQueueTest.java

http://thoughtsite.googlecode.com/
Java | 27 lines | 21 code | 4 blank | 2 comment | 1 complexity | d366e34113a8c4c22b456c0eb176c09f MD5 | raw file
 1package com.google.ie.test;
 2
 3import com.google.appengine.api.labs.taskqueue.dev.LocalTaskQueue;
 4import com.google.appengine.tools.development.ApiProxyLocalImpl;
 5import com.google.apphosting.api.ApiProxy;
 6
 7public class LocalTaskQueueTest extends ServiceTest {
 8
 9    @Override
10    public void setUp() {
11        super.setUp();
12        ApiProxyLocalImpl proxy = (ApiProxyLocalImpl) ApiProxy.getDelegate();
13        // prevent tasks from automatically executing
14        proxy.setProperty(LocalTaskQueue.DISABLE_AUTO_TASK_EXEC_PROP, Boolean.TRUE.toString());
15    }
16
17    @Override
18    public void tearDown() {
19        ApiProxyLocalImpl proxy = (ApiProxyLocalImpl) ApiProxy.getDelegate();
20        LocalTaskQueue ltq = (LocalTaskQueue) proxy.getService(LocalTaskQueue.PACKAGE);
21        // clear out all tasks in all queues
22        for (String queueName : ltq.getQueueStateInfo().keySet()) {
23            ltq.flushQueue(queueName);
24        }
25        super.tearDown();
26    }
27}