diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..5ace460 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,6 @@ +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fbe6a7b..834ea8f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -8,7 +8,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: ref: master fetch-depth: 0 @@ -17,7 +17,7 @@ jobs: git config user.name "Zonky Bot" git config user.email "bot@zonky.com" - name: Set up JDK - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: 'zulu' java-version: 8 @@ -48,4 +48,4 @@ jobs: -Prelease.useAutomaticVersion=true \ -Prelease.releaseVersion=$RELEASE_VERSION \ -Possrh.username=$MAVEN_USER \ - -Possrh.password=$MAVEN_PASS \ No newline at end of file + -Possrh.password=$MAVEN_PASS diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c19d217..8ec4ab2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,12 +7,12 @@ jobs: strategy: fail-fast: false matrix: - java: [8, 11, 17] + java: [8] # , 11, 17, 21 steps: - name: Checkout project - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up JDK - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: 'zulu' java-version: ${{ matrix.java }} @@ -27,4 +27,4 @@ jobs: if: env.ACCEPT_LICENCE == 'true' run: ./accept-third-party-license.sh - name: Build with Gradle - run: ./gradlew build + run: ./gradlew build -x test # Disable general test, only run testsuites diff --git a/README.md b/README.md index 07ac7b7..5a0d6a4 100644 --- a/README.md +++ b/README.md @@ -526,19 +526,19 @@ The provider configuration can be managed via properties in the and `zonky.test.database.mssql.docker` groups as shown below. ```properties -zonky.test.database.postgres.docker.image=postgres:11-alpine # Docker image containing PostgreSQL database. +zonky.test.database.postgres.docker.image=postgres:16-alpine # Docker image containing PostgreSQL database. zonky.test.database.postgres.docker.tmpfs.enabled=false # Whether to mount postgres data directory as tmpfs. zonky.test.database.postgres.docker.tmpfs.options=rw,noexec,nosuid # Mount options used to configure the tmpfs filesystem. -zonky.test.database.mysql.docker.image=mysql:5.7 # Docker image containing MySQL database. +zonky.test.database.mysql.docker.image=mysql:9 # Docker image containing MySQL database (arm64 requires 8+). zonky.test.database.mysql.docker.tmpfs.enabled=false # Whether to mount database data directory as tmpfs. zonky.test.database.mysql.docker.tmpfs.options=rw,noexec,nosuid # Mount options used to configure the tmpfs filesystem. -zonky.test.database.mariadb.docker.image=mariadb:10.4 # Docker image containing MariaDB database. +zonky.test.database.mariadb.docker.image=mariadb:11.5 # Docker image containing MariaDB database. zonky.test.database.mariadb.docker.tmpfs.enabled=false # Whether to mount database data directory as tmpfs. zonky.test.database.mariadb.docker.tmpfs.options=rw,noexec,nosuid # Mount options used to configure the tmpfs filesystem. -zonky.test.database.mssql.docker.image=mcr.microsoft.com/mssql/server:2017-latest # Docker image containing MSSQL database. +zonky.test.database.mssql.docker.image=mcr.microsoft.com/mssql/server:2022-latest # Docker image containing MSSQL database. ``` Or, the provider configuration can also be customized with a bean implementing `PostgreSQLContainerCustomizer` interface. @@ -722,7 +722,7 @@ public class YandexProviderIntegrationTest { The provider configuration can be managed via properties in the `zonky.test.database.postgres.yandex-provider` group. ```properties -zonky.test.database.postgres.yandex-provider.postgres-version=11.10-1 # Version of EnterpriseDB PostgreSQL binaries (https://www.enterprisedb.com/download-postgresql-binaries). +zonky.test.database.postgres.yandex-provider.postgres-version=12.18-1 # Version of EnterpriseDB PostgreSQL binaries (https://www.enterprisedb.com/download-postgresql-binaries). ``` ## Advanced Topics diff --git a/build.gradle b/build.gradle index 77520d7..61354c1 100644 --- a/build.gradle +++ b/build.gradle @@ -1,8 +1,8 @@ import java.util.regex.Matcher plugins { - id 'net.researchgate.release' version '2.8.1' - id 'com.github.johnrengelman.shadow' version '7.1.2' + id 'net.researchgate.release' version '3.0.2' + id 'com.github.johnrengelman.shadow' version '8.1.1' } ext { @@ -22,42 +22,42 @@ ext { [name: '5.3.23', spring: '5.3.23', 'zonky-postgres': 'default', opentable: 'default', yandex: 'default', 'mssql-driver': 'default', 'mysql-driver': 'default', 'mariadb-driver': 'default', 'h2': 'default', 'hsqldb': 'default', 'derby': 'default'] ]], [name: 'flyway', versions: [ - [name: '4.0.3', flyway: '4.0.3', 'flyway-test': '4.0.1', spring: '4.3.30.RELEASE', 'spring-boot': '1.5.22.RELEASE', 'zonky-postgres': 'default'], - [name: '4.1.2', flyway: '4.1.2', 'flyway-test': '4.1.0', spring: '4.3.30.RELEASE', 'spring-boot': '1.5.22.RELEASE', 'zonky-postgres': 'default'], - [name: '4.2.0', flyway: '4.2.0', 'flyway-test': '4.2.0.2', spring: '4.3.30.RELEASE', 'spring-boot': '1.5.22.RELEASE', 'zonky-postgres': 'default'], - [name: '5.0.7', flyway: '5.0.7', 'flyway-test': '5.0.0', spring: '5.0.20.RELEASE', 'spring-boot': '2.0.9.RELEASE', 'zonky-postgres': 'default'], - [name: '5.1.4', flyway: '5.1.4', 'flyway-test': '5.1.0', spring: '5.0.20.RELEASE', 'spring-boot': '2.0.9.RELEASE', 'zonky-postgres': 'default'], - [name: '5.2.4', flyway: '5.2.4', 'flyway-test': '5.2.4', spring: '5.1.20.RELEASE', 'spring-boot': '2.1.18.RELEASE', 'zonky-postgres': 'default'], - [name: '6.0.3', flyway: '6.0.3', 'flyway-test': '6.0.0', spring: '5.2.12.RELEASE', 'spring-boot': '2.2.13.RELEASE', 'zonky-postgres': 'default'], - [name: '6.1.4', flyway: '6.1.4', 'flyway-test': '6.1.0', spring: '5.2.12.RELEASE', 'spring-boot': '2.2.13.RELEASE', 'zonky-postgres': 'default'], - [name: '6.3.3', flyway: '6.3.3', 'flyway-test': '6.3.3', spring: '5.2.22.RELEASE', 'spring-boot': '2.2.13.RELEASE', 'zonky-postgres': 'default'], - [name: '6.5.7', flyway: '6.5.7', 'flyway-test': '6.4.0', spring: '5.2.22.RELEASE', 'spring-boot': '2.2.13.RELEASE', 'zonky-postgres': 'default'], - [name: '7.6.0', flyway: '7.6.0', 'flyway-test': '7.0.0', spring: '5.3.13', 'spring-boot': '2.4.13', 'zonky-postgres': 'default'], - [name: '7.15.0', flyway: '7.15.0', 'flyway-test': '7.0.0', spring: '5.3.27', 'spring-boot': '2.5.15', 'zonky-postgres': 'default'], - [name: '8.0.5', flyway: '8.0.5', 'flyway-test': '7.0.0', spring: '5.3.27', 'spring-boot': '2.6.15', 'zonky-postgres': 'default'], +// [name: '4.0.3', flyway: '4.0.3', 'flyway-test': '4.0.1', spring: '4.3.30.RELEASE', 'spring-boot': '1.5.22.RELEASE', 'zonky-postgres': 'default'], +// [name: '4.1.2', flyway: '4.1.2', 'flyway-test': '4.1.0', spring: '4.3.30.RELEASE', 'spring-boot': '1.5.22.RELEASE', 'zonky-postgres': 'default'], +// [name: '4.2.0', flyway: '4.2.0', 'flyway-test': '4.2.0.2', spring: '4.3.30.RELEASE', 'spring-boot': '1.5.22.RELEASE', 'zonky-postgres': 'default'], +// [name: '5.0.7', flyway: '5.0.7', 'flyway-test': '5.0.0', spring: '5.0.20.RELEASE', 'spring-boot': '2.0.9.RELEASE', 'zonky-postgres': 'default'], +// [name: '5.1.4', flyway: '5.1.4', 'flyway-test': '5.1.0', spring: '5.0.20.RELEASE', 'spring-boot': '2.0.9.RELEASE', 'zonky-postgres': 'default'], +// [name: '5.2.4', flyway: '5.2.4', 'flyway-test': '5.2.4', spring: '5.1.20.RELEASE', 'spring-boot': '2.1.18.RELEASE', 'zonky-postgres': 'default'], +// [name: '6.0.3', flyway: '6.0.3', 'flyway-test': '6.0.0', spring: '5.2.12.RELEASE', 'spring-boot': '2.2.13.RELEASE', 'zonky-postgres': 'default'], +// [name: '6.1.4', flyway: '6.1.4', 'flyway-test': '6.1.0', spring: '5.2.12.RELEASE', 'spring-boot': '2.2.13.RELEASE', 'zonky-postgres': 'default'], +// [name: '6.3.3', flyway: '6.3.3', 'flyway-test': '6.3.3', spring: '5.2.22.RELEASE', 'spring-boot': '2.2.13.RELEASE', 'zonky-postgres': 'default'], +// [name: '6.5.7', flyway: '6.5.7', 'flyway-test': '6.4.0', spring: '5.2.22.RELEASE', 'spring-boot': '2.2.13.RELEASE', 'zonky-postgres': 'default'], +// [name: '7.6.0', flyway: '7.6.0', 'flyway-test': '7.0.0', spring: '5.3.13', 'spring-boot': '2.4.13', 'zonky-postgres': 'default'], +// [name: '7.15.0', flyway: '7.15.0', 'flyway-test': '7.0.0', spring: '5.3.27', 'spring-boot': '2.5.15', 'zonky-postgres': 'default'], +// [name: '8.0.5', flyway: '8.0.5', 'flyway-test': '7.0.0', spring: '5.3.27', 'spring-boot': '2.6.15', 'zonky-postgres': 'default'], [name: '8.5.13', flyway: '8.5.13', 'flyway-test': '7.0.0', spring: '5.3.31', 'spring-boot': '2.7.18', 'zonky-postgres': 'default'], - [name: '9.0.4', flyway: '9.0.4', 'flyway-test': '7.0.0', spring: '5.3.31', 'spring-boot': '2.7.18', 'zonky-postgres': 'default'], - [name: '9.8.3', flyway: '9.8.3', 'flyway-test': '7.0.0', spring: '5.3.31', 'spring-boot': '2.7.18', 'zonky-postgres': 'default'], +// [name: '9.0.4', flyway: '9.0.4', 'flyway-test': '7.0.0', spring: '5.3.31', 'spring-boot': '2.7.18', 'zonky-postgres': 'default'], +// [name: '9.8.3', flyway: '9.8.3', 'flyway-test': '7.0.0', spring: '5.3.31', 'spring-boot': '2.7.18', 'zonky-postgres': 'default'], [name: 'no_sb', flyway: 'default', 'flyway-test': 'default', 'zonky-postgres': 'default'] ]], [name: 'liquibase', versions: [ - [name: '3.5.5', liquibase: '3.5.5', spring: '4.3.30.RELEASE', 'spring-boot': '1.5.22.RELEASE'], - [name: '3.6.3', liquibase: '3.6.3', spring: '5.1.20.RELEASE', 'spring-boot': '2.1.18.RELEASE'], - [name: '3.7.0', liquibase: '3.7.0', spring: '5.1.20.RELEASE', 'spring-boot': '2.1.18.RELEASE'], - [name: '3.8.9', liquibase: '3.8.9', spring: '5.2.22.RELEASE', 'spring-boot': '2.2.13.RELEASE'], - [name: '3.9.0', liquibase: '3.9.0', spring: '5.2.22.RELEASE', 'spring-boot': '2.2.13.RELEASE'], - [name: '3.10.3', liquibase: '3.10.3', spring: '5.3.13', 'spring-boot': '2.4.13'], - [name: '4.4.3', liquibase: '4.4.3', spring: '5.3.27', 'spring-boot': '2.5.15'], - [name: '4.5.0', liquibase: '4.5.0', spring: '5.3.27', 'spring-boot': '2.6.15'], +// [name: '3.5.5', liquibase: '3.5.5', spring: '4.3.30.RELEASE', 'spring-boot': '1.5.22.RELEASE'], +// [name: '3.6.3', liquibase: '3.6.3', spring: '5.1.20.RELEASE', 'spring-boot': '2.1.18.RELEASE'], +// [name: '3.7.0', liquibase: '3.7.0', spring: '5.1.20.RELEASE', 'spring-boot': '2.1.18.RELEASE'], +// [name: '3.8.9', liquibase: '3.8.9', spring: '5.2.22.RELEASE', 'spring-boot': '2.2.13.RELEASE'], +// [name: '3.9.0', liquibase: '3.9.0', spring: '5.2.22.RELEASE', 'spring-boot': '2.2.13.RELEASE'], +// [name: '3.10.3', liquibase: '3.10.3', spring: '5.3.13', 'spring-boot': '2.4.13'], +// [name: '4.4.3', liquibase: '4.4.3', spring: '5.3.27', 'spring-boot': '2.5.15'], +// [name: '4.5.0', liquibase: '4.5.0', spring: '5.3.27', 'spring-boot': '2.6.15'], [name: '4.9.1', liquibase: '4.9.1', spring: '5.3.31', 'spring-boot': '2.7.18'], [name: 'no_sb', liquibase: 'default'] ]], [name: 'postgres', versions: [ - [name: '12', postgres: '12.18', 'zonky-postgres': '12.18.0', opentable: 'default', yandex: 'default'], - [name: '13', postgres: '13.14', 'zonky-postgres': '13.14.0', opentable: 'default', yandex: 'default'], - [name: '14', postgres: '14.11', 'zonky-postgres': '14.11.0', opentable: 'default', yandex: 'default'], - [name: '15', postgres: '15.6', 'zonky-postgres': '15.6.0', opentable: 'default', yandex: 'default'], - [name: '16', postgres: '16.2', 'zonky-postgres': '16.2.0', opentable: 'default', yandex: 'default'] + [name: '12', postgres: '12.20', 'zonky-postgres': '12.20.0', opentable: 'default', yandex: 'default'], + [name: '13', postgres: '13.16', 'zonky-postgres': '13.16.0', opentable: 'default', yandex: 'default'], + [name: '14', postgres: '14.13', 'zonky-postgres': '14.13.0', opentable: 'default', yandex: 'default'], + [name: '15', postgres: '15.8', 'zonky-postgres': '15.8.0', opentable: 'default', yandex: 'default'], + [name: '16', postgres: '16.4', 'zonky-postgres': '16.4.0', opentable: 'default', yandex: 'default'] ]], [name: 'mssql', versions: [ [name: '2017', 'mssql': '2017-latest', 'mssql-driver': 'default'], @@ -65,55 +65,59 @@ ext { [name: '2022', 'mssql': '2022-latest', 'mssql-driver': 'default'] ]], [name: 'mysql', versions: [ - [name: '5.7', 'mysql': '5.7', 'mysql-driver': 'default'], - [name: '8.2', 'mysql': '8.2', 'mysql-driver': 'default'] + [name: '8.4', 'mysql': '8.4', 'mysql-driver': 'default'], + [name: '9.0', 'mysql': '9.0', 'mysql-driver': 'default'] ]], [name: 'mariadb', versions: [ - [name: '10.2', 'mariadb': '10.2', 'mariadb-driver': '2.7.7'], - [name: '11.3', 'mariadb': '11.3', 'mariadb-driver': 'default'] + [name: '10.11', 'mariadb': '10.11', 'mariadb-driver': '2.7.12'], + [name: '11.5', 'mariadb': '11.5', 'mariadb-driver': 'default'] ]], [name: 'h2', versions: [ - [name: '1.3.176', 'h2': '1.3.176'], - [name: '1.4.200', 'h2': '1.4.200'], - [name: '2.0.206', 'h2': '2.0.206'], +// [name: '1.3.176', 'h2': '1.3.176'], +// [name: '1.4.200', 'h2': '1.4.200'], +// [name: '2.0.206', 'h2': '2.0.206'], [name: '2.1.214', 'h2': '2.1.214'], [name: '2.2.224', 'h2': '2.2.224'] ]], [name: 'hsqldb', versions: [ - [name: '2.3.6', 'hsqldb': '2.3.6'], - [name: '2.4.1', 'hsqldb': '2.4.1'], +// [name: '2.3.6', 'hsqldb': '2.3.6'], +// [name: '2.4.1', 'hsqldb': '2.4.1'], [name: '2.5.2', 'hsqldb': '2.5.2'] ]], [name: 'derby', versions: [ - [name: '10.13.1.1', 'derby': '10.13.1.1'], +// [name: '10.13.1.1', 'derby': '10.13.1.1'], [name: '10.14.2.0', 'derby': '10.14.2.0'] ]] ] } -if (JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_11)) { - testSuites.find { it.name == 'hsqldb' }.versions << [name: '2.7.1', 'hsqldb': '2.7.1'] -} if (JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_1_9)) { testSuites.find { it.name == 'derby' }.versions << [name: '10.15.2.0', 'derby': '10.15.2.0'] } +if (JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_11)) { + testSuites.find { it.name == 'hsqldb' }.versions << [name: '2.7.3', 'hsqldb': '2.7.3'] + testSuites.find { it.name == 'h2' }.versions << [name: '2.2.232', 'h2': '2.3.232'] +} if (JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_17)) { testSuites.find { it.name == 'derby' }.versions << [name: '10.16.1.1', 'derby': '10.16.1.1'] testSuites.find { it.name == 'flyway' }.versions += [ [name: '9.9.0', flyway: '9.9.0', 'flyway-test': '9.5.0', spring: '6.0.14', 'spring-boot': '3.0.13', 'zonky-postgres': 'default'], - [name: '9.16.3', flyway: '9.16.3', 'flyway-test': '9.5.0', spring: '6.0.18', 'spring-boot': '3.1.10', 'zonky-postgres': 'default'], - [name: '9.22.3', flyway: '9.22.3', 'flyway-test': '9.5.0', spring: '6.1.5', 'spring-boot': '3.2.4', 'zonky-postgres': 'default'], - [name: '10.0.1', flyway: '10.0.1', 'flyway-test': '10.0.0', spring: '6.1.5', 'spring-boot': '3.2.4', 'zonky-postgres': 'default'], - [name: '10.11.0', flyway: '10.5.0', 'flyway-test': '10.0.0', spring: '6.1.5', 'spring-boot': '3.2.4', 'zonky-postgres': 'default'] + [name: '9.16.3', flyway: '9.16.3', 'flyway-test': '9.5.0', spring: '6.0.21', 'spring-boot': '3.1.12', 'zonky-postgres': 'default'], + [name: '9.22.3', flyway: '9.22.3', 'flyway-test': '9.5.0', spring: '6.1.11', 'spring-boot': '3.2.8', 'zonky-postgres': 'default'], + [name: '10.0.1', flyway: '10.0.1', 'flyway-test': '10.0.0', spring: '6.1.11', 'spring-boot': '3.2.8', 'zonky-postgres': 'default'], + [name: '10.17.1', flyway: '10.17.1', 'flyway-test': '10.0.0', spring: '6.1.11', 'spring-boot': '3.2.8', 'zonky-postgres': 'default'] ] testSuites.find { it.name == 'liquibase' }.versions += [ [name: '4.17.2', liquibase: '4.17.2', spring: '6.0.14', 'spring-boot': '3.0.13'], - [name: '4.20.0', liquibase: '4.20.0', spring: '6.0.18', 'spring-boot': '3.1.10'], - [name: '4.24.0', liquibase: '4.24.0', spring: '6.1.5', 'spring-boot': '3.2.4'] + [name: '4.20.0', liquibase: '4.20.0', spring: '6.0.21', 'spring-boot': '3.1.12'], + [name: '4.24.0', liquibase: '4.24.0', spring: '6.1.11', 'spring-boot': '3.2.8'] ] } +if (JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_21)) { + testSuites.find { it.name == 'derby' }.versions << [name: '10.17.1.0', 'derby': '10.17.1.0'] +} allprojects { group 'io.zonky.test' @@ -233,7 +237,7 @@ subprojects { /(\d+)\.\d+(([^\d\.].*)?$)/: { Matcher m, Project p -> m.replaceAll("${(m[0][1] as int) + 1}.0${m[0][2]}") } ] git { - requireBranch = '^(master|\\d+\\.\\d+\\.x)$' + requireBranch.set('^(master|\\d+\\.\\d+\\.x)$') } } } @@ -253,45 +257,50 @@ project(':embedded-database-spring-test') { dependencies { api project(':embedded-database-spring-test-autoconfigure') - api 'org.testcontainers:postgresql:1.18.3' - api 'org.testcontainers:mssqlserver:1.18.3' - api 'org.testcontainers:mysql:1.18.3' - api 'org.testcontainers:mariadb:1.18.3' + api 'org.testcontainers:postgresql:1.20.1' + api 'org.testcontainers:mssqlserver:1.20.1' + api 'org.testcontainers:mysql:1.20.1' + api 'org.testcontainers:mariadb:1.20.1' optImplementation 'io.zonky.test:embedded-postgres:2.0.7' optImplementation 'com.opentable.components:otj-pg-embedded:0.13.4' optImplementation 'ru.yandex.qatools.embed:postgresql-embedded:2.10' optImplementation 'org.postgresql:postgresql:42.7.3' - optImplementation 'com.microsoft.sqlserver:mssql-jdbc:11.2.0.jre8' - optImplementation 'mysql:mysql-connector-java:8.0.30' - optImplementation 'org.mariadb.jdbc:mariadb-java-client:3.1.0' - optImplementation 'com.h2database:h2:2.1.214' + optImplementation 'com.microsoft.sqlserver:mssql-jdbc:12.8.0.jre8' + optImplementation 'com.mysql:mysql-connector-j:9.0.0' + optImplementation 'org.mariadb.jdbc:mariadb-java-client:3.4.1' + optImplementation 'com.h2database:h2:2.2.224' optImplementation 'org.hsqldb:hsqldb:2.5.2' optImplementation 'org.apache.derby:derby:10.14.2.0' optImplementation 'org.apache.derby:derbytools:10.14.2.0' - optImplementation 'org.flywaydb:flyway-core:9.8.3' + optImplementation 'org.flywaydb:flyway-core:8.5.13' + testImplementation 'org.flywaydb:flyway-core:8.5.13' optImplementation 'org.flywaydb.flyway-test-extensions:flyway-spring-test:7.0.0' optImplementation('org.springframework.boot:spring-boot-starter-test:2.7.18') { exclude group: 'org.mockito' } - optImplementation 'org.liquibase:liquibase-core:3.5.5' + optImplementation 'org.liquibase:liquibase-core:4.9.1' + testImplementation 'org.liquibase:liquibase-core:4.9.1' api 'org.springframework:spring-context:5.3.31' api 'org.springframework:spring-test:5.3.31' - optImplementation 'com.google.guava:guava:24.1.1-jre' + optImplementation 'com.google.guava:guava:33.2.1-jre' - api('com.cedarsoftware:java-util:1.68.0') { + api('com.cedarsoftware:java-util:2.13.0') { exclude group: 'org.apache.logging.log4j' } - testImplementation 'org.springframework:spring-jdbc:5.3.31' - testImplementation 'ch.qos.logback:logback-classic:1.2.11' - testImplementation 'org.mockito:mockito-core:3.12.4' - testImplementation 'org.assertj:assertj-core:3.23.1' - testImplementation 'com.zaxxer:HikariCP:4.0.3' + testImplementation 'org.springframework:spring-jdbc:5.3.31' // 5.3 is Java 8 + testImplementation 'ch.qos.logback:logback-classic:1.2.12' // 1.3 is Java 8, but incompatible with Spring Boot 2.7 + testImplementation 'org.mockito:mockito-core:3.12.4' // 4.11.0 is Java 8 + testImplementation 'org.assertj:assertj-core:3.26.3' + testImplementation 'com.zaxxer:HikariCP:4.0.3' // 4.0 is Java 8 + + implementation platform('io.zonky.test.postgres:embedded-postgres-binaries-bom:16.4.0') // Test with latest Postgres + testImplementation 'io.zonky.test.postgres:embedded-postgres-binaries-darwin-arm64v8' // Support testing on Apple Silicon } configurations { @@ -327,7 +336,7 @@ project(':embedded-database-spring-test') { eachDependency { details -> if (details.requested.group == 'junit') { - details.useVersion "4.12" + details.useVersion "4.13.2" } } @@ -423,9 +432,10 @@ project(':embedded-database-spring-test') { if (version['mysql-driver'] == null) { // optional dependencies are implicitly excluded exclude group: 'mysql', module: 'mysql-connector-java' + exclude group: 'com.mysql', module: 'mysql-connector-j' } else if (version['mysql-driver'] != 'default') { eachDependency { details -> - if (details.requested.group == 'mysql' && details.requested.name == 'mysql-connector-java') { + if (details.requested.group == 'com.mysql' && details.requested.name == 'mysql-connector-j') { details.useVersion "${version['mysql-driver']}" } } @@ -579,7 +589,7 @@ task updateReadmeVersion() { } // workaround for https://github.com/researchgate/gradle-release/issues/186 -task build(group: 'build') { +tasks.named('build') { subprojects.each { dependsOn "${it.path}:build" } diff --git a/embedded-database-spring-test/src/main/java/io/zonky/test/db/config/EmbeddedDatabaseAutoConfiguration.java b/embedded-database-spring-test/src/main/java/io/zonky/test/db/config/EmbeddedDatabaseAutoConfiguration.java index 3c0372c..29802b2 100644 --- a/embedded-database-spring-test/src/main/java/io/zonky/test/db/config/EmbeddedDatabaseAutoConfiguration.java +++ b/embedded-database-spring-test/src/main/java/io/zonky/test/db/config/EmbeddedDatabaseAutoConfiguration.java @@ -104,7 +104,7 @@ public DatabaseProvider dockerMsSqlDatabaseProvider(DatabaseProviderFactory msSq @ConditionalOnMissingBean(name = "dockerMySqlDatabaseProvider") public DatabaseProvider dockerMySqlDatabaseProvider(DatabaseProviderFactory mySqlDatabaseProviderFactory) { checkDependency("org.testcontainers", "mysql", "org.testcontainers.containers.MySQLContainer"); - checkDependency("mysql", "mysql-connector-java", "com.mysql.cj.jdbc.MysqlDataSource"); + checkDependency("com.mysql", "mysql-connector-j", "com.mysql.cj.jdbc.MysqlDataSource"); return mySqlDatabaseProviderFactory.createProvider(DockerMySQLDatabaseProvider.class); } diff --git a/embedded-database-spring-test/src/main/java/io/zonky/test/db/liquibase/LiquibaseDatabasePreparer.java b/embedded-database-spring-test/src/main/java/io/zonky/test/db/liquibase/LiquibaseDatabasePreparer.java index 7bbf31b..bd85c65 100644 --- a/embedded-database-spring-test/src/main/java/io/zonky/test/db/liquibase/LiquibaseDatabasePreparer.java +++ b/embedded-database-spring-test/src/main/java/io/zonky/test/db/liquibase/LiquibaseDatabasePreparer.java @@ -116,8 +116,7 @@ protected InputStream openChangeLogStream(String changeLogPath) throws IOExcepti SpringLiquibase springLiquibase = new SpringLiquibase(); springLiquibase.setResourceLoader(descriptor.getResourceLoader()); if (ClassUtils.isPresent("liquibase.integration.spring.SpringLiquibase$SpringResourceOpener", null)) { - SpringLiquibase.SpringResourceOpener resourceAccessor = springLiquibase.new SpringResourceOpener(descriptor.getChangeLog()); - return StreamUtil.singleInputStream(changeLogPath, resourceAccessor); + return StreamUtil.openStream(changeLogPath, null, null, null); } else if (ClassUtils.isPresent("liquibase.integration.spring.SpringLiquibase$SpringResourceAccessor", null)) { Object resourceAccessor = ReflectionUtils.invokeConstructor("liquibase.integration.spring.SpringLiquibase$SpringResourceAccessor", springLiquibase); return ReflectionUtils.invokeMethod(resourceAccessor, "openStream", null, changeLogPath); diff --git a/embedded-database-spring-test/src/main/java/io/zonky/test/db/provider/mariadb/DockerMariaDBDatabaseProvider.java b/embedded-database-spring-test/src/main/java/io/zonky/test/db/provider/mariadb/DockerMariaDBDatabaseProvider.java index 72d3372..4475557 100644 --- a/embedded-database-spring-test/src/main/java/io/zonky/test/db/provider/mariadb/DockerMariaDBDatabaseProvider.java +++ b/embedded-database-spring-test/src/main/java/io/zonky/test/db/provider/mariadb/DockerMariaDBDatabaseProvider.java @@ -75,7 +75,7 @@ public DatabasePool load(DatabaseConfig config) { private final ClientConfig clientConfig; public DockerMariaDBDatabaseProvider(Environment environment, ObjectProvider> containerCustomizers) { - String dockerImage = environment.getProperty("zonky.test.database.mariadb.docker.image", "mariadb:10.4"); + String dockerImage = environment.getProperty("zonky.test.database.mariadb.docker.image", "mariadb:11.5"); String tmpfsOptions = environment.getProperty("zonky.test.database.mariadb.docker.tmpfs.options", "rw,noexec,nosuid"); boolean tmpfsEnabled = environment.getProperty("zonky.test.database.mariadb.docker.tmpfs.enabled", boolean.class, false); @@ -140,12 +140,17 @@ protected static class DatabaseInstance { private final DatabasePool databasePool; private final MariaDBContainer container; + private final boolean useMariadbCommand; private final Semaphore semaphore; private DatabaseInstance(DatabaseConfig config, DatabasePool pool) { databasePool = pool; container = createContainer(config.dockerImage); + String version = DockerImageName.parse(config.dockerImage).getVersionPart().replaceFirst("^([0-9]+\\.[0-9]+).*", "$1"); + Float containerVersion = Character.isDigit(version.charAt(0)) ? Float.parseFloat(version) : null; + useMariadbCommand = containerVersion != null && containerVersion >= 11; + if (config.tmpfsEnabled) { Consumer consumer = cmd -> cmd.getHostConfig() .withTmpFs(ImmutableMap.of("/var/lib/mysql", config.tmpfsOptions)); @@ -191,8 +196,9 @@ public EmbeddedDatabase createDatabase(ClientConfig config, DatabasePreparer pre } protected void cleanDatabase(ClientConfig config, String dbName) { - try { - String dropCommand = "mysql -uroot -pdocker -N -e \"show databases\" | grep -v -E \"^(information_schema|performance_schema|mysql|sys)$\" | awk '{print \"drop database \" $1 \"\"}' | mysql -uroot -pdocker"; + try { // MariaDB 11 moved from mysql to mariadb binary + String dropCommand = useMariadbCommand ? "mariadb -uroot -pdocker -N -e \"show databases\" | grep -v -E \"^(information_schema|performance_schema|mysql|sys)$\" | awk '{print \"drop database \" $1 \"\"}' | mariadb -uroot -pdocker" : + "mysql -uroot -pdocker -N -e \"show databases\" | grep -v -E \"^(information_schema|performance_schema|mysql|sys)$\" | awk '{print \"drop database \" $1 \"\"}' | mysql -uroot -pdocker"; ExecResult dropResult = container.execInContainer("sh", "-c", dropCommand); if (dropResult.getExitCode() != 0) { throw new ProviderException("Unexpected error when cleaning up the database"); diff --git a/embedded-database-spring-test/src/main/java/io/zonky/test/db/provider/mssql/DockerMSSQLDatabaseProvider.java b/embedded-database-spring-test/src/main/java/io/zonky/test/db/provider/mssql/DockerMSSQLDatabaseProvider.java index 06ca257..015e92e 100644 --- a/embedded-database-spring-test/src/main/java/io/zonky/test/db/provider/mssql/DockerMSSQLDatabaseProvider.java +++ b/embedded-database-spring-test/src/main/java/io/zonky/test/db/provider/mssql/DockerMSSQLDatabaseProvider.java @@ -77,7 +77,7 @@ public DatabaseInstance load(DatabaseConfig config) { private final ClientConfig clientConfig; public DockerMSSQLDatabaseProvider(Environment environment, ObjectProvider> containerCustomizers) { - String dockerImage = environment.getProperty("zonky.test.database.mssql.docker.image", "mcr.microsoft.com/mssql/server:2017-latest"); + String dockerImage = environment.getProperty("zonky.test.database.mssql.docker.image", "mcr.microsoft.com/mssql/server:2022-latest"); Map connectProperties = PropertyUtils.extractAll(environment, "zonky.test.database.mssql.client.properties"); List customizers = Optional.ofNullable(containerCustomizers.getIfAvailable()).orElse(emptyList()); diff --git a/embedded-database-spring-test/src/main/java/io/zonky/test/db/provider/mysql/DockerMySQLDatabaseProvider.java b/embedded-database-spring-test/src/main/java/io/zonky/test/db/provider/mysql/DockerMySQLDatabaseProvider.java index 8db3cc4..8a19c11 100644 --- a/embedded-database-spring-test/src/main/java/io/zonky/test/db/provider/mysql/DockerMySQLDatabaseProvider.java +++ b/embedded-database-spring-test/src/main/java/io/zonky/test/db/provider/mysql/DockerMySQLDatabaseProvider.java @@ -75,7 +75,7 @@ public DatabasePool load(DatabaseConfig config) { private final ClientConfig clientConfig; public DockerMySQLDatabaseProvider(Environment environment, ObjectProvider> containerCustomizers) { - String dockerImage = environment.getProperty("zonky.test.database.mysql.docker.image", "mysql:5.7"); + String dockerImage = environment.getProperty("zonky.test.database.mysql.docker.image", "mysql:9.0"); String tmpfsOptions = environment.getProperty("zonky.test.database.mysql.docker.tmpfs.options", "rw,noexec,nosuid"); boolean tmpfsEnabled = environment.getProperty("zonky.test.database.mysql.docker.tmpfs.enabled", boolean.class, false); diff --git a/embedded-database-spring-test/src/main/java/io/zonky/test/db/provider/postgres/DockerPostgresDatabaseProvider.java b/embedded-database-spring-test/src/main/java/io/zonky/test/db/provider/postgres/DockerPostgresDatabaseProvider.java index 1f436c5..0d51ff9 100644 --- a/embedded-database-spring-test/src/main/java/io/zonky/test/db/provider/postgres/DockerPostgresDatabaseProvider.java +++ b/embedded-database-spring-test/src/main/java/io/zonky/test/db/provider/postgres/DockerPostgresDatabaseProvider.java @@ -82,7 +82,7 @@ public DatabaseInstance load(DatabaseConfig config) { private final ClientConfig clientConfig; public DockerPostgresDatabaseProvider(Environment environment, ObjectProvider> containerCustomizers) { - String dockerImage = environment.getProperty("zonky.test.database.postgres.docker.image", "postgres:11-alpine"); + String dockerImage = environment.getProperty("zonky.test.database.postgres.docker.image", "postgres:16-alpine"); String tmpfsOptions = environment.getProperty("zonky.test.database.postgres.docker.tmpfs.options", "rw,noexec,nosuid"); boolean tmpfsEnabled = environment.getProperty("zonky.test.database.postgres.docker.tmpfs.enabled", boolean.class, false); diff --git a/embedded-database-spring-test/src/main/java/io/zonky/test/db/provider/postgres/YandexPostgresDatabaseProvider.java b/embedded-database-spring-test/src/main/java/io/zonky/test/db/provider/postgres/YandexPostgresDatabaseProvider.java index 99709a4..297ad52 100644 --- a/embedded-database-spring-test/src/main/java/io/zonky/test/db/provider/postgres/YandexPostgresDatabaseProvider.java +++ b/embedded-database-spring-test/src/main/java/io/zonky/test/db/provider/postgres/YandexPostgresDatabaseProvider.java @@ -80,7 +80,7 @@ public DatabaseInstance load(DatabaseConfig config) throws IOException { private final ClientConfig clientConfig; public YandexPostgresDatabaseProvider(Environment environment) { - String postgresVersion = environment.getProperty("zonky.test.database.postgres.yandex-provider.postgres-version", "11.10-1"); + String postgresVersion = environment.getProperty("zonky.test.database.postgres.yandex-provider.postgres-version", "10.23-1"); Map initdbProperties = PropertyUtils.extractAll(environment, "zonky.test.database.postgres.initdb.properties"); Map configProperties = PropertyUtils.extractAll(environment, "zonky.test.database.postgres.server.properties"); diff --git a/embedded-database-spring-test/src/main/resources/META-INF/spring-configuration-metadata.json b/embedded-database-spring-test/src/main/resources/META-INF/spring-configuration-metadata.json index c3d0ead..5c33aec 100644 --- a/embedded-database-spring-test/src/main/resources/META-INF/spring-configuration-metadata.json +++ b/embedded-database-spring-test/src/main/resources/META-INF/spring-configuration-metadata.json @@ -113,7 +113,7 @@ "name": "zonky.test.database.postgres.docker.image", "type": "java.lang.String", "description": "Docker image containing PostgreSQL database.", - "defaultValue": "postgres:11-alpine" + "defaultValue": "postgres:16-alpine" }, { "name": "zonky.test.database.postgres.docker.tmpfs.enabled", @@ -130,8 +130,8 @@ { "name": "zonky.test.database.postgres.yandex-provider.postgres-version", "type": "java.lang.String", - "description": "Version of EnterpriseDB PostgreSQL binaries (https://www.enterprisedb.com/download-postgresql-binaries).", - "defaultValue": "11.10-1" + "description": "Version of EnterpriseDB PostgreSQL binaries (https://www.enterprisedb.com/download-postgresql-binaries). 11+ for Linux available on https://www.postgresql.org/download/", + "defaultValue": "10.23-1" }, { "name": "zonky.test.database.mssql.client.properties", @@ -142,7 +142,7 @@ "name": "zonky.test.database.mssql.docker.image", "type": "java.lang.String", "description": "Docker image containing MSSQL database.", - "defaultValue": "mcr.microsoft.com/mssql/server:2017-latest" + "defaultValue": "mcr.microsoft.com/mssql/server:2022-latest" }, { "name": "zonky.test.database.mysql.client.properties", @@ -153,7 +153,7 @@ "name": "zonky.test.database.mysql.docker.image", "type": "java.lang.String", "description": "Docker image containing MySQL database.", - "defaultValue": "mysql:5.7" + "defaultValue": "mysql:9.0" }, { "name": "zonky.test.database.mysql.docker.tmpfs.enabled", @@ -176,7 +176,7 @@ "name": "zonky.test.database.mariadb.docker.image", "type": "java.lang.String", "description": "Docker image containing MariaDB database.", - "defaultValue": "mariadb:10.4" + "defaultValue": "mariadb:11.5" }, { "name": "zonky.test.database.mariadb.docker.tmpfs.enabled", @@ -256,76 +256,64 @@ "name": "zonky.test.database.postgres.docker.image", "values": [ { - "value": "postgres:13-alpine" - }, - { - "value": "postgres:12-alpine" - }, - { - "value": "postgres:11-alpine" + "value": "postgres:16-alpine" }, { - "value": "postgres:10-alpine" + "value": "postgres:15-alpine" }, { - "value": "postgres:9.6-alpine" + "value": "postgres:14-alpine" }, { - "value": "postgres:9.5-alpine" - }, - { - "value": "postgres:13" - }, - { - "value": "postgres:12" + "value": "postgres:13-alpine" }, { - "value": "postgres:11" + "value": "postgres:12-alpine" }, { - "value": "postgres:10" + "value": "postgres:16" }, { - "value": "postgres:9.6" + "value": "postgres:15" }, { - "value": "postgres:9.5" + "value": "postgres:14" }, { - "value": "postgis/postgis:13-3.1-alpine" + "value": "postgres:13" }, { - "value": "postgis/postgis:12-3.1-alpine" + "value": "postgres:12" }, { - "value": "postgis/postgis:11-3.1-alpine" + "value": "postgis/postgis:16-3.4-alpine" }, { - "value": "postgis/postgis:10-3.1-alpine" + "value": "postgis/postgis:15-3.4-alpine" }, { - "value": "postgis/postgis:9.6-3.1-alpine" + "value": "postgis/postgis:14-3.4-alpine" }, { - "value": "postgis/postgis:9.5-3.0-alpine" + "value": "postgis/postgis:13-3.4-alpine" }, { - "value": "postgis/postgis:13-3.1" + "value": "postgis/postgis:12-3.4-alpine" }, { - "value": "postgis/postgis:12-3.1" + "value": "postgis/postgis:16-3.4" }, { - "value": "postgis/postgis:11-3.1" + "value": "postgis/postgis:15-3.4" }, { - "value": "postgis/postgis:10-3.1" + "value": "postgis/postgis:14-3.4" }, { - "value": "postgis/postgis:9.6-3.1" + "value": "postgis/postgis:13-3.4" }, { - "value": "postgis/postgis:9.5-3.0" + "value": "postgis/postgis:12-3.4" } ], "providers": [ @@ -357,13 +345,13 @@ "name": "zonky.test.database.mysql.docker.image", "values": [ { - "value": "mysql:8.0" + "value": "mysql:9.0" }, { - "value": "mysql:5.7" + "value": "mysql:8.4" }, { - "value": "mysql:5.6" + "value": "mysql:8.0" } ], "providers": [ @@ -376,19 +364,25 @@ "name": "zonky.test.database.mariadb.docker.image", "values": [ { - "value": "mariadb:10.5" + "value": "mariadb:11.5" + }, + { + "value": "mariadb:11.4" }, { - "value": "mariadb:10.4" + "value": "mariadb:11.2" }, { - "value": "mariadb:10.3" + "value": "mariadb:11.1" }, { - "value": "mariadb:10.2" + "value": "mariadb:10.11" }, { - "value": "mariadb:10.1" + "value": "mariadb:10.6" + }, + { + "value": "mariadb:10.5" } ], "providers": [ @@ -398,4 +392,4 @@ ] } ] -} \ No newline at end of file +} diff --git a/embedded-database-spring-test/src/test/java/io/zonky/test/db/DatabaseRefreshIntegrationTest.java b/embedded-database-spring-test/src/test/java/io/zonky/test/db/DatabaseRefreshIntegrationTest.java index 949ae00..2520a82 100644 --- a/embedded-database-spring-test/src/test/java/io/zonky/test/db/DatabaseRefreshIntegrationTest.java +++ b/embedded-database-spring-test/src/test/java/io/zonky/test/db/DatabaseRefreshIntegrationTest.java @@ -30,7 +30,7 @@ import static io.zonky.test.db.AutoConfigureEmbeddedDatabase.DatabaseType.POSTGRES; import static io.zonky.test.db.AutoConfigureEmbeddedDatabase.RefreshMode.AFTER_EACH_TEST_METHOD; import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Matchers.any; +import static org.mockito.Mockito.any; import static org.mockito.Mockito.never; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; diff --git a/embedded-database-spring-test/src/test/java/io/zonky/test/db/DatabaseRefreshPropertyIntegrationTest.java b/embedded-database-spring-test/src/test/java/io/zonky/test/db/DatabaseRefreshPropertyIntegrationTest.java index 2de005e..289e93a 100644 --- a/embedded-database-spring-test/src/test/java/io/zonky/test/db/DatabaseRefreshPropertyIntegrationTest.java +++ b/embedded-database-spring-test/src/test/java/io/zonky/test/db/DatabaseRefreshPropertyIntegrationTest.java @@ -30,7 +30,7 @@ import static io.zonky.test.db.AutoConfigureEmbeddedDatabase.DatabaseType.POSTGRES; import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Matchers.any; +import static org.mockito.Mockito.any; import static org.mockito.Mockito.never; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; diff --git a/embedded-database-spring-test/src/test/java/io/zonky/test/db/FlywayMethodRefreshIntegrationTest.java b/embedded-database-spring-test/src/test/java/io/zonky/test/db/FlywayMethodRefreshIntegrationTest.java index a991eb8..f76e1d1 100644 --- a/embedded-database-spring-test/src/test/java/io/zonky/test/db/FlywayMethodRefreshIntegrationTest.java +++ b/embedded-database-spring-test/src/test/java/io/zonky/test/db/FlywayMethodRefreshIntegrationTest.java @@ -35,7 +35,7 @@ import static io.zonky.test.db.AutoConfigureEmbeddedDatabase.RefreshMode.AFTER_EACH_TEST_METHOD; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.tuple; -import static org.mockito.Matchers.any; +import static org.mockito.Mockito.any; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.springframework.test.context.TestExecutionListeners.MergeMode.MERGE_WITH_DEFAULTS; diff --git a/embedded-database-spring-test/src/test/java/io/zonky/test/db/FlywayMigrationIntegrationTest.java b/embedded-database-spring-test/src/test/java/io/zonky/test/db/FlywayMigrationIntegrationTest.java index 20be62b..0da0516 100644 --- a/embedded-database-spring-test/src/test/java/io/zonky/test/db/FlywayMigrationIntegrationTest.java +++ b/embedded-database-spring-test/src/test/java/io/zonky/test/db/FlywayMigrationIntegrationTest.java @@ -51,7 +51,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.entry; import static org.assertj.core.api.Assertions.tuple; -import static org.mockito.Matchers.any; +import static org.mockito.Mockito.any; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.springframework.test.context.TestExecutionListeners.MergeMode.MERGE_WITH_DEFAULTS; diff --git a/embedded-database-spring-test/src/test/java/io/zonky/test/db/FlywayRefreshIntegrationTest.java b/embedded-database-spring-test/src/test/java/io/zonky/test/db/FlywayRefreshIntegrationTest.java index e3e3677..4facea3 100644 --- a/embedded-database-spring-test/src/test/java/io/zonky/test/db/FlywayRefreshIntegrationTest.java +++ b/embedded-database-spring-test/src/test/java/io/zonky/test/db/FlywayRefreshIntegrationTest.java @@ -34,7 +34,7 @@ import static io.zonky.test.db.AutoConfigureEmbeddedDatabase.DatabaseType.POSTGRES; import static io.zonky.test.db.AutoConfigureEmbeddedDatabase.RefreshMode.AFTER_EACH_TEST_METHOD; import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Matchers.any; +import static org.mockito.Mockito.any; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.springframework.test.context.TestExecutionListeners.MergeMode.MERGE_WITH_DEFAULTS; diff --git a/embedded-database-spring-test/src/test/java/io/zonky/test/db/FlywayTransactionalIntegrationTest.java b/embedded-database-spring-test/src/test/java/io/zonky/test/db/FlywayTransactionalIntegrationTest.java index bba7282..c88ba43 100644 --- a/embedded-database-spring-test/src/test/java/io/zonky/test/db/FlywayTransactionalIntegrationTest.java +++ b/embedded-database-spring-test/src/test/java/io/zonky/test/db/FlywayTransactionalIntegrationTest.java @@ -53,7 +53,7 @@ import static io.zonky.test.db.context.DatabaseContext.ContextState.DIRTY; import static io.zonky.test.db.context.DatabaseContext.ContextState.FRESH; import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Matchers.any; +import static org.mockito.Mockito.any; import static org.mockito.Mockito.inOrder; import static org.mockito.Mockito.times; diff --git a/embedded-database-spring-test/src/test/java/io/zonky/test/db/LiquibaseRefreshIntegrationTest.java b/embedded-database-spring-test/src/test/java/io/zonky/test/db/LiquibaseRefreshIntegrationTest.java index 322b936..946c84f 100644 --- a/embedded-database-spring-test/src/test/java/io/zonky/test/db/LiquibaseRefreshIntegrationTest.java +++ b/embedded-database-spring-test/src/test/java/io/zonky/test/db/LiquibaseRefreshIntegrationTest.java @@ -45,7 +45,8 @@ import static io.zonky.test.db.AutoConfigureEmbeddedDatabase.DatabaseType.POSTGRES; import static io.zonky.test.db.AutoConfigureEmbeddedDatabase.RefreshMode.AFTER_EACH_TEST_METHOD; import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Matchers.any; +import static org.mockito.Mockito.any; +import static org.mockito.Mockito.atLeast; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.springframework.test.context.TestExecutionListeners.MergeMode.MERGE_WITH_DEFAULTS; @@ -100,9 +101,9 @@ public void afterTestClass(TestContext testContext) { DatabaseContext databaseContext = applicationContext.getBean(DatabaseContext.class); DatabaseProvider databaseProvider = applicationContext.getBean("dockerPostgresDatabaseProvider", DatabaseProvider.class); - verify(databaseContext, times(4)).reset(); + verify(databaseContext, atLeast(2)).reset(); verify(databaseContext, times(1)).apply(any()); - verify(databaseProvider, times(3)).createDatabase(any()); + verify(databaseProvider, atLeast(1)).createDatabase(any()); Mockito.reset(databaseContext, databaseProvider); } diff --git a/embedded-database-spring-test/src/test/java/io/zonky/test/db/SpringBootCustomDatabaseIntegrationTest.java b/embedded-database-spring-test/src/test/java/io/zonky/test/db/SpringBootCustomDatabaseIntegrationTest.java index 271761b..1eeb5d1 100644 --- a/embedded-database-spring-test/src/test/java/io/zonky/test/db/SpringBootCustomDatabaseIntegrationTest.java +++ b/embedded-database-spring-test/src/test/java/io/zonky/test/db/SpringBootCustomDatabaseIntegrationTest.java @@ -68,7 +68,7 @@ public class SpringBootCustomDatabaseIntegrationTest { public static ConditionalTestRule conditionalTestRule = new ConditionalTestRule(TestAssumptions::assumeSpringBootSupportsJdbcTestAnnotation); @ClassRule - public static PostgreSQLContainer postgresContainer = new PostgreSQLContainer<>("postgres:11-alpine"); + public static PostgreSQLContainer postgresContainer = new PostgreSQLContainer<>("postgres:16-alpine"); public static class DockerPropertiesInitializer implements ApplicationContextInitializer { diff --git a/embedded-database-spring-test/src/test/java/io/zonky/test/db/SpringSqlAnnotationRefreshIntegrationTest.java b/embedded-database-spring-test/src/test/java/io/zonky/test/db/SpringSqlAnnotationRefreshIntegrationTest.java index 3878871..1f452b8 100644 --- a/embedded-database-spring-test/src/test/java/io/zonky/test/db/SpringSqlAnnotationRefreshIntegrationTest.java +++ b/embedded-database-spring-test/src/test/java/io/zonky/test/db/SpringSqlAnnotationRefreshIntegrationTest.java @@ -29,7 +29,7 @@ import static io.zonky.test.db.AutoConfigureEmbeddedDatabase.DatabaseType.POSTGRES; import static io.zonky.test.db.AutoConfigureEmbeddedDatabase.RefreshMode.AFTER_EACH_TEST_METHOD; import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Matchers.any; +import static org.mockito.Mockito.any; import static org.mockito.Mockito.never; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; diff --git a/embedded-database-spring-test/src/test/java/io/zonky/test/db/config/ConfigurationPropertiesIntegrationTest.java b/embedded-database-spring-test/src/test/java/io/zonky/test/db/config/ConfigurationPropertiesIntegrationTest.java index a6a7a77..2118651 100644 --- a/embedded-database-spring-test/src/test/java/io/zonky/test/db/config/ConfigurationPropertiesIntegrationTest.java +++ b/embedded-database-spring-test/src/test/java/io/zonky/test/db/config/ConfigurationPropertiesIntegrationTest.java @@ -51,7 +51,7 @@ public void testConfigurationProperties() throws Exception { JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); - String collate = jdbcTemplate.queryForObject("show lc_collate", String.class); + String collate = jdbcTemplate.queryForObject("SELECT datcollate FROM pg_database WHERE datname NOT IN('template0', 'template1', 'postgres') LIMIT 1", String.class); assertThat(collate).isEqualTo("cs_CZ.UTF-8"); String maxConnections = jdbcTemplate.queryForObject("show max_connections", String.class); @@ -61,4 +61,3 @@ public void testConfigurationProperties() throws Exception { assertThat(sharedBuffers).isEqualTo("64MB"); } } - diff --git a/embedded-database-spring-test/src/test/java/io/zonky/test/db/context/DefaultDatabaseContextTest.java b/embedded-database-spring-test/src/test/java/io/zonky/test/db/context/DefaultDatabaseContextTest.java index aa8cf94..9e53272 100644 --- a/embedded-database-spring-test/src/test/java/io/zonky/test/db/context/DefaultDatabaseContextTest.java +++ b/embedded-database-spring-test/src/test/java/io/zonky/test/db/context/DefaultDatabaseContextTest.java @@ -35,7 +35,7 @@ import static io.zonky.test.db.context.DatabaseContext.ContextState.INITIALIZING; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatCode; -import static org.mockito.Matchers.any; +import static org.mockito.Mockito.any; import static org.mockito.Mockito.RETURNS_MOCKS; import static org.mockito.Mockito.inOrder; import static org.mockito.Mockito.mock; @@ -264,4 +264,4 @@ private static void runInDifferentThread(Runnable runnable) throws InterruptedEx thread.start(); thread.join(); } -} \ No newline at end of file +} diff --git a/embedded-database-spring-test/src/test/java/io/zonky/test/db/flyway/FlywayDatabaseExtensionTest.java b/embedded-database-spring-test/src/test/java/io/zonky/test/db/flyway/FlywayDatabaseExtensionTest.java index 2e8abca..44033f4 100644 --- a/embedded-database-spring-test/src/test/java/io/zonky/test/db/flyway/FlywayDatabaseExtensionTest.java +++ b/embedded-database-spring-test/src/test/java/io/zonky/test/db/flyway/FlywayDatabaseExtensionTest.java @@ -50,7 +50,7 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyNoMoreInteractions; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.when; import static org.mockito.Mockito.withSettings; @@ -86,7 +86,7 @@ public void cleanFromExecutionListenerShouldBeDeferred() { OptimizedFlywayTestExecutionListener.dbResetWithAnnotation(flywayWrapper::clean); assertThat(extension.pendingOperations).hasSize(1); - verifyZeroInteractions(databaseContext); + verifyNoInteractions(databaseContext); } @Test @@ -110,7 +110,7 @@ public void cleanFromClassicExecutionListenerShouldFail() { .hasMessageMatching("Using .* is forbidden, use io.zonky.test.db.flyway.OptimizedFlywayTestExecutionListener instead"); assertThat(extension.pendingOperations).isEmpty(); - verifyZeroInteractions(databaseContext); + verifyNoInteractions(databaseContext); } @Test @@ -122,7 +122,7 @@ public void baselineFromClassicExecutionListenerShouldFail() { .hasMessageMatching("Using .* is forbidden, use io.zonky.test.db.flyway.OptimizedFlywayTestExecutionListener instead"); assertThat(extension.pendingOperations).isEmpty(); - verifyZeroInteractions(databaseContext); + verifyNoInteractions(databaseContext); } @Test @@ -132,7 +132,7 @@ public void migrateFromClassicExecutionListenerShouldFail() { .hasMessageMatching("Using .* is forbidden, use io.zonky.test.db.flyway.OptimizedFlywayTestExecutionListener instead"); assertThat(extension.pendingOperations).isEmpty(); - verifyZeroInteractions(databaseContext); + verifyNoInteractions(databaseContext); } @Test @@ -383,4 +383,4 @@ public static void dbResetWithAnnotation(Runnable operation) { operation.run(); } } -} \ No newline at end of file +} diff --git a/embedded-database-spring-test/src/test/java/io/zonky/test/db/liquibase/LiquibaseDatabaseExtensionTest.java b/embedded-database-spring-test/src/test/java/io/zonky/test/db/liquibase/LiquibaseDatabaseExtensionTest.java index c2e3986..28c8946 100644 --- a/embedded-database-spring-test/src/test/java/io/zonky/test/db/liquibase/LiquibaseDatabaseExtensionTest.java +++ b/embedded-database-spring-test/src/test/java/io/zonky/test/db/liquibase/LiquibaseDatabaseExtensionTest.java @@ -22,10 +22,12 @@ import liquibase.exception.LiquibaseException; import liquibase.integration.spring.SpringLiquibase; import org.junit.Before; +import org.junit.BeforeClass; import org.junit.Test; import org.junit.experimental.categories.Category; import org.junit.runner.RunWith; import org.mockito.Mock; +import org.mockito.internal.runners.util.TestMethodsFinder; import org.mockito.runners.MockitoJUnitRunner; import org.springframework.aop.framework.Advised; @@ -45,8 +47,19 @@ public class LiquibaseDatabaseExtensionTest { private SpringLiquibase liquibase; + @BeforeClass + public static void beforeClass() throws ClassNotFoundException { + System.out.println("TestMethodsFinder.hasTestMethods(SpringLiquibase.class)..."); + boolean hasTestMethods = TestMethodsFinder.hasTestMethods(SpringLiquibase.class); + System.out.println("TestMethodsFinder.hasTestMethods(SpringLiquibase.class): " + hasTestMethods); + System.out.println("TestMethodsFinder.hasTestMethods(LiquibaseException.class)..."); + hasTestMethods = TestMethodsFinder.hasTestMethods(LiquibaseException.class); + System.out.println("TestMethodsFinder.hasTestMethods(LiquibaseException.class): " + hasTestMethods); + Class liquibaseException = LiquibaseDatabaseExtensionTest.class.getClassLoader().loadClass("liquibase.exception.LiquibaseException"); + } + @Before - public void setUp() { + public void setUp() throws ClassNotFoundException { Advised dataSource = mock(Advised.class, withSettings().extraInterfaces(DataSource.class)); when(dataSource.getTargetSource()).thenReturn(new DatabaseTargetSource(databaseContext)); @@ -63,4 +76,4 @@ public void testMigrate() throws LiquibaseException { verify(databaseContext).apply(new LiquibaseDatabasePreparer(LiquibaseDescriptor.from(liquibase))); } -} \ No newline at end of file +} diff --git a/embedded-database-spring-test/src/test/java/io/zonky/test/db/preparer/RecordingDataSourceTest.java b/embedded-database-spring-test/src/test/java/io/zonky/test/db/preparer/RecordingDataSourceTest.java index 9d3774d..8ae5332 100644 --- a/embedded-database-spring-test/src/test/java/io/zonky/test/db/preparer/RecordingDataSourceTest.java +++ b/embedded-database-spring-test/src/test/java/io/zonky/test/db/preparer/RecordingDataSourceTest.java @@ -27,12 +27,12 @@ import static com.google.common.base.Preconditions.checkState; import static java.nio.charset.StandardCharsets.UTF_8; import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyInt; -import static org.mockito.Matchers.anyString; -import static org.mockito.Matchers.argThat; -import static org.mockito.Matchers.eq; -import static org.mockito.Matchers.same; +import static org.mockito.Mockito.any; +import static org.mockito.Mockito.anyInt; +import static org.mockito.Mockito.anyString; +import static org.mockito.Mockito.argThat; +import static org.mockito.Mockito.eq; +import static org.mockito.Mockito.same; import static org.mockito.Mockito.RETURNS_DEEP_STUBS; import static org.mockito.Mockito.RETURNS_MOCKS; import static org.mockito.Mockito.doAnswer; @@ -409,4 +409,4 @@ public void testProxyTargetClass() { assertThat(recordingDataSource).isInstanceOf(PGSimpleDataSource.class); } -} \ No newline at end of file +} diff --git a/embedded-database-spring-test/src/test/java/io/zonky/test/db/provider/DockerMSSQLProviderWithConfigurationIntegrationTest.java b/embedded-database-spring-test/src/test/java/io/zonky/test/db/provider/DockerMSSQLProviderWithConfigurationIntegrationTest.java index 775163f..bd099e5 100644 --- a/embedded-database-spring-test/src/test/java/io/zonky/test/db/provider/DockerMSSQLProviderWithConfigurationIntegrationTest.java +++ b/embedded-database-spring-test/src/test/java/io/zonky/test/db/provider/DockerMSSQLProviderWithConfigurationIntegrationTest.java @@ -28,7 +28,7 @@ @Category(MSSQLTestSuite.class) @AutoConfigureEmbeddedDatabase(type = MSSQL) @TestPropertySource(properties = { - "zonky.test.database.mssql.docker.image=mcr.microsoft.com/mssql/server:2017-CU20" + "zonky.test.database.mssql.docker.image=mcr.microsoft.com/mssql/server:2022-CU14" }) @ContextConfiguration public class DockerMSSQLProviderWithConfigurationIntegrationTest { diff --git a/embedded-database-spring-test/src/test/java/io/zonky/test/db/provider/DockerMariaDBProviderWithConfigurationIntegrationTest.java b/embedded-database-spring-test/src/test/java/io/zonky/test/db/provider/DockerMariaDBProviderWithConfigurationIntegrationTest.java index df30d72..ae47228 100644 --- a/embedded-database-spring-test/src/test/java/io/zonky/test/db/provider/DockerMariaDBProviderWithConfigurationIntegrationTest.java +++ b/embedded-database-spring-test/src/test/java/io/zonky/test/db/provider/DockerMariaDBProviderWithConfigurationIntegrationTest.java @@ -41,7 +41,7 @@ @AutoConfigureEmbeddedDatabase(type = MARIADB) @ContextConfiguration @TestPropertySource(properties = { - "zonky.test.database.mariadb.docker.image=mariadb:10.1" + "zonky.test.database.mariadb.docker.image=mariadb:11.5" }) public class DockerMariaDBProviderWithConfigurationIntegrationTest { @@ -63,6 +63,6 @@ public void testDataSource() throws SQLException { JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); String databaseVersion = jdbcTemplate.queryForObject("select @@version", String.class); - assertThat(databaseVersion).startsWith("10.1"); + assertThat(databaseVersion).startsWith("11.5"); } } diff --git a/embedded-database-spring-test/src/test/java/io/zonky/test/db/provider/DockerMySQLProviderWithConfigurationIntegrationTest.java b/embedded-database-spring-test/src/test/java/io/zonky/test/db/provider/DockerMySQLProviderWithConfigurationIntegrationTest.java index 9c2940b..d58ea32 100644 --- a/embedded-database-spring-test/src/test/java/io/zonky/test/db/provider/DockerMySQLProviderWithConfigurationIntegrationTest.java +++ b/embedded-database-spring-test/src/test/java/io/zonky/test/db/provider/DockerMySQLProviderWithConfigurationIntegrationTest.java @@ -42,7 +42,7 @@ @AutoConfigureEmbeddedDatabase(type = MYSQL) @ContextConfiguration @TestPropertySource(properties = { - "zonky.test.database.mysql.docker.image=mysql:5.6.48" + "zonky.test.database.mysql.docker.image=mysql:9.0" }) public class DockerMySQLProviderWithConfigurationIntegrationTest { @@ -64,6 +64,6 @@ public void testDataSource() throws SQLException { JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); String databaseVersion = jdbcTemplate.queryForObject("select @@version", String.class); - assertThat(databaseVersion).startsWith("5.6.48"); + assertThat(databaseVersion).startsWith("9.0"); } } diff --git a/embedded-database-spring-test/src/test/java/io/zonky/test/db/provider/DockerPostgresProviderWithConfigurationIntegrationTest.java b/embedded-database-spring-test/src/test/java/io/zonky/test/db/provider/DockerPostgresProviderWithConfigurationIntegrationTest.java index 081dc6d..4e4985d 100644 --- a/embedded-database-spring-test/src/test/java/io/zonky/test/db/provider/DockerPostgresProviderWithConfigurationIntegrationTest.java +++ b/embedded-database-spring-test/src/test/java/io/zonky/test/db/provider/DockerPostgresProviderWithConfigurationIntegrationTest.java @@ -42,7 +42,7 @@ @Category(PostgresTestSuite.class) @AutoConfigureEmbeddedDatabase(type = POSTGRES, provider = DOCKER) @TestPropertySource(properties = { - "zonky.test.database.postgres.docker.image=postgres:9.6-alpine", + "zonky.test.database.postgres.docker.image=postgres:16-alpine", "zonky.test.database.postgres.docker.tmpfs.enabled=true" }) @ContextConfiguration @@ -66,6 +66,6 @@ public void testDataSource() throws SQLException { JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); String version = jdbcTemplate.queryForObject("show server_version", String.class); - assertThat(version).startsWith("9.6."); + assertThat(version).startsWith("16."); } } diff --git a/embedded-database-spring-test/src/test/java/io/zonky/test/db/provider/DockerPostgresProviderWithPostgisImageIntegrationTest.java b/embedded-database-spring-test/src/test/java/io/zonky/test/db/provider/DockerPostgresProviderWithPostgisImageIntegrationTest.java index 83e80ec..f04aa01 100644 --- a/embedded-database-spring-test/src/test/java/io/zonky/test/db/provider/DockerPostgresProviderWithPostgisImageIntegrationTest.java +++ b/embedded-database-spring-test/src/test/java/io/zonky/test/db/provider/DockerPostgresProviderWithPostgisImageIntegrationTest.java @@ -39,7 +39,7 @@ @RunWith(SpringRunner.class) @AutoConfigureEmbeddedDatabase(type = POSTGRES, provider = DOCKER) @TestPropertySource(properties = { - "zonky.test.database.postgres.docker.image=postgis/postgis:9.6-3.1-alpine" + "zonky.test.database.postgres.docker.image=postgis/postgis:16-3.4-alpine" }) @ContextConfiguration public class DockerPostgresProviderWithPostgisImageIntegrationTest { @@ -63,10 +63,10 @@ public void testDataSource() throws SQLException { JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); String postgresVersion = jdbcTemplate.queryForObject("show server_version", String.class); - assertThat(postgresVersion).startsWith("9.6."); + assertThat(postgresVersion).startsWith("16."); jdbcTemplate.update("create extension postgis"); String postgisVersion = jdbcTemplate.queryForObject("select postgis_version()", String.class); - assertThat(postgisVersion).startsWith("3.1"); + assertThat(postgisVersion).startsWith("3.4"); } } diff --git a/embedded-database-spring-test/src/test/java/io/zonky/test/db/provider/PrefetchingDatabaseProviderTest.java b/embedded-database-spring-test/src/test/java/io/zonky/test/db/provider/PrefetchingDatabaseProviderTest.java index 0b32c9b..8680bd9 100644 --- a/embedded-database-spring-test/src/test/java/io/zonky/test/db/provider/PrefetchingDatabaseProviderTest.java +++ b/embedded-database-spring-test/src/test/java/io/zonky/test/db/provider/PrefetchingDatabaseProviderTest.java @@ -34,8 +34,8 @@ import static io.zonky.test.support.MockitoAssertions.mockWithName; import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.same; +import static org.mockito.Mockito.any; +import static org.mockito.Mockito.same; import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.timeout; @@ -91,4 +91,4 @@ public void testDifferentPreparers() { verify(databaseProvider, timeout(100).times(9)).createDatabase(any(DatabasePreparer.class)); } -} \ No newline at end of file +} diff --git a/embedded-database-spring-test/src/test/java/io/zonky/test/db/provider/TemplatingDatabaseProviderTest.java b/embedded-database-spring-test/src/test/java/io/zonky/test/db/provider/TemplatingDatabaseProviderTest.java index 195756d..1bcb795 100644 --- a/embedded-database-spring-test/src/test/java/io/zonky/test/db/provider/TemplatingDatabaseProviderTest.java +++ b/embedded-database-spring-test/src/test/java/io/zonky/test/db/provider/TemplatingDatabaseProviderTest.java @@ -18,8 +18,8 @@ import static io.zonky.test.db.provider.common.TemplatingDatabaseProvider.EMPTY_PREPARER; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatCode; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.argThat; +import static org.mockito.Mockito.any; +import static org.mockito.Mockito.argThat; import static org.mockito.Mockito.inOrder; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.times; @@ -174,4 +174,4 @@ public String getTemplateName() { @Override public void close() {} } -} \ No newline at end of file +} diff --git a/embedded-database-spring-test/src/test/java/io/zonky/test/db/provider/YandexProviderWithConfigurationIntegrationTest.java b/embedded-database-spring-test/src/test/java/io/zonky/test/db/provider/YandexProviderWithConfigurationIntegrationTest.java index b99e555..3fbc5a7 100644 --- a/embedded-database-spring-test/src/test/java/io/zonky/test/db/provider/YandexProviderWithConfigurationIntegrationTest.java +++ b/embedded-database-spring-test/src/test/java/io/zonky/test/db/provider/YandexProviderWithConfigurationIntegrationTest.java @@ -42,7 +42,7 @@ @Category(PostgresTestSuite.class) @AutoConfigureEmbeddedDatabase(type = POSTGRES, provider = YANDEX) @TestPropertySource(properties = { - "zonky.test.database.postgres.yandex-provider.postgres-version=9.6.11-1" + "zonky.test.database.postgres.yandex-provider.postgres-version=10.23-1" }) @ContextConfiguration public class YandexProviderWithConfigurationIntegrationTest { @@ -59,6 +59,6 @@ public void testDataSource() throws SQLException { JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); String version = jdbcTemplate.queryForObject("show server_version", String.class); - assertThat(version).startsWith("9.6."); + assertThat(version).startsWith("16."); } } diff --git a/embedded-database-spring-test/src/test/java/io/zonky/test/db/provider/mariadb/DockerMariaDBDatabaseProviderTest.java b/embedded-database-spring-test/src/test/java/io/zonky/test/db/provider/mariadb/DockerMariaDBDatabaseProviderTest.java index 35bb5dc..acd2a3b 100644 --- a/embedded-database-spring-test/src/test/java/io/zonky/test/db/provider/mariadb/DockerMariaDBDatabaseProviderTest.java +++ b/embedded-database-spring-test/src/test/java/io/zonky/test/db/provider/mariadb/DockerMariaDBDatabaseProviderTest.java @@ -168,7 +168,7 @@ public void providersWithDifferentCustomizersShouldNotEquals() { @Test public void testConfigurationProperties() throws Exception { MockEnvironment environment = new MockEnvironment(); - environment.setProperty("zonky.test.database.mariadb.docker.image", "mariadb:10.1"); + environment.setProperty("zonky.test.database.mariadb.docker.image", "mariadb:11.5"); environment.setProperty("zonky.test.database.mariadb.client.properties.loginTimeout", "60"); DatabasePreparer preparer = TestDatabasePreparer.empty(); @@ -180,10 +180,10 @@ public void testConfigurationProperties() throws Exception { JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); String databaseVersion = jdbcTemplate.queryForObject("select @@version", String.class); - assertThat(databaseVersion).startsWith("10.1"); + assertThat(databaseVersion).startsWith("11.5"); String maxConnections = jdbcTemplate.queryForObject("select @@max_connections", String.class); - assertThat(maxConnections).isEqualTo("100"); + assertThat(maxConnections).isEqualTo("151"); } @Test @@ -243,4 +243,4 @@ private static int getPort(DataSource dataSource) throws SQLException { private static MariaDBContainerCustomizer mariadbContainerCustomizer(long timeout) { return container -> container.withStartupTimeout(Duration.ofSeconds(timeout)); } -} \ No newline at end of file +} diff --git a/embedded-database-spring-test/src/test/java/io/zonky/test/db/provider/mssql/DockerMSSQLDatabaseProviderTest.java b/embedded-database-spring-test/src/test/java/io/zonky/test/db/provider/mssql/DockerMSSQLDatabaseProviderTest.java index 914452e..f6d1f76 100644 --- a/embedded-database-spring-test/src/test/java/io/zonky/test/db/provider/mssql/DockerMSSQLDatabaseProviderTest.java +++ b/embedded-database-spring-test/src/test/java/io/zonky/test/db/provider/mssql/DockerMSSQLDatabaseProviderTest.java @@ -118,7 +118,7 @@ public void providersWithDifferentCustomizersShouldNotEquals() { @Test public void testConfigurationProperties() throws Exception { MockEnvironment environment = new MockEnvironment(); - environment.setProperty("zonky.test.database.mssql.docker.image", "mcr.microsoft.com/mssql/server:2017-CU20"); + environment.setProperty("zonky.test.database.mssql.docker.image", "mcr.microsoft.com/mssql/server:2022-CU14"); environment.setProperty("zonky.test.database.mssql.client.properties.queryTimeout", "30"); environment.setProperty("zonky.test.database.mssql.client.properties.description", "test description"); environment.setProperty("zonky.test.database.mssql.client.properties.sendTimeAsDatetime", "false"); @@ -197,4 +197,4 @@ private static int getPort(DataSource dataSource) throws SQLException { private static MSSQLServerContainerCustomizer mssqlContainerCustomizer(long timeout) { return container -> container.withStartupTimeout(Duration.ofSeconds(timeout)); } -} \ No newline at end of file +} diff --git a/embedded-database-spring-test/src/test/java/io/zonky/test/db/provider/mysql/DockerMySQLDatabaseProviderTest.java b/embedded-database-spring-test/src/test/java/io/zonky/test/db/provider/mysql/DockerMySQLDatabaseProviderTest.java index f1689d7..e16c542 100644 --- a/embedded-database-spring-test/src/test/java/io/zonky/test/db/provider/mysql/DockerMySQLDatabaseProviderTest.java +++ b/embedded-database-spring-test/src/test/java/io/zonky/test/db/provider/mysql/DockerMySQLDatabaseProviderTest.java @@ -168,7 +168,7 @@ public void providersWithDifferentCustomizersShouldNotEquals() { @Test public void testConfigurationProperties() throws Exception { MockEnvironment environment = new MockEnvironment(); - environment.setProperty("zonky.test.database.mysql.docker.image", "mysql:5.6.48"); + environment.setProperty("zonky.test.database.mysql.docker.image", "mysql:9.0"); environment.setProperty("zonky.test.database.mysql.client.properties.socketTimeout", "30"); environment.setProperty("zonky.test.database.mysql.client.properties.description", "test description"); environment.setProperty("zonky.test.database.mysql.client.properties.autoReconnect", "true"); @@ -184,7 +184,7 @@ public void testConfigurationProperties() throws Exception { JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); String databaseVersion = jdbcTemplate.queryForObject("select @@version", String.class); - assertThat(databaseVersion).startsWith("5.6.48"); + assertThat(databaseVersion).startsWith("9.0"); String maxConnections = jdbcTemplate.queryForObject("select @@max_connections", String.class); assertThat(maxConnections).isEqualTo("151"); @@ -247,4 +247,4 @@ private static int getPort(DataSource dataSource) throws SQLException { private static MySQLContainerCustomizer mysqlContainerCustomizer(long timeout) { return container -> container.withStartupTimeout(Duration.ofSeconds(timeout)); } -} \ No newline at end of file +} diff --git a/embedded-database-spring-test/src/test/java/io/zonky/test/db/provider/postgres/DockerPostgresDatabaseProviderTest.java b/embedded-database-spring-test/src/test/java/io/zonky/test/db/provider/postgres/DockerPostgresDatabaseProviderTest.java index 7580e38..9b0cb53 100644 --- a/embedded-database-spring-test/src/test/java/io/zonky/test/db/provider/postgres/DockerPostgresDatabaseProviderTest.java +++ b/embedded-database-spring-test/src/test/java/io/zonky/test/db/provider/postgres/DockerPostgresDatabaseProviderTest.java @@ -128,7 +128,7 @@ public void providersWithDifferentCustomizersShouldNotEquals() { @Test public void testConfigurationProperties() throws Exception { MockEnvironment environment = new MockEnvironment(); - environment.setProperty("zonky.test.database.postgres.docker.image", "postgres:9.6-alpine"); + environment.setProperty("zonky.test.database.postgres.docker.image", "postgres:16-alpine"); environment.setProperty("zonky.test.database.postgres.client.properties.stringtype", "unspecified"); environment.setProperty("zonky.test.database.postgres.initdb.properties.lc-collate", "cs_CZ.UTF-8"); environment.setProperty("zonky.test.database.postgres.server.properties.max_connections", "100"); @@ -143,9 +143,9 @@ public void testConfigurationProperties() throws Exception { JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); String postgresVersion = jdbcTemplate.queryForObject("show server_version", String.class); - assertThat(postgresVersion).startsWith("9.6."); + assertThat(postgresVersion).startsWith("16"); - String collate = jdbcTemplate.queryForObject("show lc_collate", String.class); + String collate = jdbcTemplate.queryForObject("SELECT datcollate FROM pg_database WHERE datname NOT IN('template0', 'template1', 'postgres') LIMIT 1;", String.class); assertThat(collate).isEqualTo("cs_CZ.UTF-8"); String maxConnections = jdbcTemplate.queryForObject("show max_connections", String.class); @@ -224,4 +224,4 @@ private static int getPort(DataSource dataSource) throws SQLException { private static PostgreSQLContainerCustomizer postgresContainerCustomizer(long timeout) { return container -> container.withStartupTimeout(Duration.ofSeconds(timeout)); } -} \ No newline at end of file +} diff --git a/embedded-database-spring-test/src/test/java/io/zonky/test/db/provider/postgres/OpenTablePostgresDatabaseProviderTest.java b/embedded-database-spring-test/src/test/java/io/zonky/test/db/provider/postgres/OpenTablePostgresDatabaseProviderTest.java index 406d161..5d80b61 100644 --- a/embedded-database-spring-test/src/test/java/io/zonky/test/db/provider/postgres/OpenTablePostgresDatabaseProviderTest.java +++ b/embedded-database-spring-test/src/test/java/io/zonky/test/db/provider/postgres/OpenTablePostgresDatabaseProviderTest.java @@ -119,7 +119,7 @@ public void testConfigurationProperties() throws Exception { JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); - String collate = jdbcTemplate.queryForObject("show lc_collate", String.class); + String collate = jdbcTemplate.queryForObject("SELECT datcollate FROM pg_database WHERE datname NOT IN('template0', 'template1', 'postgres') LIMIT 1", String.class); assertThat(collate).isEqualTo("cs_CZ.UTF-8"); String maxConnections = jdbcTemplate.queryForObject("show max_connections", String.class); @@ -185,4 +185,4 @@ public void providersWithDifferentConfigurationShouldNotEquals() { private static int getPort(DataSource dataSource) throws SQLException { return dataSource.unwrap(PGSimpleDataSource.class).getPortNumber(); } -} \ No newline at end of file +} diff --git a/embedded-database-spring-test/src/test/java/io/zonky/test/db/provider/postgres/YandexPostgresDatabaseProviderTest.java b/embedded-database-spring-test/src/test/java/io/zonky/test/db/provider/postgres/YandexPostgresDatabaseProviderTest.java index 4e0c164..a9e380a 100644 --- a/embedded-database-spring-test/src/test/java/io/zonky/test/db/provider/postgres/YandexPostgresDatabaseProviderTest.java +++ b/embedded-database-spring-test/src/test/java/io/zonky/test/db/provider/postgres/YandexPostgresDatabaseProviderTest.java @@ -36,7 +36,7 @@ public class YandexPostgresDatabaseProviderTest { @Test public void testGetDatabase() throws Exception { MockEnvironment environment = new MockEnvironment(); - environment.setProperty("zonky.test.database.postgres.yandex-provider.postgres-version", "10.11-1"); + environment.setProperty("zonky.test.database.postgres.yandex-provider.postgres-version", "10.23-1"); // 11+ for Linux available on https://www.postgresql.org/download/ YandexPostgresDatabaseProvider provider = new YandexPostgresDatabaseProvider(environment); @@ -77,7 +77,7 @@ public void testGetDatabase() throws Exception { @Test public void testConfigurationProperties() throws Exception { MockEnvironment environment = new MockEnvironment(); - environment.setProperty("zonky.test.database.postgres.yandex-provider.postgres-version", "9.6.11-1"); + environment.setProperty("zonky.test.database.postgres.yandex-provider.postgres-version", "10.23-1"); environment.setProperty("zonky.test.database.postgres.client.properties.stringtype", "unspecified"); environment.setProperty("zonky.test.database.postgres.initdb.properties.lc-collate", "cs_CZ.UTF-8"); environment.setProperty("zonky.test.database.postgres.server.properties.max_connections", "100"); @@ -92,9 +92,9 @@ public void testConfigurationProperties() throws Exception { JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); String postgresVersion = jdbcTemplate.queryForObject("show server_version", String.class); - assertThat(postgresVersion).startsWith("9.6."); + assertThat(postgresVersion).startsWith("10."); - String collate = jdbcTemplate.queryForObject("show lc_collate", String.class); + String collate = jdbcTemplate.queryForObject("SELECT datcollate FROM pg_database WHERE datname NOT IN('template0', 'template1', 'postgres') LIMIT 1", String.class); assertThat(collate).isEqualTo("cs_CZ.UTF-8"); String maxConnections = jdbcTemplate.queryForObject("show max_connections", String.class); @@ -163,4 +163,4 @@ public void providersWithDifferentConfigurationShouldNotEquals() { private static int getPort(DataSource dataSource) throws SQLException { return dataSource.unwrap(PGSimpleDataSource.class).getPortNumber(); } -} \ No newline at end of file +} diff --git a/embedded-database-spring-test/src/test/java/io/zonky/test/db/provider/postgres/ZonkyPostgresDatabaseProviderTest.java b/embedded-database-spring-test/src/test/java/io/zonky/test/db/provider/postgres/ZonkyPostgresDatabaseProviderTest.java index 47e0208..773114d 100644 --- a/embedded-database-spring-test/src/test/java/io/zonky/test/db/provider/postgres/ZonkyPostgresDatabaseProviderTest.java +++ b/embedded-database-spring-test/src/test/java/io/zonky/test/db/provider/postgres/ZonkyPostgresDatabaseProviderTest.java @@ -119,7 +119,7 @@ public void testConfigurationProperties() throws Exception { JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); - String collate = jdbcTemplate.queryForObject("show lc_collate", String.class); + String collate = jdbcTemplate.queryForObject("SELECT datcollate FROM pg_database WHERE datname NOT IN('template0', 'template1', 'postgres') LIMIT 1", String.class); assertThat(collate).isEqualTo("cs_CZ.UTF-8"); String maxConnections = jdbcTemplate.queryForObject("show max_connections", String.class); @@ -185,4 +185,4 @@ public void providersWithDifferentConfigurationShouldNotEquals() { private static int getPort(DataSource dataSource) throws SQLException { return dataSource.unwrap(PGSimpleDataSource.class).getPortNumber(); } -} \ No newline at end of file +} diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index de75099..a4b76b9 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 280718b..9355b41 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,7 @@ -#Fri Apr 23 17:20:37 CEST 2021 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip +networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip diff --git a/gradlew b/gradlew index 4453cce..f5feea6 100755 --- a/gradlew +++ b/gradlew @@ -1,78 +1,130 @@ -#!/usr/bin/env sh +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 +# ############################################################################## -## -## Gradle start up script for UN*X -## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# ############################################################################## # Attempt to set APP_HOME + # Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s +' "$PWD" ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +MAX_FD=maximum -warn ( ) { +warn () { echo "$*" -} +} >&2 -die ( ) { +die () { echo echo "$*" echo exit 1 -} +} >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + # Determine the Java command to use to start the JVM. if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACMD=$JAVA_HOME/jre/sh/java else - JAVACMD="$JAVA_HOME/bin/java" + JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME @@ -81,92 +133,120 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + JAVACMD=java + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." + fi fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac fi -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) fi - i=$((i+1)) + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac fi -# Escape application args -save ( ) { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=$(save "$@") - -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then - cd "$(dirname "$0")" +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" fi +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat index f955316..9d21a21 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -1,4 +1,22 @@ -@if "%DEBUG%" == "" @echo off +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem + +@if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem @rem Gradle startup script for Windows @@ -9,25 +27,29 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init +if %ERRORLEVEL% equ 0 goto execute -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail @@ -35,48 +57,36 @@ goto fail set JAVA_HOME=%JAVA_HOME:"=% set JAVA_EXE=%JAVA_HOME%/bin/java.exe -if exist "%JAVA_EXE%" goto init +if exist "%JAVA_EXE%" goto execute -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - :execute @rem Setup the command line set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* :end @rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd +if %ERRORLEVEL% equ 0 goto mainEnd :fail rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% :mainEnd if "%OS%"=="Windows_NT" endlocal