Smoke tests:
  tags:
    - itup-alm-x86
  timeout: 3h
  image: images.paas.redhat.com/it-cloud-ocp-proxy-lib/fedora:latest
  parallel:
    matrix:
      - JAVA_VER:
        - 17
        - 21
        - 25

  variables:
    ECJ_URL: "https://indy.corp.redhat.com/api/content/maven/hosted/pnc-builds/org/eclipse/jdt/core/compiler/ecj/4.38.0.redhat-00001/ecj-4.38.0.redhat-00001.jar"
  cache:
    key:
      files:
        - build.properties.default
        - .gitlab-ci.yml
    paths:
      - tomcat-build-libs/

  before_script:
    - dnf install wget -y
    - if [ ! -d tomcat-build-libs/ ]; then mkdir tomcat-build-libs; fi
    - |
      if [ ! -d tomcat-build-libs/ecj-4.38/ ]; then
          wget --no-check-certificate -O tomcat-build-libs/ecj-4.38/ecj-4.38.jar $ECJ_URL
      fi

  script:
    - dnf install openssl -y
    - dnf install which -y
    - echo "$(which openssl)"
    - dnf install adoptium-temurin-java-repository -y && dnf config-manager setopt *temurin-java*.enabled=1
    - dnf install temurin-${JAVA_VER}-jdk ant ant-junit maven junit util-linux -y
    - export JAVA_HOME=/usr/lib/jvm/temurin-${JAVA_VER}-jdk/
    - lscpu
    - echo "ANT_OPTS=$ANT_OPTS"
    - echo "Testing $(java --version | head -n 1)"
    - ls -la tomcat-build-libs/ || true
    - ant -Dbase.path=$(pwd)/tomcat-build-libs/ -Dexecute.download=true -Dtest.exclude=**/*TestWsSessionSuspendResume*.java -Dtest.excludePerformance=true -Dtest.relaxTiming=true -noinput echoproperties deploy embed test-nio test-status > test-output-with-java${JAVA_VER}
    - mv output output${JAVA_VER}

  artifacts:
    name: test-logs
    paths:
      - test-output*
      - output*/build/logs/TEST*.txt
    expire_in: 1 week
    when: always
