-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-api.sh
More file actions
56 lines (46 loc) · 1.86 KB
/
test-api.sh
File metadata and controls
56 lines (46 loc) · 1.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/bash
# Script de test pour l'API REST OrqueIO
BASE_URL="http://localhost:8080/engine-rest"
echo "======================================"
echo "OrqueIO External Task - API Test"
echo "======================================"
echo ""
# 1. Lister les définitions de processus
echo "1. Liste des processus déployés:"
curl -s $BASE_URL/process-definition | json_pp 2>/dev/null || curl -s $BASE_URL/process-definition
echo ""
echo ""
# 2. Démarrer une instance
echo "2. Démarrage d'une nouvelle instance de processus..."
RESPONSE=$(curl -s -X POST $BASE_URL/process-definition/key/ExternalTaskProcess/start \
-H "Content-Type: application/json" \
-d '{"variables":{"inputData":{"value":"Test from API Script","type":"String"}}}')
echo "$RESPONSE" | json_pp 2>/dev/null || echo "$RESPONSE"
# Extraire l'ID de l'instance
INSTANCE_ID=$(echo "$RESPONSE" | grep -o '"id":"[^"]*"' | head -1 | cut -d'"' -f4)
echo ""
echo "Instance ID: $INSTANCE_ID"
echo ""
# 3. Attendre que le worker traite la tâche
echo "3. Attente du traitement par le worker (5 secondes)..."
sleep 5
echo ""
# 4. Vérifier l'historique
echo "4. Historique de l'instance:"
if [ -n "$INSTANCE_ID" ]; then
curl -s "$BASE_URL/history/process-instance/$INSTANCE_ID" | json_pp 2>/dev/null || curl -s "$BASE_URL/history/process-instance/$INSTANCE_ID"
else
curl -s "$BASE_URL/history/process-instance?finished=true" | json_pp 2>/dev/null || curl -s "$BASE_URL/history/process-instance?finished=true"
fi
echo ""
echo ""
# 5. Obtenir les variables
echo "5. Variables de l'instance:"
if [ -n "$INSTANCE_ID" ]; then
curl -s "$BASE_URL/history/variable-instance?processInstanceId=$INSTANCE_ID" | json_pp 2>/dev/null || curl -s "$BASE_URL/history/variable-instance?processInstanceId=$INSTANCE_ID"
fi
echo ""
echo ""
echo "======================================"
echo "Test terminé!"
echo "======================================"