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

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


    public TaskHandle add(TaskOptions taskOptions) {
        return add(null, taskOptions);
    }

    public TaskHandle add(Transaction transaction, TaskOptions taskOptions) {
        TaskOptionsAccessor accessor = new TaskOptionsAccessor(taskOptions);
        try {
            PostMethodWebRequest request = new PostMethodWebRequest(accessor.getUrl(), accessor.getPayload(), null);
            request.setHeaderField(GTaskBinding.GAE_QUEUE_NAME, name);
            request.setHeaderField(GTaskBinding.GAE_RETRY_COUNT, "0");
            if (accessor.getTaskName() != null) {
                request.setHeaderField(GTaskBinding.GAE_TASK_NAME, accessor.getTaskName());
            }
            for (Map.Entry<String, List<String>> entry : accessor.getHeaders().entrySet()) {
                request.setHeaderField(entry.getKey(), entry.getValue().get(0));
            }
            servletUnitClient.getResponse(request);
        } catch (Exception e) {
            Assert.fail(e.getMessage());
View Full Code Here


   
    @Test
    public void testWriteRequest() throws Exception {
        GTaskEndpoint custom = createEndpoint("test?workerRoot=lazy");
        exchange.getIn().setBody("anything");
        accessor = new TaskOptionsAccessor(binding.writeRequest(endpoint, exchange, null));
        assertEquals("/worker/test", accessor.getPath());
        accessor = new TaskOptionsAccessor(binding.writeRequest(custom, exchange, null));
        assertEquals("/lazy/test", accessor.getPath());
    }
View Full Code Here

    public TaskHandle add(TaskOptions taskOptions) {
        return add(null, taskOptions);
    }

    public TaskHandle add(Transaction transaction, TaskOptions taskOptions) {
        TaskOptionsAccessor accessor = new TaskOptionsAccessor(taskOptions);
        try {
            PostMethodWebRequest request = new PostMethodWebRequest(accessor.getUrl(), accessor.getPayload(), null);
            request.setHeaderField(GTaskBinding.GAE_QUEUE_NAME, name);
            request.setHeaderField(GTaskBinding.GAE_RETRY_COUNT, "0");
            if (accessor.getTaskName() != null) {
                request.setHeaderField(GTaskBinding.GAE_TASK_NAME, accessor.getTaskName());
            }
            for (Map.Entry<String, String> entry : accessor.getHeaders().entrySet()) {
                request.setHeaderField(entry.getKey(), entry.getValue());
            }
            servletUnitClient.getResponse(request);
        } catch (Exception e) {
            Assert.fail(e.getMessage());
View Full Code Here

    public static GTaskEndpoint createEndpoint(String endpointUri) throws Exception {
        return (GTaskEndpoint)component.createEndpoint(endpointUri);
    }
   
    public static TaskOptionsAccessor createTaskOptionsAccessor() throws Exception {
        return new TaskOptionsAccessor(TaskOptions.Builder.withDefaults());
    }
View Full Code Here

   
    @Test
    public void testWriteRequest() throws Exception {
        GTaskEndpoint custom = createEndpoint("test?workerRoot=lazy");
        exchange.getIn().setBody("anything");
        accessor = new TaskOptionsAccessor(binding.writeRequest(endpoint, exchange, null));
        assertEquals("/worker/test", accessor.getPath());
        accessor = new TaskOptionsAccessor(binding.writeRequest(custom, exchange, null));
        assertEquals("/lazy/test", accessor.getPath());
    }
View Full Code Here

TOP

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

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.