From 34981c30a78e8bbd7791131059a9210f9928b62c Mon Sep 17 00:00:00 2001
From: 刘光辉 <347230014@qq.com>
Date: 星期四, 17 九月 2026 09:24:09 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master' into master

---
 jnpf-flow-engine/test/lifecycle.sh |   64 ++++++++++++++++++++++++++++++++
 1 files changed, 64 insertions(+), 0 deletions(-)

diff --git a/jnpf-flow-engine/test/lifecycle.sh b/jnpf-flow-engine/test/lifecycle.sh
new file mode 100644
index 0000000..59ead52
--- /dev/null
+++ b/jnpf-flow-engine/test/lifecycle.sh
@@ -0,0 +1,64 @@
+#!/usr/bin/env bash
+# 瀹屾暣娴佺▼鐢熷懡鍛ㄦ湡鍥炲綊锛歞eploy鈫抯tart鈫抧ext鈫抍omplete鈫抌ack(JumpCmd 鑺傜偣璺宠浆)鈫抙istoric鈫抎elete銆�
+# 瑕嗙洊濂戠害鍐掔儫娴嬩笉鍒扮殑鍐欒矾寰勪笌鐘舵�佹満閫昏緫锛團lowable ChangeActivityState / 鑷畾涔夎烦杞懡浠わ級銆�
+# 鐢ㄦ硶锛�./lifecycle.sh [寮曟搸base锛岄粯璁� http://127.0.0.1:31000] [鏍囩锛岄粯璁� LIFECYCLE]
+#
+# A/B 瀵规瘮锛氬垎鍒鏂版棫寮曟搸璺戯紝鎶� taskKey/code/name 楠ㄦ灦 diff锛堟椂闂存埑涓庨洩鑺� id 澶╃劧涓嶅悓锛夛細
+#   ./lifecycle.sh http://127.0.0.1:31000 A 2>&1 | grep -oE 'taskKey":"[^"]*"|"code":"[0-9]+"|"name":"[^"]*"' > /tmp/a.txt
+#   ./lifecycle.sh http://127.0.0.1:31001 B 2>&1 | grep -oE 'taskKey":"[^"]*"|"code":"[0-9]+"|"name":"[^"]*"' > /tmp/b.txt
+#   diff /tmp/a.txt /tmp/b.txt   # 搴斾负绌� = 璇箟楠ㄦ灦涓�鑷�
+set -euo pipefail
+BASE="${1:-http://127.0.0.1:31000}"
+TAG="${2:-LIFECYCLE}"
+J='-H Content-Type:application/json'
+
+BPMN='<?xml version="1.0" encoding="UTF-8"?>
+<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:flowable="http://flowable.org/bpmn" targetNamespace="test">
+  <process id="rebuildTest" name="閲嶅缓楠岃瘉娴佺▼" isExecutable="true">
+    <startEvent id="start"/>
+    <sequenceFlow id="f1" sourceRef="start" targetRef="task1"/>
+    <userTask id="task1" name="瀹℃壒涓�" flowable:assignee="u1"/>
+    <sequenceFlow id="f2" sourceRef="task1" targetRef="task2"/>
+    <userTask id="task2" name="瀹℃壒浜�" flowable:assignee="u2"/>
+    <sequenceFlow id="f3" sourceRef="task2" targetRef="end"/>
+    <endEvent id="end"/>
+  </process>
+</definitions>'
+BPMN_JSON=$(python3 -c 'import json,sys;print(json.dumps(sys.stdin.read()))' <<< "$BPMN")
+pick() { python3 -c "import sys,json;print(json.load(sys.stdin)$1)"; }
+C() { curl -sS --noproxy '*' "$@"; }
+
+echo "### [$TAG] deploy"
+DEP=$(C -X POST $J -d "{\"name\":\"rebuildTest\",\"key\":\"rebuildTest\",\"bpmnXml\":$BPMN_JSON}" "$BASE/api/Flow/definition/deploy"); echo "$DEP"
+DEPID=$(echo "$DEP" | pick "['data']['deploymentId']")
+
+echo "### [$TAG] start"
+INS=$(C -X POST $J -d "{\"deploymentId\":\"$DEPID\"}" "$BASE/api/Flow/instance/start"); echo "$INS"
+INSID=$(echo "$INS" | pick "['data']['instanceId']")
+
+echo "### [$TAG] task/list锛堝簲鏈� task1=瀹℃壒涓�锛�"
+T=$(C "$BASE/api/Flow/task/list/$INSID"); echo "$T"
+TID=$(echo "$T" | pick "['data'][0]['taskId']")
+
+echo "### [$TAG] next锛坱ask1 涓嬩竴鑺傜偣搴斾负 task2锛�"
+C "$BASE/api/Flow/task/next?taskId=$TID"; echo
+
+echo "### [$TAG] complete task1"
+C -X POST $J -d "{\"taskId\":\"$TID\"}" "$BASE/api/Flow/task/complete"; echo
+
+echo "### [$TAG] task/list锛堝簲娴佽浆鍒� task2=瀹℃壒浜岋級"
+T2=$(C "$BASE/api/Flow/task/list/$INSID"); echo "$T2"
+TASKID2=$(echo "$T2" | pick "['data'][0]['taskId']")
+
+echo "### [$TAG] back锛堜粠 task2 閫�鍥� task1锛岃蛋 JumpCmd锛�"
+C -X POST $J -d "{\"taskId\":\"$TASKID2\",\"targetKey\":\"task1\"}" "$BASE/api/Flow/task/back"; echo
+
+echo "### [$TAG] task/list锛堥��鍥炲悗搴斿洖鍒� task1=瀹℃壒涓�锛�"
+C "$BASE/api/Flow/task/list/$INSID"; echo
+
+echo "### [$TAG] historic锛堝巻鍙茶妭鐐癸級"
+C "$BASE/api/Flow/task/historic/$INSID"; echo
+
+echo "### [$TAG] cleanup: delete instance + definition"
+C -X DELETE "$BASE/api/Flow/instance?instanceId=$INSID&deleteReason=test"; echo
+C -X DELETE "$BASE/api/Flow/definition?deploymentId=$DEPID"; echo

--
Gitblit v1.8.0