#!/usr/bin/env bash # Runs one scenario against its own external H2 file database and CSV drop file (both under # scenario-data//, outside target/ so a rebuild never touches them -- see # docs/07-restartability.md for why that matters: `mvn spring-boot:run` re-copies # src/main/resources over target/classes before every run, which would silently undo an # in-place "fix" to a classpath resource between two runs of the same scenario. # # ./scripts/run-scenario.sh # # Reuses the packaged jar (target/spring-batch-1.0.0.jar); run `mvn -B -o -DskipTests package` # first if it is missing or stale. set -euo pipefail cd "$(dirname "$0")/.." NAME="${1:?usage: run-scenario.sh }" PROFILE="${2:?usage: run-scenario.sh }" SRC_CSV="${3:?usage: run-scenario.sh }" DIR="scenario-data/${NAME}" mkdir -p "$DIR" if [ ! -f "$DIR/input.csv" ]; then cp "$SRC_CSV" "$DIR/input.csv" fi java -jar target/spring-batch-1.0.0.jar \ --spring.profiles.active="$PROFILE" \ --import.file="file:${DIR}/input.csv" \ --spring.datasource.url="jdbc:h2:file:${PWD}/${DIR}/db"