PageRenderTime 329ms CodeModel.GetById 164ms app.highlight 4ms RepoModel.GetById 144ms app.codeStats 1ms

/src/test/java/com/google/ie/core/common/audit/AuditManagerTest.java

http://thoughtsite.googlecode.com/
Java | 43 lines | 25 code | 7 blank | 11 comment | 0 complexity | d45388d9116824c1c19fcba6ead39bd1 MD5 | raw file
 1// Copyright 2009 Google Inc. All Rights Reserved.
 2/**
 3 * 
 4 */
 5package com.google.ie.core.common.audit;
 6
 7import com.google.appengine.api.labs.taskqueue.QueueFactory;
 8import com.google.appengine.api.labs.taskqueue.TaskOptions;
 9import com.google.appengine.api.labs.taskqueue.dev.LocalTaskQueue;
10import com.google.appengine.api.labs.taskqueue.dev.QueueStateInfo;
11import com.google.appengine.tools.development.ApiProxyLocalImpl;
12import com.google.apphosting.api.ApiProxy;
13import com.google.ie.common.constants.IdeaExchangeConstants;
14import com.google.ie.test.LocalTaskQueueTest;
15
16import org.junit.Test;
17
18import junit.framework.Assert;
19
20/**
21 * @author asirohi
22 * 
23 */
24public class AuditManagerTest extends LocalTaskQueueTest {
25
26    /**
27     * 
28     */
29    @Test
30    public void audit() {
31
32        QueueFactory.getDefaultQueue().add(
33                        TaskOptions.Builder.taskName(IdeaExchangeConstants.AUDIT_TASK));
34        ApiProxyLocalImpl proxy = (ApiProxyLocalImpl) ApiProxy.getDelegate();
35        LocalTaskQueue ltq = (LocalTaskQueue) proxy.getService(LocalTaskQueue.PACKAGE);
36        String defaultQueueName = QueueFactory.getDefaultQueue().getQueueName();
37        QueueStateInfo qsi = ltq.getQueueStateInfo().get(defaultQueueName);
38        Assert.assertEquals(1, qsi.getTaskInfo().size());
39        Assert.assertEquals(IdeaExchangeConstants.AUDIT_TASK, qsi.getTaskInfo().get(0)
40                        .getTaskName());
41
42    }
43}