Files
spring-boot-microservices-p…/gateway-mvc/scripts/wrong-retry-import.sh
T

17 lines
1017 B
Bash
Executable File

#!/usr/bin/env bash
# Shows what happens if RoutesConfig imports GatewayRetryFilterFunctions.retry (the Spring Retry flavour)
# instead of RetryFilterFunctions.retry (the one that picks an implementation). Works on a temporary copy.
set -u
. "$(dirname "$0")/lib.sh"
TMP="$(mktemp -d)"; cp -r "$HERE/pom.xml" "$HERE/src" "$TMP/"
sed -i 's/filter\.RetryFilterFunctions\.retry/filter.GatewayRetryFilterFunctions.retry/' "$TMP/src/main/java/com/ankurm/gwmvc/RoutesConfig.java"
echo "\$ diff: the one-line change"
grep -n 'RetryFilterFunctions.retry' "$TMP/src/main/java/com/ankurm/gwmvc/RoutesConfig.java"
(cd "$TMP" && mvn -B -q -DskipTests package 2>&1 | grep -E 'ERROR|BUILD' | head -3)
stop_all
java -jar "$TMP/target/gateway-mvc-1.0.0.jar" --server.port=8099 > "$LOGDIR/wrong-import.log" 2>&1
echo "# startup log:"
grep -m1 -oE 'Factory method .retryRoute. threw exception with message: [^ ]+' "$LOGDIR/wrong-import.log"
grep -m1 'Caused by: java.lang.NoClassDefFoundError' "$LOGDIR/wrong-import.log"
rm -rf "$TMP"