Skip to content

Commit b763690

Browse files
authored
fix: update workflows quickstart (#7959)
* fix: update workflows quickstart * add header
1 parent 3b77046 commit b763690

File tree

4 files changed

+22
-7
lines changed

4 files changed

+22
-7
lines changed

workflows/cloud-client/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ limitations under the License.
4444
<dependency>
4545
<groupId>com.google.cloud</groupId>
4646
<artifactId>libraries-bom</artifactId>
47-
<version>26.12.0</version>
47+
<version>26.13.0</version>
4848
<type>pom</type>
4949
<scope>import</scope>
5050
</dependency>

workflows/cloud-client/src/main/java/com/example/workflows/WorkflowsQuickstart.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@ public class WorkflowsQuickstart {
3131

3232
private static final String PROJECT = System.getenv("GOOGLE_CLOUD_PROJECT");
3333
private static final String LOCATION = System.getenv().getOrDefault("LOCATION", "us-central1");
34-
private static final String WORKFLOW = System.getenv().getOrDefault("WORKFLOW",
35-
"myFirstWorkflow");
34+
private static final String WORKFLOW =
35+
System.getenv().getOrDefault("WORKFLOW", "myFirstWorkflow");
3636

3737
public static void main(String... args)
3838
throws IOException, InterruptedException, ExecutionException {
3939
if (PROJECT == null) {
4040
throw new IllegalArgumentException(
41-
"Environment variable 'GOOGLE_CLOUD_PROJECT' is required to run this quickstart.");
41+
"Environment variable 'GOOGLE_CLOUD_PROJECT' is required to run this quickstart.");
4242
}
4343
workflowsQuickstart(PROJECT, LOCATION, WORKFLOW);
4444
}
@@ -70,7 +70,7 @@ public static void workflowsQuickstart(String projectId, String location, String
7070
long backoffDelay = 1_000; // Start wait with delay of 1,000 ms
7171
final long backoffTimeout = 10 * 60 * 1_000; // Time out at 10 minutes
7272
System.out.println("Poll for results...");
73-
73+
7474
// Wait for execution to finish, then print results.
7575
while (!finished && backoffTime < backoffTimeout) {
7676
Execution execution = executionsClient.getExecution(executionName);

workflows/cloud-client/src/test/java/com/example/workflows/WorkflowsQuickstartTest.java

+1
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ public void testQuickstart() throws IOException, InterruptedException, Execution
6666
// Run the workflow we deployed
6767
workflowsQuickstart(PROJECT_ID, LOCATION_ID, WORKFLOW_ID);
6868
assertThat(stdOut.toString()).contains("Execution results:");
69+
assertThat(stdOut.toString()).contains("Execution finished with state: SUCCEEDED");
6970
}
7071

7172
private static void deployWorkflow(String projectId, String location, String workflowId)
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,29 @@
1+
# Copyright 2023 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
115
- getCurrentTime:
216
call: http.get
317
args:
4-
url: https://us-central1-workflowsample.cloudfunctions.net/datetime
18+
url: https://timeapi.io/api/Time/current/zone?timeZone=Europe/Amsterdam
519
result: currentTime
620
- readWikipedia:
721
call: http.get
822
args:
923
url: https://en.wikipedia.org/w/api.php
1024
query:
1125
action: opensearch
12-
search: ${currentTime.body.dayOfTheWeek}
26+
search: ${currentTime.body.dayOfWeek}
1327
result: wikiResult
1428
- returnResult:
1529
return: ${wikiResult.body[1]}

0 commit comments

Comments
 (0)