Package gobo

Examples of gobo.ControllerTester


  @SuppressWarnings("unchecked")
  @Test
  public void runTest() throws Exception {

    ControllerTester tester = new ControllerTester();
    String run = tester.start("/restore/sheet");
    assertNotNull(run);
    List<Map<String, Object>> list = (List) tester.request.getAttribute("list");
    assertNull(list);
  }
View Full Code Here


  public void runAuthWithDataTest() throws Exception {

    String[] kinds = new String[] { "TestKind1" };
    final SpreadsheetEntry spreadsheet = SpreadsheetUtil.createSpreadsheet(authSubToken, kinds);
    try {
      ControllerTester tester = new ControllerTester();
      HttpSession session = tester.request.getSession(true);
      session.setAttribute("token", authSubToken);
     
      tester.request.setParameter("ssKey", spreadsheet.getKey());
      String run = tester.start("/restore/sheet");
      assertNotNull(run);
      List<Map<String, Object>> list = (List) tester.request.getAttribute("list");
      assertThat(list.size(), not(0));
    } finally {
      SpreadsheetUtil.deleteSpreadsheet(authSubToken, spreadsheet);
View Full Code Here

  @Test
  public void runTest() throws Exception {

    Key controlKey = TaskQueueUtil.prepareDropControlKey("TestKind1");

    ControllerTester tester = new ControllerTester();
    tester.request.setParameter("controlKey", KeyFactory.keyToString(controlKey));

    String run = tester.start("/tasks/dropEnd");
    assertNull(run);

    LocalTaskQueue ltq = LocalTaskQueueTestConfig.getLocalTaskQueue();
    String defaultQueueName = QueueFactory.getDefaultQueue().getQueueName();
    QueueStateInfo qsi = ltq.getQueueStateInfo().get(defaultQueueName);
View Full Code Here

public class StartedControllerTest extends TestBase {

  @Test
  public void singleTaskTest() throws Exception {

    ControllerTester tester = new ControllerTester();
    String run = tester.start("/drop/started");
    assertNotNull(run);
  }
View Full Code Here

  @Test
  public void runWithoutDataTest() throws Exception {

    Key controlKey = TaskQueueUtil.prepareDropControlKey("TestKind1");

    ControllerTester tester = new ControllerTester();
    tester.request.setParameter("controlKey", KeyFactory.keyToString(controlKey));

    String run = tester.start("/tasks/drop");
    assertNull(run);

    LocalTaskQueue ltq = LocalTaskQueueTestConfig.getLocalTaskQueue();
    String defaultQueueName = QueueFactory.getDefaultQueue().getQueueName();
    QueueStateInfo qsi = ltq.getQueueStateInfo().get(defaultQueueName);
View Full Code Here

    DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();
    datastore.put(bulkData);

    Key controlKey = TaskQueueUtil.prepareDropControlKey("TestKind1");

    ControllerTester tester = new ControllerTester();
    tester.request.setParameter("controlKey", KeyFactory.keyToString(controlKey));

    String run = tester.start("/tasks/drop");
    assertNull(run);

    LocalTaskQueue ltq = LocalTaskQueueTestConfig.getLocalTaskQueue();
    String defaultQueueName = QueueFactory.getDefaultQueue().getQueueName();
    QueueStateInfo qsi = ltq.getQueueStateInfo().get(defaultQueueName);
View Full Code Here

  @Test(expected = EntityNotFoundException.class)
  public void runOverRetryCountTest() throws Exception {

    Key controlKey = TaskQueueUtil.prepareDropControlKey("TestKind1");

    ControllerTester tester = new ControllerTester();
    tester.request.setHeader("X-AppEngine-TaskRetryCount", "11");
    tester.request.setParameter("controlKey", KeyFactory.keyToString(controlKey));
    String run = tester.start("/tasks/drop");
    assertNull(run);

    DatastoreService ds = DatastoreServiceFactory.getDatastoreService();
    ds.get(controlKey);
  }
View Full Code Here

  @SuppressWarnings("unchecked")
  @Test
  public void runWithoutDataTest() throws Exception {

    ControllerTester tester = new ControllerTester();
    String run = tester.start("/drop/index");
    assertNotNull(run);
    List<Map<String, Object>> list = (List) tester.request.getAttribute("list");
    assertThat(list.size(), is(0));
   
  }
View Full Code Here

    DatastoreService ds = DatastoreServiceFactory.getDatastoreService();
    Entity entity = new Entity(KeyFactory.createKey("TestKind", 1));
    ds.put(entity);

    ControllerTester tester = new ControllerTester();
    String run = tester.start("/drop/index");
    assertNotNull(run);
    List<Map<String, Object>> list = (List) tester.request.getAttribute("list");
    assertThat(list.size(), is(1));
   
    Map row = list.get(0);
View Full Code Here

public class StartControllerTest extends TestBase {

  @Test
  public void runSingleTaskTest() throws Exception {

    ControllerTester tester = new ControllerTester();
    tester.request.setParameter("kindArray", TestDataUtil.TEST_KIND);

    String run = tester.start("/drop/start");
    assertNotNull(run);
   
    TaskQueueUtil.removeTasks();
  }
View Full Code Here

TOP

Related Classes of gobo.ControllerTester

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.