./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 12 64 15
  sleep 1
  ./wrk-test.sh $1 $2 $3 12 128 15
  sleep 1
  ./wrk-test.sh $1 $2 $3 12 256 15
  sleep 1
  ./wrk-test.sh $1 $2 $3 12 512 15
  sleep 1
  ./wrk-test.sh $1 $2 $3 12 1024 15
  kill $TEST_DOCKER_PID
}
modules=( 'quarkus-resteasy-jackson' 'quarkus-resteasy-jsonb' 'jersey-grizzly2' 'jersey-jdk-http' 'jersey-simple-http' 'jersey-jetty' 'jersey-netty' 'jersey-netty' 'jersey-netty' 'jersey-netty' 'jooby-netty' 'jooby-jetty' 'jooby-undertow' 'resteasy-jdk-http' 'resteasy-netty' 'resteasy-reactor-netty' 'resteasy-vertx' 'resteasy-undertow' 'cxf-jetty' 'cxf-netty' 'cxf-undertow' )
versions=( '11' '17' )
for version in "${versions[@]}"
do
  jkds=( 'amazoncorretto' 'azul/zulu-openjdk' 'azul/zulu-openjdk-alpine' 'eclipse-temurin' 'openjdk' )
  for jdk in "${jkds[@]}"
  do
    for module in "${modules[@]}"
    do
      test $module $jdk $version
    done
  done
done

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