예제 #1
0
 @Override
 protected void setUp() throws Exception {
   super.setUp();
   helper.setUp();
   taskQueue = LocalTaskQueueTestConfig.getLocalTaskQueue();
   StubMapper.fakeSetUp();
 }
 // Run this test twice to demonstrate we're not leaking state across tests.
 // If we _are_ leaking state across tests we'll get an exception on the
 // second test because there will already be a task with the given name.
 private void doTest() throws InterruptedException {
   QueueFactory.getDefaultQueue().add(TaskOptions.Builder.withTaskName("task29"));
   // Give the task time to execute if tasks are actually enabled (which they
   // aren't, but that's part of the test).
   Thread.sleep(1000);
   LocalTaskQueue ltq = LocalTaskQueueTestConfig.getLocalTaskQueue();
   QueueStateInfo qsi = ltq.getQueueStateInfo().get(QueueFactory.getDefaultQueue().getQueueName());
   assertEquals(1, qsi.getTaskInfo().size());
   assertEquals("task29", qsi.getTaskInfo().get(0).getTaskName());
 }