From df91c0e9d8e04b4797f7c2ac6ccb0343b704b1b6 Mon Sep 17 00:00:00 2001 From: averikitsch Date: Tue, 11 Jun 2019 14:21:34 -0700 Subject: [PATCH 1/9] Add tests --- tasks/README.md | 20 ++---- tasks/pom.xml | 13 ++++ .../java/com/example/task/CreateHttpTask.java | 5 +- .../example/task/CreateHttpTaskWithToken.java | 10 +-- .../com/example/task/CreateHttpTaskIT.java | 65 +++++++++++++++++++ 5 files changed, 92 insertions(+), 21 deletions(-) create mode 100644 tasks/src/test/java/com/example/task/CreateHttpTaskIT.java diff --git a/tasks/README.md b/tasks/README.md index 332780d17c6..01473a458f6 100644 --- a/tasks/README.md +++ b/tasks/README.md @@ -54,17 +54,13 @@ export LOCATION_ID= ### Creating Tasks with HTTP Targets -Set an environment variable for the endpoint to your task handler. This is an -example url: -``` -export URL=https://example.com/taskshandler -``` - -Running the sample will create a task and add it to your queue. As the queue -processes each task, it will send the task to the specific URL endpoint: +Set an endpoint to your task handler by replacing the variable `url` with your +HTTP target. Running the sample will create a task and add it to your queue. +As the queue processes each task, it will send the task to the specific URL +endpoint: ``` -mvn exec:java@HttpTask" +mvn exec:java@HttpTask ``` ### Using HTTP Targets with Authentication Tokens @@ -73,13 +69,11 @@ Your Cloud Tasks [service account][sa], (service-@gcp-sa-cloudtasks.iam.gserviceaccount.com), must have the role of: `Service Account Token Creator` to generate a tokens. -Create or use an existing [service account][sa] to replace `` -in `CreateHttpTaskWithToken.java`. This service account will be used to -authenticate the OIDC token. +Create or use an existing [service account][sa] to authenticate the OIDC token. Running the sample with command: ``` -mvn exec:java@WithToken" +mvn exec:java@WithToken -Dexec.args="" ``` diff --git a/tasks/pom.xml b/tasks/pom.xml index 697eb29e61d..df91bafb3a6 100644 --- a/tasks/pom.xml +++ b/tasks/pom.xml @@ -47,7 +47,20 @@ Copyright 2018 Google LLC google-cloud-tasks 0.88.0-beta + + + junit + junit + 4.13-beta-2 + + + com.google.truth + truth + 0.44 + test + + diff --git a/tasks/src/main/java/com/example/task/CreateHttpTask.java b/tasks/src/main/java/com/example/task/CreateHttpTask.java index 6e8412426bb..508b058a23f 100644 --- a/tasks/src/main/java/com/example/task/CreateHttpTask.java +++ b/tasks/src/main/java/com/example/task/CreateHttpTask.java @@ -27,11 +27,10 @@ public class CreateHttpTask { - public static void main(String[] args) throws Exception { + public static void main(String... args) throws Exception { String projectId = System.getenv("PROJECT_ID"); String queueName = System.getenv("QUEUE_ID"); String location = System.getenv("LOCATION_ID"); - String url = System.getenv("URL"); // Instantiates a client. try (CloudTasksClient client = CloudTasksClient.create()) { @@ -39,7 +38,7 @@ public static void main(String[] args) throws Exception { // projectId = "my-project-id"; // queueName = "my-queue"; // location = "us-central1"; - // url = "https://example.com/taskhandler"; + String url = "https://example.com/taskhandler"; String payload = "hello"; // Construct the fully qualified queue name. diff --git a/tasks/src/main/java/com/example/task/CreateHttpTaskWithToken.java b/tasks/src/main/java/com/example/task/CreateHttpTaskWithToken.java index f67cee97d32..4102c029d85 100644 --- a/tasks/src/main/java/com/example/task/CreateHttpTaskWithToken.java +++ b/tasks/src/main/java/com/example/task/CreateHttpTaskWithToken.java @@ -32,7 +32,6 @@ public static void main(String[] args) throws Exception { String projectId = System.getenv("PROJECT_ID"); String queueName = System.getenv("QUEUE_ID"); String location = System.getenv("LOCATION_ID"); - String url = System.getenv("URL"); // Instantiates a client. try (CloudTasksClient client = CloudTasksClient.create()) { @@ -40,16 +39,17 @@ public static void main(String[] args) throws Exception { // projectId = "my-project-id"; // queueName = "my-queue"; // location = "us-central1"; - // url = "https://example.com/taskhandler"; - String payload = "hello"; + String email = args[0]; // Cloud IAM service account + String url = + "https://example.com/taskhandler"; // The full url path that the request will be sent to + String payload = "Hello, World!"; // The task HTTP request body // Construct the fully qualified queue name. String queuePath = QueueName.of(projectId, location, queueName).toString(); // Add your service account email to construct the OIDC token. // in order to add an authentication header to the request. - OidcToken.Builder oidcTokenBuilder = - OidcToken.newBuilder().setServiceAccountEmail(""); + OidcToken.Builder oidcTokenBuilder = OidcToken.newBuilder().setServiceAccountEmail(email); // Construct the task body. Task.Builder taskBuilder = diff --git a/tasks/src/test/java/com/example/task/CreateHttpTaskIT.java b/tasks/src/test/java/com/example/task/CreateHttpTaskIT.java new file mode 100644 index 00000000000..d60502b83a9 --- /dev/null +++ b/tasks/src/test/java/com/example/task/CreateHttpTaskIT.java @@ -0,0 +1,65 @@ +/* + * Copyright 2016 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.example.task; + +import static com.google.common.truth.Truth.assertThat; + +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.Timeout; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; + +/** Tests for creating Tasks with HTTP targets. */ +@RunWith(JUnit4.class) +public class CreateHttpTaskIT { + + private ByteArrayOutputStream bout; + + @Rule public Timeout globalTimeout = Timeout.seconds(300); // 5 minute timeout + + @Before + public void setUp() { + bout = new ByteArrayOutputStream(); + PrintStream out = new PrintStream(bout); + System.setOut(out); + } + + @After + public void tearDown() throws Exception { + System.setOut(null); + } + + @Test + public void testCreateHttpTask() throws Exception { + CreateHttpTask.main(); + String got = bout.toString(); + assertThat(got).contains("Task created:"); + } + + @Test + public void testCreateHttpTaskWithToken() throws Exception { + String[] args = {" tasks-test@java-docs-samples-tests.iam.gserviceaccount.com"}; + CreateHttpTaskWithToken.main(args); + String got = bout.toString(); + assertThat(got).contains("Task created:"); + } +} From bb0666cffe9dd231da7c3f640174b81757f45487 Mon Sep 17 00:00:00 2001 From: averikitsch Date: Tue, 11 Jun 2019 14:22:58 -0700 Subject: [PATCH 2/9] Update license --- tasks/src/test/java/com/example/task/CreateHttpTaskIT.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/src/test/java/com/example/task/CreateHttpTaskIT.java b/tasks/src/test/java/com/example/task/CreateHttpTaskIT.java index d60502b83a9..a1fa7341fab 100644 --- a/tasks/src/test/java/com/example/task/CreateHttpTaskIT.java +++ b/tasks/src/test/java/com/example/task/CreateHttpTaskIT.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 Google Inc. + * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. From 67b9cd38921cce8e236903fdae3c492e000f165b Mon Sep 17 00:00:00 2001 From: averikitsch Date: Thu, 13 Jun 2019 13:29:42 -0700 Subject: [PATCH 3/9] Update README --- tasks/README.md | 7 ++++++- .../src/test/java/com/example/task/CreateHttpTaskIT.java | 8 ++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/tasks/README.md b/tasks/README.md index 01473a458f6..6b35180da67 100644 --- a/tasks/README.md +++ b/tasks/README.md @@ -55,7 +55,9 @@ export LOCATION_ID= ### Creating Tasks with HTTP Targets Set an endpoint to your task handler by replacing the variable `url` with your -HTTP target. Running the sample will create a task and add it to your queue. +HTTP target in `CreateHttpTask.java`. + +Running the sample will create a task and add it to your queue. As the queue processes each task, it will send the task to the specific URL endpoint: @@ -65,6 +67,9 @@ mvn exec:java@HttpTask ### Using HTTP Targets with Authentication Tokens +Set an endpoint to your task handler by replacing the variable `url` with your +HTTP target in `CreateHttpTaskWithToken.java`. + Your Cloud Tasks [service account][sa], (service-@gcp-sa-cloudtasks.iam.gserviceaccount.com), must have the role of: `Service Account Token Creator` to generate a tokens. diff --git a/tasks/src/test/java/com/example/task/CreateHttpTaskIT.java b/tasks/src/test/java/com/example/task/CreateHttpTaskIT.java index a1fa7341fab..d929a1a7e6f 100644 --- a/tasks/src/test/java/com/example/task/CreateHttpTaskIT.java +++ b/tasks/src/test/java/com/example/task/CreateHttpTaskIT.java @@ -33,18 +33,18 @@ public class CreateHttpTaskIT { private ByteArrayOutputStream bout; - - @Rule public Timeout globalTimeout = Timeout.seconds(300); // 5 minute timeout + private PrintStream out; + // @Rule public Timeout globalTimeout = Timeout.seconds(300); // 5 minute timeout @Before public void setUp() { bout = new ByteArrayOutputStream(); - PrintStream out = new PrintStream(bout); + out = new PrintStream(bout); System.setOut(out); } @After - public void tearDown() throws Exception { + public void tearDown() { System.setOut(null); } From 960ae1ebc9c8f21bd8a50c0f225fde8c8a12d2b9 Mon Sep 17 00:00:00 2001 From: averikitsch Date: Thu, 13 Jun 2019 16:30:03 -0700 Subject: [PATCH 4/9] Update for testing purposes --- tasks/README.md | 47 ++++--------------- tasks/pom.xml | 4 +- .../java/com/example/task/CreateHttpTask.java | 23 ++++----- .../example/task/CreateHttpTaskWithToken.java | 27 ++++++----- .../com/example/task/CreateHttpTaskIT.java | 13 +++-- 5 files changed, 44 insertions(+), 70 deletions(-) diff --git a/tasks/README.md b/tasks/README.md index 6b35180da67..5928b28e4d6 100644 --- a/tasks/README.md +++ b/tasks/README.md @@ -19,56 +19,33 @@ pushes it to your queue. ## Creating a queue -To create a queue using the Cloud SDK, use the following gcloud command: +To create a queue using the Cloud SDK, use the following `gcloud` command: ``` gcloud tasks queues create ``` -## Run the Sample Using the Command Line +The location of your queue is the same as your Google Cloud Project. It can be discovered by using the following `gcloud` command: -Set environment variables: - -First, your project ID: - -``` -export GOOGLE_CLOUD_PROJECT= ``` - -Then the queue ID, as specified at queue creation time. Queue IDs already -created can be listed with `gcloud tasks queues list`. - +gcloud tasks queues describe ``` -export QUEUE_ID= -``` - -And finally the location ID, which can be discovered with -`gcloud tasks queues describe $QUEUE_ID`, with the location embedded in -the "name" value (for instance, if the name is +the location embedded in the "name" value (for instance, if the name is "projects/my-project/locations/us-central1/queues/my-queue", then the location is "us-central1"). -``` -export LOCATION_ID= -``` - -### Creating Tasks with HTTP Targets +## Creating Tasks with HTTP Targets Set an endpoint to your task handler by replacing the variable `url` with your HTTP target in `CreateHttpTask.java`. -Running the sample will create a task and add it to your queue. -As the queue processes each task, it will send the task to the specific URL -endpoint: - -``` -mvn exec:java@HttpTask -``` +The sample will create a task and add it to your queue. As the queue processes +each task, it will send the task to the specific URL endpoint. -### Using HTTP Targets with Authentication Tokens +## Using HTTP Targets with Authentication Tokens Set an endpoint to your task handler by replacing the variable `url` with your -HTTP target in `CreateHttpTaskWithToken.java`. +HTTP target in `CreateHttpTaskWithToken.java`. Your Cloud Tasks [service account][sa], (service-@gcp-sa-cloudtasks.iam.gserviceaccount.com), must @@ -76,10 +53,4 @@ have the role of: `Service Account Token Creator` to generate a tokens. Create or use an existing [service account][sa] to authenticate the OIDC token. -Running the sample with command: -``` -mvn exec:java@WithToken -Dexec.args="" -``` - - [sa]: https://cloud.google.com/iam/docs/service-accounts diff --git a/tasks/pom.xml b/tasks/pom.xml index df91bafb3a6..94bc22f1a59 100644 --- a/tasks/pom.xml +++ b/tasks/pom.xml @@ -61,7 +61,7 @@ Copyright 2018 Google LLC - + diff --git a/tasks/src/main/java/com/example/task/CreateHttpTask.java b/tasks/src/main/java/com/example/task/CreateHttpTask.java index 508b058a23f..6e1e6b2ee4d 100644 --- a/tasks/src/main/java/com/example/task/CreateHttpTask.java +++ b/tasks/src/main/java/com/example/task/CreateHttpTask.java @@ -26,23 +26,24 @@ import java.nio.charset.Charset; public class CreateHttpTask { - - public static void main(String... args) throws Exception { - String projectId = System.getenv("PROJECT_ID"); - String queueName = System.getenv("QUEUE_ID"); - String location = System.getenv("LOCATION_ID"); + /** + * Create a task with a HTTP target using the Cloud Tasks client. + * + * @param projectId the Id of the project. + * @param queueId the name of your Queue. + * @param locationId the GCP region of your queue. + * @throws Exception on Cloud Tasks Client errors. + */ + public static void createTask(String projectId, String locationId, String queueId) + throws Exception { // Instantiates a client. try (CloudTasksClient client = CloudTasksClient.create()) { - // Variables provided by the system variables. - // projectId = "my-project-id"; - // queueName = "my-queue"; - // location = "us-central1"; String url = "https://example.com/taskhandler"; - String payload = "hello"; + String payload = "Hello, World!"; // Construct the fully qualified queue name. - String queuePath = QueueName.of(projectId, location, queueName).toString(); + String queuePath = QueueName.of(projectId, locationId, queueId).toString(); // Construct the task body. Task.Builder taskBuilder = diff --git a/tasks/src/main/java/com/example/task/CreateHttpTaskWithToken.java b/tasks/src/main/java/com/example/task/CreateHttpTaskWithToken.java index 4102c029d85..9259243bd97 100644 --- a/tasks/src/main/java/com/example/task/CreateHttpTaskWithToken.java +++ b/tasks/src/main/java/com/example/task/CreateHttpTaskWithToken.java @@ -27,29 +27,32 @@ import java.nio.charset.Charset; public class CreateHttpTaskWithToken { - - public static void main(String[] args) throws Exception { - String projectId = System.getenv("PROJECT_ID"); - String queueName = System.getenv("QUEUE_ID"); - String location = System.getenv("LOCATION_ID"); + /** + * Create a task with a HTTP target and authorization token using the Cloud Tasks client. + * + * @param projectId the Id of the project. + * @param queueId the name of your Queue. + * @param locationId the GCP region of your queue. + * @param serviceAccountEmail your Cloud IAM service account + * @throws Exception on Cloud Tasks Client errors. + */ + public static void createTask( + String projectId, String locationId, String queueId, String serviceAccountEmail) + throws Exception { // Instantiates a client. try (CloudTasksClient client = CloudTasksClient.create()) { - // Variables provided by the system variables. - // projectId = "my-project-id"; - // queueName = "my-queue"; - // location = "us-central1"; - String email = args[0]; // Cloud IAM service account String url = "https://example.com/taskhandler"; // The full url path that the request will be sent to String payload = "Hello, World!"; // The task HTTP request body // Construct the fully qualified queue name. - String queuePath = QueueName.of(projectId, location, queueName).toString(); + String queuePath = QueueName.of(projectId, locationId, queueId).toString(); // Add your service account email to construct the OIDC token. // in order to add an authentication header to the request. - OidcToken.Builder oidcTokenBuilder = OidcToken.newBuilder().setServiceAccountEmail(email); + OidcToken.Builder oidcTokenBuilder = + OidcToken.newBuilder().setServiceAccountEmail(serviceAccountEmail); // Construct the task body. Task.Builder taskBuilder = diff --git a/tasks/src/test/java/com/example/task/CreateHttpTaskIT.java b/tasks/src/test/java/com/example/task/CreateHttpTaskIT.java index d929a1a7e6f..e81bc534dd1 100644 --- a/tasks/src/test/java/com/example/task/CreateHttpTaskIT.java +++ b/tasks/src/test/java/com/example/task/CreateHttpTaskIT.java @@ -22,19 +22,19 @@ import java.io.PrintStream; import org.junit.After; import org.junit.Before; -import org.junit.Rule; import org.junit.Test; -import org.junit.rules.Timeout; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; /** Tests for creating Tasks with HTTP targets. */ @RunWith(JUnit4.class) public class CreateHttpTaskIT { - + private static final String PROJECT_ID = "java-docs-samples-testing"; + private static final String LOCATION_ID = "us-central1"; + private static final String QUEUE_ID = "default"; + private static final String EMAIL = "tasks-test@java-docs-samples-tests.iam.gserviceaccount.com"; private ByteArrayOutputStream bout; private PrintStream out; - // @Rule public Timeout globalTimeout = Timeout.seconds(300); // 5 minute timeout @Before public void setUp() { @@ -50,15 +50,14 @@ public void tearDown() { @Test public void testCreateHttpTask() throws Exception { - CreateHttpTask.main(); + CreateHttpTask.createTask(PROJECT_ID, LOCATION_ID, QUEUE_ID); String got = bout.toString(); assertThat(got).contains("Task created:"); } @Test public void testCreateHttpTaskWithToken() throws Exception { - String[] args = {" tasks-test@java-docs-samples-tests.iam.gserviceaccount.com"}; - CreateHttpTaskWithToken.main(args); + CreateHttpTaskWithToken.createTask(PROJECT_ID, LOCATION_ID, QUEUE_ID, EMAIL); String got = bout.toString(); assertThat(got).contains("Task created:"); } From 31439994320d6f956f76db9217bd257432577592 Mon Sep 17 00:00:00 2001 From: averikitsch Date: Thu, 13 Jun 2019 16:36:32 -0700 Subject: [PATCH 5/9] Update queue location --- tasks/src/test/java/com/example/task/CreateHttpTaskIT.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tasks/src/test/java/com/example/task/CreateHttpTaskIT.java b/tasks/src/test/java/com/example/task/CreateHttpTaskIT.java index e81bc534dd1..d17d448888a 100644 --- a/tasks/src/test/java/com/example/task/CreateHttpTaskIT.java +++ b/tasks/src/test/java/com/example/task/CreateHttpTaskIT.java @@ -22,7 +22,9 @@ import java.io.PrintStream; import org.junit.After; import org.junit.Before; +import org.junit.Rule; import org.junit.Test; +import org.junit.rules.Timeout; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; @@ -30,7 +32,7 @@ @RunWith(JUnit4.class) public class CreateHttpTaskIT { private static final String PROJECT_ID = "java-docs-samples-testing"; - private static final String LOCATION_ID = "us-central1"; + private static final String LOCATION_ID = "us-east1"; private static final String QUEUE_ID = "default"; private static final String EMAIL = "tasks-test@java-docs-samples-tests.iam.gserviceaccount.com"; private ByteArrayOutputStream bout; From 35479f9962e298a709fc3957f1df64a401019b18 Mon Sep 17 00:00:00 2001 From: averikitsch Date: Fri, 14 Jun 2019 07:45:45 -0700 Subject: [PATCH 6/9] Fix test styling --- tasks/src/test/java/com/example/task/CreateHttpTaskIT.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tasks/src/test/java/com/example/task/CreateHttpTaskIT.java b/tasks/src/test/java/com/example/task/CreateHttpTaskIT.java index d17d448888a..fea0f524b0c 100644 --- a/tasks/src/test/java/com/example/task/CreateHttpTaskIT.java +++ b/tasks/src/test/java/com/example/task/CreateHttpTaskIT.java @@ -34,7 +34,8 @@ public class CreateHttpTaskIT { private static final String PROJECT_ID = "java-docs-samples-testing"; private static final String LOCATION_ID = "us-east1"; private static final String QUEUE_ID = "default"; - private static final String EMAIL = "tasks-test@java-docs-samples-tests.iam.gserviceaccount.com"; + private static final String EMAIL = + "tasks-test@java-docs-samples-tests.iam.gserviceaccount.com"; private ByteArrayOutputStream bout; private PrintStream out; From c0a4dca3575e281a4ca88d283da4acc8d3277ba9 Mon Sep 17 00:00:00 2001 From: averikitsch Date: Fri, 14 Jun 2019 09:00:16 -0700 Subject: [PATCH 7/9] Library version --- tasks/pom.xml | 40 +++++++++++++++------------------------- 1 file changed, 15 insertions(+), 25 deletions(-) diff --git a/tasks/pom.xml b/tasks/pom.xml index 2448c13141e..16b49706190 100644 --- a/tasks/pom.xml +++ b/tasks/pom.xml @@ -31,7 +31,6 @@ Copyright 2018 Google LLC com.google.cloud.samples shared-configuration 1.0.11 - @@ -45,7 +44,7 @@ Copyright 2018 Google LLC com.google.cloud google-cloud-tasks - 1.4.0 + 1.3.0 @@ -61,35 +60,26 @@ Copyright 2018 Google LLC - + From 4cfa03bea9c15167a06743afa270d3525afe8265 Mon Sep 17 00:00:00 2001 From: averikitsch Date: Fri, 14 Jun 2019 09:44:13 -0700 Subject: [PATCH 8/9] Update service account --- tasks/src/test/java/com/example/task/CreateHttpTaskIT.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/src/test/java/com/example/task/CreateHttpTaskIT.java b/tasks/src/test/java/com/example/task/CreateHttpTaskIT.java index fea0f524b0c..aa3dd6ee52c 100644 --- a/tasks/src/test/java/com/example/task/CreateHttpTaskIT.java +++ b/tasks/src/test/java/com/example/task/CreateHttpTaskIT.java @@ -35,7 +35,7 @@ public class CreateHttpTaskIT { private static final String LOCATION_ID = "us-east1"; private static final String QUEUE_ID = "default"; private static final String EMAIL = - "tasks-test@java-docs-samples-tests.iam.gserviceaccount.com"; + "java-docs-samples@cloud-samples-tests.iam.gserviceaccount.com"; private ByteArrayOutputStream bout; private PrintStream out; From 201881ac4872d9b4d166bf730c0e51c853dd18ec Mon Sep 17 00:00:00 2001 From: averikitsch Date: Fri, 14 Jun 2019 10:29:27 -0700 Subject: [PATCH 9/9] Fix service account --- tasks/src/test/java/com/example/task/CreateHttpTaskIT.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/src/test/java/com/example/task/CreateHttpTaskIT.java b/tasks/src/test/java/com/example/task/CreateHttpTaskIT.java index aa3dd6ee52c..02bc66029b4 100644 --- a/tasks/src/test/java/com/example/task/CreateHttpTaskIT.java +++ b/tasks/src/test/java/com/example/task/CreateHttpTaskIT.java @@ -35,7 +35,7 @@ public class CreateHttpTaskIT { private static final String LOCATION_ID = "us-east1"; private static final String QUEUE_ID = "default"; private static final String EMAIL = - "java-docs-samples@cloud-samples-tests.iam.gserviceaccount.com"; + "java-docs-samples-testing@java-docs-samples-testing.iam.gserviceaccount.com"; private ByteArrayOutputStream bout; private PrintStream out;