Search in sources :

Example 1 with TaskQueueDeleteRequest

use of com.google.appengine.api.taskqueue.TaskQueuePb.TaskQueueDeleteRequest in project appengine-java-standard by GoogleCloudPlatform.

the class LocalTaskQueueTest method testDeleteUnknownTask.

@Test
public void testDeleteUnknownTask() throws Exception {
    localService.bulkAdd(new Status(), bulkAddRequest.build());
    TaskQueueDeleteRequest deleteRequest = TaskQueueDeleteRequest.newBuilder().setQueueName(ByteString.copyFromUtf8(entry.getName())).addTaskName(bulkAddRequest.getAddRequest(1).getTaskName()).build();
    TaskQueueDeleteResponse deleteResponse = localService.delete(new Status(), deleteRequest);
    assertThat(deleteResponse.getResultCount()).isEqualTo(1);
    assertThat(deleteResponse.getResult(0)).isEqualTo(ErrorCode.OK);
    deleteResponse = localService.delete(new Status(), deleteRequest);
    assertThat(deleteResponse.getResultCount()).isEqualTo(1);
    assertThat(deleteResponse.getResult(0)).isEqualTo(ErrorCode.UNKNOWN_TASK);
}
Also used : Status(com.google.appengine.tools.development.LocalRpcService.Status) TaskQueueDeleteRequest(com.google.appengine.api.taskqueue.TaskQueuePb.TaskQueueDeleteRequest) TaskQueueDeleteResponse(com.google.appengine.api.taskqueue.TaskQueuePb.TaskQueueDeleteResponse) Test(org.junit.Test)

Example 2 with TaskQueueDeleteRequest

use of com.google.appengine.api.taskqueue.TaskQueuePb.TaskQueueDeleteRequest in project appengine-java-standard by GoogleCloudPlatform.

the class LocalTaskQueueTest method testDelete.

@Test
public void testDelete() throws Exception {
    localService.bulkAdd(new Status(), bulkAddRequest.build());
    TaskQueueDeleteRequest deleteRequest = TaskQueueDeleteRequest.newBuilder().setQueueName(ByteString.copyFromUtf8(entry.getName())).addTaskName(bulkAddRequest.getAddRequest(1).getTaskName()).build();
    TaskQueueDeleteResponse deleteResponse = localService.delete(new Status(), deleteRequest);
    assertThat(deleteResponse.getResultCount()).isEqualTo(1);
    assertThat(deleteResponse.getResult(0)).isEqualTo(ErrorCode.OK);
    QueueStateInfo queueInfo = localService.getQueueStateInfo().get(entry.getName());
    assertThat(queueInfo.getCountTasks()).isEqualTo(2);
}
Also used : Status(com.google.appengine.tools.development.LocalRpcService.Status) TaskQueueDeleteRequest(com.google.appengine.api.taskqueue.TaskQueuePb.TaskQueueDeleteRequest) TaskQueueDeleteResponse(com.google.appengine.api.taskqueue.TaskQueuePb.TaskQueueDeleteResponse) Test(org.junit.Test)

Example 3 with TaskQueueDeleteRequest

use of com.google.appengine.api.taskqueue.TaskQueuePb.TaskQueueDeleteRequest in project appengine-java-standard by GoogleCloudPlatform.

the class LocalTaskQueueTest method testDeleteMultiple.

@Test
public void testDeleteMultiple() throws Exception {
    localService.bulkAdd(new Status(), bulkAddRequest.build());
    TaskQueueDeleteRequest deleteRequest = TaskQueueDeleteRequest.newBuilder().setQueueName(ByteString.copyFromUtf8(entry.getName())).addTaskName(bulkAddRequest.getAddRequest(1).getTaskName()).addTaskName(bulkAddRequest.getAddRequest(0).getTaskName()).build();
    TaskQueueDeleteResponse deleteResponse = localService.delete(new Status(), deleteRequest);
    assertThat(deleteResponse.getResultCount()).isEqualTo(2);
    assertThat(deleteResponse.getResult(0)).isEqualTo(ErrorCode.OK);
    assertThat(deleteResponse.getResult(1)).isEqualTo(ErrorCode.OK);
    QueueStateInfo queueInfo = localService.getQueueStateInfo().get(entry.getName());
    assertThat(queueInfo.getCountTasks()).isEqualTo(1);
}
Also used : Status(com.google.appengine.tools.development.LocalRpcService.Status) TaskQueueDeleteRequest(com.google.appengine.api.taskqueue.TaskQueuePb.TaskQueueDeleteRequest) TaskQueueDeleteResponse(com.google.appengine.api.taskqueue.TaskQueuePb.TaskQueueDeleteResponse) Test(org.junit.Test)

Aggregations

TaskQueueDeleteRequest (com.google.appengine.api.taskqueue.TaskQueuePb.TaskQueueDeleteRequest)3 TaskQueueDeleteResponse (com.google.appengine.api.taskqueue.TaskQueuePb.TaskQueueDeleteResponse)3 Status (com.google.appengine.tools.development.LocalRpcService.Status)3 Test (org.junit.Test)3