This is an automated email from the ASF dual-hosted git repository.
fjtiradosarti pushed a commit to branch main
in repository
https://gitbox.apache.org/repos/asf/incubator-kie-kogito-examples.git
The following commit(s) were added to refs/heads/main by this push:
new 95eff23b4 [Fix apache/incubator-kie-kogito-runtimes#4051] Fix parallel
example (#2130)
95eff23b4 is described below
commit 95eff23b475bed74c877297c7ffc319eafa7271b
Author: Francisco Javier Tirado Sarti
<[email protected]>
AuthorDate: Mon Sep 15 21:59:31 2025 +0200
[Fix apache/incubator-kie-kogito-runtimes#4051] Fix parallel example (#2130)
---
.../src/main/resources/01-sonataflow_parallel.yaml | 79 ----------------------
.../src/main/resources/parallel.sw.json | 29 ++------
.../org/kie/kogito/examples/ParallelStateTest.java | 7 +-
3 files changed, 11 insertions(+), 104 deletions(-)
diff --git
a/serverless-workflow-examples/serverless-workflow-parallel-execution/src/main/resources/01-sonataflow_parallel.yaml
b/serverless-workflow-examples/serverless-workflow-parallel-execution/src/main/resources/01-sonataflow_parallel.yaml
deleted file mode 100755
index 0ba1d57fa..000000000
---
a/serverless-workflow-examples/serverless-workflow-parallel-execution/src/main/resources/01-sonataflow_parallel.yaml
+++ /dev/null
@@ -1,79 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you 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.
-#
-
-apiVersion: sonataflow.org/v1alpha08
-kind: SonataFlow
-metadata:
- annotations:
- sonataflow.org/description: Testing parallelism
- sonataflow.org/expressionLang: jq
- sonataflow.org/profile: dev
- sonataflow.org/version: "1.0"
- creationTimestamp: null
- labels:
- app: parallel
- name: parallel
- namespace: operatordemo
-spec:
- flow:
- functions:
- - name: concatA
- operation: .result|=.+"A"
- type: expression
- - name: concatB
- operation: .result|=.+"B"
- type: expression
- - name: concatC
- operation: .result|=.+"C"
- type: expression
- start:
- stateName: Parallel
- states:
- - branches:
- - actions:
- - actionDataFilter:
- useResults: true
- functionRef:
- invoke: sync
- refName: concatA
- name: branchA
- - actions:
- - actionDataFilter:
- useResults: true
- functionRef:
- invoke: sync
- refName: concatB
- name: branchB
- - actions:
- - actionDataFilter:
- useResults: true
- functionRef:
- invoke: sync
- refName: concatC
- name: branchC
- completionType: atLeast
- end:
- terminate: true
- name: Parallel
- numCompleted: "2"
- type: parallel
- resources: {}
-status:
- address: {}
- lastTimeRecoverAttempt: null
diff --git
a/serverless-workflow-examples/serverless-workflow-parallel-execution/src/main/resources/parallel.sw.json
b/serverless-workflow-examples/serverless-workflow-parallel-execution/src/main/resources/parallel.sw.json
index 1a6477bc9..6687a2d7b 100644
---
a/serverless-workflow-examples/serverless-workflow-parallel-execution/src/main/resources/parallel.sw.json
+++
b/serverless-workflow-examples/serverless-workflow-parallel-execution/src/main/resources/parallel.sw.json
@@ -7,19 +7,14 @@
"start": "Parallel",
"functions": [
{
- "name": "concatA",
+ "name": "half",
"type": "expression",
- "operation": ".result|=.+\"A\""
+ "operation": "{half:.number/2}"
},
{
- "name": "concatB",
+ "name": "double",
"type": "expression",
- "operation": ".result|=.+\"B\""
- },
- {
- "name": "concatC",
- "type": "expression",
- "operation": ".result|=.+\"C\""
+ "operation": "{double:.number*2}"
}
],
"states": [
@@ -31,7 +26,7 @@
"name": "branchA",
"actions": [
{
- "functionRef": "concatA"
+ "functionRef": "half"
}
]
},
@@ -39,24 +34,14 @@
"name": "branchB",
"actions": [
{
- "functionRef": "concatB"
- }
- ]
- },
- {
- "name": "branchC",
- "actions": [
- {
- "functionRef": "concatC"
+ "functionRef": "double"
}
]
}
],
"numCompleted": "2",
"completionType": "atLeast",
- "end": {
- "terminate": true
- }
+ "end": true
}
]
}
\ No newline at end of file
diff --git
a/serverless-workflow-examples/serverless-workflow-parallel-execution/src/test/java/org/kie/kogito/examples/ParallelStateTest.java
b/serverless-workflow-examples/serverless-workflow-parallel-execution/src/test/java/org/kie/kogito/examples/ParallelStateTest.java
index f6e1afaca..a2588854c 100644
---
a/serverless-workflow-examples/serverless-workflow-parallel-execution/src/test/java/org/kie/kogito/examples/ParallelStateTest.java
+++
b/serverless-workflow-examples/serverless-workflow-parallel-execution/src/test/java/org/kie/kogito/examples/ParallelStateTest.java
@@ -19,7 +19,7 @@
package org.kie.kogito.examples;
import static io.restassured.RestAssured.given;
-import static org.hamcrest.Matchers.hasLength;
+import static org.hamcrest.Matchers.is;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.http.ContentType;
@@ -33,10 +33,11 @@ class ParallelStateTest {
given()
.contentType(ContentType.JSON)
.accept(ContentType.JSON)
- .body("{}").when()
+ .body("{\"number\":2}").when()
.post("/parallel")
.then()
.statusCode(201)
- .body("workflowdata.result", hasLength(2));
+ .body("workflowdata.half", is(1))
+ .body("workflowdata.double", is(4));
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]