use of com.google.appengine.api.taskqueue.TaskQueuePb.TaskQueueAddResponse in project appengine-java-standard by GoogleCloudPlatform.
the class DevPullQueueTest method testDelete.
public void testDelete() throws Exception {
TaskQueueAddRequest.Builder addRequest = newAddRequest(1000);
TaskQueueAddResponse response = queue.add(addRequest);
boolean deleted = queue.deleteTask(response.getChosenTaskName().toStringUtf8());
assertTrue(deleted);
deleted = queue.deleteTask(response.getChosenTaskName().toStringUtf8());
assertEquals(false, deleted);
}
use of com.google.appengine.api.taskqueue.TaskQueuePb.TaskQueueAddResponse in project appengine-java-standard by GoogleCloudPlatform.
the class DevQueueIntegrationTest method testAdd_UnnamedTask.
@Test
public void testAdd_UnnamedTask() throws Exception {
// schedule way in the past
TaskQueueAddRequest.Builder add = newAddRequest(1000);
TaskQueueAddResponse response = queue.add(add);
waitForJobExecution();
assertThat(providedFetchReqs).hasSize(1);
assertFetchReqEquals(providedFetchReqs.get(0), URLFetchRequest.RequestMethod.GET, "http://localhost:8080/my/url", false, 0, response.getChosenTaskName().toStringUtf8(), 0);
}
use of com.google.appengine.api.taskqueue.TaskQueuePb.TaskQueueAddResponse in project appengine-java-standard by GoogleCloudPlatform.
the class DevQueueIntegrationTest method testAddTaskIgnoresNonLocalhostHostHeader.
@Test
public void testAddTaskIgnoresNonLocalhostHostHeader() throws Exception {
// schedule way in the past
TaskQueueAddRequest.Builder add = newAddRequest(1000);
Header header = TaskQueueAddRequest.Header.newBuilder().setKey(ByteString.copyFromUtf8("Host")).setValue(ByteString.copyFromUtf8("foo:8085")).build();
add.addHeader(header);
TaskQueueAddResponse response = queue.add(add);
waitForJobExecution();
assertThat(providedFetchReqs).hasSize(1);
assertFetchReqEquals(providedFetchReqs.get(0), URLFetchRequest.RequestMethod.GET, "http://localhost:8080/my/url", false, 0, response.getChosenTaskName().toStringUtf8(), 0);
}
use of com.google.appengine.api.taskqueue.TaskQueuePb.TaskQueueAddResponse in project appengine-java-standard by GoogleCloudPlatform.
the class DevQueueIntegrationTest method testAddTaskRespectsHostHeader.
@Test
public void testAddTaskRespectsHostHeader() throws Exception {
// schedule way in the past
TaskQueueAddRequest.Builder add = newAddRequest(1000);
Header header = TaskQueueAddRequest.Header.newBuilder().setKey(ByteString.copyFromUtf8("Host")).setValue(ByteString.copyFromUtf8("localhost:24358")).build();
add.addHeader(header);
TaskQueueAddResponse response = queue.add(add);
waitForJobExecution();
assertThat(providedFetchReqs).hasSize(1);
assertFetchReqEquals(providedFetchReqs.get(0), URLFetchRequest.RequestMethod.GET, "http://localhost:24358/my/url", false, 0, response.getChosenTaskName().toStringUtf8(), 0);
}
use of com.google.appengine.api.taskqueue.TaskQueuePb.TaskQueueAddResponse in project appengine-java-standard by GoogleCloudPlatform.
the class DevQueueTest method testAdd_UnnamedTask.
@Test
public void testAdd_UnnamedTask() throws Exception {
TaskQueueAddRequest.Builder add = newAddRequest(1000);
when(schedulerMock.getJobDetail(any(), eq("default"))).thenReturn(null);
when(schedulerMock.scheduleJob(isA(JobDetail.class), isA(SimpleTrigger.class))).thenReturn(null);
TaskQueueAddResponse resp = queue.add(add);
ArgumentCaptor<String> taskName = ArgumentCaptor.forClass(String.class);
verify(schedulerMock).getJobDetail(taskName.capture(), eq("default"));
assertThat(resp.getChosenTaskName().toStringUtf8()).isEqualTo(taskName.getValue());
}
Aggregations