summaryrefslogtreecommitdiff
path: root/test-protocols.sh
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2025-06-21 20:10:38 +0300
committerPaul Buetow <paul@buetow.org>2025-06-21 20:10:38 +0300
commit695adc1f6bfb0a0eeef4dd6c035475ea2826871f (patch)
tree945fc0552d4f7f1ef1f468f6030e9925970fa72b /test-protocols.sh
parentd3b697218773eaa5a3dd368705184726dbc0fa38 (diff)
Complete GUI decoupling implementation for headless testing
- Implement MessageHandler pattern to decouple message sending from visualization - Add HeadlessLoader to load simulations without GUI components - Create HeadlessProtocolRunner for clean protocol test execution - Update VSInternalProcess to use MessageHandler for message routing - Add null checks in VSSimulator for headless mode compatibility - Update VSSimulatorVisualization paint() to check for headless mode - Remove obsolete test scripts and documentation - Update test-protocols.sh to remove GUI error suppression options - Consolidate testing documentation in docs/testing-guide.md All protocol tests now run cleanly in headless mode without GUI errors, enabling proper CI/CD integration and automated testing. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Diffstat (limited to 'test-protocols.sh')
-rwxr-xr-xtest-protocols.sh70
1 files changed, 70 insertions, 0 deletions
diff --git a/test-protocols.sh b/test-protocols.sh
new file mode 100755
index 0000000..2edbef9
--- /dev/null
+++ b/test-protocols.sh
@@ -0,0 +1,70 @@
+#!/bin/bash
+#
+# DS-Sim Protocol Test Runner
+#
+# This script runs protocol simulation tests in headless mode.
+# GUI decoupling has been implemented, so tests run cleanly without GUI errors.
+#
+
+echo "DS-Sim Protocol Test Runner"
+echo "=========================="
+echo
+
+# Check if we're in the right directory
+if [ ! -f "pom.xml" ]; then
+ echo "ERROR: Please run this script from the project root directory"
+ exit 1
+fi
+
+# Build if needed
+if [ ! -d "target/classes" ]; then
+ echo "Building project..."
+ mvn compile -q || { echo "Build failed!"; exit 1; }
+fi
+
+# Menu
+echo "Choose an option:"
+echo "1) Run all protocol tests"
+echo "2) Run specific protocol test"
+echo "3) Run tests with detailed logs"
+echo "4) Test GUI decoupling (verify no GUI errors)"
+echo "5) Exit"
+echo
+
+read -p "Enter choice [1-5]: " choice
+
+case $choice in
+ 1)
+ echo "Running all protocol tests..."
+ java -cp target/classes:target/test-classes -Djava.awt.headless=true testing.HeadlessProtocolRunner
+ ;;
+ 2)
+ echo "Available simulations:"
+ ls saved-simulations/*.dat | sed 's/saved-simulations\// - /g'
+ echo
+ read -p "Enter simulation name (without .dat): " sim
+ if [ -f "saved-simulations/${sim}.dat" ]; then
+ java -cp target/classes:target/test-classes -Djava.awt.headless=true \
+ testing.HeadlessProtocolRunner "saved-simulations/${sim}.dat"
+ else
+ echo "Simulation not found!"
+ fi
+ ;;
+ 3)
+ echo "Running tests with detailed logs..."
+ java -cp target/classes:target/test-classes -Djava.awt.headless=true \
+ -Dds.sim.verbose=true testing.HeadlessProtocolRunner
+ ;;
+ 4)
+ echo "Testing GUI decoupling..."
+ java -cp target/classes:target/test-classes testing.TestNoGuiErrors
+ ;;
+ 5)
+ echo "Exiting..."
+ exit 0
+ ;;
+ *)
+ echo "Invalid choice!"
+ exit 1
+ ;;
+esac \ No newline at end of file