PageRenderTime 324ms CodeModel.GetById 160ms app.highlight 4ms RepoModel.GetById 157ms app.codeStats 0ms

/src/test/java/com/google/ie/core/common/objectionable/ObjectionableManagerTest.java

http://thoughtsite.googlecode.com/
Java | 40 lines | 23 code | 6 blank | 11 comment | 0 complexity | 93cb297722204584b947e30f60c0205d MD5 | raw file
 1// Copyright 2009 Google Inc. All Rights Reserved.
 2/**
 3 * 
 4 */
 5package com.google.ie.core.common.objectionable;
 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 gmaurya
22 * 
23 */
24public class ObjectionableManagerTest extends LocalTaskQueueTest {
25
26    /**
27     * 
28     */
29    @Test
30    public void checkObjectionable() {       
31        QueueFactory.getDefaultQueue().add(TaskOptions.Builder.taskName(IdeaExchangeConstants.CHECK_OBJECTIONABLE_TASK));
32        ApiProxyLocalImpl proxy = (ApiProxyLocalImpl) ApiProxy.getDelegate();
33        LocalTaskQueue ltq = (LocalTaskQueue) proxy.getService(LocalTaskQueue.PACKAGE);
34        String defaultQueueName = QueueFactory.getDefaultQueue().getQueueName();
35        QueueStateInfo qsi = ltq.getQueueStateInfo().get(defaultQueueName);
36        Assert.assertEquals(1, qsi.getTaskInfo().size());
37        Assert.assertEquals(IdeaExchangeConstants.CHECK_OBJECTIONABLE_TASK, qsi.getTaskInfo().get(0).getTaskName());
38
39    }
40}