./collect-jars.sh

test () {
  parentdir="$(dirname "$(pwd)")"
  xterm -e "docker run --rm -it -p 8080:8080 -w /root -v $parentdir/docker/jars/$1:/root $2:$3 java -jar app.jar" &
  TEST_DOCKER_PID=$!
  sleep 1
  ./wrk-test.sh $1 $2 $3 6 64 60
  sleep 1
  ./wrk-test.sh $1 $2 $3 6 256 60
  sleep 1
  ./wrk-test.sh $1 $2 $3 6 1024 60
  sleep 1
  ./wrk-test.sh $1 $2 $3 6 2048 60
  sleep 1
  ./wrk-test.sh $1 $2 $3 6 4096 60
  sleep 1
  ./wrk-test.sh $1 $2 $3 12 64 60
  sleep 1
  ./wrk-test.sh $1 $2 $3 12 256 60
  sleep 1
  ./wrk-test.sh $1 $2 $3 12 1024 60
  sleep 1
  ./wrk-test.sh $1 $2 $3 12 2048 60
  sleep 1
  ./wrk-test.sh $1 $2 $3 12 4096 60
  kill $TEST_DOCKER_PID
}
modules=( 'jooby-undertow' 'resteasy-vertx' )

versions=( '11-alpine' '17-alpine' )
for version in "${versions[@]}"
do
  jkds=( 'amazoncorretto' 'eclipse-temurin' )
  for jdk in "${jkds[@]}"
  do
    for module in "${modules[@]}"
    do
      test $module $jdk $version
    done
  done
done
