Moves the existing virtual-thread/context-propagation project into context-propagation/ and adds method-security/ for the Spring Security 7 method-security article: nine runnable demos, fourteen assertions, and every transcript the article quotes, regenerated by scripts/run-all.sh. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RSrsDSRKVsY588yFiMJMo9
34 lines
1.3 KiB
Bash
Executable File
34 lines
1.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Compiles and runs all seven demos plus the JUnit contract test suite, regenerating
|
|
# docs/output/*.txt. Requires JDK 25 (StructuredTaskScope is a preview API through JDK 25 /
|
|
# JEP 505).
|
|
set -euo pipefail
|
|
cd "$(dirname "$0")/.."
|
|
|
|
mvn -q dependency:build-classpath -Dmdep.outputFile=cp.txt
|
|
CP=$(cat cp.txt)
|
|
|
|
rm -rf target/classes
|
|
mkdir -p target/classes docs/output
|
|
javac --release 25 --enable-preview -cp "$CP" -d target/classes $(find src/main -name '*.java')
|
|
|
|
for demo in Demo1PlainThreadLocal Demo2AsyncVirtualThreads Demo3StructuredConcurrency \
|
|
Demo4ExecutorWrapping Demo5ReactiveContext Demo6ScheduledSystemIdentity \
|
|
Demo7ServletFilterPersistence; do
|
|
num=$(echo "$demo" | grep -o '^Demo[0-9]*' | grep -o '[0-9]*')
|
|
out="docs/output/demo${num}.txt"
|
|
echo "Running $demo -> $out"
|
|
java --enable-preview -cp "target/classes:$CP" "com.ankurm.vt.$demo" \
|
|
| grep -v '^Picked up JAVA_TOOL_OPTIONS' | tee "$out"
|
|
done
|
|
|
|
echo "Running JUnit contract test suite -> docs/output/tests.txt"
|
|
mvn -q test > /tmp/mvn-test-raw.txt 2>&1 || true
|
|
{
|
|
echo "mvn test -- SecurityContextPropagationContractTest (10 tests pinning the claims each demo prints above)"
|
|
echo
|
|
cat target/surefire-reports/com.ankurm.vt.SecurityContextPropagationContractTest.txt
|
|
} > docs/output/tests.txt
|
|
cat docs/output/tests.txt
|
|
rm -f /tmp/mvn-test-raw.txt
|