Skip to content

Commit 24bf054

Browse files
Copilotvobu
andcommitted
docs: add notebook reference to README and test script
Co-authored-by: vobu <6573426+vobu@users.noreply.github.com>
1 parent 84a5033 commit 24bf054

File tree

3 files changed

+177
-0
lines changed

3 files changed

+177
-0
lines changed

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,22 @@ c8ctl <command>
349349
4. Update help text in `src/commands/help.ts`
350350
5. Document in `EXAMPLES.md`
351351

352+
## Learning Resources
353+
354+
### Examples and Tutorials
355+
356+
- **[EXAMPLES.md](EXAMPLES.md)** - Comprehensive command-line examples for all operations
357+
- **[examples/e2e-operations.ipynb](examples/e2e-operations.ipynb)** - Interactive Jupyter Notebook with end-to-end workflows
358+
- **[examples/README.md](examples/README.md)** - Setup guide for running the notebook locally
359+
360+
The Jupyter notebook provides an interactive learning experience with:
361+
- Step-by-step operation examples
362+
- Process deployment and management
363+
- User task workflows
364+
- Message correlation
365+
- Plugin system demonstrations
366+
- Complete end-to-end scenarios
367+
352368
## Environment Variables
353369

354370
- `CAMUNDA_BASE_URL`: Cluster base URL

examples/README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,20 @@ jupyter notebook examples/e2e-operations.ipynb
153153

154154
The notebook operations are also tested in GitHub Actions. See `.github/workflows/e2e-notebook.yml` for the automated test configuration.
155155

156+
You can also run the test script locally to validate all operations:
157+
158+
```bash
159+
# Make sure Camunda is running first
160+
cd assets/c8/8.8
161+
docker compose --profile elasticsearch up -d
162+
cd ../..
163+
164+
# Run the test script
165+
./examples/test-notebook-operations.sh
166+
```
167+
168+
This script validates all the operations demonstrated in the notebook.
169+
156170
## Alternative: Bash Script Examples
157171

158172
If you prefer command-line examples without Jupyter, see:
Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
#!/bin/bash
2+
# Test script to validate notebook operations work with c8ctl
3+
# This script mimics what users would do in the Jupyter notebook
4+
5+
set -e # Exit on error
6+
7+
echo "=========================================="
8+
echo "Testing c8ctl E2E Notebook Operations"
9+
echo "=========================================="
10+
echo ""
11+
12+
# Colors for output
13+
GREEN='\033[0;32m'
14+
YELLOW='\033[1;33m'
15+
NC='\033[0m' # No Color
16+
17+
# Check if Camunda is running
18+
echo "Checking Camunda connectivity..."
19+
if ! curl -s -f -u demo:demo http://localhost:8080/v2/topology > /dev/null; then
20+
echo "❌ Cannot connect to Camunda at localhost:8080"
21+
echo "Please start Camunda 8 first:"
22+
echo " cd assets/c8/8.8"
23+
echo " docker compose --profile elasticsearch up -d"
24+
exit 1
25+
fi
26+
echo -e "${GREEN}✓ Camunda is running${NC}"
27+
echo ""
28+
29+
# Determine c8ctl command
30+
if command -v c8ctl &> /dev/null; then
31+
C8="c8ctl"
32+
echo "Using globally installed c8ctl"
33+
elif [ -f "dist/index.js" ]; then
34+
C8="node dist/index.js"
35+
echo "Using compiled c8ctl from dist/"
36+
elif [ -f "src/index.ts" ]; then
37+
C8="node src/index.ts"
38+
echo "Using c8ctl from source (requires Node.js 22+)"
39+
else
40+
echo "❌ Cannot find c8ctl. Please install or build it first."
41+
exit 1
42+
fi
43+
echo ""
44+
45+
# Test version
46+
echo "1. Testing version..."
47+
$C8 --version
48+
echo -e "${GREEN}✓ Version check passed${NC}"
49+
echo ""
50+
51+
# Test topology
52+
echo "2. Testing topology..."
53+
$C8 get topology | head -20
54+
echo -e "${GREEN}✓ Topology check passed${NC}"
55+
echo ""
56+
57+
# Test profile management
58+
echo "3. Testing profile management..."
59+
$C8 add profile local --baseUrl=http://localhost:8080 2>/dev/null || true
60+
$C8 use profile local
61+
$C8 list profiles | head -10
62+
echo -e "${GREEN}✓ Profile management passed${NC}"
63+
echo ""
64+
65+
# Test deployment
66+
echo "4. Testing deployment..."
67+
if [ -f "tests/fixtures/simple.bpmn" ]; then
68+
$C8 deploy tests/fixtures/simple.bpmn
69+
echo -e "${GREEN}✓ Deployment passed${NC}"
70+
else
71+
echo -e "${YELLOW}⚠ simple.bpmn not found, skipping${NC}"
72+
fi
73+
echo ""
74+
75+
# Test process instance creation
76+
echo "5. Testing process instance creation..."
77+
OUTPUT=$($C8 create pi --bpmnProcessId=simple-process 2>&1 || true)
78+
echo "$OUTPUT"
79+
if echo "$OUTPUT" | grep -q "Key:"; then
80+
echo -e "${GREEN}✓ Process instance creation passed${NC}"
81+
else
82+
echo -e "${YELLOW}⚠ Process instance creation returned unexpected output${NC}"
83+
fi
84+
echo ""
85+
86+
# Test listing process instances
87+
echo "6. Testing list process instances..."
88+
$C8 list pi | head -10
89+
echo -e "${GREEN}✓ List process instances passed${NC}"
90+
echo ""
91+
92+
# Test user task deployment
93+
echo "7. Testing user task process..."
94+
if [ -f "tests/fixtures/list-pis/min-usertask.bpmn" ]; then
95+
$C8 deploy tests/fixtures/list-pis/min-usertask.bpmn
96+
$C8 create pi --bpmnProcessId=Process_0t60ay7 2>&1 || true
97+
sleep 2
98+
$C8 list ut | head -10
99+
echo -e "${GREEN}✓ User task operations passed${NC}"
100+
else
101+
echo -e "${YELLOW}⚠ min-usertask.bpmn not found, skipping${NC}"
102+
fi
103+
echo ""
104+
105+
# Test run command
106+
echo "8. Testing run command..."
107+
if [ -f "tests/fixtures/simple.bpmn" ]; then
108+
$C8 run tests/fixtures/simple.bpmn --variables='{"test":true}' 2>&1 || true
109+
echo -e "${GREEN}✓ Run command passed${NC}"
110+
else
111+
echo -e "${YELLOW}⚠ simple.bpmn not found, skipping${NC}"
112+
fi
113+
echo ""
114+
115+
# Test message operations
116+
echo "9. Testing message operations..."
117+
$C8 publish msg test-message --correlationKey=test-123 --variables='{"status":"test"}' 2>&1 || true
118+
echo -e "${GREEN}✓ Message operations passed${NC}"
119+
echo ""
120+
121+
# Test incident operations
122+
echo "10. Testing incident operations..."
123+
$C8 list inc | head -10
124+
echo -e "${GREEN}✓ Incident operations passed${NC}"
125+
echo ""
126+
127+
# Test job operations
128+
echo "11. Testing job operations..."
129+
$C8 list jobs | head -10
130+
echo -e "${GREEN}✓ Job operations passed${NC}"
131+
echo ""
132+
133+
# Test plugin operations
134+
echo "12. Testing plugin operations..."
135+
$C8 list plugins
136+
echo -e "${GREEN}✓ Plugin operations passed${NC}"
137+
echo ""
138+
139+
echo "=========================================="
140+
echo -e "${GREEN}✅ All E2E notebook operations validated!${NC}"
141+
echo "=========================================="
142+
echo ""
143+
echo "The notebook examples should work correctly."
144+
echo "To run the notebook:"
145+
echo " 1. Install Jupyter kernel: npm install -g tslab && tslab install"
146+
echo " 2. Start Jupyter: jupyter notebook examples/e2e-operations.ipynb"
147+
echo " 3. Execute cells sequentially"

0 commit comments

Comments
 (0)