|
|
|
|
@@ -80,8 +80,13 @@ fl_base="http://$(ip "$fl"):8080/flowable-rest/service"
|
|
|
|
|
reg_id="${loc##*/}"
|
|
|
|
|
|
|
|
|
|
# Extracts the Beoordelen task id for our registration from a Flowable task-query response on stdin.
|
|
|
|
|
# Tolerates an empty/non-JSON body (a transient failure during the poll) by printing nothing.
|
|
|
|
|
task_for_reg() { REG_ID="$reg_id" python3 -c "import os,sys,json
|
|
|
|
|
d=json.load(sys.stdin); rid=os.environ['REG_ID']
|
|
|
|
|
try:
|
|
|
|
|
d=json.load(sys.stdin)
|
|
|
|
|
except Exception:
|
|
|
|
|
d={}
|
|
|
|
|
rid=os.environ['REG_ID']
|
|
|
|
|
print(next((t['id'] for t in (d.get('data') or [])
|
|
|
|
|
if any(v.get('name')=='registrationId' and v.get('value')==rid for v in (t.get('processVariables') or []))), ''))"; }
|
|
|
|
|
|
|
|
|
|
@@ -91,7 +96,7 @@ query='{"processDefinitionKey":"registratie","taskDefinitionKey":"Beoordelen","i
|
|
|
|
|
echo ">> polling Flowable for the Beoordelen user task (werkbak)"
|
|
|
|
|
task_id=""
|
|
|
|
|
for _ in $(seq 1 30); do
|
|
|
|
|
resp="$(flcurl -X POST "$fl_base/runtime/tasks/query" -H 'Content-Type: application/json' -d "$query" 2>/dev/null || true)"
|
|
|
|
|
resp="$(flcurl -X POST "$fl_base/query/tasks" -H 'Content-Type: application/json' -d "$query" 2>/dev/null || true)"
|
|
|
|
|
task_id="$(printf '%s' "$resp" | task_for_reg)"
|
|
|
|
|
[ -n "$task_id" ] && break
|
|
|
|
|
sleep 2
|
|
|
|
|
@@ -108,7 +113,7 @@ flcurl -X POST "$fl_base/runtime/tasks/$task_id" -H 'Content-Type: application/j
|
|
|
|
|
-d '{"action":"complete","variables":[{"name":"besluit","type":"string","value":"goedkeuren"}]}' >/dev/null
|
|
|
|
|
|
|
|
|
|
echo ">> asserting the process finished (no Beoordelen task remains for the registration)"
|
|
|
|
|
resp="$(flcurl -X POST "$fl_base/runtime/tasks/query" -H 'Content-Type: application/json' -d "$query")"
|
|
|
|
|
resp="$(flcurl -X POST "$fl_base/query/tasks" -H 'Content-Type: application/json' -d "$query")"
|
|
|
|
|
still="$(printf '%s' "$resp" | task_for_reg)"
|
|
|
|
|
[ -z "$still" ] || { echo "FAIL — Beoordelen task $still still active after completion" >&2; exit 1; }
|
|
|
|
|
echo "OK — behandelaar claimed and completed the Beoordelen task; the registratie process finished"
|
|
|
|
|
|