Package com.google.appengine.api.labs.taskqueue

Examples of com.google.appengine.api.labs.taskqueue.TaskOptions


    }
    List<Event> events = (List<Event>) query.execute(thenDate, nowDate);

    String cursorString =
      JDOCursorHelper.getCursor(events).toWebSafeString();
    TaskOptions options = TaskOptions.Builder
        .url("/offline/getEventStats")
        .param(CURSOR_KEY, cursorString)
        .param(NOW_DATE, ""+nowDate.getTime())
        .param(THEN_DATE, ""+thenDate.getTime());
View Full Code Here


      }
    }

    String cursorString =
      JDOCursorHelper.getCursor(chapterResults).toWebSafeString();
    TaskOptions options = TaskOptions.Builder
        .url("/offline/getChapterStats")
        .param(CURSOR_KEY, cursorString);

    countChapters(request, chapters, options);
    countCountries(request, chapters, options);
View Full Code Here

    @Test
    public void testWriteRequestHeaders() throws Exception {
        exchange.getIn().setHeader("test", "abc");
        exchange.getIn().setHeader(Exchange.HTTP_QUERY, "x=y");
        TaskOptions options = withDefaults();
        binding.writeRequestHeaders(endpoint, exchange, options);
        queue.add(options);
        TaskStateInfo info = getTaskStateInfos().get(0);
        assertEquals("abc", getHeader(info, "test"));
        assertNull(getHeader(info, Exchange.HTTP_QUERY));
View Full Code Here

    }
   
    @Test
    public void testWriteRequestBody() {
        exchange.getIn().setBody("test");
        TaskOptions options = withDefaults();
        binding.writeRequestBody(endpoint, exchange, options);
        queue.add(options);
        TaskStateInfo info = getTaskStateInfos().get(0);
        assertEquals("test", info.getBody());
        assertNull("application/octet-stream", getHeader(info , Exchange.CONTENT_TYPE));
View Full Code Here

    }
   
    @Test
    public void testWriteRequestWithDefaultWorkerRoot() throws Exception {
        exchange.getIn().setBody("anything");
        TaskOptions options = binding.writeRequest(endpoint, exchange, null);
        queue.add(options);
        TaskStateInfo info = getTaskStateInfos().get(0);
        assertEquals("/worker/test", info.getUrl());
    }
View Full Code Here

   
    @Test
    public void testWriteRequestWithCustomWorkerRoot() throws Exception {
        GTaskEndpoint custom = createEndpoint("test?workerRoot=lazy");
        exchange.getIn().setBody("anything");
        TaskOptions options = binding.writeRequest(custom, exchange, null);
        queue.add(options);
        TaskStateInfo info = getTaskStateInfos().get(0);
        assertEquals("/lazy/test", info.getUrl());
    }
View Full Code Here

     *            ignored.
     * @return a newly created {@link TaskOptions} instance containing data from
     *         <code>exchange</code>.
     */
    public TaskOptions writeRequest(GTaskEndpoint endpoint, Exchange exchange, TaskOptions request) {
        TaskOptions answer = TaskOptions.Builder.url(getWorkerRoot(endpoint) + endpoint.getPath());
        writeRequestHeaders(endpoint, exchange, answer);
        writeRequestBody(endpoint, exchange, answer);
        // TODO: consider TaskOptions method (POST, GET, ...)
        return answer;
    }
View Full Code Here

 
 
  public void addTaskToQueue(Map<String, String> params) {
    // System.out.println("PRE_TASK_ADDING");
    Queue tq = QueueFactory.getQueue("onPositiveQueue");
    TaskOptions to = TaskOptions.Builder.url(CONN_URL);
    for (String k : params.keySet()) {
      String val = params.get(k);
      to = to.param(k, val);
    }
    to = to.method(Method.POST);
    // to = to.taskName("task" + INIT + "count" + (-1));
    tq.add(to);
    // System.out.println("TASK_ADDED");
    new NewAccess().addTaskToQueue(params);
  }
View Full Code Here

        json.put("waveId", waveId);
        json.put("waveletId", waveletId);
        json.put("robotAddress", robotAddress);
        json.put("projectName", projectName);

        TaskOptions taskOptions = TaskOptions.Builder.url("/updateIssueTask").method(Method.POST)
            .payload(json.toString());

        queue.add(taskOptions);
      }
    } catch (JSONException e) {
View Full Code Here

     *            ignored.
     * @return a newly created {@link TaskOptions} instance containing data from
     *         <code>exchange</code>.
     */
    public TaskOptions writeRequest(GTaskEndpoint endpoint, Exchange exchange, TaskOptions request) {
        TaskOptions answer = TaskOptions.Builder.url(getWorkerRoot(endpoint) + endpoint.getPath());
        writeRequestHeaders(endpoint, exchange, answer);
        writeRequestBody(endpoint, exchange, answer);
        // TODO: consider TaskOptions method (POST, GET, ...)
        return answer;
    }
View Full Code Here

TOP

Related Classes of com.google.appengine.api.labs.taskqueue.TaskOptions

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.