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
51 lines
2.0 KiB
Bash
Executable File
51 lines
2.0 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Compiles this module twice -- once with -parameters and once without -- runs all nine demos
|
|
# plus the JUnit suite, and regenerates every file in docs/output/.
|
|
#
|
|
# Requires JDK 25 (no preview features needed; the sibling context-propagation module does).
|
|
set -euo pipefail
|
|
cd "$(dirname "$0")/.."
|
|
|
|
mvn -q dependency:build-classpath -Dmdep.outputFile=cp.txt
|
|
CP=$(cat cp.txt)
|
|
|
|
rm -rf target/classes target/classes-noparams
|
|
mkdir -p target/classes target/classes-noparams docs/output
|
|
|
|
# -parameters is what makes #owner resolve to "owner" instead of "arg0". Demo 9 is run from
|
|
# both builds so the difference is a diff, not a claim.
|
|
javac --release 25 -parameters -cp "$CP" -d target/classes $(find src/main -name '*.java')
|
|
javac --release 25 -cp "$CP" -d target/classes-noparams $(find src/main -name '*.java')
|
|
|
|
run() { # run <class-simple-name> <output-file> [classes-dir]
|
|
local demo="$1" out="docs/output/$2" dir="${3:-target/classes}"
|
|
echo "Running $demo -> $out"
|
|
# stderr is kept: Spring's own CGLIB warning about final methods is part of the evidence.
|
|
java -cp "$dir:$CP" "com.ankurm.methodsec.$demo" 2>&1 \
|
|
| grep -v '^Picked up JAVA_TOOL_OPTIONS' > "$out"
|
|
}
|
|
|
|
run Demo1AnnotationsInAction demo1.txt
|
|
run Demo2SelfInvocation demo2.txt
|
|
run Demo3NonProxyable demo3.txt
|
|
run Demo4SpelReference demo4.txt
|
|
run Demo5FilteringTraps demo5.txt
|
|
run Demo6InterceptorOrder demo6.txt
|
|
run Demo7DeniedHandling demo7.txt
|
|
run Demo8MetaAnnotations demo8.txt
|
|
run Demo9ParameterNames demo9-with-parameters.txt target/classes
|
|
run Demo9ParameterNames demo9-without-parameters.txt target/classes-noparams
|
|
|
|
echo "Running JUnit trap suite -> docs/output/tests.txt"
|
|
mvn -q test > /tmp/ms-mvn-test.txt 2>&1 || true
|
|
{
|
|
echo "mvn test -- MethodSecurityTrapsTest (14 tests pinning every claim the demos print)"
|
|
echo
|
|
cat target/surefire-reports/com.ankurm.methodsec.MethodSecurityTrapsTest.txt
|
|
} > docs/output/tests.txt
|
|
rm -f /tmp/ms-mvn-test.txt
|
|
|
|
echo
|
|
echo "Regenerated:"
|
|
ls -1 docs/output/
|