From 6f45d4a5da4f9b82121b59be7aa65e99aeeea0a6 Mon Sep 17 00:00:00 2001 From: Francisco Javier Tirado Sarti <65240126+fjtirado@users.noreply.github.com> Date: Tue, 27 Feb 2024 13:13:05 +0100 Subject: [PATCH] [Fix 1868] Including usage of $WORKFLOW.prevActionResult (#1878) --- .../src/main/resources/foreach.sw.json | 19 ++++++------------- .../kie/kogito/examples/ForEachRestIT.java | 2 +- 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/serverless-workflow-examples/serverless-workflow-foreach-quarkus/src/main/resources/foreach.sw.json b/serverless-workflow-examples/serverless-workflow-foreach-quarkus/src/main/resources/foreach.sw.json index 5532eed27f..dbd6852ad6 100644 --- a/serverless-workflow-examples/serverless-workflow-foreach-quarkus/src/main/resources/foreach.sw.json +++ b/serverless-workflow-examples/serverless-workflow-foreach-quarkus/src/main/resources/foreach.sw.json @@ -6,9 +6,9 @@ "start": "start", "functions": [ { - "name": "printMessage", - "type": "custom", - "operation": "sysout" + "name": "double", + "type": "expression", + "operation": "$WORKFLOW.prevActionResult*2" }, { "name": "increase", @@ -30,18 +30,11 @@ "actions": [ { "name":"increase", - "functionRef": { - "refName": "increase" - } + "functionRef": "increase" }, { - "name": "printAction", - "functionRef": { - "refName": "printMessage", - "arguments": { - "message": ".item" - } - } + "name": "double", + "functionRef": "double" }], "end": true } diff --git a/serverless-workflow-examples/serverless-workflow-foreach-quarkus/src/test/java/org/kie/kogito/examples/ForEachRestIT.java b/serverless-workflow-examples/serverless-workflow-foreach-quarkus/src/test/java/org/kie/kogito/examples/ForEachRestIT.java index f185daf26d..8b8b06e115 100644 --- a/serverless-workflow-examples/serverless-workflow-foreach-quarkus/src/test/java/org/kie/kogito/examples/ForEachRestIT.java +++ b/serverless-workflow-examples/serverless-workflow-foreach-quarkus/src/test/java/org/kie/kogito/examples/ForEachRestIT.java @@ -41,7 +41,7 @@ void testForEachRest() { .post("/foreach") .then() .statusCode(201) - .body("workflowdata.output", is(Arrays.asList(2, 3, 4))) + .body("workflowdata.output", is(Arrays.asList(4, 6, 8))) .body("workflowdata.input", nullValue()); } }