Package com.google.appengine.api.taskqueue

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


        String groupTag = "testLeaseTasksByTagBytes";
        String taskBaseName = groupTag + "_" + getTimeStampRandom();
        taskTags.add(taskBaseName);
        byte[] tagBytes = taskBaseName.getBytes();

        TaskOptions options =
            withMethod(TaskOptions.Method.PULL)
                .taskName(taskBaseName + "_0")
                .tag(tagBytes)
                .payload("");
        queue.add(options);
View Full Code Here


     */
    private List<TaskHandle> addTasks(int count, String taskBaseName,
                                      String groupTag, String payload) {
        ArrayList<TaskOptions> optionList = new ArrayList<>();
        for (int i = 0; i < count; i++) {
            TaskOptions options =
                withMethod(TaskOptions.Method.PULL)
                    .taskName(taskBaseName + "_" + i)
                    .tag(groupTag)
                    .payload(payload);
            optionList.add(options);
View Full Code Here

    @Test
    public void testDeferredDefault() {
        String testMethodTag = "testDefault";
        Map<String, String> paramMap = dsUtil.createParamMap(testMethodTag);

        TaskOptions taskOptions = TaskOptions.Builder.withPayload(new ExecDeferred(dsUtil, paramMap));

        QueueFactory.getDefaultQueue().add(taskOptions);
        Entity entity = dsUtil.waitForTaskThenFetchEntity(waitInterval, retryMax, testMethodTag);

        dsUtil.assertTaskParamsMatchEntityProperties(paramMap, entity);
View Full Code Here

    @Test
    public void testDeferredTaskWithNoName() {
        String testMethodTag = "testDeferredTaskWithNoName";
        Map<String, String> paramMap = dsUtil.createParamMap(testMethodTag);

        TaskOptions taskOptions = TaskOptions.Builder.withPayload(new ExecDeferred(dsUtil, paramMap));

        QueueFactory.getQueue(E2E_TESTING_DEFERRED).add(taskOptions);
        Entity entity = dsUtil.waitForTaskThenFetchEntity(waitInterval, retryMax, testMethodTag);

        dsUtil.assertTaskParamsMatchEntityProperties(paramMap, entity);
View Full Code Here

    public void testDeferredTaskNameSpecified() {
        String taskName = "This_is_my_deferred_task_name_" + testRunId;
        String testMethodTag = "testDeferredTaskNameSpecified";
        Map<String, String> paramMap = dsUtil.createParamMap(testMethodTag);

        TaskOptions taskOptions = TaskOptions.Builder.withTaskName(taskName).payload(new ExecDeferred(dsUtil, paramMap));

        QueueFactory.getQueue(E2E_TESTING_DEFERRED).add(taskOptions);
        Entity entity = dsUtil.waitForTaskThenFetchEntity(waitInterval, retryMax, testMethodTag);

        Map<String, String> expectedMap = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
View Full Code Here

        String specifiedNameSpace = "the_testDeferredUserNS";
        Map<String, String> paramMap = dsUtil.createParamMap(testMethodTag);

        NamespaceManager.set(specifiedNameSpace);

        TaskOptions taskOptions = TaskOptions.Builder.withPayload(new ExecDeferred(dsUtil, paramMap));

        // no task name specified.
        QueueFactory.getQueue(E2E_TESTING_DEFERRED).add(taskOptions);
        Entity entity = dsUtil.waitForTaskThenFetchEntity(waitInterval, retryMax, testMethodTag);
View Full Code Here

    @Test
    public void testDeferredMarkForRetry() {
        String testMethodTag = "testDeferredWithRetry";
        Map<String, String> paramMap = dsUtil.createParamMap(testMethodTag);

        TaskOptions taskOptions = TaskOptions.Builder.withPayload(ExecDeferred.markForRetry(dsUtil, paramMap));

        QueueFactory.getQueue(E2E_TESTING_DEFERRED).add(taskOptions);
        Entity entity = dsUtil.waitForTaskThenFetchEntity(waitInterval, retryMax, testMethodTag);

        dsUtil.assertTaskParamsMatchEntityProperties(paramMap, entity);
View Full Code Here

@RunWith(Arquillian.class)
public class TaskOptionsTest extends QueueTestBase {

    @Test
    public void testParams() {
        TaskOptions options = TaskOptions.Builder.withParam("foo", "bar");
        options.removeParam("foo");

        options = TaskOptions.Builder.withParam("foo", "bar".getBytes());
        options.clearParams();
    }
View Full Code Here

        options.clearParams();
    }

    @Test
    public void testHeaders() {
        TaskOptions options = TaskOptions.Builder.withHeaders(Collections.<String, String>singletonMap("foo", "bar"));
        options.removeHeader("foo");
    }
View Full Code Here

        options.removeHeader("foo");
    }

    @Test
    public void testMisc() throws Exception {
        TaskOptions options = TaskOptions.Builder.withTag("tag".getBytes()).etaMillis(1000L).payload("p").url("/frc");
        Assert.assertEquals("tag", options.getTag());
        Assert.assertArrayEquals("tag".getBytes(), options.getTagAsBytes());
        Assert.assertEquals(Long.valueOf(1000), options.getEtaMillis());
        Assert.assertArrayEquals("p".getBytes(), options.getPayload());
        Assert.assertEquals("/frc", options.getUrl());
    }
View Full Code Here

TOP

Related Classes of com.google.appengine.api.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.