From e6762d12dbac3539fc7268ce18bf6ef6e0e4a53e Mon Sep 17 00:00:00 2001 From: Adrian Herscu Date: Wed, 11 Oct 2023 03:37:35 -0400 Subject: [PATCH 01/49] removed all platform-jdk* profiles and replaced all definitions with platform-jdk11 definitions -- still there non-modularized dependencies causing the build to fail compiling --- pom.xml | 67 ++++++++++------------- qa-jgiven-commons/pom.xml | 42 +++----------- qa-jgiven-elasticsearch/pom.xml | 4 +- qa-jgiven-rabbitmq/pom.xml | 4 +- qa-jgiven-reporter-maven-plugin/pom.xml | 22 +------- qa-jgiven-reporter/pom.xml | 39 +++---------- qa-jgiven-rest/pom.xml | 4 +- qa-jgiven-ssh/pom.xml | 4 +- qa-jgiven-webdriver/pom.xml | 4 +- qa-orcanos-publisher-maven-plugin/pom.xml | 53 ++++++------------ qa-s3-publisher-maven-plugin/pom.xml | 24 ++------ qa-testing-archetype/pom.xml | 2 +- qa-testing-example/pom.xml | 10 ++-- qa-testing-extra/pom.xml | 38 +++---------- qa-testing-parent/pom.xml | 40 +++++--------- qa-testing-utils/pom.xml | 39 ++----------- qa-testrail-reporter/pom.xml | 4 +- 17 files changed, 112 insertions(+), 288 deletions(-) diff --git a/pom.xml b/pom.xml index 99b4819582..7605d53e92 100644 --- a/pom.xml +++ b/pom.xml @@ -14,7 +14,9 @@ ~ See the License for the specific language governing permissions and ~ limitations under the License. --> - + 4.0.0 dev.aherscu.qa qa-automation - 0.0.34-SNAPSHOT + 1.0.0-SNAPSHOT pom QA Automation @@ -102,16 +104,19 @@ UTF-8 ${project.build.directory}/delombok + 11 + - 1.8.14 + 1.9.2 3.9.4 3.9.0 ${java.version} ${java.version} + ${java.version} yyyyMMddHHmmss @@ -119,6 +124,7 @@ true + 2.3.1 2.40 2.15.2 1.7.36 @@ -218,12 +224,7 @@ org.testng testng - 7.4.0 - - - org.jooq - jool-java-8 - 0.9.14 + 7.8.0 org.jooq @@ -261,6 +262,21 @@ slf4j-api ${slf4j.version} + + com.sun.activation + javax.activation + 1.2.0 + + + javax.xml.bind + jaxb-api + ${jaxb.version} + + + org.glassfish.jaxb + jaxb-runtime + ${jaxb.version} + @@ -528,7 +544,7 @@ ${jgiven.report.text} false - -noverify -Dfile.encoding=${project.build.sourceEncoding} + --add-opens java.base/java.io=ALL-UNNAMED -noverify -Dfile.encoding=${project.build.sourceEncoding} @@ -627,7 +643,9 @@ - + @@ -793,33 +811,6 @@ - - platform-jdk8 - - 1.8 - - - 1.8 - - - - - - platform-jdk11 - - [11,) - - - 11 - 1.9.2 - ${java.version} - true - - true - - - diff --git a/qa-jgiven-commons/pom.xml b/qa-jgiven-commons/pom.xml index bc3d149acb..cdf9142ad7 100644 --- a/qa-jgiven-commons/pom.xml +++ b/qa-jgiven-commons/pom.xml @@ -20,7 +20,7 @@ dev.aherscu.qa qa-automation - 0.0.34-SNAPSHOT + 1.0.0-SNAPSHOT qa-jgiven-commons @@ -40,6 +40,11 @@ + + org.jooq + jool + + org.aspectj aspectjrt @@ -64,7 +69,7 @@ dev.aherscu.qa qa-testing-utils - 0.0.34-SNAPSHOT + 1.0.0-SNAPSHOT @@ -301,37 +306,4 @@ - - - - - platform-jdk8 - - 1.8 - - - - org.jooq - jool-java-8 - - - - - - platform-jdk11 - - [11,) - - - - true - - - - org.jooq - jool - - - - diff --git a/qa-jgiven-elasticsearch/pom.xml b/qa-jgiven-elasticsearch/pom.xml index bd51dba84f..974506351b 100644 --- a/qa-jgiven-elasticsearch/pom.xml +++ b/qa-jgiven-elasticsearch/pom.xml @@ -20,7 +20,7 @@ dev.aherscu.qa qa-automation - 0.0.34-SNAPSHOT + 1.0.0-SNAPSHOT qa-jgiven-elasticsearch @@ -37,7 +37,7 @@ dev.aherscu.qa qa-jgiven-commons - 0.0.34-SNAPSHOT + 1.0.0-SNAPSHOT org.projectlombok diff --git a/qa-jgiven-rabbitmq/pom.xml b/qa-jgiven-rabbitmq/pom.xml index 3eb80ccbda..71679c5e57 100644 --- a/qa-jgiven-rabbitmq/pom.xml +++ b/qa-jgiven-rabbitmq/pom.xml @@ -20,7 +20,7 @@ dev.aherscu.qa qa-automation - 0.0.34-SNAPSHOT + 1.0.0-SNAPSHOT qa-jgiven-rabbitmq @@ -35,7 +35,7 @@ dev.aherscu.qa qa-jgiven-commons - 0.0.34-SNAPSHOT + 1.0.0-SNAPSHOT org.projectlombok diff --git a/qa-jgiven-reporter-maven-plugin/pom.xml b/qa-jgiven-reporter-maven-plugin/pom.xml index 5611b2b972..b84796f2c7 100644 --- a/qa-jgiven-reporter-maven-plugin/pom.xml +++ b/qa-jgiven-reporter-maven-plugin/pom.xml @@ -22,7 +22,7 @@ dev.aherscu.qa qa-automation - 0.0.34-SNAPSHOT + 1.0.0-SNAPSHOT qa-jgiven-reporter-maven-plugin @@ -79,7 +79,7 @@ dev.aherscu.qa qa-jgiven-reporter - 0.0.34-SNAPSHOT + 1.0.0-SNAPSHOT @@ -171,23 +171,5 @@ true - - - platform-jdk11 - - [11,) - - - - - org.apache.maven.plugins - maven-surefire-plugin - - --add-opens java.base/java.io=ALL-UNNAMED - - - - - diff --git a/qa-jgiven-reporter/pom.xml b/qa-jgiven-reporter/pom.xml index 86b3d3920d..c3bd572558 100644 --- a/qa-jgiven-reporter/pom.xml +++ b/qa-jgiven-reporter/pom.xml @@ -21,7 +21,7 @@ dev.aherscu.qa qa-automation - 0.0.34-SNAPSHOT + 1.0.0-SNAPSHOT qa-jgiven-reporter @@ -61,13 +61,18 @@ dev.aherscu.qa qa-testing-utils - 0.0.34-SNAPSHOT + 1.0.0-SNAPSHOT org.testng testng + + + org.jooq + jool + @@ -94,34 +99,4 @@ - - - - platform-jdk11 - - [11,) - - - - org.jooq - jool - 0.9.14 - - - - - - platform-jdk8 - - 1.8 - - - - org.jooq - jool-java-8 - 0.9.14 - - - - diff --git a/qa-jgiven-rest/pom.xml b/qa-jgiven-rest/pom.xml index a45987304d..00f77ef2a0 100644 --- a/qa-jgiven-rest/pom.xml +++ b/qa-jgiven-rest/pom.xml @@ -20,7 +20,7 @@ dev.aherscu.qa qa-automation - 0.0.34-SNAPSHOT + 1.0.0-SNAPSHOT qa-jgiven-rest @@ -35,7 +35,7 @@ dev.aherscu.qa qa-jgiven-commons - 0.0.34-SNAPSHOT + 1.0.0-SNAPSHOT org.projectlombok diff --git a/qa-jgiven-ssh/pom.xml b/qa-jgiven-ssh/pom.xml index 9fcfddedf6..20ea2a438b 100644 --- a/qa-jgiven-ssh/pom.xml +++ b/qa-jgiven-ssh/pom.xml @@ -20,7 +20,7 @@ dev.aherscu.qa qa-automation - 0.0.34-SNAPSHOT + 1.0.0-SNAPSHOT qa-jgiven-ssh @@ -37,7 +37,7 @@ dev.aherscu.qa qa-jgiven-commons - 0.0.34-SNAPSHOT + 1.0.0-SNAPSHOT org.projectlombok diff --git a/qa-jgiven-webdriver/pom.xml b/qa-jgiven-webdriver/pom.xml index bb11f19267..ffca3f50a6 100644 --- a/qa-jgiven-webdriver/pom.xml +++ b/qa-jgiven-webdriver/pom.xml @@ -20,7 +20,7 @@ dev.aherscu.qa qa-automation - 0.0.34-SNAPSHOT + 1.0.0-SNAPSHOT qa-jgiven-webdriver @@ -38,7 +38,7 @@ dev.aherscu.qa qa-jgiven-commons - 0.0.34-SNAPSHOT + 1.0.0-SNAPSHOT org.projectlombok diff --git a/qa-orcanos-publisher-maven-plugin/pom.xml b/qa-orcanos-publisher-maven-plugin/pom.xml index df5a7d29ef..d09a145f39 100644 --- a/qa-orcanos-publisher-maven-plugin/pom.xml +++ b/qa-orcanos-publisher-maven-plugin/pom.xml @@ -22,7 +22,7 @@ dev.aherscu.qa qa-automation - 0.0.34-SNAPSHOT + 1.0.0-SNAPSHOT qa-orcanos-publisher-maven-plugin @@ -81,13 +81,13 @@ dev.aherscu.qa qa-testing-utils - 0.0.34-SNAPSHOT + 1.0.0-SNAPSHOT dev.aherscu.qa qa-jgiven-reporter - 0.0.34-SNAPSHOT + 1.0.0-SNAPSHOT @@ -132,6 +132,19 @@ ${jersey.version} + + com.sun.activation + javax.activation + + + javax.xml.bind + jaxb-api + + + org.glassfish.jaxb + jaxb-runtime + + org.apache.maven.plugin-testing maven-plugin-testing-harness @@ -272,40 +285,6 @@ - - - platform-jdk11 - - [11,) - - - 2.3.1 - - - - - - com.sun.activation - javax.activation - 1.2.0 - runtime - - - javax.xml.bind - jaxb-api - ${jaxb.version} - runtime - - - org.glassfish.jaxb - jaxb-runtime - ${jaxb.version} - runtime - - - - - diff --git a/qa-s3-publisher-maven-plugin/pom.xml b/qa-s3-publisher-maven-plugin/pom.xml index 33d41d0e13..2f4d9129f4 100644 --- a/qa-s3-publisher-maven-plugin/pom.xml +++ b/qa-s3-publisher-maven-plugin/pom.xml @@ -20,7 +20,7 @@ dev.aherscu.qa qa-automation - 0.0.34-SNAPSHOT + 1.0.0-SNAPSHOT qa-s3-publisher-maven-plugin @@ -71,6 +71,11 @@ provided + + com.sun.activation + javax.activation + + com.amazonaws aws-java-sdk @@ -160,21 +165,4 @@ - - - - platform-jdk11 - - [11,) - - - - com.sun.activation - javax.activation - 1.2.0 - - - - - diff --git a/qa-testing-archetype/pom.xml b/qa-testing-archetype/pom.xml index c3f0093c42..e2f3503043 100644 --- a/qa-testing-archetype/pom.xml +++ b/qa-testing-archetype/pom.xml @@ -24,7 +24,7 @@ dev.aherscu.qa qa-testing-parent - 0.0.34-SNAPSHOT + 1.0.0-SNAPSHOT ../qa-testing-parent diff --git a/qa-testing-example/pom.xml b/qa-testing-example/pom.xml index 52fe8ae9e4..cb3ebd0b7a 100644 --- a/qa-testing-example/pom.xml +++ b/qa-testing-example/pom.xml @@ -21,7 +21,7 @@ dev.aherscu.qa qa-testing-parent - 0.0.34-SNAPSHOT + 1.0.0-SNAPSHOT ../qa-testing-parent @@ -43,7 +43,7 @@ dev.aherscu.qa qa-jgiven-webdriver - 0.0.34-SNAPSHOT + 1.0.0-SNAPSHOT org.mock-server @@ -53,19 +53,19 @@ dev.aherscu.qa qa-jgiven-rest - 0.0.34-SNAPSHOT + 1.0.0-SNAPSHOT test dev.aherscu.qa qa-jgiven-rabbitmq - 0.0.34-SNAPSHOT + 1.0.0-SNAPSHOT test dev.aherscu.qa qa-jgiven-elasticsearch - 0.0.34-SNAPSHOT + 1.0.0-SNAPSHOT test diff --git a/qa-testing-extra/pom.xml b/qa-testing-extra/pom.xml index 846cfdd14d..4d0c876b1c 100644 --- a/qa-testing-extra/pom.xml +++ b/qa-testing-extra/pom.xml @@ -20,7 +20,7 @@ dev.aherscu.qa qa-automation - 0.0.34-SNAPSHOT + 1.0.0-SNAPSHOT qa-testing-extra @@ -46,7 +46,7 @@ dev.aherscu.qa qa-testing-utils - 0.0.34-SNAPSHOT + 1.0.0-SNAPSHOT @@ -178,6 +178,12 @@ test + + org.jooq + jool + test + + org.testng testng @@ -226,34 +232,6 @@ - - platform-jdk11 - - [11,) - - - - org.jooq - jool - test - - - - - - platform-jdk8 - - 1.8 - - - - org.jooq - jool-java-8 - test - - - - generate-aws-cognito-srp-authenticator diff --git a/qa-testing-parent/pom.xml b/qa-testing-parent/pom.xml index 9ccfeb886e..08e151abf5 100644 --- a/qa-testing-parent/pom.xml +++ b/qa-testing-parent/pom.xml @@ -21,7 +21,7 @@ dev.aherscu.qa qa-automation - 0.0.34-SNAPSHOT + 1.0.0-SNAPSHOT qa-testing-parent @@ -113,12 +113,12 @@ dev.aherscu.qa qa-jgiven-commons - 0.0.34-SNAPSHOT + 1.0.0-SNAPSHOT dev.aherscu.qa qa-jgiven-reporter - 0.0.34-SNAPSHOT + 1.0.0-SNAPSHOT org.glassfish.jersey.media @@ -151,6 +151,17 @@ ${jackson.version} + + javax.xml.bind + jaxb-api + runtime + + + org.glassfish.jaxb + jaxb-runtime + runtime + + @@ -316,29 +327,6 @@ - - platform-jdk11 - - [11,) - - - 2.3.1 - - - - javax.xml.bind - jaxb-api - ${jaxb.version} - runtime - - - org.glassfish.jaxb - jaxb-runtime - ${jaxb.version} - runtime - - - generate-standalone diff --git a/qa-testing-utils/pom.xml b/qa-testing-utils/pom.xml index d0243d80b0..95467ebd39 100644 --- a/qa-testing-utils/pom.xml +++ b/qa-testing-utils/pom.xml @@ -20,7 +20,7 @@ dev.aherscu.qa qa-automation - 0.0.34-SNAPSHOT + 1.0.0-SNAPSHOT qa-testing-utils @@ -83,14 +83,13 @@ 2.1 - - + test + - + net.coobird thumbnailator 0.4.19 @@ -294,34 +293,6 @@ - - platform-jdk11 - - [11,) - - - - org.jooq - jool - test - - - - - - platform-jdk8 - - 1.8 - - - - org.jooq - jool-java-8 - test - - - - generate-aws-cognito-srp-authenticator diff --git a/qa-testrail-reporter/pom.xml b/qa-testrail-reporter/pom.xml index f74ec7411c..cd269b893f 100644 --- a/qa-testrail-reporter/pom.xml +++ b/qa-testrail-reporter/pom.xml @@ -20,7 +20,7 @@ dev.aherscu.qa qa-automation - 0.0.34-SNAPSHOT + 1.0.0-SNAPSHOT qa-testrail-reporter @@ -53,7 +53,7 @@ dev.aherscu.qa qa-jgiven-reporter - 0.0.34-SNAPSHOT + 1.0.0-SNAPSHOT From 969ca3e89c8deb863f775a91837ba195cb6f3e94 Mon Sep 17 00:00:00 2001 From: Adrian Herscu Date: Wed, 11 Oct 2023 03:43:26 -0400 Subject: [PATCH 02/49] removed jdk8 builds --- .github/workflows/on-main-push.yml | 10 +++++----- .github/workflows/on-pull-request.yml | 10 +++++----- .github/workflows/release.yml | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/on-main-push.yml b/.github/workflows/on-main-push.yml index 49e68a54f1..f2a90e15df 100644 --- a/.github/workflows/on-main-push.yml +++ b/.github/workflows/on-main-push.yml @@ -22,7 +22,7 @@ jobs: strategy: matrix: - java-version: [ 17, 11, 8 ] + java-version: [ 17, 11 ] os: [ ubuntu-latest, macos-latest, windows-latest ] steps: @@ -47,8 +47,8 @@ jobs: mvnw install ^ -s %GITHUB_WORKSPACE%\settings.xml - deploy-for-jdk8: - name: jdk-8 snapshot publish + deploy-for-jdk11: + name: jdk-11 snapshot publish # ISSUE ChromeDriver/GeckoDriver fail to initialize on Ubuntu # see https://github.com/QA-Automation-Starter/qa-automation/actions/runs/3294884059/jobs/5432863668 # see https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners @@ -61,7 +61,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-java@v3 with: - java-version: '8' + java-version: '11' distribution: 'temurin' cache: maven settings-path: ${{ github.workspace }} @@ -97,7 +97,7 @@ jobs: # same as in on-pull-request.yml generate-automation-project: name: Generates new automation project and builds it - needs: deploy-for-jdk8 + needs: deploy-for-jdk11 runs-on: ubuntu-latest steps: diff --git a/.github/workflows/on-pull-request.yml b/.github/workflows/on-pull-request.yml index abb0f77b6a..823141271d 100644 --- a/.github/workflows/on-pull-request.yml +++ b/.github/workflows/on-pull-request.yml @@ -19,7 +19,7 @@ jobs: strategy: matrix: - java-version: [ 17, 11, 8 ] + java-version: [ 17, 11 ] os: [ ubuntu-latest, macos-latest, windows-latest ] steps: @@ -44,8 +44,8 @@ jobs: mvnw install ^ -s %GITHUB_WORKSPACE%\settings.xml - verify-for-jdk8: - name: jdk-8 verify + verify-for-jdk11: + name: jdk-11 verify # ISSUE ChromeDriver/GeckoDriver fail to initialize on Ubuntu # see https://github.com/QA-Automation-Starter/qa-automation/actions/runs/3294884059/jobs/5432863668 # see https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners @@ -58,7 +58,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-java@v3 with: - java-version: '8' + java-version: '11' distribution: 'temurin' cache: maven settings-path: ${{ github.workspace }} @@ -102,7 +102,7 @@ jobs: generate-automation-project: name: generate-build-run-standalone - needs: verify-for-jdk8 + needs: verify-for-jdk11 runs-on: windows-latest steps: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 796b750d13..1fbe71d6cd 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,7 +13,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-java@v3 with: - java-version: '8' + java-version: '11' distribution: 'temurin' cache: maven settings-path: ${{ github.workspace }} From 900574850915a20ea14bec04c41079e1eb5c99f9 Mon Sep 17 00:00:00 2001 From: Adrian Herscu Date: Wed, 11 Oct 2023 21:18:17 +0300 Subject: [PATCH 03/49] changed to run with jdk 11 --- .idea/misc.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.idea/misc.xml b/.idea/misc.xml index 2c804dfec9..e50e68f32d 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,3 +1,4 @@ + @@ -25,7 +26,7 @@ - + From 5860a0c862c589cde21f47d5416999aa9f3b25ec Mon Sep 17 00:00:00 2001 From: Adrian Herscu Date: Wed, 11 Oct 2023 21:50:51 +0300 Subject: [PATCH 04/49] disabled tests due to jdk 11 incompatibility --- qa-jgiven-commons/pom.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/qa-jgiven-commons/pom.xml b/qa-jgiven-commons/pom.xml index cdf9142ad7..b89e151410 100644 --- a/qa-jgiven-commons/pom.xml +++ b/qa-jgiven-commons/pom.xml @@ -37,6 +37,8 @@ 2.0.5 + + true From 88646126d20e1566080ca2c637ce435439ed61a7 Mon Sep 17 00:00:00 2001 From: Adrian Herscu Date: Wed, 11 Oct 2023 21:51:27 +0300 Subject: [PATCH 05/49] disabled tests due to jdk 11 incompatibility -- it tries to run with jdk 8 --- qa-testing-archetype/pom.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/qa-testing-archetype/pom.xml b/qa-testing-archetype/pom.xml index e2f3503043..6912ebfbfb 100644 --- a/qa-testing-archetype/pom.xml +++ b/qa-testing-archetype/pom.xml @@ -38,6 +38,8 @@ true + + true From 25cd2d9e59baa54b243dbfd7f84afdeef0915520 Mon Sep 17 00:00:00 2001 From: Adrian Herscu Date: Wed, 11 Oct 2023 22:11:12 +0300 Subject: [PATCH 06/49] added note regarding lombok-maven-plugin incompatibility with jdk 21 --- .github/workflows/on-main-push.yml | 4 ++++ .github/workflows/on-pull-request.yml | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/.github/workflows/on-main-push.yml b/.github/workflows/on-main-push.yml index dd0d0ad167..508024ed83 100644 --- a/.github/workflows/on-main-push.yml +++ b/.github/workflows/on-main-push.yml @@ -22,6 +22,10 @@ jobs: strategy: matrix: + # ISSUE on JDK 21 -- + # while running lombok-maven-plugin + # Class com.sun.tools.javac.tree.JCTree$JCImport does not have member field 'com.sun.tools.javac.tree.JCTree qualid' + # see also https://github.com/projectlombok/lombok/issues/3393 java-version: [ 17, 11 ] os: [ ubuntu-latest, macos-latest, windows-latest ] diff --git a/.github/workflows/on-pull-request.yml b/.github/workflows/on-pull-request.yml index 74938ea636..3f627fb84f 100644 --- a/.github/workflows/on-pull-request.yml +++ b/.github/workflows/on-pull-request.yml @@ -19,6 +19,10 @@ jobs: strategy: matrix: + # ISSUE on JDK 21 -- + # while running lombok-maven-plugin + # Class com.sun.tools.javac.tree.JCTree$JCImport does not have member field 'com.sun.tools.javac.tree.JCTree qualid' + # see also https://github.com/projectlombok/lombok/issues/3393 java-version: [ 17, 11 ] os: [ ubuntu-latest, macos-latest, windows-latest ] From ab688960f2593c347dbdb539346f23a75f8a2a19 Mon Sep 17 00:00:00 2001 From: Adrian Herscu Date: Thu, 12 Oct 2023 07:19:46 +0300 Subject: [PATCH 07/49] upgraded maven plugins --- pom.xml | 43 ++++++++++++++--------- qa-jgiven-reporter-maven-plugin/pom.xml | 2 +- qa-orcanos-publisher-maven-plugin/pom.xml | 3 +- qa-s3-publisher-maven-plugin/pom.xml | 4 +-- qa-testing-extra/pom.xml | 2 +- qa-testing-parent/pom.xml | 4 +-- qa-testing-utils/pom.xml | 2 +- 7 files changed, 35 insertions(+), 25 deletions(-) diff --git a/pom.xml b/pom.xml index 7605d53e92..18509ddc51 100644 --- a/pom.xml +++ b/pom.xml @@ -106,6 +106,8 @@ 11 + 1.18.30 + @@ -136,7 +138,7 @@ test.properties testng.xml - 3.0.0-M3 + 3.1.2 false @@ -234,7 +236,7 @@ org.projectlombok lombok - 1.18.26 + ${lombok.version} provided @@ -296,7 +298,7 @@ org.apache.maven.plugins maven-scm-publish-plugin - 3.1.0 + 3.2.1 @@ -509,7 +511,7 @@ org.projectlombok lombok - 1.18.28 + ${lombok.version} @@ -625,6 +627,13 @@ + + + org.projectlombok + lombok + ${lombok.version} + + @@ -633,7 +642,7 @@ this is used instead of maven-source-plugin --> org.apache.maven.plugins maven-antrun-plugin - 3.0.0 + 3.1.0 generate-delomboked-sources-jar @@ -657,7 +666,7 @@ otherwise the attached sources JAR will not match their bytecode --> org.codehaus.mojo build-helper-maven-plugin - 3.3.0 + 3.4.0 attach-delomboked-sources-jar @@ -683,7 +692,7 @@ com.github.spotbugs spotbugs-maven-plugin - 4.7.3.5 + 4.7.3.6 Max false @@ -759,7 +768,7 @@ org.apache.maven.plugins maven-help-plugin - 3.2.0 + 3.3.0 @@ -776,7 +785,7 @@ org.apache.maven.plugins maven-enforcer-plugin - 3.0.0 + 3.4.1 enforce-java @@ -800,7 +809,7 @@ org.apache.maven.plugins maven-site-plugin - 4.0.0-M9 + 4.0.0-M10 org.apache.maven.plugins diff --git a/qa-jgiven-reporter-maven-plugin/pom.xml b/qa-jgiven-reporter-maven-plugin/pom.xml index b84796f2c7..7a3b52e680 100644 --- a/qa-jgiven-reporter-maven-plugin/pom.xml +++ b/qa-jgiven-reporter-maven-plugin/pom.xml @@ -95,7 +95,7 @@ junit - 3.8.1 + 3.8.2 test diff --git a/qa-orcanos-publisher-maven-plugin/pom.xml b/qa-orcanos-publisher-maven-plugin/pom.xml index d09a145f39..cc7ea8c855 100644 --- a/qa-orcanos-publisher-maven-plugin/pom.xml +++ b/qa-orcanos-publisher-maven-plugin/pom.xml @@ -158,7 +158,7 @@ junit - 3.8.1 + 3.8.2 test @@ -189,6 +189,7 @@ org.codehaus.mojo jaxb2-maven-plugin + 2.5.0 diff --git a/qa-s3-publisher-maven-plugin/pom.xml b/qa-s3-publisher-maven-plugin/pom.xml index 2f4d9129f4..30efbda8a1 100644 --- a/qa-s3-publisher-maven-plugin/pom.xml +++ b/qa-s3-publisher-maven-plugin/pom.xml @@ -95,7 +95,7 @@ junit - 3.8.1 + 3.8.2 test @@ -149,7 +149,7 @@ org.apache.maven.surefire surefire-junit3 - 3.0.0-M3 + ${surefire.version} diff --git a/qa-testing-extra/pom.xml b/qa-testing-extra/pom.xml index 4d0c876b1c..b412f88ba9 100644 --- a/qa-testing-extra/pom.xml +++ b/qa-testing-extra/pom.xml @@ -284,7 +284,7 @@ com.akathist.maven.plugins.launch4j launch4j-maven-plugin - 1.7.25 + 2.4.1 cli-aws-cognito-srp-authenticator diff --git a/qa-testing-parent/pom.xml b/qa-testing-parent/pom.xml index 08e151abf5..6471d5b7d1 100644 --- a/qa-testing-parent/pom.xml +++ b/qa-testing-parent/pom.xml @@ -179,7 +179,7 @@ org.codehaus.mojo properties-maven-plugin - 1.0.0 + 1.2.0 read-project-properties @@ -333,7 +333,7 @@ maven-assembly-plugin - 3.3.0 + 3.6.0 package diff --git a/qa-testing-utils/pom.xml b/qa-testing-utils/pom.xml index 95467ebd39..a7f0c6f3d9 100644 --- a/qa-testing-utils/pom.xml +++ b/qa-testing-utils/pom.xml @@ -301,7 +301,7 @@ org.apache.maven.plugins maven-shade-plugin - 3.2.2 + 3.5.1 package From 494b1b1923a038fb989060d7805d35172582a521 Mon Sep 17 00:00:00 2001 From: Adrian Herscu Date: Thu, 12 Oct 2023 07:20:33 +0300 Subject: [PATCH 08/49] formatted by new maven formatter plugin --- .../commons/formatters/DataSetFormatter.java | 2 +- .../formatters/DescriptionFormatter.java | 2 +- .../commons/formatters/FileFormatter.java | 2 +- .../formatters/JsonAssertionFormatter.java | 2 +- .../formatters/JsonAssertionsFormatter.java | 2 +- .../formatters/NotOrBlankFormatter.java | 2 +- .../commons/formatters/ObjectExFormatter.java | 2 +- .../commons/formatters/ObjectFormatter.java | 2 +- .../commons/formatters/PairFormatter.java | 2 +- .../commons/formatters/StringFormatter.java | 2 +- .../commons/formatters/UnitFormatter.java | 2 +- .../jgiven/commons/model/AnyScenarioType.java | 2 +- .../qa/jgiven/commons/model/Element.java | 2 +- .../qa/jgiven/commons/model/Numeric.java | 4 +-- .../qa/jgiven/commons/model/Percentage.java | 2 +- .../qa/jgiven/commons/model/ScenarioType.java | 2 +- .../jgiven/commons/steps/GenericActions.java | 4 +-- .../jgiven/commons/steps/GenericFixtures.java | 26 +++++++------- .../qa/jgiven/commons/tags/DatabaseTest.java | 2 +- .../jgiven/commons/tags/MissingCoverage.java | 2 +- .../qa/jgiven/commons/tags/SelfTest.java | 2 +- ...AbstractConfigurableDataSourceFactory.java | 10 +++--- .../commons/utils/AttachesScreenshot.java | 2 +- .../utils/AttachesScreenshotAspect.java | 2 +- .../commons/utils/BeanUtilsConverter.java | 2 +- .../utils/CallableWithDescription.java | 4 +-- .../jgiven/commons/utils/DbUnitExModule.java | 10 +++--- .../commons/utils/DesiredCapabilitiesEx.java | 4 +-- .../utils/FunctionWithDescription.java | 4 +-- .../utils/HikariPoolingDataSourceFactory.java | 8 ++--- .../jgiven/commons/utils/LoggingAspect.java | 4 +-- .../commons/utils/MayAttachScreenshots.java | 4 +-- .../utils/MetricReporterSuiteListener.java | 4 +-- .../RemoteWebDriverHttpClientAspect.java | 2 +- .../aherscu/qa/jgiven/commons/utils/Root.java | 4 +-- .../jgiven/commons/utils/ScenarioTestEx.java | 2 +- .../commons/utils/ScenarioTestListenerEx.java | 16 ++++----- .../qa/jgiven/commons/utils/StageEx.java | 2 +- .../commons/utils/StepModelPatchAspect.java | 2 +- .../commons/utils/TestRetryAnalyzer.java | 2 +- .../commons/utils/UnitilsScenarioTest.java | 4 +-- .../qa/jgiven/commons/utils/WebDriverEx.java | 2 +- .../model/ElasticSearchScenarioType.java | 2 +- .../rabbitmq/model/RabbitMqScenarioType.java | 2 +- .../jgiven/rabbitmq/utils/QueueHandler.java | 6 ++-- .../reporter/QaJGivenPerMethodReporter.java | 10 +++--- .../jgiven/reporter/QaJGivenReportModel.java | 2 +- .../qa/jgiven/reporter/QaJGivenReporter.java | 2 +- .../jgiven/rest/formatters/FormFormatter.java | 2 +- .../jgiven/rest/model/RestScenarioType.java | 2 +- .../qa/jgiven/rest/steps/RestFixtures.java | 2 +- .../aherscu/qa/jgiven/rest/tags/RestTest.java | 2 +- .../aherscu/qa/jgiven/ssh/model/SshInfo.java | 2 +- .../qa/jgiven/ssh/model/SshScenarioType.java | 2 +- .../qa/jgiven/ssh/steps/SshActions.java | 12 +++---- .../qa/jgiven/ssh/steps/SshFixtures.java | 12 +++---- .../ApplicationPerClassWebSessionTest.java | 4 +-- .../ApplicationPerMethodWebSessionTest.java | 4 +-- .../webdriver/WebDriverConfiguration.java | 14 ++++---- .../formatters/CapabilitiesFormatter.java | 2 +- .../formatters/WebDriverFormatter.java | 2 +- .../model/WebDriverScenarioType.java | 2 +- .../qa/jgiven/webdriver/tags/UITest.java | 2 +- .../jgiven/webdriver/tags/WebDriverTest.java | 2 +- .../maven/plugin/OrcanosPublisherMojo.java | 4 +-- .../publisher/maven/plugin/ReportHandle.java | 34 +++++++++---------- .../maven/plugin/S3StaticUploaderMojo.java | 2 +- .../publisher/maven/plugin/config/Bind.java | 2 +- .../maven/plugin/config/Include.java | 2 +- .../maven/plugin/util/S3Uploader.java | 2 +- .../aherscu/qa/testing/extra/CsvUtils.java | 2 +- .../qa/testing/extra/ParallelLoop.java | 6 ++-- .../qa/testing/extra/ReadMultiWriteLock.java | 6 ++-- .../testing/extra/pooling/AutoReturnable.java | 2 +- .../pooling/AutoReturnableObjectFactory.java | 4 +-- .../pooling/AutoReturnableObjectPool.java | 2 +- .../extra/supermachine/BeanScanner.java | 4 +-- .../testing/extra/supermachine/Scanner.java | 4 +-- .../extra/supermachine/StreamScanner.java | 4 +-- .../DisableSslCertificateValidation.java | 2 +- .../qa/testing/extra/yaml/YamlReader.java | 10 +++--- .../qa/testing/extra/yaml/YamlWriter.java | 8 ++--- .../aherscu/qa/testing/utils/Base64Utils.java | 6 ++-- .../aherscu/qa/testing/utils/EnumUtils.java | 2 +- .../qa/testing/utils/FileUtilsExtensions.java | 14 ++++---- .../utils/FilenameUtilsExtensions.java | 4 +-- .../aherscu/qa/testing/utils/ImageUtils.java | 4 +-- .../aherscu/qa/testing/utils/MapUtils.java | 10 +++--- .../aherscu/qa/testing/utils/NumberUtils.java | 2 +- .../testing/utils/ObjectUtilsExtensions.java | 4 +-- .../qa/testing/utils/TemplateUtils.java | 2 +- .../aherscu/qa/testing/utils/ThreadUtils.java | 6 ++-- .../aherscu/qa/testing/utils/UriUtils.java | 12 +++---- .../aherscu/qa/testing/utils/UrlUtils.java | 4 +-- .../testing/utils/assertions/Assertion.java | 4 +-- .../utils/assertions/JXPathAsserter.java | 6 ++-- .../utils/assertions/JXPathAsserterImpl.java | 2 +- .../utils/assertions/JXPathAssertion.java | 6 ++-- .../utils/assertions/JsonAsserterEx.java | 4 +-- .../utils/assertions/JsonAssertion.java | 8 ++--- .../utils/config/BaseConfiguration.java | 2 +- .../qa/testing/utils/config/Configurable.java | 8 ++--- .../utils/logging/LoggingInputStream.java | 8 ++--- .../utils/logging/LoggingOutputStream.java | 8 ++--- .../rest/AbstractJaxbReadableProvider.java | 2 +- .../rest/AbstractJaxbWriteableProvider.java | 6 ++-- .../utils/rest/AbstractReadableProvider.java | 2 +- .../utils/rest/AbstractRestApplication.java | 4 +-- .../utils/rest/AbstractWriteableProvider.java | 2 +- .../utils/rest/OAuthRequestFilter.java | 2 +- .../utils/rest/ResponseExtensions.java | 6 ++-- .../testing/utils/rest/RestClientUtils.java | 8 ++--- .../qa/testrail/reporter/TestRailClient.java | 8 ++--- .../reporter/TestRailReportModel.java | 4 +-- .../testrail/reporter/TestRailReporter.java | 14 ++++---- 115 files changed, 270 insertions(+), 270 deletions(-) diff --git a/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/formatters/DataSetFormatter.java b/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/formatters/DataSetFormatter.java index 36b46e0a92..e2dd84e9da 100644 --- a/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/formatters/DataSetFormatter.java +++ b/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/formatters/DataSetFormatter.java @@ -31,7 +31,7 @@ /** * Formats an {@link IDataSet} such that each table appears in a separate * section and each row appears on separate line. - * + * *

* NOTE: meanwhile, only table names are reported *

diff --git a/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/formatters/DescriptionFormatter.java b/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/formatters/DescriptionFormatter.java index 4da6422662..e7c1449205 100644 --- a/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/formatters/DescriptionFormatter.java +++ b/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/formatters/DescriptionFormatter.java @@ -24,7 +24,7 @@ /** * Annotation formatter for objects with {@link HasDescription}. - * + * * @author aherscu * */ diff --git a/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/formatters/FileFormatter.java b/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/formatters/FileFormatter.java index 341bde41f3..7469143904 100644 --- a/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/formatters/FileFormatter.java +++ b/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/formatters/FileFormatter.java @@ -31,7 +31,7 @@ /** * Formatter for {@link File}s. - * + * * @author aherscu * */ diff --git a/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/formatters/JsonAssertionFormatter.java b/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/formatters/JsonAssertionFormatter.java index ba988a9d47..00d2df4146 100644 --- a/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/formatters/JsonAssertionFormatter.java +++ b/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/formatters/JsonAssertionFormatter.java @@ -28,7 +28,7 @@ /** * Annotation formatter for JSON paths. - * + * * @author aherscu * */ diff --git a/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/formatters/JsonAssertionsFormatter.java b/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/formatters/JsonAssertionsFormatter.java index 29ce1434d5..2605b5d915 100644 --- a/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/formatters/JsonAssertionsFormatter.java +++ b/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/formatters/JsonAssertionsFormatter.java @@ -30,7 +30,7 @@ /** * Annotation formatter for JSON paths. - * + * * @author aherscu * */ diff --git a/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/formatters/NotOrBlankFormatter.java b/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/formatters/NotOrBlankFormatter.java index a59e02c4c5..612ab96e44 100644 --- a/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/formatters/NotOrBlankFormatter.java +++ b/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/formatters/NotOrBlankFormatter.java @@ -21,7 +21,7 @@ /** * Annotation formatter for {@link Boolean} objects. - * + * * @author aherscu * */ diff --git a/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/formatters/ObjectExFormatter.java b/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/formatters/ObjectExFormatter.java index 794211637b..03a21a8970 100644 --- a/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/formatters/ObjectExFormatter.java +++ b/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/formatters/ObjectExFormatter.java @@ -26,7 +26,7 @@ /** * Formatter for {@link Object}s using ReflectionToStringBuilder. - * + * * @author aherscu * */ diff --git a/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/formatters/ObjectFormatter.java b/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/formatters/ObjectFormatter.java index 4837239b2e..7699ef4058 100644 --- a/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/formatters/ObjectFormatter.java +++ b/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/formatters/ObjectFormatter.java @@ -28,7 +28,7 @@ /** * Formatter for {@link Object}s. - * + * * @author aherscu * */ diff --git a/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/formatters/PairFormatter.java b/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/formatters/PairFormatter.java index 4f5eaa0b8b..4199ec526c 100644 --- a/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/formatters/PairFormatter.java +++ b/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/formatters/PairFormatter.java @@ -26,7 +26,7 @@ /** * Annotation formatter for {@link Pair} objects. - * + * * @author aherscu * */ diff --git a/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/formatters/StringFormatter.java b/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/formatters/StringFormatter.java index cbb970c1c5..ce45a2d0a7 100644 --- a/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/formatters/StringFormatter.java +++ b/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/formatters/StringFormatter.java @@ -26,7 +26,7 @@ /** * Formatter for {@link String}s. - * + * * @author aherscu * */ diff --git a/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/formatters/UnitFormatter.java b/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/formatters/UnitFormatter.java index cdcb28cf40..f7f37d719a 100644 --- a/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/formatters/UnitFormatter.java +++ b/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/formatters/UnitFormatter.java @@ -24,7 +24,7 @@ /** * Annotation formatter for units. - * + * * @author aherscu * */ diff --git a/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/model/AnyScenarioType.java b/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/model/AnyScenarioType.java index 19c454d768..bafb209dd7 100644 --- a/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/model/AnyScenarioType.java +++ b/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/model/AnyScenarioType.java @@ -17,7 +17,7 @@ /** * Any type of scenario. - * + * * @author aherscu * */ diff --git a/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/model/Element.java b/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/model/Element.java index 97cb26ed45..193b45d89a 100644 --- a/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/model/Element.java +++ b/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/model/Element.java @@ -26,7 +26,7 @@ public interface Element { /** * Deserializes this object from given strings. - * + * * @param strings * the strings from which to deserialize * @return the deserialized object diff --git a/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/model/Numeric.java b/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/model/Numeric.java index d52cdee572..66c7942051 100644 --- a/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/model/Numeric.java +++ b/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/model/Numeric.java @@ -26,10 +26,10 @@ /** * Represents an identifier. - * + * * @param * type of indentifier's value - * + * * @author aherscu * */ diff --git a/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/model/Percentage.java b/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/model/Percentage.java index 2a6c0ddc7d..e7e5613a5d 100644 --- a/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/model/Percentage.java +++ b/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/model/Percentage.java @@ -29,7 +29,7 @@ * * @param * the type of percentage value - * + * * @author aherscu * */ diff --git a/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/model/ScenarioType.java b/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/model/ScenarioType.java index f0ae3a2f06..33a9930fbf 100644 --- a/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/model/ScenarioType.java +++ b/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/model/ScenarioType.java @@ -17,7 +17,7 @@ /** * Used to mark a stage as belonging to some type of scenario. - * + * * @author aherscu * * @param diff --git a/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/steps/GenericActions.java b/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/steps/GenericActions.java index 510f690e9b..6c9055e6d0 100644 --- a/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/steps/GenericActions.java +++ b/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/steps/GenericActions.java @@ -152,7 +152,7 @@ public SELF doing_nothing(final Duration duration) { /** * Failing with specified throwable for self-testing purposes. - * + * * @param throwable * the throwable * @return {@link #self()} @@ -189,7 +189,7 @@ public final SELF retrying(final StepWithDescription step) { /** * Safely executes specified step, swallowing all exceptions. - * + * *

* IMPORTANT:must not be called from step method that is * annotated with {@link NestedSteps} since this interferes with exception diff --git a/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/steps/GenericFixtures.java b/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/steps/GenericFixtures.java index a60e57c643..c71166231c 100644 --- a/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/steps/GenericFixtures.java +++ b/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/steps/GenericFixtures.java @@ -40,13 +40,13 @@ /** * Generic fixtures. - * + * * @param * the type of the subclass - * + * * @param * type of scenario - * + * * @author aherscu */ @ThreadSafe @@ -73,9 +73,9 @@ private static DbUnitExModule dbUnitExModule() { /** * Run a specified Unitils multi-schema dataset file. - * + * * @see #data(IDataSet) - * + * * @param multiSchemaDataSetFile * a Unitils multi-schema dataset file; by default, a @@ -95,13 +95,13 @@ public SELF data( /** * Run a specified DBUnit dataset. - * + * *

* This method of data insertion should be prefered instead of Unitils' * {@link DataSet} annotation. By using this method your data-sets are * rendered in the JGiven report, while otherwise they would not. *

- * + * *

* Internally, uses the default {@link DataSetLoadStrategy} and * {@link DataSetFactory}. These may be configured via the @@ -111,9 +111,9 @@ public SELF data( * Configuring the dataset load strategy section of Unitils' Database * Tutorial. *

- * + * * @see DbUnitExModule#insertDataSet(IDataSet) - * + * * @param dataSet * a DBUnit dataset object * @return {@link #self()} @@ -146,16 +146,16 @@ public SELF data( /** * Runs specified SQL-DML batch. - * + * * @param sql * the SQL statement to execute * @param params * an array of query replacement parameters, where each row in * this array is one set of batch replacement values - * + * * @see QueryRunner#batch(String, Object[][]) * @return {@link #self()} - * + * * @throws IllegalArgumentException * if the array of replacement parameters is empty */ @@ -177,7 +177,7 @@ public SELF data( /** * Does nothing -- just initializes the JGiven infrastructure. - * + * * @return {@link #self()} */ public SELF nothing() { diff --git a/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/tags/DatabaseTest.java b/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/tags/DatabaseTest.java index 36bf5cdb2f..f3b53c4253 100644 --- a/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/tags/DatabaseTest.java +++ b/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/tags/DatabaseTest.java @@ -23,7 +23,7 @@ /** * Database testing annotation. - * + * * @author aherscu * */ diff --git a/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/tags/MissingCoverage.java b/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/tags/MissingCoverage.java index 534d3b9d29..9477a86805 100644 --- a/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/tags/MissingCoverage.java +++ b/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/tags/MissingCoverage.java @@ -21,7 +21,7 @@ /** * Missing coverage. - * + * * @author aherscu * */ diff --git a/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/tags/SelfTest.java b/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/tags/SelfTest.java index bddd23b40a..811b352041 100644 --- a/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/tags/SelfTest.java +++ b/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/tags/SelfTest.java @@ -21,7 +21,7 @@ /** * Self test tagging annotation. - * + * * @author aherscu * */ diff --git a/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/AbstractConfigurableDataSourceFactory.java b/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/AbstractConfigurableDataSourceFactory.java index 8e3ed42cf0..cb3c258bcd 100644 --- a/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/AbstractConfigurableDataSourceFactory.java +++ b/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/AbstractConfigurableDataSourceFactory.java @@ -25,7 +25,7 @@ /** * Data source factory that its configuration can be overridden via system * properties. - * + * * @author aherscu * */ @@ -57,8 +57,8 @@ public final void init(final Properties configuration, config = new CustomDatabaseConfiguration( new DatabaseConfigurationsFactory( new Configuration(configuration)) - .create() - .getDatabaseConfiguration(databaseName)); + .create() + .getDatabaseConfiguration(databaseName)); } /** @@ -73,8 +73,8 @@ public final void init(final Properties configuration) { config = new CustomDatabaseConfiguration( new DatabaseConfigurationsFactory( new Configuration(configuration)) - .create() - .getDatabaseConfiguration()); + .create() + .getDatabaseConfiguration()); } /** diff --git a/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/AttachesScreenshot.java b/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/AttachesScreenshot.java index 925ccd10a7..6db6e62575 100644 --- a/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/AttachesScreenshot.java +++ b/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/AttachesScreenshot.java @@ -19,7 +19,7 @@ /** * Screenshot directive annotation. - * + * * @author aherscu * */ diff --git a/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/AttachesScreenshotAspect.java b/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/AttachesScreenshotAspect.java index 885b60a216..c5e077cf25 100644 --- a/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/AttachesScreenshotAspect.java +++ b/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/AttachesScreenshotAspect.java @@ -53,7 +53,7 @@ public class AttachesScreenshotAspect { /** * Attaches a screenshot even if the advised method failed. - * + * * @param thisJoinPoint * advised join point * @return forwarded from advised method diff --git a/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/BeanUtilsConverter.java b/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/BeanUtilsConverter.java index 0dfad5a64d..46113bbc70 100644 --- a/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/BeanUtilsConverter.java +++ b/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/BeanUtilsConverter.java @@ -21,7 +21,7 @@ /** * Provides the means to specify a {@link Converter} for the annotated type. - * + * *

* EXPERIMENTAL *

diff --git a/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/CallableWithDescription.java b/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/CallableWithDescription.java index 99b3ad4996..2a146bd667 100644 --- a/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/CallableWithDescription.java +++ b/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/CallableWithDescription.java @@ -22,10 +22,10 @@ /** * Wraps a {@link Callable} with a description. - * + * * @param * the type of output - * + * * @author Adrian Herscu * */ diff --git a/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/DbUnitExModule.java b/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/DbUnitExModule.java index ffc536f727..8364c26ea6 100644 --- a/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/DbUnitExModule.java +++ b/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/DbUnitExModule.java @@ -26,7 +26,7 @@ /** * Provides data insertion method using the default dataset factory. - * + * *

* In order to use this class during runtime, the {@code unitils.properties} * file of the project shall contain @@ -69,7 +69,7 @@ public DbUnitExModule() { /** * Creates a multi-schema data-set from given DbUnit dataset file. - * + * * @param dataSetFile * The test data set, not null * @return the data-set @@ -81,7 +81,7 @@ public MultiSchemaDataSet createDataSet(final File dataSetFile) { /** * Loads the given dataset into the default schema of the database, using * the default load strategy. - * + * * @param dataSet * dataset that is inserted in the database */ @@ -92,7 +92,7 @@ public void insertDataSet(final IDataSet dataSet) { /** * Loads the given dataset into the default schema of the database, using a * specified load strategy. - * + * * @param dataSet * dataset that is inserted in the database * @param dataSetLoadStrategy @@ -115,7 +115,7 @@ public void insertDataSet( /** * Loads the given dataset into the default schema of the database, using * the default load strategy. - * + * * @param multiSchemaDataSet * multi-schema dataset that is inserted in the database */ diff --git a/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/DesiredCapabilitiesEx.java b/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/DesiredCapabilitiesEx.java index b17c5dc6e6..86a74e5eb2 100644 --- a/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/DesiredCapabilitiesEx.java +++ b/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/DesiredCapabilitiesEx.java @@ -67,7 +67,7 @@ public DesiredCapabilitiesEx with( /** * Chains a {@code true} capability. - * + * * @param key * the capability to chain * @return chained capabilities, on new set of capabilities @@ -113,7 +113,7 @@ public DesiredCapabilitiesEx withAdded( return with(key, requireNonNull(getCapability(key), "capability does not exist") - .toString() + .toString() + value); } } diff --git a/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/FunctionWithDescription.java b/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/FunctionWithDescription.java index 1e5374ed0d..18bb32f9bd 100644 --- a/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/FunctionWithDescription.java +++ b/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/FunctionWithDescription.java @@ -22,13 +22,13 @@ /** * Wraps a {@link Function} with a description. - * + * * @param * the type of input * * @param * the type of output - * + * * @author Adrian Herscu * */ diff --git a/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/HikariPoolingDataSourceFactory.java b/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/HikariPoolingDataSourceFactory.java index 625575f264..c978544330 100644 --- a/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/HikariPoolingDataSourceFactory.java +++ b/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/HikariPoolingDataSourceFactory.java @@ -31,13 +31,13 @@ * pooling used by * Unitils' * {@link DatabaseModule}. - * + * *

* This implementation uses * HikariCP as its * connection pooling library. *

- * + * *

* Adapted from {@link PropertiesDataSourceFactory}. *

@@ -72,7 +72,7 @@ public final DataSource createDataSource() { /** * Override to customize the connection timeout. - * + * * @return the configured connection timeout; by default 30,000 ms * @see HikariConfig#setConnectionTimeout(long) */ @@ -83,7 +83,7 @@ protected long connectionTimeout() { /** * Override to customize the idle timeout. - * + * * @return the configured idle timeout; by default 600,000 ms (10 minutes) * @see HikariConfig#setIdleTimeout(long) */ diff --git a/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/LoggingAspect.java b/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/LoggingAspect.java index fdf86f8921..dea970ff43 100644 --- a/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/LoggingAspect.java +++ b/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/LoggingAspect.java @@ -59,8 +59,8 @@ public Object aroundStepMethod( stream(isNull(thisJoinPoint.getArgs()) ? new Object[] {} : thisJoinPoint.getArgs()) - .map(arg -> Objects.toString(arg, "null")) - .collect(joining(COMMA, "[", "]"))); + .map(arg -> Objects.toString(arg, "null")) + .collect(joining(COMMA, "[", "]"))); val retval = thisJoinPoint.proceed(thisJoinPoint.getArgs()); diff --git a/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/MayAttachScreenshots.java b/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/MayAttachScreenshots.java index 6fcbd122ed..9ddd249789 100644 --- a/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/MayAttachScreenshots.java +++ b/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/MayAttachScreenshots.java @@ -20,12 +20,12 @@ /** * Use to mark a JGiven stage that may attach screenshots. - * + * * @param * type of JGiven stage * * @see AttachesScreenshot - * + * * @author Adrian Herscu * */ diff --git a/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/MetricReporterSuiteListener.java b/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/MetricReporterSuiteListener.java index b08685fc5e..5474c34c0c 100644 --- a/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/MetricReporterSuiteListener.java +++ b/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/MetricReporterSuiteListener.java @@ -43,12 +43,12 @@ * CSV files are written to directory as specified via {@code target-directory} * parameter. If this parameter is not specified, then {@code target} is * assumed. - * + * *

* If {@code metric-report-interval-ms} parameter is specified, then plots the * accumulated metrics to console every so milliseconds. *

- * + * *

* To be used via {@code testng.xml}; see diff --git a/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/RemoteWebDriverHttpClientAspect.java b/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/RemoteWebDriverHttpClientAspect.java index f3d45f9e0c..fc713b9a25 100644 --- a/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/RemoteWebDriverHttpClientAspect.java +++ b/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/RemoteWebDriverHttpClientAspect.java @@ -50,7 +50,7 @@ public class RemoteWebDriverHttpClientAspect implements ISuiteListener { * * @param thisJoinPoint * the execution - * + * * @return the {@link HttpResponse} * @throws Throwable * any of below diff --git a/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/Root.java b/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/Root.java index ea26033eb5..fc0f3449b2 100644 --- a/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/Root.java +++ b/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/Root.java @@ -22,11 +22,11 @@ /** * Annotation bound to {@link Locale#ROOT} locale. - * + * * @see * Storing translations in source code - * + * * @author aherscu */ @Target(ElementType.METHOD) diff --git a/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/ScenarioTestEx.java b/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/ScenarioTestEx.java index 13c9bb7d23..8cc1619c52 100644 --- a/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/ScenarioTestEx.java +++ b/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/ScenarioTestEx.java @@ -29,7 +29,7 @@ * This is a complete replacement of * {@link com.tngtech.jgiven.testng.ScenarioTest} in order to use * {@link ScenarioTestListenerEx}. - * + * * @param * type of given stage * @param diff --git a/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/ScenarioTestListenerEx.java b/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/ScenarioTestListenerEx.java index 8814289e09..ca45552f86 100644 --- a/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/ScenarioTestListenerEx.java +++ b/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/ScenarioTestListenerEx.java @@ -71,14 +71,14 @@ private static Stream> reportModelsFor( final ITestContext context) { return ((Map) context .getAttribute(REPORT_MODELS_ATTRIBUTE)) - .entrySet() + .entrySet() + .stream() + .filter(reportModelEntry -> ((TestRunner) context) + .getTestClasses() .stream() - .filter(reportModelEntry -> ((TestRunner) context) - .getTestClasses() - .stream() - .map(IClass::getName) - .anyMatch(testClassName -> testClassName.equals( - reportModelEntry.getKey()))); + .map(IClass::getName) + .anyMatch(testClassName -> testClassName.equals( + reportModelEntry.getKey()))); } private static void reportRetries( @@ -95,7 +95,7 @@ private static void reportRetries( TestRetryAnalyzer.retryCounters .get(qualifiedMethodName) .toString()) - .setPrependType(true); + .setPrependType(true); reportModel.addTag(retriesTag); scenario.addTag(retriesTag); diff --git a/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/StageEx.java b/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/StageEx.java index 13e9235733..15196f40e0 100644 --- a/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/StageEx.java +++ b/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/StageEx.java @@ -143,7 +143,7 @@ protected final void attachScreenshot( /** * Attaches specified text. Useful for attaching JSON, XML, or just plain * text. Override to customize, e.g. to shorten or format the text. - * + * * @param text * the text to attach * @return the attached text diff --git a/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/StepModelPatchAspect.java b/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/StepModelPatchAspect.java index bc99d29502..7b7e966258 100644 --- a/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/StepModelPatchAspect.java +++ b/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/StepModelPatchAspect.java @@ -44,7 +44,7 @@ public class StepModelPatchAspect { /** * Monitors attempts to set step method's duration. If the duration is * already set, then overrides to do nothing. - * + * * @param thisJoinPoint * this join-point * @param stepModel diff --git a/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/TestRetryAnalyzer.java b/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/TestRetryAnalyzer.java index ca5c531c89..3393fdb9bd 100644 --- a/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/TestRetryAnalyzer.java +++ b/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/TestRetryAnalyzer.java @@ -38,7 +38,7 @@ *

* Had an issue with JGiven: https://github.com/TNG/JGiven/issues/312 *

- * + * *

* Can be added as a listener, in this case the retry mechanism will get applied * to all test methods covered by. diff --git a/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/UnitilsScenarioTest.java b/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/UnitilsScenarioTest.java index 24532a88b3..3d647c5d5b 100644 --- a/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/UnitilsScenarioTest.java +++ b/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/UnitilsScenarioTest.java @@ -116,8 +116,8 @@ public void configure() { try { val typesAnnotatedWithBeanUtilsConverter = new Reflections( "dev.aherscu.qa.jgiven.commons.scenarios") //$NON-NLS-1$ - .getTypesAnnotatedWith( - BeanUtilsConverter.class); + .getTypesAnnotatedWith( + BeanUtilsConverter.class); for (val clazz : typesAnnotatedWithBeanUtilsConverter) { val annotation = clazz .getAnnotation(BeanUtilsConverter.class); diff --git a/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/WebDriverEx.java b/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/WebDriverEx.java index 21909b7171..38370c1aa1 100644 --- a/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/WebDriverEx.java +++ b/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/WebDriverEx.java @@ -198,7 +198,7 @@ private static Class webDriverClassFor( final Capabilities capabilities) { val driverClass = Class.forName(requireNonNull(capabilities .getCapability("class"), "must have a class capability") - .toString()) + .toString()) .asSubclass(WebDriver.class); if (driverClass.isAssignableFrom(ChromeDriver.class)) diff --git a/qa-jgiven-elasticsearch/src/main/java/dev/aherscu/qa/jgiven/elasticsearch/model/ElasticSearchScenarioType.java b/qa-jgiven-elasticsearch/src/main/java/dev/aherscu/qa/jgiven/elasticsearch/model/ElasticSearchScenarioType.java index e8491ddd35..6a72ed3922 100644 --- a/qa-jgiven-elasticsearch/src/main/java/dev/aherscu/qa/jgiven/elasticsearch/model/ElasticSearchScenarioType.java +++ b/qa-jgiven-elasticsearch/src/main/java/dev/aherscu/qa/jgiven/elasticsearch/model/ElasticSearchScenarioType.java @@ -19,7 +19,7 @@ /** * Elastic Search client type of scenario. - * + * * @author aherscu * */ diff --git a/qa-jgiven-rabbitmq/src/main/java/dev/aherscu/qa/jgiven/rabbitmq/model/RabbitMqScenarioType.java b/qa-jgiven-rabbitmq/src/main/java/dev/aherscu/qa/jgiven/rabbitmq/model/RabbitMqScenarioType.java index f21a2cc2c6..03b7a093d6 100644 --- a/qa-jgiven-rabbitmq/src/main/java/dev/aherscu/qa/jgiven/rabbitmq/model/RabbitMqScenarioType.java +++ b/qa-jgiven-rabbitmq/src/main/java/dev/aherscu/qa/jgiven/rabbitmq/model/RabbitMqScenarioType.java @@ -19,7 +19,7 @@ /** * Rest client type of scenario. - * + * * @author aherscu * */ diff --git a/qa-jgiven-rabbitmq/src/main/java/dev/aherscu/qa/jgiven/rabbitmq/utils/QueueHandler.java b/qa-jgiven-rabbitmq/src/main/java/dev/aherscu/qa/jgiven/rabbitmq/utils/QueueHandler.java index 4ae29b487c..0af4ff6803 100644 --- a/qa-jgiven-rabbitmq/src/main/java/dev/aherscu/qa/jgiven/rabbitmq/utils/QueueHandler.java +++ b/qa-jgiven-rabbitmq/src/main/java/dev/aherscu/qa/jgiven/rabbitmq/utils/QueueHandler.java @@ -73,7 +73,7 @@ public class QueueHandler implements AutoCloseable { * *

* Build it: - * + * *

      * private final Supplier> queueHandlerSupplier =
      *     QueueHandler.Singleton. builder()
@@ -98,12 +98,12 @@ public class QueueHandler implements AutoCloseable {
      * It is guaranteed that calling {@code queueHandler()} from any
      * thread, will supply the same QueueHandler instance.
      * 

- * + * *

* The connection is internally managed and closed via a runtime shutdown * hook. *

- * + * * @param * type of message-key; it should have a proper hash function in * order to get O(1) access time, otherwise it may degrade to diff --git a/qa-jgiven-reporter/src/main/java/dev/aherscu/qa/jgiven/reporter/QaJGivenPerMethodReporter.java b/qa-jgiven-reporter/src/main/java/dev/aherscu/qa/jgiven/reporter/QaJGivenPerMethodReporter.java index 78e599c7f0..c0b6188fd5 100644 --- a/qa-jgiven-reporter/src/main/java/dev/aherscu/qa/jgiven/reporter/QaJGivenPerMethodReporter.java +++ b/qa-jgiven-reporter/src/main/java/dev/aherscu/qa/jgiven/reporter/QaJGivenPerMethodReporter.java @@ -116,12 +116,12 @@ public void generate() { .debug("reading " + reportModelFile.getName())) .flatMap(reportModelFile -> new ReportModelFileReader() .apply(reportModelFile).model - .getScenarios() + .getScenarios() + .stream() + .filter(scenarioModel -> scenarioModel + .getTagIds() .stream() - .filter(scenarioModel -> scenarioModel - .getTagIds() - .stream() - .anyMatch(tagId -> tagId.contains(referenceTag)))) + .anyMatch(tagId -> tagId.contains(referenceTag)))) .peek(scenarioModel -> log .debug("processing " + targetNameFor(scenarioModel))) .forEach(Unchecked.consumer(scenarioModel -> { diff --git a/qa-jgiven-reporter/src/main/java/dev/aherscu/qa/jgiven/reporter/QaJGivenReportModel.java b/qa-jgiven-reporter/src/main/java/dev/aherscu/qa/jgiven/reporter/QaJGivenReportModel.java index 9bab67d5e6..54ed5506a6 100644 --- a/qa-jgiven-reporter/src/main/java/dev/aherscu/qa/jgiven/reporter/QaJGivenReportModel.java +++ b/qa-jgiven-reporter/src/main/java/dev/aherscu/qa/jgiven/reporter/QaJGivenReportModel.java @@ -56,7 +56,7 @@ *

* * @see AbstractQaJgivenReporter - * + * * @param * one of JGiven's report models: {@link CompleteReportModel}, * {@link ScenarioModel}, or {@link ReportModelFile} diff --git a/qa-jgiven-reporter/src/main/java/dev/aherscu/qa/jgiven/reporter/QaJGivenReporter.java b/qa-jgiven-reporter/src/main/java/dev/aherscu/qa/jgiven/reporter/QaJGivenReporter.java index c39f478dfc..7da402c340 100644 --- a/qa-jgiven-reporter/src/main/java/dev/aherscu/qa/jgiven/reporter/QaJGivenReporter.java +++ b/qa-jgiven-reporter/src/main/java/dev/aherscu/qa/jgiven/reporter/QaJGivenReporter.java @@ -89,7 +89,7 @@ public void generate() { .sourceDir(sourceDirectory) .targetDir(outputDirectory) .build()) - .readDirectory()) + .readDirectory()) .screenshotScale(screenshotScale) .datePattern(datePattern) .testDocumentId(testDocumentId) diff --git a/qa-jgiven-rest/src/main/java/dev/aherscu/qa/jgiven/rest/formatters/FormFormatter.java b/qa-jgiven-rest/src/main/java/dev/aherscu/qa/jgiven/rest/formatters/FormFormatter.java index 22e07afbd6..695e0e020c 100644 --- a/qa-jgiven-rest/src/main/java/dev/aherscu/qa/jgiven/rest/formatters/FormFormatter.java +++ b/qa-jgiven-rest/src/main/java/dev/aherscu/qa/jgiven/rest/formatters/FormFormatter.java @@ -27,7 +27,7 @@ /** * Annotation formatter for {@link Form} objects. - * + * * @author aherscu * */ diff --git a/qa-jgiven-rest/src/main/java/dev/aherscu/qa/jgiven/rest/model/RestScenarioType.java b/qa-jgiven-rest/src/main/java/dev/aherscu/qa/jgiven/rest/model/RestScenarioType.java index 01ce1cdf0f..169557c9d3 100644 --- a/qa-jgiven-rest/src/main/java/dev/aherscu/qa/jgiven/rest/model/RestScenarioType.java +++ b/qa-jgiven-rest/src/main/java/dev/aherscu/qa/jgiven/rest/model/RestScenarioType.java @@ -19,7 +19,7 @@ /** * Rest client type of scenario. - * + * * @author aherscu * */ diff --git a/qa-jgiven-rest/src/main/java/dev/aherscu/qa/jgiven/rest/steps/RestFixtures.java b/qa-jgiven-rest/src/main/java/dev/aherscu/qa/jgiven/rest/steps/RestFixtures.java index a4cacc6619..6b853f5fc4 100644 --- a/qa-jgiven-rest/src/main/java/dev/aherscu/qa/jgiven/rest/steps/RestFixtures.java +++ b/qa-jgiven-rest/src/main/java/dev/aherscu/qa/jgiven/rest/steps/RestFixtures.java @@ -47,7 +47,7 @@ public class RestFixtures> /** * Keeps a {@link Client} for later operations. - * + * * @param aClient * a REST client * diff --git a/qa-jgiven-rest/src/main/java/dev/aherscu/qa/jgiven/rest/tags/RestTest.java b/qa-jgiven-rest/src/main/java/dev/aherscu/qa/jgiven/rest/tags/RestTest.java index cfee720cd0..6e34e98312 100644 --- a/qa-jgiven-rest/src/main/java/dev/aherscu/qa/jgiven/rest/tags/RestTest.java +++ b/qa-jgiven-rest/src/main/java/dev/aherscu/qa/jgiven/rest/tags/RestTest.java @@ -21,7 +21,7 @@ /** * Self test tagging annotation. - * + * * @author aherscu * */ diff --git a/qa-jgiven-ssh/src/main/java/dev/aherscu/qa/jgiven/ssh/model/SshInfo.java b/qa-jgiven-ssh/src/main/java/dev/aherscu/qa/jgiven/ssh/model/SshInfo.java index b66f6ea2e2..a9e1fcee98 100644 --- a/qa-jgiven-ssh/src/main/java/dev/aherscu/qa/jgiven/ssh/model/SshInfo.java +++ b/qa-jgiven-ssh/src/main/java/dev/aherscu/qa/jgiven/ssh/model/SshInfo.java @@ -91,7 +91,7 @@ private static String sshPrivateKeyFile(final String defaultName) { * *
  • {@code } -- required, the password; can be empty * - * + * * * @param client * the SSH client diff --git a/qa-jgiven-ssh/src/main/java/dev/aherscu/qa/jgiven/ssh/model/SshScenarioType.java b/qa-jgiven-ssh/src/main/java/dev/aherscu/qa/jgiven/ssh/model/SshScenarioType.java index 640f8755e3..6ac3011526 100644 --- a/qa-jgiven-ssh/src/main/java/dev/aherscu/qa/jgiven/ssh/model/SshScenarioType.java +++ b/qa-jgiven-ssh/src/main/java/dev/aherscu/qa/jgiven/ssh/model/SshScenarioType.java @@ -19,7 +19,7 @@ /** * SSH configuration type of scenario. - * + * * @author aherscu * */ diff --git a/qa-jgiven-ssh/src/main/java/dev/aherscu/qa/jgiven/ssh/steps/SshActions.java b/qa-jgiven-ssh/src/main/java/dev/aherscu/qa/jgiven/ssh/steps/SshActions.java index d5bf392664..eb464444ec 100644 --- a/qa-jgiven-ssh/src/main/java/dev/aherscu/qa/jgiven/ssh/steps/SshActions.java +++ b/qa-jgiven-ssh/src/main/java/dev/aherscu/qa/jgiven/ssh/steps/SshActions.java @@ -39,10 +39,10 @@ /** * Generic SSH configuration actions. Act on previously set configuration. Each * action closes the connection. - * + * * @param * the type of the subclass - * + * * @author aherscu */ @ThreadSafe @@ -112,7 +112,7 @@ private static int portOfOrDefault(final URI url) { /** * Deletes the entire directory of downloaded files. - * + * * @return {@link #self()} */ @NestedSteps @@ -122,7 +122,7 @@ public SELF deleting_downloaded_files() { /** * Downloads a file from target SSH machine to local machine. - * + * * @param url * the machine from which to download * @param file @@ -147,7 +147,7 @@ public SELF downloading(final URI url, final File file) { * Executes a batch command on target SSH machine, using the timeout set by * {@link SshFixtures#execution_timeout(int)} and the target output stream * set by {@link SshFixtures#execution_output_to(OutputStream)}. - * + * * @param url * the machine on which to execute * @param command @@ -163,7 +163,7 @@ public SELF executing(final URI url, final String command) { /** * Executes a batch command on target SSH machine. - * + * * @param url * the machine on which to execute * @param command diff --git a/qa-jgiven-ssh/src/main/java/dev/aherscu/qa/jgiven/ssh/steps/SshFixtures.java b/qa-jgiven-ssh/src/main/java/dev/aherscu/qa/jgiven/ssh/steps/SshFixtures.java index b909408256..69790183ce 100644 --- a/qa-jgiven-ssh/src/main/java/dev/aherscu/qa/jgiven/ssh/steps/SshFixtures.java +++ b/qa-jgiven-ssh/src/main/java/dev/aherscu/qa/jgiven/ssh/steps/SshFixtures.java @@ -86,10 +86,10 @@ public class SshFixtures> /** * Sets up a specific SSH configuration; otherwise the {@link DefaultConfig} * will be used. - * + * * @param config * the configuration to use - * + * * @return {@link #self()} */ public SELF an_SSH_client_configuration(final Config config) { @@ -100,7 +100,7 @@ public SELF an_SSH_client_configuration(final Config config) { /** * Sets the connection timeout on the given SSH client; otherwise * {@link ConnectionDefaults#DEFAULT_CONNECTION_TIMEOUT}. - * + * * @param millis * the read timeout interval, in milliseconds. * @@ -115,7 +115,7 @@ public SELF connection_timeout( /** * Sets the execution output on the given SSH client; otherwise * {@link System#err}. - * + * * @param target * the target output stream * @@ -129,7 +129,7 @@ public SELF execution_output_to(final OutputStream target) { /** * Sets the execution timeout on the given SSH client; otherwise * {@link ConnectionDefaults#DEFAULT_EXECUTION_TIMEOUT}. - * + * * @param millis * the read timeout interval, in milliseconds. * @@ -144,7 +144,7 @@ public SELF execution_timeout( /** * Sets the read timeout on the given SSH client; otherwise * {@link ConnectionDefaults#DEFAULT_READ_TIMEOUT}. - * + * * @param millis * the read timeout interval, in milliseconds. * diff --git a/qa-jgiven-webdriver/src/main/java/dev/aherscu/qa/jgiven/webdriver/ApplicationPerClassWebSessionTest.java b/qa-jgiven-webdriver/src/main/java/dev/aherscu/qa/jgiven/webdriver/ApplicationPerClassWebSessionTest.java index b9f07708a0..0775046586 100644 --- a/qa-jgiven-webdriver/src/main/java/dev/aherscu/qa/jgiven/webdriver/ApplicationPerClassWebSessionTest.java +++ b/qa-jgiven-webdriver/src/main/java/dev/aherscu/qa/jgiven/webdriver/ApplicationPerClassWebSessionTest.java @@ -70,7 +70,7 @@ protected void afterClassQuitWebDriver() { log.debug("after class quitting web driver"); requireNonNull(webDriver.get(), "web driver not initialized nothing to quit") - .safelyQuit(); + .safelyQuit(); } /** @@ -105,7 +105,7 @@ protected void beforeClassOpenWebDriver() { /** * Continues on same device session without recovery. - * + * * @see #continuing_section(Runnable) */ protected void continuing_section() { diff --git a/qa-jgiven-webdriver/src/main/java/dev/aherscu/qa/jgiven/webdriver/ApplicationPerMethodWebSessionTest.java b/qa-jgiven-webdriver/src/main/java/dev/aherscu/qa/jgiven/webdriver/ApplicationPerMethodWebSessionTest.java index a0f01b4e47..d9d5250cbf 100644 --- a/qa-jgiven-webdriver/src/main/java/dev/aherscu/qa/jgiven/webdriver/ApplicationPerMethodWebSessionTest.java +++ b/qa-jgiven-webdriver/src/main/java/dev/aherscu/qa/jgiven/webdriver/ApplicationPerMethodWebSessionTest.java @@ -32,7 +32,7 @@ * {@link WebDriverConfiguration}. This enables each test method to run in its * own thread. *

    - * + * *

    * Eventually, multiple support classes may be derived from this one and * override above behaviors as needed. @@ -71,7 +71,7 @@ protected void afterMethodQuitWebDriver() { log.debug("after method quitting web driver"); requireNonNull(webDriver.get(), "web driver not initialized nothing to quit") - .safelyQuit(); + .safelyQuit(); } /** diff --git a/qa-jgiven-webdriver/src/main/java/dev/aherscu/qa/jgiven/webdriver/WebDriverConfiguration.java b/qa-jgiven-webdriver/src/main/java/dev/aherscu/qa/jgiven/webdriver/WebDriverConfiguration.java index fcedfb95d3..c144d4f0b4 100644 --- a/qa-jgiven-webdriver/src/main/java/dev/aherscu/qa/jgiven/webdriver/WebDriverConfiguration.java +++ b/qa-jgiven-webdriver/src/main/java/dev/aherscu/qa/jgiven/webdriver/WebDriverConfiguration.java @@ -199,7 +199,7 @@ public List requiredCapabilities( .from(requireNonNull(capabilities .getCapability("type"), "internal error, no type capability") - .toString()) + .toString()) .equals(deviceType)) .peek(capabilities -> log.trace("found required capabilities {}", capabilities)) @@ -253,12 +253,12 @@ private Stream loadRequiredCapabilities() { .map(requiredCapabilitiesGroup -> new DesiredCapabilitiesEx( capabilitiesFor( provider() + requiredCapabilitiesGroup.get("type"))) - .with(requiredCapabilitiesGroup - .entrySet() - .stream() - .map(e -> Maps.immutableEntry( - e.getKey(), - e.getValue())))); + .with(requiredCapabilitiesGroup + .entrySet() + .stream() + .map(e -> Maps.immutableEntry( + e.getKey(), + e.getValue())))); } enum DeviceType { diff --git a/qa-jgiven-webdriver/src/main/java/dev/aherscu/qa/jgiven/webdriver/formatters/CapabilitiesFormatter.java b/qa-jgiven-webdriver/src/main/java/dev/aherscu/qa/jgiven/webdriver/formatters/CapabilitiesFormatter.java index b393dd40fa..48d971af17 100644 --- a/qa-jgiven-webdriver/src/main/java/dev/aherscu/qa/jgiven/webdriver/formatters/CapabilitiesFormatter.java +++ b/qa-jgiven-webdriver/src/main/java/dev/aherscu/qa/jgiven/webdriver/formatters/CapabilitiesFormatter.java @@ -30,7 +30,7 @@ /** * Annotation formatter for {@link Capabilities} objects. - * + * * @author aherscu * */ diff --git a/qa-jgiven-webdriver/src/main/java/dev/aherscu/qa/jgiven/webdriver/formatters/WebDriverFormatter.java b/qa-jgiven-webdriver/src/main/java/dev/aherscu/qa/jgiven/webdriver/formatters/WebDriverFormatter.java index c4b7f89ac3..00e89889e5 100644 --- a/qa-jgiven-webdriver/src/main/java/dev/aherscu/qa/jgiven/webdriver/formatters/WebDriverFormatter.java +++ b/qa-jgiven-webdriver/src/main/java/dev/aherscu/qa/jgiven/webdriver/formatters/WebDriverFormatter.java @@ -32,7 +32,7 @@ /** * Annotation formatter for WebDriver. - * + * * @author aherscu * */ diff --git a/qa-jgiven-webdriver/src/main/java/dev/aherscu/qa/jgiven/webdriver/model/WebDriverScenarioType.java b/qa-jgiven-webdriver/src/main/java/dev/aherscu/qa/jgiven/webdriver/model/WebDriverScenarioType.java index 4c8853d96a..2e7ae383c2 100644 --- a/qa-jgiven-webdriver/src/main/java/dev/aherscu/qa/jgiven/webdriver/model/WebDriverScenarioType.java +++ b/qa-jgiven-webdriver/src/main/java/dev/aherscu/qa/jgiven/webdriver/model/WebDriverScenarioType.java @@ -19,7 +19,7 @@ /** * Web Driver type of scenario. - * + * * @author aherscu * */ diff --git a/qa-jgiven-webdriver/src/main/java/dev/aherscu/qa/jgiven/webdriver/tags/UITest.java b/qa-jgiven-webdriver/src/main/java/dev/aherscu/qa/jgiven/webdriver/tags/UITest.java index c44380cb64..bb9a3b77d3 100644 --- a/qa-jgiven-webdriver/src/main/java/dev/aherscu/qa/jgiven/webdriver/tags/UITest.java +++ b/qa-jgiven-webdriver/src/main/java/dev/aherscu/qa/jgiven/webdriver/tags/UITest.java @@ -21,7 +21,7 @@ /** * User interface testing annotation. - * + * * @author aherscu * */ diff --git a/qa-jgiven-webdriver/src/main/java/dev/aherscu/qa/jgiven/webdriver/tags/WebDriverTest.java b/qa-jgiven-webdriver/src/main/java/dev/aherscu/qa/jgiven/webdriver/tags/WebDriverTest.java index a2108d9430..eaf02f778e 100644 --- a/qa-jgiven-webdriver/src/main/java/dev/aherscu/qa/jgiven/webdriver/tags/WebDriverTest.java +++ b/qa-jgiven-webdriver/src/main/java/dev/aherscu/qa/jgiven/webdriver/tags/WebDriverTest.java @@ -21,7 +21,7 @@ /** * Self test tagging annotation. - * + * * @author aherscu * */ diff --git a/qa-orcanos-publisher-maven-plugin/src/main/java/dev/aherscu/qa/orcanos/publisher/maven/plugin/OrcanosPublisherMojo.java b/qa-orcanos-publisher-maven-plugin/src/main/java/dev/aherscu/qa/orcanos/publisher/maven/plugin/OrcanosPublisherMojo.java index 67610bd7a7..81f8930ab0 100644 --- a/qa-orcanos-publisher-maven-plugin/src/main/java/dev/aherscu/qa/orcanos/publisher/maven/plugin/OrcanosPublisherMojo.java +++ b/qa-orcanos-publisher-maven-plugin/src/main/java/dev/aherscu/qa/orcanos/publisher/maven/plugin/OrcanosPublisherMojo.java @@ -193,7 +193,7 @@ private GenericResponse recordExecutionResults( + "on execution set {2} with status {3}", requireNonNull(results.getRun(), "couldn't get execution run result, check orcanos credentials") - .getName(), + .getName(), reportHandle.testId(), reportHandle.executionSetId(), reportHandle.status())); @@ -240,7 +240,7 @@ private void report( retrieveExecutionSetRunResults(orcanosEndpointTarget, reportHandle), uploadReport(orcanosEndpointTarget, reportToUpload)) - .toString()); + .toString()); } catch (final Throwable t) { getLog().error(reportHandle.toString(), t); } diff --git a/qa-orcanos-publisher-maven-plugin/src/main/java/dev/aherscu/qa/orcanos/publisher/maven/plugin/ReportHandle.java b/qa-orcanos-publisher-maven-plugin/src/main/java/dev/aherscu/qa/orcanos/publisher/maven/plugin/ReportHandle.java index 4867bffb3b..c9f1c02339 100644 --- a/qa-orcanos-publisher-maven-plugin/src/main/java/dev/aherscu/qa/orcanos/publisher/maven/plugin/ReportHandle.java +++ b/qa-orcanos-publisher-maven-plugin/src/main/java/dev/aherscu/qa/orcanos/publisher/maven/plugin/ReportHandle.java @@ -57,9 +57,9 @@ final class ReportHandle { /** * Returns the device name from {@code DeviceName} attribute. - * + * * @return the device name - * + * */ public String deviceName() { return attributes.get(DEVICE_NAME); @@ -67,9 +67,9 @@ public String deviceName() { /** * Returns the execution set identifier from {@code Reference} attribute. - * + * * @return the id - * + * */ public String executionSetId() { return substringAfter(reference(), UNDERSCORE); @@ -78,9 +78,9 @@ public String executionSetId() { /** * Returns supported {@code Reference} has an execution set id and a test * case id. - * + * * @return true if has a execution set id - * + * */ public boolean hasSupportedReference() { return reference().matches("\\d+_\\d+"); @@ -88,9 +88,9 @@ public boolean hasSupportedReference() { /** * Returns supported status can be {@code SUCCESS or FAIL}. - * + * * @return true if supported - * + * */ public boolean hasSupportedStatus() { return !Status.UNSUPPORTED.equals(status()); @@ -98,9 +98,9 @@ public boolean hasSupportedStatus() { /** * Returns the platform name from {@code PlatformName} attribute. - * + * * @return platform name - * + * */ public String platformName() { return attributes.get(PLATFORM_NAME); @@ -108,9 +108,9 @@ public String platformName() { /** * Returns the platform version from {@code PlatformVersion} attribute. - * + * * @return platform version - * + * */ public String platformVersion() { return attributes.get(PLATFORM_VERSION); @@ -138,9 +138,9 @@ public String reference() { /** * Returns the report source file to upload. - * + * * @return the source file - * + * */ public File sourceFile() { return sourceFile; @@ -148,9 +148,9 @@ public File sourceFile() { /** * Returns the execution status. - * + * * @return the status - * + * */ public Status status() { return Status.from(status); @@ -158,7 +158,7 @@ public Status status() { /** * Returns the test case identifier from {@code Reference} attribute. - * + * * @return the test id */ public String testId() { diff --git a/qa-s3-publisher-maven-plugin/src/main/java/dev/aherscu/qa/s3/publisher/maven/plugin/S3StaticUploaderMojo.java b/qa-s3-publisher-maven-plugin/src/main/java/dev/aherscu/qa/s3/publisher/maven/plugin/S3StaticUploaderMojo.java index 4e539b8ee3..53ad1358be 100644 --- a/qa-s3-publisher-maven-plugin/src/main/java/dev/aherscu/qa/s3/publisher/maven/plugin/S3StaticUploaderMojo.java +++ b/qa-s3-publisher-maven-plugin/src/main/java/dev/aherscu/qa/s3/publisher/maven/plugin/S3StaticUploaderMojo.java @@ -111,7 +111,7 @@ public class S3StaticUploaderMojo extends AbstractMojo { * for those remote objects which remain unchanged but contain metadata with * expired timestamps. This is useful if you want to enlarge cache lifetime * for unchanged objects when you deploy new versions of the site. - * + * * @parameter default-value= false */ private boolean refreshExpiredObjects; diff --git a/qa-s3-publisher-maven-plugin/src/main/java/dev/aherscu/qa/s3/publisher/maven/plugin/config/Bind.java b/qa-s3-publisher-maven-plugin/src/main/java/dev/aherscu/qa/s3/publisher/maven/plugin/config/Bind.java index 911c1e5ac3..a5f3aa9e85 100644 --- a/qa-s3-publisher-maven-plugin/src/main/java/dev/aherscu/qa/s3/publisher/maven/plugin/config/Bind.java +++ b/qa-s3-publisher-maven-plugin/src/main/java/dev/aherscu/qa/s3/publisher/maven/plugin/config/Bind.java @@ -34,7 +34,7 @@ public class Bind { /** * The id of the metadata which will be applied to all the files matching * the pattern parameter. - * + * * @parameter * @required */ diff --git a/qa-s3-publisher-maven-plugin/src/main/java/dev/aherscu/qa/s3/publisher/maven/plugin/config/Include.java b/qa-s3-publisher-maven-plugin/src/main/java/dev/aherscu/qa/s3/publisher/maven/plugin/config/Include.java index 72f735c597..81b0f369ca 100644 --- a/qa-s3-publisher-maven-plugin/src/main/java/dev/aherscu/qa/s3/publisher/maven/plugin/config/Include.java +++ b/qa-s3-publisher-maven-plugin/src/main/java/dev/aherscu/qa/s3/publisher/maven/plugin/config/Include.java @@ -34,7 +34,7 @@ public class Include { /** * List of binds specifying constraints in order to override metadata for a * subset of files. - * + * * @parameter */ List constraints; diff --git a/qa-s3-publisher-maven-plugin/src/main/java/dev/aherscu/qa/s3/publisher/maven/plugin/util/S3Uploader.java b/qa-s3-publisher-maven-plugin/src/main/java/dev/aherscu/qa/s3/publisher/maven/plugin/util/S3Uploader.java index e7243674d2..11223af936 100644 --- a/qa-s3-publisher-maven-plugin/src/main/java/dev/aherscu/qa/s3/publisher/maven/plugin/util/S3Uploader.java +++ b/qa-s3-publisher-maven-plugin/src/main/java/dev/aherscu/qa/s3/publisher/maven/plugin/util/S3Uploader.java @@ -111,7 +111,7 @@ private CopyObjectRequest buildCopyObjectRequest( final ObjectMetadata objectMetadata) { return new CopyObjectRequest(bucketName, remoteFileName, bucketName, remoteFileName) - .withNewObjectMetadata(objectMetadata); + .withNewObjectMetadata(objectMetadata); } private File encodeManagedFile(final ManagedFile managedFile) diff --git a/qa-testing-extra/src/main/java/dev/aherscu/qa/testing/extra/CsvUtils.java b/qa-testing-extra/src/main/java/dev/aherscu/qa/testing/extra/CsvUtils.java index 077b28cdf3..85b98c3fdf 100644 --- a/qa-testing-extra/src/main/java/dev/aherscu/qa/testing/extra/CsvUtils.java +++ b/qa-testing-extra/src/main/java/dev/aherscu/qa/testing/extra/CsvUtils.java @@ -34,7 +34,7 @@ public final class CsvUtils { /** * Provides a Java 8 stream wrapper around a CSV I/O stream. - * + * * @param inputStream * input stream for CSV data * @return non parallel stream of CSV lines parsed as String array diff --git a/qa-testing-extra/src/main/java/dev/aherscu/qa/testing/extra/ParallelLoop.java b/qa-testing-extra/src/main/java/dev/aherscu/qa/testing/extra/ParallelLoop.java index 74838c7824..123dc9dbf3 100644 --- a/qa-testing-extra/src/main/java/dev/aherscu/qa/testing/extra/ParallelLoop.java +++ b/qa-testing-extra/src/main/java/dev/aherscu/qa/testing/extra/ParallelLoop.java @@ -25,7 +25,7 @@ /** * Parallel looping with specified threads, repetitions and block of code. - * + * *

    * NOTE: there is a library class at * https://github.com/pablormier/parallel-loops @@ -56,7 +56,7 @@ public ParallelLoop() { /** * Runs specified function in configured loop. - * + * * @param function * the function to run; is called with the run identifier and * expected to return it @@ -79,7 +79,7 @@ public void run(final Function function) { /** * Runs specified consumer in configured loop. - * + * * @param consumer * the consumer to run; is called with the run identifier. */ diff --git a/qa-testing-extra/src/main/java/dev/aherscu/qa/testing/extra/ReadMultiWriteLock.java b/qa-testing-extra/src/main/java/dev/aherscu/qa/testing/extra/ReadMultiWriteLock.java index dbb0c07ac8..b11c505056 100644 --- a/qa-testing-extra/src/main/java/dev/aherscu/qa/testing/extra/ReadMultiWriteLock.java +++ b/qa-testing-extra/src/main/java/dev/aherscu/qa/testing/extra/ReadMultiWriteLock.java @@ -26,7 +26,7 @@ /** * Based on * http://tutorials.jenkov.com/java-concurrency/read-write-locks.html#simple - * + * *

    * Allows for multiple writers. *

    @@ -94,7 +94,7 @@ public static void writeLocking(final Runnable criticalSection) { /** * Waits for writers to finish and accounts for another reader lock. - * + * * @throws InterruptedException * if this thread was interrupted */ @@ -117,7 +117,7 @@ public synchronized void readingRelease() { /** * Waits for readers to finish and accounts for another writer lock. - * + * * @throws InterruptedException * if this thread was interrupted */ diff --git a/qa-testing-extra/src/main/java/dev/aherscu/qa/testing/extra/pooling/AutoReturnable.java b/qa-testing-extra/src/main/java/dev/aherscu/qa/testing/extra/pooling/AutoReturnable.java index 2c03be5d83..2c64ae55cd 100644 --- a/qa-testing-extra/src/main/java/dev/aherscu/qa/testing/extra/pooling/AutoReturnable.java +++ b/qa-testing-extra/src/main/java/dev/aherscu/qa/testing/extra/pooling/AutoReturnable.java @@ -31,7 +31,7 @@ public class AutoReturnable implements AutoCloseable { /** * Returns the object to its pool. - * + * * @throws Exception * pooled object is missing reference to originating pool; * should not happen if borrowed via diff --git a/qa-testing-extra/src/main/java/dev/aherscu/qa/testing/extra/pooling/AutoReturnableObjectFactory.java b/qa-testing-extra/src/main/java/dev/aherscu/qa/testing/extra/pooling/AutoReturnableObjectFactory.java index cb17a2c59c..420a094b18 100644 --- a/qa-testing-extra/src/main/java/dev/aherscu/qa/testing/extra/pooling/AutoReturnableObjectFactory.java +++ b/qa-testing-extra/src/main/java/dev/aherscu/qa/testing/extra/pooling/AutoReturnableObjectFactory.java @@ -31,7 +31,7 @@ /** * Creates {@link AutoReturnable}s. To be used with * {@link AutoReturnableObjectPool}. - * + * * @param * type of object to pool */ @@ -61,7 +61,7 @@ public AutoReturnableObjectFactory(final List objects) { /** * As long as there are available objects, creates a pooled object. - * + * * @return a pooled object * @throws Exception * should not happen diff --git a/qa-testing-extra/src/main/java/dev/aherscu/qa/testing/extra/pooling/AutoReturnableObjectPool.java b/qa-testing-extra/src/main/java/dev/aherscu/qa/testing/extra/pooling/AutoReturnableObjectPool.java index 6d378a3bdc..197f2218f4 100644 --- a/qa-testing-extra/src/main/java/dev/aherscu/qa/testing/extra/pooling/AutoReturnableObjectPool.java +++ b/qa-testing-extra/src/main/java/dev/aherscu/qa/testing/extra/pooling/AutoReturnableObjectPool.java @@ -29,7 +29,7 @@ * pooled object is borrowed it will not be borrowed to other running test. * Borrowed pooled objects shall be returned as soon as possible in order not * block other tests running in parallel. - * + * * @param * type of object to pool */ diff --git a/qa-testing-extra/src/main/java/dev/aherscu/qa/testing/extra/supermachine/BeanScanner.java b/qa-testing-extra/src/main/java/dev/aherscu/qa/testing/extra/supermachine/BeanScanner.java index e93504998b..3dc05fc2ef 100644 --- a/qa-testing-extra/src/main/java/dev/aherscu/qa/testing/extra/supermachine/BeanScanner.java +++ b/qa-testing-extra/src/main/java/dev/aherscu/qa/testing/extra/supermachine/BeanScanner.java @@ -23,7 +23,7 @@ /** * A scanner traversing an object graph. - * + * * @param * the type of the traversed items. */ @@ -65,7 +65,7 @@ public Scanner find(Class clazz) { /** * Traverses the object graph for each items of this scanner and returns a * scanner emitting all found items of the given type. - * + * * @param clazz * the type selector. * @param diff --git a/qa-testing-extra/src/main/java/dev/aherscu/qa/testing/extra/supermachine/Scanner.java b/qa-testing-extra/src/main/java/dev/aherscu/qa/testing/extra/supermachine/Scanner.java index 7dcd03ee13..335fb7db5e 100644 --- a/qa-testing-extra/src/main/java/dev/aherscu/qa/testing/extra/supermachine/Scanner.java +++ b/qa-testing-extra/src/main/java/dev/aherscu/qa/testing/extra/supermachine/Scanner.java @@ -22,7 +22,7 @@ /** * Abstraction wrapping a data structure that can be walked through to produce * streams. - * + * * @param * the type of elements composing the data structure. */ @@ -74,7 +74,7 @@ public Scanner filter(Predicate predicate) { * Scans the elements of the source and returns a scanner emitting relevant * items of the given type. This method can return fewer items according to * subclass logic. Subclasses implement the actual scanning algorithm. - * + * * @param clazz * the type selector. * @param diff --git a/qa-testing-extra/src/main/java/dev/aherscu/qa/testing/extra/supermachine/StreamScanner.java b/qa-testing-extra/src/main/java/dev/aherscu/qa/testing/extra/supermachine/StreamScanner.java index 4936acf698..e0f321142d 100644 --- a/qa-testing-extra/src/main/java/dev/aherscu/qa/testing/extra/supermachine/StreamScanner.java +++ b/qa-testing-extra/src/main/java/dev/aherscu/qa/testing/extra/supermachine/StreamScanner.java @@ -20,7 +20,7 @@ /** * A scanner iterating over items of a stream. Nothing really fancy. - * + * * @param * the types of the stream items. */ @@ -32,7 +32,7 @@ private StreamScanner(Stream stream) { /** * Create a scanner iterating over a stream. - * + * * @param stream * the stream to scan. * @param diff --git a/qa-testing-extra/src/main/java/dev/aherscu/qa/testing/extra/testng/DisableSslCertificateValidation.java b/qa-testing-extra/src/main/java/dev/aherscu/qa/testing/extra/testng/DisableSslCertificateValidation.java index 396cd513d9..385961e991 100644 --- a/qa-testing-extra/src/main/java/dev/aherscu/qa/testing/extra/testng/DisableSslCertificateValidation.java +++ b/qa-testing-extra/src/main/java/dev/aherscu/qa/testing/extra/testng/DisableSslCertificateValidation.java @@ -23,7 +23,7 @@ /** * Disables SSL certificate validation before the TestNG test suites begins * execution. This allows running with self-signed certificates. - * + * *

    * Usage: TestNG diff --git a/qa-testing-extra/src/main/java/dev/aherscu/qa/testing/extra/yaml/YamlReader.java b/qa-testing-extra/src/main/java/dev/aherscu/qa/testing/extra/yaml/YamlReader.java index 3d8b4f63b5..0e4fea9aa2 100644 --- a/qa-testing-extra/src/main/java/dev/aherscu/qa/testing/extra/yaml/YamlReader.java +++ b/qa-testing-extra/src/main/java/dev/aherscu/qa/testing/extra/yaml/YamlReader.java @@ -26,7 +26,7 @@ /** * Wraps the {@link com.esotericsoftware.yamlbeans.YamlReader} in order to * implement {@link java.io.Closeable}. - * + * * @param * the type to read * @@ -39,12 +39,12 @@ public class YamlReader /** * Creates a file-based YAML reader; you should call {@link #close()} in * order to release it. - * + * * @param from * the file to read from * @throws IOException * if the file cannot be open for reading - * + * * @see com.esotericsoftware.yamlbeans.YamlReader#YamlReader(Reader) */ public YamlReader(final File from) throws IOException { @@ -57,7 +57,7 @@ public YamlReader(final File from) throws IOException { /** * @param reader * the reader - * + * * @see com.esotericsoftware.yamlbeans.YamlReader#YamlReader(Reader) */ public YamlReader(final Reader reader) { @@ -70,7 +70,7 @@ public YamlReader(final Reader reader) { * @return object read * @throws YamlException * if anything fails - * + * * @see com.esotericsoftware.yamlbeans.YamlReader#read(Class) */ public T read(final Class type) diff --git a/qa-testing-extra/src/main/java/dev/aherscu/qa/testing/extra/yaml/YamlWriter.java b/qa-testing-extra/src/main/java/dev/aherscu/qa/testing/extra/yaml/YamlWriter.java index 2d5e8a7e1f..e7bdfa8403 100644 --- a/qa-testing-extra/src/main/java/dev/aherscu/qa/testing/extra/yaml/YamlWriter.java +++ b/qa-testing-extra/src/main/java/dev/aherscu/qa/testing/extra/yaml/YamlWriter.java @@ -25,7 +25,7 @@ /** * Wraps the {@link com.esotericsoftware.yamlbeans.YamlWriter} in order to * implement {@link java.io.Closeable}. - * + * * @param * the type to write * @@ -38,7 +38,7 @@ public class YamlWriter /** * Creates a YAML writer based on a supplied file; you should call * {@link #close()} in order to release it. - * + * * @param file * the file * @throws IOException @@ -54,7 +54,7 @@ public YamlWriter(final File file) throws IOException { /** * @param writer * the writer - * + * * @see com.esotericsoftware.yamlbeans.YamlWriter#YamlWriter(Writer) */ public YamlWriter(final Writer writer) { @@ -66,7 +66,7 @@ public YamlWriter(final Writer writer) { * the type to read * @throws YamlException * if anything fails - * + * * @see com.esotericsoftware.yamlbeans.YamlWriter#write(Object) */ public void write(final T object) throws YamlException { diff --git a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/Base64Utils.java b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/Base64Utils.java index 4890278b7c..387be98f85 100644 --- a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/Base64Utils.java +++ b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/Base64Utils.java @@ -33,11 +33,11 @@ public class Base64Utils { /** * Encodes a specified UUID in short textual format compatible with URI * spec. - * + * * @param uuid * a UUID (16 bytes) * @return a 22 character Base64-encoded string of given UUID - * + * * @throws NullPointerException * if the UUID is null */ @@ -55,7 +55,7 @@ public static String encode(final UUID uuid) { /** * Encodes a specified long in short textual format compatible with URI * spec. - * + * * @param l * a long (8-bytes) * @return a 11 character Base64-encoded string of given long diff --git a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/EnumUtils.java b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/EnumUtils.java index 56e823b644..ece53a6ac4 100644 --- a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/EnumUtils.java +++ b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/EnumUtils.java @@ -26,7 +26,7 @@ /** * Enumeration utilities. - * + * * @author aherscu * */ diff --git a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/FileUtilsExtensions.java b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/FileUtilsExtensions.java index f29e080d57..0036a537c1 100644 --- a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/FileUtilsExtensions.java +++ b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/FileUtilsExtensions.java @@ -30,7 +30,7 @@ /** * Provides encoding-safe file readers and writers. - * + * * @author aherscu * */ @@ -40,12 +40,12 @@ public final class FileUtilsExtensions extends FileUtils { * Reads lines from source file and appends them into target file, checking * whether the parent directory exists, and creating it if it does not * exist. - * + * * @param sourceFile * the source file * @param targetFile * the target file - * + * * @throws IOException * in case of an I/O error */ @@ -68,7 +68,7 @@ public static void append(final File sourceFile, final File targetFile) /** * Constructs a {@link File} by specified name relative to specified class. - * + * * @param clazz * the class from which package to compute * @param name @@ -78,12 +78,12 @@ public static void append(final File sourceFile, final File targetFile) public static File file(final Class clazz, final String name) { return new File(requireNonNull(clazz.getResource(name), name + "resource missing") - .getPath()); + .getPath()); } /** * Constructs a {@link FileReader} using {@link StandardCharsets#UTF_8}. - * + * * @param from * the file from which to read * @return the reader @@ -96,7 +96,7 @@ public static Reader fileReader(final File from) throws IOException { /** * Constructs a {@link FileWriter} using {@link StandardCharsets#UTF_8}. - * + * * @param to * the file to which to write * @return the writer diff --git a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/FilenameUtilsExtensions.java b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/FilenameUtilsExtensions.java index a140e478ed..ea62e67074 100644 --- a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/FilenameUtilsExtensions.java +++ b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/FilenameUtilsExtensions.java @@ -35,12 +35,12 @@ public class FilenameUtilsExtensions extends FilenameUtils { /** * Gets the base name, minus the full path and extension, from a full * filename. - * + * * @param file * the filename to query, null returns null * @return the name of the file without the path, or an empty string if none * exists - * + * * @see FilenameUtils#getBaseName(String) */ public String getBaseName(final File file) { diff --git a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/ImageUtils.java b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/ImageUtils.java index fcbf6a66bd..9fa0b26608 100644 --- a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/ImageUtils.java +++ b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/ImageUtils.java @@ -185,7 +185,7 @@ public static double areaOf(final BufferedImage image) { /** * Makes two images same size by scaling down the image with bigger area. - * + * * @param pair * images to adapt * @return adapted images @@ -352,7 +352,7 @@ public Pipeline scale( /** * Difference between this image and other image. - * + * * @param other * image to find difference from * @param differentiator diff --git a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/MapUtils.java b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/MapUtils.java index 2df0a22941..783dbb0f83 100644 --- a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/MapUtils.java +++ b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/MapUtils.java @@ -24,7 +24,7 @@ /** * Map utilities. - * + * * @author aherscu * */ @@ -32,19 +32,19 @@ public final class MapUtils { /** * Creates a map from a list of pairs. - * + * * @param pairs * one ore more pairs; if none, an empty map will be returned - * + * * @param * the type of left-side of the pair; this will become the key of * the map * @param * the type of right-side of the pair; this will become the value * of the map - * + * * @return the map of pairs - * + * * @see Pair */ @SafeVarargs diff --git a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/NumberUtils.java b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/NumberUtils.java index c3b7c3885a..d5f98a6d99 100644 --- a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/NumberUtils.java +++ b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/NumberUtils.java @@ -25,7 +25,7 @@ /** * Number utilities. - * + * * @author aherscu * */ diff --git a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/ObjectUtilsExtensions.java b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/ObjectUtilsExtensions.java index 550d33de8c..19ecb20f19 100644 --- a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/ObjectUtilsExtensions.java +++ b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/ObjectUtilsExtensions.java @@ -29,7 +29,7 @@ /** * Object utilities. - * + * * @author aherscu * */ @@ -98,7 +98,7 @@ public static T requireNonNull(final T obj, final RuntimeException e) { /** * Returns a string representation of specified object, while keeping the * length of its fields to the specified length. - * + * * @param obj * the object from which to extract the string * @param separator diff --git a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/TemplateUtils.java b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/TemplateUtils.java index f448f30acf..499924e9c1 100644 --- a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/TemplateUtils.java +++ b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/TemplateUtils.java @@ -32,7 +32,7 @@ /** * Template utilities. - * + * * @author aherscu * */ diff --git a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/ThreadUtils.java b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/ThreadUtils.java index 1f05c14835..86a5576506 100644 --- a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/ThreadUtils.java +++ b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/ThreadUtils.java @@ -21,7 +21,7 @@ /** * Thread utilities. - * + * * @author aherscu * */ @@ -33,7 +33,7 @@ public final class ThreadUtils { /** * Safe alternative to {@link Thread#join()}. - * + * * @param thread * the thread to join * @param timeoutMs @@ -46,7 +46,7 @@ public static void join(final Thread thread, final int timeoutMs) { /** * Safe alternative to {@link Thread#sleep(long)} - * + * * @param millis * how many milliseconds to sleep */ diff --git a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/UriUtils.java b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/UriUtils.java index 412816f30e..93b05b7368 100644 --- a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/UriUtils.java +++ b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/UriUtils.java @@ -35,7 +35,7 @@ public class UriUtils { * Extracts the last segment of the path of specified URL. For example, for * {@code http://somewhere.com/path/to/resource}, {@code resource} would be * returned. - * + * * @param url * the URL * @return the last segment of the specified URL @@ -57,7 +57,7 @@ public static List listOfStringsFrom(final List uris) { * Extracts the password from specified URL. For example, for * {@code http://jdoe:s3cr3t@somewhere.com/path/to/resource}, {@code s3cr3t} * would be returned. - * + * * @param url * the URL * @return the password @@ -68,7 +68,7 @@ public static String passwordFrom(final URI url) { /** * Extracts a path segment from specified URL. - * + * * @param url * the URL * @param n @@ -81,7 +81,7 @@ public static String pathSegmentFrom(final URI url, final int n) { /** * Sneakily re-throws the {@link URISyntaxException} thrown by {@link URI}. - * + * * @param url * the {@code String} to parse as a URL * @return {@link URL#URL(String)} @@ -93,7 +93,7 @@ public static URI quietUriFrom(final String url) { /** * Removes username and password from specified URL. - * + * * @param url * the URL * @return URL without username and password @@ -107,7 +107,7 @@ public static URI stripUserInfoFrom(final URI url) { * Extracts the user-name from specified URL. For example, for * {@code http://jdoe:s3cr3t@somewhere.com/path/to/resource}, {@code jdoe} * would be returned. - * + * * @param url * the URL * @return the password diff --git a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/UrlUtils.java b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/UrlUtils.java index 2668ea9cc5..e0ce4d207a 100644 --- a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/UrlUtils.java +++ b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/UrlUtils.java @@ -39,7 +39,7 @@ public static String hostOf(final String url) { /** * Checks whether specified URL is well-formed. - * + * * @param url * the URL to check * @return true if URL is well-formed, namely if {@code new URL(url)} does @@ -59,7 +59,7 @@ public static boolean isUrl(final String url) { /** * Sneakily re-throws the {@link MalformedURLException} thrown by * {@link URL#URL(String)}. - * + * * @param url * the {@code String} to parse as a URL * @return {@link URL} diff --git a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/assertions/Assertion.java b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/assertions/Assertion.java index 595acdf398..c99ba0276e 100644 --- a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/assertions/Assertion.java +++ b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/assertions/Assertion.java @@ -19,7 +19,7 @@ import org.hamcrest.*; /** - * + * * * @param * type of expression to assert @@ -33,7 +33,7 @@ public abstract class Assertion extends MutablePair> { /** * Constructs an assertion. - * + * * @param expr * the expression * @param matcher diff --git a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/assertions/JXPathAsserter.java b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/assertions/JXPathAsserter.java index 95cdc03c72..f6bf9b4a7a 100644 --- a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/assertions/JXPathAsserter.java +++ b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/assertions/JXPathAsserter.java @@ -16,7 +16,7 @@ package dev.aherscu.qa.testing.utils.assertions; /** - * + * * * @author Adrian Herscu * @@ -25,7 +25,7 @@ public interface JXPathAsserter { /** * Asserts that expected contents match. - * + * * @param expectedContents * the expected contents * @@ -36,7 +36,7 @@ JXPathAsserter assertHas( /** * Asserts that expected contents match. - * + * * @param expectedContents * the expected contents * diff --git a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/assertions/JXPathAsserterImpl.java b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/assertions/JXPathAsserterImpl.java index 88f7a37c90..cec21dde95 100644 --- a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/assertions/JXPathAsserterImpl.java +++ b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/assertions/JXPathAsserterImpl.java @@ -60,7 +60,7 @@ public JXPathAsserter assertHas( } else { assertThatThrownBy( () -> context.getValue(jxpathAssertion.left)) - .isInstanceOf(JXPathNotFoundException.class); + .isInstanceOf(JXPathNotFoundException.class); } } catch (final AssertionError e) { assertionErrors.add( diff --git a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/assertions/JXPathAssertion.java b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/assertions/JXPathAssertion.java index e13bbcc7e4..859e607fe3 100644 --- a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/assertions/JXPathAssertion.java +++ b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/assertions/JXPathAssertion.java @@ -17,14 +17,14 @@ /** * Represents an JXPath assertion as a path paired with a Hamcrest matcher. - * + * *

    * NOTE: not designed for serialization *

    * * @param * type of data to match - * + * * @author aherscu */ @SuppressWarnings("serial") @@ -34,7 +34,7 @@ public class JXPathAssertion extends Assertion { /** * Constructs a JXPath assertion without and expected value. Use to assert * path existence only. - * + * * @param jxpath * the JXPath */ diff --git a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/assertions/JsonAsserterEx.java b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/assertions/JsonAsserterEx.java index 673e8db7a9..ce2ce26d07 100644 --- a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/assertions/JsonAsserterEx.java +++ b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/assertions/JsonAsserterEx.java @@ -27,7 +27,7 @@ public interface JsonAsserterEx extends JsonAsserter { /** * Asserts that expected contents match. - * + * * @param expectedContents * the expected contents * @@ -38,7 +38,7 @@ JsonAsserter assertHas( /** * Asserts that expected contents match. - * + * * @param expectedContents * the expected contents * diff --git a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/assertions/JsonAssertion.java b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/assertions/JsonAssertion.java index de9a0eb05c..dee8f2a0d8 100644 --- a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/assertions/JsonAssertion.java +++ b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/assertions/JsonAssertion.java @@ -19,14 +19,14 @@ /** * Represents a JSON assertion as a JSON path paired with a Hamcrest matcher. - * + * *

    * NOTE: not designed for serialization *

    * * @param * type of data to match - * + * * @author aherscu */ @SuppressWarnings("serial") @@ -36,7 +36,7 @@ public class JsonAssertion extends Assertion { /** * Constructs a JSON assertion without a matcher. Use to assert path * existence only. - * + * * @param jsonPath * the JSON path */ @@ -46,7 +46,7 @@ public JsonAssertion(final String jsonPath) { /** * Constructs a JSON assertion with specified matcher. - * + * * @param jsonPath * the JSON path * @param matcher diff --git a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/config/BaseConfiguration.java b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/config/BaseConfiguration.java index eafb70db43..ccd2ffa81f 100644 --- a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/config/BaseConfiguration.java +++ b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/config/BaseConfiguration.java @@ -39,7 +39,7 @@ public class BaseConfiguration /** * Loads the specified configurations. - * + * * @param configurations * the additional configurations; might be null or empty */ diff --git a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/config/Configurable.java b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/config/Configurable.java index 1aacd1255d..7540c2ea70 100644 --- a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/config/Configurable.java +++ b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/config/Configurable.java @@ -17,9 +17,9 @@ /** * Base class for all things that use {@link AbstractConfiguration}. - * + * * @author aherscu - * + * * @param * configuration type */ @@ -31,7 +31,7 @@ public class Configurable> { /** * Sets up configuration. - * + * * @param configuration * the configuration; if null, operations requiring configuration * will fail @@ -42,7 +42,7 @@ protected Configurable(final T configuration) { /** * Resolves a value according to configured definitions. - * + * * @param value * the value to resolve definitions references within * @return the resolved value diff --git a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/logging/LoggingInputStream.java b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/logging/LoggingInputStream.java index 2c15bfdd13..892b112f18 100644 --- a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/logging/LoggingInputStream.java +++ b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/logging/LoggingInputStream.java @@ -26,11 +26,11 @@ * Logs the information passing through an input stream at * trace level. The information will be logged upon * {@link #close()}. - * + * * @see Logger - * + * * @author aherscu - * + * */ @SuppressFBWarnings("LO_SUSPECT_LOG_PARAMETER") public class LoggingInputStream @@ -39,7 +39,7 @@ public class LoggingInputStream /** * Initializes a logging input stream. - * + * * @param input * the input stream to log * @param logger diff --git a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/logging/LoggingOutputStream.java b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/logging/LoggingOutputStream.java index ed275ecbc4..f6a356494f 100644 --- a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/logging/LoggingOutputStream.java +++ b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/logging/LoggingOutputStream.java @@ -26,11 +26,11 @@ * Logs the information passing through an output stream at * trace level. The information will be logged upon * {@link #close()}. - * + * * @see Logger - * + * * @author aherscu - * + * */ @SuppressFBWarnings("LO_SUSPECT_LOG_PARAMETER") public class LoggingOutputStream @@ -39,7 +39,7 @@ public class LoggingOutputStream /** * Initializes a logging output stream. - * + * * @param output * the output stream to log * @param logger diff --git a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/AbstractJaxbReadableProvider.java b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/AbstractJaxbReadableProvider.java index 1a26ebf2b1..5aec4e0c94 100644 --- a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/AbstractJaxbReadableProvider.java +++ b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/AbstractJaxbReadableProvider.java @@ -26,7 +26,7 @@ /** * Provides common XML unmarshalling over REST. - * + * * @author aherscu * * @param diff --git a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/AbstractJaxbWriteableProvider.java b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/AbstractJaxbWriteableProvider.java index 2204bf1034..cc247a4d6a 100644 --- a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/AbstractJaxbWriteableProvider.java +++ b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/AbstractJaxbWriteableProvider.java @@ -27,7 +27,7 @@ /** * Provides common XML marshalling over REST. - * + * * @author aherscu * * @param @@ -38,7 +38,7 @@ public abstract class AbstractJaxbWriteableProvider extends AbstractWriteableProvider { /** * The root XML element name to use when marshalling. - * + * * @see #writeTo(Object, Class, Type, Annotation[], MediaType, * MultivaluedMap, OutputStream) */ @@ -46,7 +46,7 @@ public abstract class AbstractJaxbWriteableProvider /** * Initializes this provider to use a specified root XML element name. - * + * * @param elementName * to be used as the name of the root XML element */ diff --git a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/AbstractReadableProvider.java b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/AbstractReadableProvider.java index 09a8e1abbb..0c4f0f5a70 100644 --- a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/AbstractReadableProvider.java +++ b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/AbstractReadableProvider.java @@ -23,7 +23,7 @@ /** * Provides common implementation. - * + * * @author aherscu * * @param diff --git a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/AbstractRestApplication.java b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/AbstractRestApplication.java index 7fec5e4542..2260511f85 100644 --- a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/AbstractRestApplication.java +++ b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/AbstractRestApplication.java @@ -26,7 +26,7 @@ /** * Holds the classes comprising a REST application. - * + * * @author aherscu * */ @@ -38,7 +38,7 @@ public abstract class AbstractRestApplication extends Application { /** * Sets up an REST application by scanning a given package for {@link Path} * annotated classes. - * + * * @param packageName * the name of the package to scan */ diff --git a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/AbstractWriteableProvider.java b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/AbstractWriteableProvider.java index 79db038af6..b8c31030e9 100644 --- a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/AbstractWriteableProvider.java +++ b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/AbstractWriteableProvider.java @@ -23,7 +23,7 @@ /** * Provides common implementation. - * + * * @author aherscu * * @param diff --git a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/OAuthRequestFilter.java b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/OAuthRequestFilter.java index e539497062..77062200a4 100644 --- a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/OAuthRequestFilter.java +++ b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/OAuthRequestFilter.java @@ -35,7 +35,7 @@ *

    * Your concrete implementation may look like this: *

    - * + * *
      * protected TokenBlock retrieveTokenBlockFor(
      *     final ClientRequestContext context) {
    diff --git a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/ResponseExtensions.java b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/ResponseExtensions.java
    index b027978406..06e5725bbd 100644
    --- a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/ResponseExtensions.java
    +++ b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/ResponseExtensions.java
    @@ -22,7 +22,7 @@
     
     /**
      * Fixes the JAX RS API a bit...
    - * 
    + *
      * @author aherscu
      *
      */
    @@ -30,14 +30,14 @@
     public final class ResponseExtensions {
         /**
          * Closes this response and returns it; enables fluent coding style.
    -     * 
    +     *
          * 

    * Assuming that you have the Lombok library in your classpath, then * applying {@code @ExtensionMethod({ ResponseExtensions.class })} on your * class will allow you to use * {@code target.request().get().closeThis().getCookies()...}, where * {@code target} is a {@link WebTarget}. - * + * * @param thisResponse * this response * @return the closed response diff --git a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/RestClientUtils.java b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/RestClientUtils.java index fa8eacc2ee..4c72b7ce9c 100644 --- a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/RestClientUtils.java +++ b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/RestClientUtils.java @@ -23,16 +23,16 @@ /** * Provides REST client utility functions. - * + * * @author aherscu - * + * */ @UtilityClass public final class RestClientUtils { /** * Tests whether the status is successful. - * + * * @param status * the REST status * @return true if the status belongs to {@link Family#SUCCESSFUL} @@ -43,7 +43,7 @@ public static boolean successful(final Response.StatusType status) { /** * Tests whether the status is unauthorised. - * + * * @param status * the REST status * @return true if the status was {@link Status#UNAUTHORIZED} diff --git a/qa-testrail-reporter/src/main/java/dev/aherscu/qa/testrail/reporter/TestRailClient.java b/qa-testrail-reporter/src/main/java/dev/aherscu/qa/testrail/reporter/TestRailClient.java index 72455d3c8c..790889ed1c 100644 --- a/qa-testrail-reporter/src/main/java/dev/aherscu/qa/testrail/reporter/TestRailClient.java +++ b/qa-testrail-reporter/src/main/java/dev/aherscu/qa/testrail/reporter/TestRailClient.java @@ -50,7 +50,7 @@ private static String getAuthorization(String user, String password) { * Get/Set Password *

    * Returns/sets the password used for authenticating the API requests. - * + * * @return the password */ public String getPassword() { @@ -65,7 +65,7 @@ public void setPassword(String password) { * Get/Set User *

    * Returns/sets the user used for authenticating the API requests. - * + * * @return the user */ public String getUser() { @@ -92,7 +92,7 @@ public void setUser(String user) { * same as java.util.Map. *

    * If 'get_attachment/:attachment_id', returns a String - * + * * @param uri * uri * @param data @@ -123,7 +123,7 @@ public Object sendGet(String uri) { * an instance of JSONObject or JSONArray (depending on the API method). In * most cases, this returns a JSONObject instance which is basically the * same as java.util.Map. - * + * * @param uri * uri * @param data diff --git a/qa-testrail-reporter/src/main/java/dev/aherscu/qa/testrail/reporter/TestRailReportModel.java b/qa-testrail-reporter/src/main/java/dev/aherscu/qa/testrail/reporter/TestRailReportModel.java index cb5cf30263..c6524f870f 100644 --- a/qa-testrail-reporter/src/main/java/dev/aherscu/qa/testrail/reporter/TestRailReportModel.java +++ b/qa-testrail-reporter/src/main/java/dev/aherscu/qa/testrail/reporter/TestRailReportModel.java @@ -56,12 +56,12 @@ public class TestRailReportModel extends QaJGivenReportModel { /** * To be called from Mustache template for saving screenshots as separate * PNG files, in a directory matching the name of the test report file. - * + * *

    * These are later picked up by the {@link TestRailReporter} and attached to * the test result in TestRail. *

    - * + * * @param frag * Mustache fragment to process, assumed to be a screenshot in * Base64 PNG format diff --git a/qa-testrail-reporter/src/main/java/dev/aherscu/qa/testrail/reporter/TestRailReporter.java b/qa-testrail-reporter/src/main/java/dev/aherscu/qa/testrail/reporter/TestRailReporter.java index 621ee03094..b86a59a136 100644 --- a/qa-testrail-reporter/src/main/java/dev/aherscu/qa/testrail/reporter/TestRailReporter.java +++ b/qa-testrail-reporter/src/main/java/dev/aherscu/qa/testrail/reporter/TestRailReporter.java @@ -161,13 +161,13 @@ protected void reportGenerated( // ISSUE sometimes throws UncheckedIOException listScreenshots( new File(outputDirectory, targetNameFor(scenarioModel))) - .forEach(file -> { - log.trace("attaching {}", file); - val attachScreenshotsResponse = - addAttachmentToResult(addResultForCaseResponse.id, - file); - log.debug("attached {}", attachScreenshotsResponse.id); - }); + .forEach(file -> { + log.trace("attaching {}", file); + val attachScreenshotsResponse = + addAttachmentToResult(addResultForCaseResponse.id, + file); + log.debug("attached {}", attachScreenshotsResponse.id); + }); } catch (final Exception e) { log.error("failed to report case {} on run {} -> {}", From 74d8a915c94bfc4f9f72ccfd9e998f1ff69d6c27 Mon Sep 17 00:00:00 2001 From: Adrian Herscu Date: Thu, 12 Oct 2023 15:34:47 +0300 Subject: [PATCH 09/49] upgraded dependencies --- pom.xml | 18 ++++++------- qa-jgiven-commons/pom.xml | 24 ++++++++--------- qa-jgiven-rabbitmq/pom.xml | 2 +- qa-jgiven-reporter/pom.xml | 9 +------ qa-jgiven-rest/pom.xml | 2 +- qa-jgiven-ssh/pom.xml | 2 +- qa-jgiven-webdriver/pom.xml | 2 +- qa-orcanos-publisher-maven-plugin/pom.xml | 9 +------ qa-s3-publisher-maven-plugin/pom.xml | 2 +- qa-testing-example/pom.xml | 2 +- qa-testing-extra/pom.xml | 26 +++++-------------- qa-testing-parent/pom.xml | 2 +- qa-testing-utils/pom.xml | 24 ++++++++--------- .../qa/testing/utils/IOUtilsExtensions.java | 1 - 14 files changed, 49 insertions(+), 76 deletions(-) diff --git a/pom.xml b/pom.xml index 18509ddc51..46381dd57f 100644 --- a/pom.xml +++ b/pom.xml @@ -111,10 +111,9 @@ - 1.9.2 + 1.9.20.1 - - 3.9.4 + 3.9.5 3.9.0 ${java.version} ${java.version} @@ -126,10 +125,10 @@ true - 2.3.1 + 2.4.0-b180830.0359 2.40 2.15.2 - 1.7.36 + 2.0.9 info 30000 @@ -231,7 +230,7 @@ org.jooq jool - 0.9.14 + 0.9.15 org.projectlombok @@ -257,7 +256,7 @@ ch.qos.logback logback-classic - 1.2.3 + 1.4.11 org.slf4j @@ -277,7 +276,8 @@ org.glassfish.jaxb jaxb-runtime - ${jaxb.version} + + 2.4.0-b180830.0438 @@ -589,7 +589,7 @@ org.slf4j slf4j-simple - 1.7.13 + ${slf4j.version} - 29.0-jre - - dev.aherscu.qa qa-testing-utils diff --git a/qa-jgiven-rest/pom.xml b/qa-jgiven-rest/pom.xml index 00f77ef2a0..0d6ad7daa8 100644 --- a/qa-jgiven-rest/pom.xml +++ b/qa-jgiven-rest/pom.xml @@ -44,7 +44,7 @@ org.skyscreamer jsonassert - 1.5.0 + 1.5.1 diff --git a/qa-jgiven-ssh/pom.xml b/qa-jgiven-ssh/pom.xml index 20ea2a438b..4dbe2865c2 100644 --- a/qa-jgiven-ssh/pom.xml +++ b/qa-jgiven-ssh/pom.xml @@ -46,7 +46,7 @@ com.hierynomus sshj - 0.35.0 + 0.37.0 diff --git a/qa-jgiven-webdriver/pom.xml b/qa-jgiven-webdriver/pom.xml index ffca3f50a6..f7edcc1202 100644 --- a/qa-jgiven-webdriver/pom.xml +++ b/qa-jgiven-webdriver/pom.xml @@ -47,7 +47,7 @@ org.seleniumhq.selenium htmlunit-driver - 2.39.0 + 2.70.0 test diff --git a/qa-orcanos-publisher-maven-plugin/pom.xml b/qa-orcanos-publisher-maven-plugin/pom.xml index cc7ea8c855..428649e60c 100644 --- a/qa-orcanos-publisher-maven-plugin/pom.xml +++ b/qa-orcanos-publisher-maven-plugin/pom.xml @@ -93,7 +93,7 @@ com.j2html j2html - 1.4.0 + 1.6.0 @@ -162,13 +162,6 @@ test - - com.github.tomakehurst - wiremock-jre8 - 2.26.3 - test - - org.xmlunit xmlunit-core diff --git a/qa-s3-publisher-maven-plugin/pom.xml b/qa-s3-publisher-maven-plugin/pom.xml index 30efbda8a1..19a438d5a6 100644 --- a/qa-s3-publisher-maven-plugin/pom.xml +++ b/qa-s3-publisher-maven-plugin/pom.xml @@ -79,7 +79,7 @@ com.amazonaws aws-java-sdk - 1.12.406 + 1.12.565 diff --git a/qa-testing-example/pom.xml b/qa-testing-example/pom.xml index cb3ebd0b7a..67212d8757 100644 --- a/qa-testing-example/pom.xml +++ b/qa-testing-example/pom.xml @@ -48,7 +48,7 @@ org.mock-server mockserver-netty - 5.14.0 + 5.15.0 dev.aherscu.qa diff --git a/qa-testing-extra/pom.xml b/qa-testing-extra/pom.xml index b412f88ba9..937c8b2a5e 100644 --- a/qa-testing-extra/pom.xml +++ b/qa-testing-extra/pom.xml @@ -67,14 +67,14 @@ org.apache.commons commons-pool2 - 2.8.0 + 2.12.0 com.amazonaws aws-java-sdk-cognitoidp - 1.12.418 + 1.12.565 commons-logging @@ -86,7 +86,7 @@ com.opencsv opencsv - 4.4 + 5.8 commons-logging @@ -101,18 +101,6 @@ 3.2.1 - - com.google.guava - guava - 27.0.1-jre - - - com.google.code.findbugs - jsr305 - - - - javax.ws.rs javax.ws.rs-api @@ -122,13 +110,13 @@ com.esotericsoftware.yamlbeans yamlbeans - 1.13 + 1.15 org.apache.commons commons-lang3 - 3.8.1 + 3.13.0 @@ -140,7 +128,7 @@ com.github.rodionmoiseev.c10n c10n-core - 1.2 + 1.3 @@ -192,7 +180,7 @@ commons-cli commons-cli - 1.4 + 1.5.0 diff --git a/qa-testing-parent/pom.xml b/qa-testing-parent/pom.xml index 6471d5b7d1..e76d706303 100644 --- a/qa-testing-parent/pom.xml +++ b/qa-testing-parent/pom.xml @@ -96,7 +96,7 @@ org.jooq jooq - 3.17.7 + 3.18.7 org.projectlombok diff --git a/qa-testing-utils/pom.xml b/qa-testing-utils/pom.xml index a7f0c6f3d9..76ef97c1f9 100644 --- a/qa-testing-utils/pom.xml +++ b/qa-testing-utils/pom.xml @@ -80,7 +80,7 @@ org.hamcrest hamcrest - 2.1 + 2.2 @@ -92,7 +92,7 @@ net.coobird thumbnailator - 0.4.19 + 0.4.20 @@ -142,13 +142,13 @@ org.apache.commons commons-text - 1.6 + 1.10.0 com.google.guava guava - 27.0.1-jre + 32.1.3-jre com.google.code.findbugs @@ -166,19 +166,19 @@ org.apache.commons commons-lang3 - 3.8.1 + 3.13.0 commons-io commons-io - 2.11.0 + 2.14.0 commons-codec commons-codec - 1.11 + 1.16.0 @@ -215,7 +215,7 @@ com.jayway.jsonpath json-path-assert - 2.6.0 + 2.8.0 @@ -233,15 +233,15 @@ - com.github.tomakehurst - wiremock-jre8 - 2.35.0 + org.wiremock + wiremock + 3.2.0 com.samskivert jmustache - 1.14 + 1.15 diff --git a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/IOUtilsExtensions.java b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/IOUtilsExtensions.java index 28010d9983..12efff8e01 100644 --- a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/IOUtilsExtensions.java +++ b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/IOUtilsExtensions.java @@ -43,7 +43,6 @@ public static Properties propertiesFrom(final File file) { } } - @SneakyThrows(IOException.class) public static List readUTF8Lines(final InputStream in) { return IOUtils.readLines(in, UTF_8); } From add8361c50fb9d0097bb94268b1ae9d32554670f Mon Sep 17 00:00:00 2001 From: Adrian Herscu Date: Thu, 12 Oct 2023 19:14:10 +0300 Subject: [PATCH 10/49] upgraded to jersey 3 --- pom.xml | 2 +- .../aherscu/qa/jgiven/commons/TestRuntimeException.java | 3 +-- .../aherscu/qa/jgiven/rest/formatters/FormFormatter.java | 3 ++- .../dev/aherscu/qa/jgiven/rest/steps/RestActions.java | 4 ++-- .../dev/aherscu/qa/jgiven/rest/steps/RestFixtures.java | 2 +- .../aherscu/qa/jgiven/rest/steps/RestVerifications.java | 4 ++-- .../qa/jgiven/rest/scenarios/GenericRestClientTest.java | 4 ++-- .../qa/jgiven/rest/scenarios/GenericRestTest.java | 2 +- .../publisher/maven/plugin/OrcanosPublisherMojo.java | 9 ++++----- .../publisher/maven/plugin/OrcanosPublisherMojoTest.java | 2 +- .../qa/orcanos/publisher/maven/plugin/SelfTest.java | 8 ++++---- .../qa/testing/example/AbstractMockServerTest.java | 3 +-- .../scenarios/tutorial6/GenericMockServerRestTest.java | 4 ++-- .../example/scenarios/tutorial6/GenericRestTest.java | 2 +- .../example/scenarios/tutorial6/StatefulRestTest.java | 4 ++-- qa-testing-extra/pom.xml | 6 +++--- .../testing/extra/rest/AwsCognitoSrpRequestFilter.java | 4 ++-- qa-testing-utils/pom.xml | 6 +++--- .../testing/utils/rest/AbstractJaxbReadableProvider.java | 2 +- .../utils/rest/AbstractJaxbWriteableProvider.java | 2 +- .../qa/testing/utils/rest/AbstractReadableProvider.java | 4 ++-- .../qa/testing/utils/rest/AbstractRestApplication.java | 5 ++--- .../qa/testing/utils/rest/AbstractWriteableProvider.java | 4 ++-- .../testing/utils/rest/AuthenticationRequestFilter.java | 8 ++++---- .../qa/testing/utils/rest/AutoCloseableClient.java | 3 +-- .../qa/testing/utils/rest/AutoCloseableResponse.java | 3 +-- .../qa/testing/utils/rest/LoggingClientBuilder.java | 3 +-- .../qa/testing/utils/rest/LoggingReaderInterceptor.java | 3 +-- .../qa/testing/utils/rest/LoggingRequestFilter.java | 4 ++-- .../qa/testing/utils/rest/LoggingResponseFilter.java | 4 ++-- .../qa/testing/utils/rest/LoggingWriterInterceptor.java | 3 +-- .../qa/testing/utils/rest/OAuthRequestFilter.java | 5 ++--- .../qa/testing/utils/rest/ResponseExtensions.java | 5 ++--- .../aherscu/qa/testing/utils/rest/RestClientUtils.java | 7 +++---- .../qa/testrail/reporter/TestRailReporterTest.java | 2 +- 35 files changed, 64 insertions(+), 75 deletions(-) diff --git a/pom.xml b/pom.xml index 46381dd57f..d55c87e310 100644 --- a/pom.xml +++ b/pom.xml @@ -126,7 +126,7 @@ true 2.4.0-b180830.0359 - 2.40 + 3.1.3 2.15.2 2.0.9 info diff --git a/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/TestRuntimeException.java b/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/TestRuntimeException.java index b3790d6c05..2bccb9b2ff 100644 --- a/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/TestRuntimeException.java +++ b/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/TestRuntimeException.java @@ -17,10 +17,9 @@ import java.net.*; -import javax.ws.rs.*; - import org.openqa.selenium.*; +import jakarta.ws.rs.*; import lombok.extern.slf4j.*; /** diff --git a/qa-jgiven-rest/src/main/java/dev/aherscu/qa/jgiven/rest/formatters/FormFormatter.java b/qa-jgiven-rest/src/main/java/dev/aherscu/qa/jgiven/rest/formatters/FormFormatter.java index 695e0e020c..8aa5470a71 100644 --- a/qa-jgiven-rest/src/main/java/dev/aherscu/qa/jgiven/rest/formatters/FormFormatter.java +++ b/qa-jgiven-rest/src/main/java/dev/aherscu/qa/jgiven/rest/formatters/FormFormatter.java @@ -18,13 +18,14 @@ import java.lang.annotation.*; import javax.annotation.concurrent.*; -import javax.ws.rs.core.*; import org.openqa.selenium.*; import com.tngtech.jgiven.annotation.*; import com.tngtech.jgiven.format.*; +import jakarta.ws.rs.core.*; + /** * Annotation formatter for {@link Form} objects. * diff --git a/qa-jgiven-rest/src/main/java/dev/aherscu/qa/jgiven/rest/steps/RestActions.java b/qa-jgiven-rest/src/main/java/dev/aherscu/qa/jgiven/rest/steps/RestActions.java index c6693bf2c9..a5bc83fbf1 100644 --- a/qa-jgiven-rest/src/main/java/dev/aherscu/qa/jgiven/rest/steps/RestActions.java +++ b/qa-jgiven-rest/src/main/java/dev/aherscu/qa/jgiven/rest/steps/RestActions.java @@ -24,8 +24,6 @@ import javax.annotation.concurrent.*; import javax.validation.constraints.*; -import javax.ws.rs.client.*; -import javax.ws.rs.core.*; import com.tngtech.jgiven.annotation.*; @@ -33,6 +31,8 @@ import dev.aherscu.qa.jgiven.rest.formatters.*; import dev.aherscu.qa.jgiven.rest.model.*; import dev.aherscu.qa.testing.utils.rest.*; +import jakarta.ws.rs.client.*; +import jakarta.ws.rs.core.*; import lombok.*; import lombok.extern.slf4j.*; import net.jodah.failsafe.*; diff --git a/qa-jgiven-rest/src/main/java/dev/aherscu/qa/jgiven/rest/steps/RestFixtures.java b/qa-jgiven-rest/src/main/java/dev/aherscu/qa/jgiven/rest/steps/RestFixtures.java index 6b853f5fc4..60cc55ce88 100644 --- a/qa-jgiven-rest/src/main/java/dev/aherscu/qa/jgiven/rest/steps/RestFixtures.java +++ b/qa-jgiven-rest/src/main/java/dev/aherscu/qa/jgiven/rest/steps/RestFixtures.java @@ -18,12 +18,12 @@ import static java.util.Objects.*; import javax.annotation.concurrent.*; -import javax.ws.rs.client.*; import com.tngtech.jgiven.annotation.*; import dev.aherscu.qa.jgiven.commons.steps.*; import dev.aherscu.qa.jgiven.rest.model.*; +import jakarta.ws.rs.client.*; import lombok.extern.slf4j.*; /** diff --git a/qa-jgiven-rest/src/main/java/dev/aherscu/qa/jgiven/rest/steps/RestVerifications.java b/qa-jgiven-rest/src/main/java/dev/aherscu/qa/jgiven/rest/steps/RestVerifications.java index e83025dfdc..1b186d2cfa 100644 --- a/qa-jgiven-rest/src/main/java/dev/aherscu/qa/jgiven/rest/steps/RestVerifications.java +++ b/qa-jgiven-rest/src/main/java/dev/aherscu/qa/jgiven/rest/steps/RestVerifications.java @@ -18,8 +18,6 @@ import java.util.function.*; import javax.annotation.concurrent.*; -import javax.ws.rs.client.*; -import javax.ws.rs.core.*; import org.hamcrest.*; import org.json.*; @@ -31,6 +29,8 @@ import dev.aherscu.qa.jgiven.commons.steps.*; import dev.aherscu.qa.jgiven.rest.model.*; import dev.aherscu.qa.testing.utils.assertions.*; +import jakarta.ws.rs.client.*; +import jakarta.ws.rs.core.*; import lombok.*; import lombok.extern.slf4j.*; diff --git a/qa-jgiven-rest/src/test/java/dev/aherscu/qa/jgiven/rest/scenarios/GenericRestClientTest.java b/qa-jgiven-rest/src/test/java/dev/aherscu/qa/jgiven/rest/scenarios/GenericRestClientTest.java index b974adbc4e..baff54d02b 100644 --- a/qa-jgiven-rest/src/test/java/dev/aherscu/qa/jgiven/rest/scenarios/GenericRestClientTest.java +++ b/qa-jgiven-rest/src/test/java/dev/aherscu/qa/jgiven/rest/scenarios/GenericRestClientTest.java @@ -17,8 +17,8 @@ import java.net.*; -import javax.ws.rs.*; -import javax.ws.rs.client.*; +import jakarta.ws.rs.*; +import jakarta.ws.rs.client.*; import org.testng.annotations.*; diff --git a/qa-jgiven-rest/src/test/java/dev/aherscu/qa/jgiven/rest/scenarios/GenericRestTest.java b/qa-jgiven-rest/src/test/java/dev/aherscu/qa/jgiven/rest/scenarios/GenericRestTest.java index e4e02e8c25..5e6c17b0dd 100644 --- a/qa-jgiven-rest/src/test/java/dev/aherscu/qa/jgiven/rest/scenarios/GenericRestTest.java +++ b/qa-jgiven-rest/src/test/java/dev/aherscu/qa/jgiven/rest/scenarios/GenericRestTest.java @@ -19,7 +19,7 @@ import static java.util.Arrays.*; import static org.hamcrest.Matchers.equalTo; -import javax.ws.rs.client.*; +import jakarta.ws.rs.client.*; import org.testng.annotations.*; diff --git a/qa-orcanos-publisher-maven-plugin/src/main/java/dev/aherscu/qa/orcanos/publisher/maven/plugin/OrcanosPublisherMojo.java b/qa-orcanos-publisher-maven-plugin/src/main/java/dev/aherscu/qa/orcanos/publisher/maven/plugin/OrcanosPublisherMojo.java index 81f8930ab0..06d5abc7a2 100644 --- a/qa-orcanos-publisher-maven-plugin/src/main/java/dev/aherscu/qa/orcanos/publisher/maven/plugin/OrcanosPublisherMojo.java +++ b/qa-orcanos-publisher-maven-plugin/src/main/java/dev/aherscu/qa/orcanos/publisher/maven/plugin/OrcanosPublisherMojo.java @@ -19,12 +19,12 @@ import static dev.aherscu.qa.jgiven.reporter.QaJGivenPerMethodReporter.*; import static dev.aherscu.qa.testing.utils.FileUtilsExtensions.*; import static dev.aherscu.qa.testing.utils.UriUtils.*; +import static jakarta.ws.rs.client.Entity.*; +import static jakarta.ws.rs.core.MediaType.*; import static java.text.MessageFormat.*; import static java.util.Objects.*; import static java.util.UUID.*; import static java.util.regex.Pattern.*; -import static javax.ws.rs.client.Entity.*; -import static javax.ws.rs.core.MediaType.*; import static org.apache.commons.io.IOUtils.*; import static org.glassfish.jersey.client.ClientProperties.*; @@ -33,9 +33,6 @@ import java.util.*; import java.util.regex.*; -import javax.ws.rs.*; -import javax.ws.rs.client.*; - import org.apache.commons.io.filefilter.*; import org.apache.maven.plugin.*; import org.apache.maven.plugins.annotations.*; @@ -49,6 +46,8 @@ import dev.aherscu.qa.orcanos.publisher.maven.plugin.model.*; import dev.aherscu.qa.testing.utils.*; import dev.aherscu.qa.testing.utils.rest.*; +import jakarta.ws.rs.*; +import jakarta.ws.rs.client.*; import lombok.*; /** diff --git a/qa-orcanos-publisher-maven-plugin/src/test/java/dev/aherscu/qa/orcanos/publisher/maven/plugin/OrcanosPublisherMojoTest.java b/qa-orcanos-publisher-maven-plugin/src/test/java/dev/aherscu/qa/orcanos/publisher/maven/plugin/OrcanosPublisherMojoTest.java index 8550665095..c0b3379703 100644 --- a/qa-orcanos-publisher-maven-plugin/src/test/java/dev/aherscu/qa/orcanos/publisher/maven/plugin/OrcanosPublisherMojoTest.java +++ b/qa-orcanos-publisher-maven-plugin/src/test/java/dev/aherscu/qa/orcanos/publisher/maven/plugin/OrcanosPublisherMojoTest.java @@ -26,7 +26,7 @@ import java.io.*; import java.net.*; -import javax.ws.rs.client.*; +import jakarta.ws.rs.client.*; import org.apache.maven.plugin.testing.*; diff --git a/qa-orcanos-publisher-maven-plugin/src/test/java/dev/aherscu/qa/orcanos/publisher/maven/plugin/SelfTest.java b/qa-orcanos-publisher-maven-plugin/src/test/java/dev/aherscu/qa/orcanos/publisher/maven/plugin/SelfTest.java index a27676d1e0..71395c8da5 100644 --- a/qa-orcanos-publisher-maven-plugin/src/test/java/dev/aherscu/qa/orcanos/publisher/maven/plugin/SelfTest.java +++ b/qa-orcanos-publisher-maven-plugin/src/test/java/dev/aherscu/qa/orcanos/publisher/maven/plugin/SelfTest.java @@ -18,13 +18,13 @@ import static com.github.tomakehurst.wiremock.client.WireMock.*; import static dev.aherscu.qa.testing.utils.WireMockServerUtils.*; -import static javax.ws.rs.client.Entity.*; -import static javax.ws.rs.core.HttpHeaders.*; -import static javax.ws.rs.core.MediaType.*; +import static jakarta.ws.rs.client.Entity.*; +import static jakarta.ws.rs.core.HttpHeaders.*; +import static jakarta.ws.rs.core.MediaType.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import javax.ws.rs.client.*; +import jakarta.ws.rs.client.*; import org.testng.annotations.*; diff --git a/qa-testing-example/src/main/java/dev/aherscu/qa/testing/example/AbstractMockServerTest.java b/qa-testing-example/src/main/java/dev/aherscu/qa/testing/example/AbstractMockServerTest.java index 3cdc11a850..9e45806b81 100644 --- a/qa-testing-example/src/main/java/dev/aherscu/qa/testing/example/AbstractMockServerTest.java +++ b/qa-testing-example/src/main/java/dev/aherscu/qa/testing/example/AbstractMockServerTest.java @@ -18,8 +18,6 @@ import java.io.*; import java.net.*; -import javax.ws.rs.core.*; - import org.mockserver.client.*; import org.mockserver.integration.*; import org.testng.annotations.*; @@ -28,6 +26,7 @@ import dev.aherscu.qa.jgiven.commons.steps.*; import dev.aherscu.qa.jgiven.commons.utils.*; import dev.aherscu.qa.testing.utils.config.*; +import jakarta.ws.rs.core.*; import lombok.*; import lombok.extern.slf4j.*; diff --git a/qa-testing-example/src/test/java/dev/aherscu/qa/testing/example/scenarios/tutorial6/GenericMockServerRestTest.java b/qa-testing-example/src/test/java/dev/aherscu/qa/testing/example/scenarios/tutorial6/GenericMockServerRestTest.java index 1391b7bff3..798df83ec6 100644 --- a/qa-testing-example/src/test/java/dev/aherscu/qa/testing/example/scenarios/tutorial6/GenericMockServerRestTest.java +++ b/qa-testing-example/src/test/java/dev/aherscu/qa/testing/example/scenarios/tutorial6/GenericMockServerRestTest.java @@ -17,7 +17,7 @@ import static dev.aherscu.qa.testing.utils.StringUtilsExtensions.*; import static java.util.Arrays.*; -import static javax.ws.rs.core.Response.Status.Family.*; +import static jakarta.ws.rs.core.Response.Status.Family.*; import static org.hamcrest.Matchers.*; import static org.mockserver.matchers.Times.*; import static org.mockserver.model.HttpError.*; @@ -27,7 +27,7 @@ import java.util.*; -import javax.ws.rs.client.*; +import jakarta.ws.rs.client.*; import org.mockserver.mock.*; import org.mockserver.model.*; diff --git a/qa-testing-example/src/test/java/dev/aherscu/qa/testing/example/scenarios/tutorial6/GenericRestTest.java b/qa-testing-example/src/test/java/dev/aherscu/qa/testing/example/scenarios/tutorial6/GenericRestTest.java index 42eb932e62..01a40d3e72 100644 --- a/qa-testing-example/src/test/java/dev/aherscu/qa/testing/example/scenarios/tutorial6/GenericRestTest.java +++ b/qa-testing-example/src/test/java/dev/aherscu/qa/testing/example/scenarios/tutorial6/GenericRestTest.java @@ -20,7 +20,7 @@ import static org.hamcrest.Matchers.*; import static org.hamcrest.Matchers.equalTo; -import javax.ws.rs.client.*; +import jakarta.ws.rs.client.*; import org.testng.annotations.*; diff --git a/qa-testing-example/src/test/java/dev/aherscu/qa/testing/example/scenarios/tutorial6/StatefulRestTest.java b/qa-testing-example/src/test/java/dev/aherscu/qa/testing/example/scenarios/tutorial6/StatefulRestTest.java index 0fba42566b..6bba0b02b5 100644 --- a/qa-testing-example/src/test/java/dev/aherscu/qa/testing/example/scenarios/tutorial6/StatefulRestTest.java +++ b/qa-testing-example/src/test/java/dev/aherscu/qa/testing/example/scenarios/tutorial6/StatefulRestTest.java @@ -21,8 +21,8 @@ import static org.hamcrest.Matchers.*; import static org.hamcrest.Matchers.equalTo; -import javax.ws.rs.client.*; -import javax.ws.rs.core.*; +import jakarta.ws.rs.client.*; +import jakarta.ws.rs.core.*; import org.testng.annotations.*; diff --git a/qa-testing-extra/pom.xml b/qa-testing-extra/pom.xml index 937c8b2a5e..f7e37145f4 100644 --- a/qa-testing-extra/pom.xml +++ b/qa-testing-extra/pom.xml @@ -102,9 +102,9 @@ - javax.ws.rs - javax.ws.rs-api - 2.1.1 + jakarta.ws.rs + jakarta.ws.rs-api + 3.1.0 diff --git a/qa-testing-extra/src/main/java/dev/aherscu/qa/testing/extra/rest/AwsCognitoSrpRequestFilter.java b/qa-testing-extra/src/main/java/dev/aherscu/qa/testing/extra/rest/AwsCognitoSrpRequestFilter.java index 84cfe39a69..e7df0dbaa6 100644 --- a/qa-testing-extra/src/main/java/dev/aherscu/qa/testing/extra/rest/AwsCognitoSrpRequestFilter.java +++ b/qa-testing-extra/src/main/java/dev/aherscu/qa/testing/extra/rest/AwsCognitoSrpRequestFilter.java @@ -15,11 +15,11 @@ */ package dev.aherscu.qa.testing.extra.rest; -import static javax.ws.rs.core.HttpHeaders.*; +import static jakarta.ws.rs.core.HttpHeaders.*; import javax.annotation.concurrent.*; -import javax.ws.rs.client.*; +import jakarta.ws.rs.client.*; import lombok.*; /** diff --git a/qa-testing-utils/pom.xml b/qa-testing-utils/pom.xml index 76ef97c1f9..395e3370f4 100644 --- a/qa-testing-utils/pom.xml +++ b/qa-testing-utils/pom.xml @@ -158,9 +158,9 @@ - javax.ws.rs - javax.ws.rs-api - 2.1.1 + jakarta.ws.rs + jakarta.ws.rs-api + 3.1.0 diff --git a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/AbstractJaxbReadableProvider.java b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/AbstractJaxbReadableProvider.java index 5aec4e0c94..3150ae2275 100644 --- a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/AbstractJaxbReadableProvider.java +++ b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/AbstractJaxbReadableProvider.java @@ -19,9 +19,9 @@ import java.lang.annotation.*; import java.lang.reflect.*; -import javax.ws.rs.core.*; import javax.xml.bind.*; +import jakarta.ws.rs.core.*; import lombok.extern.slf4j.*; /** diff --git a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/AbstractJaxbWriteableProvider.java b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/AbstractJaxbWriteableProvider.java index cc247a4d6a..c334da31b5 100644 --- a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/AbstractJaxbWriteableProvider.java +++ b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/AbstractJaxbWriteableProvider.java @@ -19,10 +19,10 @@ import java.lang.annotation.*; import java.lang.reflect.*; -import javax.ws.rs.core.*; import javax.xml.bind.*; import javax.xml.namespace.*; +import jakarta.ws.rs.core.*; import lombok.extern.slf4j.*; /** diff --git a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/AbstractReadableProvider.java b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/AbstractReadableProvider.java index 0c4f0f5a70..65c50b11c7 100644 --- a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/AbstractReadableProvider.java +++ b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/AbstractReadableProvider.java @@ -18,8 +18,8 @@ import java.lang.annotation.*; import java.lang.reflect.*; -import javax.ws.rs.core.*; -import javax.ws.rs.ext.*; +import jakarta.ws.rs.core.*; +import jakarta.ws.rs.ext.*; /** * Provides common implementation. diff --git a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/AbstractRestApplication.java b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/AbstractRestApplication.java index 2260511f85..4d9e77e250 100644 --- a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/AbstractRestApplication.java +++ b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/AbstractRestApplication.java @@ -17,11 +17,10 @@ import java.util.*; -import javax.ws.rs.*; -import javax.ws.rs.core.*; - import org.reflections.*; +import jakarta.ws.rs.*; +import jakarta.ws.rs.core.*; import lombok.extern.slf4j.*; /** diff --git a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/AbstractWriteableProvider.java b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/AbstractWriteableProvider.java index b8c31030e9..db74f2531c 100644 --- a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/AbstractWriteableProvider.java +++ b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/AbstractWriteableProvider.java @@ -18,8 +18,8 @@ import java.lang.annotation.*; import java.lang.reflect.*; -import javax.ws.rs.core.*; -import javax.ws.rs.ext.*; +import jakarta.ws.rs.core.*; +import jakarta.ws.rs.ext.*; /** * Provides common implementation. diff --git a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/AuthenticationRequestFilter.java b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/AuthenticationRequestFilter.java index 2ddc4e5762..64781b3e29 100644 --- a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/AuthenticationRequestFilter.java +++ b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/AuthenticationRequestFilter.java @@ -18,13 +18,13 @@ import java.nio.charset.*; import javax.annotation.*; -import javax.ws.rs.*; -import javax.ws.rs.client.*; -import javax.ws.rs.core.*; -import javax.ws.rs.ext.*; import org.apache.commons.codec.binary.*; +import jakarta.ws.rs.*; +import jakarta.ws.rs.client.*; +import jakarta.ws.rs.core.*; +import jakarta.ws.rs.ext.*; import lombok.*; import lombok.extern.slf4j.*; diff --git a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/AutoCloseableClient.java b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/AutoCloseableClient.java index 58df988595..8b80cf2a53 100644 --- a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/AutoCloseableClient.java +++ b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/AutoCloseableClient.java @@ -15,9 +15,8 @@ */ package dev.aherscu.qa.testing.utils.rest; -import javax.ws.rs.client.*; - import edu.umd.cs.findbugs.annotations.*; +import jakarta.ws.rs.client.*; import lombok.experimental.*; import lombok.extern.slf4j.*; diff --git a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/AutoCloseableResponse.java b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/AutoCloseableResponse.java index f5c94ceced..442cc11898 100644 --- a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/AutoCloseableResponse.java +++ b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/AutoCloseableResponse.java @@ -17,9 +17,8 @@ import java.lang.SuppressWarnings; -import javax.ws.rs.core.*; - import edu.umd.cs.findbugs.annotations.*; +import jakarta.ws.rs.core.*; import lombok.experimental.*; import lombok.extern.slf4j.*; diff --git a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/LoggingClientBuilder.java b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/LoggingClientBuilder.java index 8dc4e3720b..473f05b43f 100644 --- a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/LoggingClientBuilder.java +++ b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/LoggingClientBuilder.java @@ -15,8 +15,7 @@ */ package dev.aherscu.qa.testing.utils.rest; -import javax.ws.rs.client.*; - +import jakarta.ws.rs.client.*; import lombok.experimental.*; import lombok.extern.slf4j.*; diff --git a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/LoggingReaderInterceptor.java b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/LoggingReaderInterceptor.java index 4e7e089872..36b8fe08b5 100644 --- a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/LoggingReaderInterceptor.java +++ b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/LoggingReaderInterceptor.java @@ -19,9 +19,8 @@ import java.io.*; import java.util.function.*; -import javax.ws.rs.ext.*; - import dev.aherscu.qa.testing.utils.logging.*; +import jakarta.ws.rs.ext.*; /** * Use to log the inbound stream. diff --git a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/LoggingRequestFilter.java b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/LoggingRequestFilter.java index c65960a710..2e79dd0f96 100644 --- a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/LoggingRequestFilter.java +++ b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/LoggingRequestFilter.java @@ -18,8 +18,8 @@ import java.text.*; import java.util.function.*; -import javax.ws.rs.client.*; -import javax.ws.rs.ext.*; +import jakarta.ws.rs.client.*; +import jakarta.ws.rs.ext.*; /** * Logs client JAX-RS requests. diff --git a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/LoggingResponseFilter.java b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/LoggingResponseFilter.java index d0cae654eb..288f47939e 100644 --- a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/LoggingResponseFilter.java +++ b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/LoggingResponseFilter.java @@ -18,8 +18,8 @@ import java.text.*; import java.util.function.*; -import javax.ws.rs.client.*; -import javax.ws.rs.ext.*; +import jakarta.ws.rs.client.*; +import jakarta.ws.rs.ext.*; /** * Logs client JAX-RS requests. diff --git a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/LoggingWriterInterceptor.java b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/LoggingWriterInterceptor.java index 1f983023cb..fb7f190512 100644 --- a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/LoggingWriterInterceptor.java +++ b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/LoggingWriterInterceptor.java @@ -19,9 +19,8 @@ import java.io.*; import java.util.function.*; -import javax.ws.rs.ext.*; - import dev.aherscu.qa.testing.utils.logging.*; +import jakarta.ws.rs.ext.*; /** * Use to log the outbound stream. diff --git a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/OAuthRequestFilter.java b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/OAuthRequestFilter.java index 77062200a4..321e84610b 100644 --- a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/OAuthRequestFilter.java +++ b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/OAuthRequestFilter.java @@ -15,17 +15,16 @@ */ package dev.aherscu.qa.testing.utils.rest; +import static jakarta.ws.rs.core.HttpHeaders.*; import static java.util.Objects.*; -import static javax.ws.rs.core.HttpHeaders.*; import static org.apache.commons.lang3.StringUtils.*; import java.time.*; -import javax.ws.rs.client.*; - import com.fasterxml.jackson.annotation.*; import com.google.common.cache.*; +import jakarta.ws.rs.client.*; import lombok.*; import lombok.experimental.*; import lombok.extern.jackson.*; diff --git a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/ResponseExtensions.java b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/ResponseExtensions.java index 06e5725bbd..bc0a1b1685 100644 --- a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/ResponseExtensions.java +++ b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/ResponseExtensions.java @@ -15,9 +15,8 @@ */ package dev.aherscu.qa.testing.utils.rest; -import javax.ws.rs.client.*; -import javax.ws.rs.core.*; - +import jakarta.ws.rs.client.*; +import jakarta.ws.rs.core.*; import lombok.experimental.*; /** diff --git a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/RestClientUtils.java b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/RestClientUtils.java index 4c72b7ce9c..e1181c9807 100644 --- a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/RestClientUtils.java +++ b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/rest/RestClientUtils.java @@ -15,10 +15,9 @@ */ package dev.aherscu.qa.testing.utils.rest; -import javax.ws.rs.core.*; -import javax.ws.rs.core.Response.*; -import javax.ws.rs.core.Response.Status.*; - +import jakarta.ws.rs.core.*; +import jakarta.ws.rs.core.Response.*; +import jakarta.ws.rs.core.Response.Status.*; import lombok.experimental.*; /** diff --git a/qa-testrail-reporter/src/test/java/dev/aherscu/qa/testrail/reporter/TestRailReporterTest.java b/qa-testrail-reporter/src/test/java/dev/aherscu/qa/testrail/reporter/TestRailReporterTest.java index 108d97f8ae..93bf52b65f 100644 --- a/qa-testrail-reporter/src/test/java/dev/aherscu/qa/testrail/reporter/TestRailReporterTest.java +++ b/qa-testrail-reporter/src/test/java/dev/aherscu/qa/testrail/reporter/TestRailReporterTest.java @@ -25,7 +25,7 @@ import java.io.*; -import javax.ws.rs.core.*; +import jakarta.ws.rs.core.*; import org.testng.annotations.*; import org.testng.xml.*; From dccd3667680a6931be5a817ac3ded31964bba6b8 Mon Sep 17 00:00:00 2001 From: Adrian Herscu Date: Fri, 13 Oct 2023 11:28:02 +0300 Subject: [PATCH 11/49] minor versions --- .mvn/wrapper/maven-wrapper.properties | 2 +- pom.xml | 2 +- qa-testing-parent/pom.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties index 0c1ecc3462..b361d0396b 100644 --- a/.mvn/wrapper/maven-wrapper.properties +++ b/.mvn/wrapper/maven-wrapper.properties @@ -13,5 +13,5 @@ # See the License for the specific language governing permissions and # limitations under the License. # -distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.4/apache-maven-3.9.4-bin.zip +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.5/apache-maven-3.9.5-bin.zip wrapperUrl =https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar diff --git a/pom.xml b/pom.xml index d55c87e310..06fa59805c 100644 --- a/pom.xml +++ b/pom.xml @@ -127,7 +127,7 @@ 2.4.0-b180830.0359 3.1.3 - 2.15.2 + 2.15.3 2.0.9 info diff --git a/qa-testing-parent/pom.xml b/qa-testing-parent/pom.xml index e76d706303..37acd2f751 100644 --- a/qa-testing-parent/pom.xml +++ b/qa-testing-parent/pom.xml @@ -167,7 +167,7 @@ org.apache.logging.log4j log4j-to-slf4j - 2.11.1 + 2.20.0 runtime From 165c6fa0589ecaffdcdd64eb05de72aab8c4ebb4 Mon Sep 17 00:00:00 2001 From: Adrian Herscu Date: Fri, 13 Oct 2023 11:53:00 +0300 Subject: [PATCH 12/49] fixed to compile on jdk 21 --- .github/workflows/on-main-push.yml | 7 ++----- .github/workflows/on-pull-request.yml | 13 +++++++++---- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/.github/workflows/on-main-push.yml b/.github/workflows/on-main-push.yml index 508024ed83..a1d1f8615a 100644 --- a/.github/workflows/on-main-push.yml +++ b/.github/workflows/on-main-push.yml @@ -22,11 +22,8 @@ jobs: strategy: matrix: - # ISSUE on JDK 21 -- - # while running lombok-maven-plugin - # Class com.sun.tools.javac.tree.JCTree$JCImport does not have member field 'com.sun.tools.javac.tree.JCTree qualid' - # see also https://github.com/projectlombok/lombok/issues/3393 - java-version: [ 17, 11 ] + # ISSUE on JDK 21 -- see on-pull-request.yml + java-version: [ 21, 17, 11 ] os: [ ubuntu-latest, macos-latest, windows-latest ] steps: diff --git a/.github/workflows/on-pull-request.yml b/.github/workflows/on-pull-request.yml index 3f627fb84f..853c569595 100644 --- a/.github/workflows/on-pull-request.yml +++ b/.github/workflows/on-pull-request.yml @@ -20,10 +20,15 @@ jobs: strategy: matrix: # ISSUE on JDK 21 -- - # while running lombok-maven-plugin - # Class com.sun.tools.javac.tree.JCTree$JCImport does not have member field 'com.sun.tools.javac.tree.JCTree qualid' - # see also https://github.com/projectlombok/lombok/issues/3393 - java-version: [ 17, 11 ] + # when running aggregated as + # mvnw install mode-build-full mode-build-nosign testing-tutorials + # while running qa-testing-example: + # Cannot define class using reflection: Unable to make protected java.lang.Package + # when running verify on qa-testing-example standalone: + # java.lang.RuntimeException: ProcessBuilder.start() debug + # (in addition) + # In summary, on JDK 21 the tests do not work. + java-version: [ 21, 17, 11 ] os: [ ubuntu-latest, macos-latest, windows-latest ] steps: From 857be0bf006b0c10122163fddd771dce37ffc1b7 Mon Sep 17 00:00:00 2001 From: Adrian Herscu Date: Sat, 14 Oct 2023 11:20:25 +0300 Subject: [PATCH 13/49] higher versions of derbyclient are compiled with jdk17 --- qa-jgiven-commons/pom.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/qa-jgiven-commons/pom.xml b/qa-jgiven-commons/pom.xml index 4129bb75cf..2cbfdbdab3 100644 --- a/qa-jgiven-commons/pom.xml +++ b/qa-jgiven-commons/pom.xml @@ -197,7 +197,8 @@ org.apache.derby derbyclient - 10.16.1.1 + + 10.15.2.0 provided From fc101dd7979ffb502a783a249ceef378c1688665 Mon Sep 17 00:00:00 2001 From: Adrian Herscu Date: Sat, 14 Oct 2023 11:20:40 +0300 Subject: [PATCH 14/49] formatting --- qa-jgiven-commons/pom.xml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/qa-jgiven-commons/pom.xml b/qa-jgiven-commons/pom.xml index 2cbfdbdab3..2a29443fba 100644 --- a/qa-jgiven-commons/pom.xml +++ b/qa-jgiven-commons/pom.xml @@ -14,7 +14,9 @@ ~ See the License for the specific language governing permissions and ~ limitations under the License. --> - + 4.0.0 From 4992a3a971b192e4c0716bec2715d404e3af04ef Mon Sep 17 00:00:00 2001 From: Adrian Herscu Date: Sat, 14 Oct 2023 11:36:31 +0300 Subject: [PATCH 15/49] testCompile fails due to JDK 11 modules --- qa-jgiven-commons/pom.xml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/qa-jgiven-commons/pom.xml b/qa-jgiven-commons/pom.xml index 2a29443fba..02e331fef7 100644 --- a/qa-jgiven-commons/pom.xml +++ b/qa-jgiven-commons/pom.xml @@ -39,8 +39,12 @@ 2.0.5 - - true + + From aa8604c238b03b2e3398cb889c110ab15dd5c2ec Mon Sep 17 00:00:00 2001 From: Adrian Herscu Date: Sat, 14 Oct 2023 14:05:06 +0300 Subject: [PATCH 16/49] removed jdk 11 problematic dependencies, java-8-matchers and json-path-assert, upgraded to jgiven 1.3 and appium 8.6 -- qa-jgiven-commons crashes on surefire:test --- pom.xml | 5 +- qa-jgiven-commons/pom.xml | 51 +- .../commons/steps/GenericVerifications.java | 1 - ... => RemoteWebDriverHttpClientAspect.~java} | 0 .../qa/jgiven/commons/utils/WebDriverEx.java | 300 ++-- .../{GenericTest.java => GenericTest.~java} | 0 .../webdriver/steps/WebDriverActions.java | 13 +- .../webdriver/steps/WebDriverFixtures.java | 14 +- .../steps/WebDriverVerifications.java | 3 +- .../tutorial4/TestingAndroidApplication.java | 4 +- .../tutorial4/TestingAndroidOnSauceLabs.java | 4 +- .../tutorial5/TestingWindowsApplication.java | 10 +- qa-testing-utils/pom.xml | 9 +- .../qa/testing/utils/Java8Matchers.java | 150 ++ .../qa/testing/utils/OptionalMatchers.java | 418 ++++++ .../qa/testing/utils/StreamMatchers.java | 1216 +++++++++++++++++ .../utils/StreamMatchersExtensions.java | 1 - .../qa/testing/utils/TimeMatchers.java | 159 +++ .../qa/testing/utils/assertions/IsJson.java | 70 + .../utils/assertions/JXPathAssert.java | 2 - .../testing/utils/assertions/JsonAssert.java | 106 ++ .../utils/assertions/JsonAssertEx.java | 1 - .../utils/assertions/JsonAsserter.java | 105 ++ .../utils/assertions/JsonAsserterEx.java | 2 - .../utils/assertions/JsonAsserterExImpl.java | 4 +- .../utils/assertions/JsonPathMatchers.java | 83 ++ .../utils/assertions/WithJsonPath.java | 62 + .../utils/assertions/WithoutJsonPath.java | 37 + .../assertions/impl/JsonAsserterImpl.java | 144 ++ .../impl/matcher/CollectionMatcher.java | 47 + .../impl/matcher/IsCollectionWithSize.java | 79 ++ .../impl/matcher/IsEmptyCollection.java | 58 + .../impl/matcher/IsMapContainingKey.java | 69 + .../impl/matcher/IsMapContainingValue.java | 70 + .../impl/matcher/MapTypeSafeMatcher.java | 44 + .../utils/function/DescribableFunction.java | 25 + .../utils/function/DescribablePredicate.java | 18 + .../function/SerializedLambdaResolvable.java | 23 + ...rgumentDescribableFunctionalInterface.java | 15 + .../UnableToGuessMethodException.java | 9 + .../utils/internal/DescriptionUtils.java | 17 + 41 files changed, 3230 insertions(+), 218 deletions(-) rename qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/{RemoteWebDriverHttpClientAspect.java => RemoteWebDriverHttpClientAspect.~java} (100%) rename qa-jgiven-commons/src/test/java/dev/aherscu/qa/jgiven/commons/scenarios/{GenericTest.java => GenericTest.~java} (100%) create mode 100644 qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/Java8Matchers.java create mode 100644 qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/OptionalMatchers.java create mode 100644 qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/StreamMatchers.java create mode 100644 qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/TimeMatchers.java create mode 100644 qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/assertions/IsJson.java create mode 100644 qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/assertions/JsonAssert.java create mode 100644 qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/assertions/JsonAsserter.java create mode 100644 qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/assertions/JsonPathMatchers.java create mode 100644 qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/assertions/WithJsonPath.java create mode 100644 qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/assertions/WithoutJsonPath.java create mode 100644 qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/assertions/impl/JsonAsserterImpl.java create mode 100644 qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/assertions/impl/matcher/CollectionMatcher.java create mode 100644 qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/assertions/impl/matcher/IsCollectionWithSize.java create mode 100644 qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/assertions/impl/matcher/IsEmptyCollection.java create mode 100644 qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/assertions/impl/matcher/IsMapContainingKey.java create mode 100644 qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/assertions/impl/matcher/IsMapContainingValue.java create mode 100644 qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/assertions/impl/matcher/MapTypeSafeMatcher.java create mode 100644 qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/function/DescribableFunction.java create mode 100644 qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/function/DescribablePredicate.java create mode 100644 qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/function/SerializedLambdaResolvable.java create mode 100644 qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/function/SingleArgumentDescribableFunctionalInterface.java create mode 100644 qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/function/UnableToGuessMethodException.java create mode 100644 qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/internal/DescriptionUtils.java diff --git a/pom.xml b/pom.xml index 06fa59805c..d314c8442a 100644 --- a/pom.xml +++ b/pom.xml @@ -121,7 +121,7 @@ yyyyMMddHHmmss - 1.1.0 + 1.3.0 true @@ -546,8 +546,7 @@ ${jgiven.report.text} false - --add-opens java.base/java.io=ALL-UNNAMED -noverify -Dfile.encoding=${project.build.sourceEncoding} - + -Dfile.encoding=${project.build.sourceEncoding} diff --git a/qa-jgiven-commons/pom.xml b/qa-jgiven-commons/pom.xml index 02e331fef7..03301ce32c 100644 --- a/qa-jgiven-commons/pom.xml +++ b/qa-jgiven-commons/pom.xml @@ -83,7 +83,7 @@ io.appium java-client - 7.6.0 + 8.6.0 commons-logging @@ -177,7 +177,7 @@ com.github.rodionmoiseev.c10n c10n-core - 1.2 + 1.3 @@ -186,14 +186,6 @@ ${slf4j.version} - - - com.jayway.jsonpath - json-path-assert - 2.8.0 - - + --illegal-access=permit diff --git a/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/steps/GenericVerifications.java b/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/steps/GenericVerifications.java index 98bc075c11..fe148fa334 100644 --- a/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/steps/GenericVerifications.java +++ b/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/steps/GenericVerifications.java @@ -37,7 +37,6 @@ import org.unitils.database.*; import com.google.common.collect.*; -import com.jayway.jsonassert.*; import com.tngtech.jgiven.annotation.*; import dev.aherscu.qa.jgiven.commons.formatters.*; diff --git a/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/RemoteWebDriverHttpClientAspect.java b/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/RemoteWebDriverHttpClientAspect.~java similarity index 100% rename from qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/RemoteWebDriverHttpClientAspect.java rename to qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/RemoteWebDriverHttpClientAspect.~java diff --git a/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/WebDriverEx.java b/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/WebDriverEx.java index 38370c1aa1..109aa6d956 100644 --- a/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/WebDriverEx.java +++ b/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/WebDriverEx.java @@ -28,7 +28,6 @@ import org.openqa.selenium.chrome.*; import org.openqa.selenium.edge.*; import org.openqa.selenium.firefox.*; -import org.openqa.selenium.opera.*; import org.openqa.selenium.remote.*; import org.openqa.selenium.safari.*; @@ -39,6 +38,7 @@ import io.appium.java_client.*; import io.appium.java_client.android.*; import io.appium.java_client.ios.*; +import io.appium.java_client.remote.*; import io.appium.java_client.windows.*; import io.github.bonigarcia.wdm.*; import lombok.*; @@ -58,6 +58,132 @@ @Slf4j @ToString public class WebDriverEx { + /** + * Represents a
    DOM + * Event. + */ + @AllArgsConstructor + public static class Event { + /** + * Represents an event type. + * + * @author Adrian Herscu + */ + public interface Type { + // marker interface + } + + /** + * The type of this Pointer Event. + */ + public final Type type; + /** + * Event + * Initialization Dictionary + */ + public final Map eventInitDict; + + /** + * @return JavaScript literal representation of this Event + */ + @Override + public String toString() { + return MessageFormat.format("new {0}(\"{1}\",{2})", + getClass().getSimpleName(), + type, + new Gson().toJson(eventInitDict, Map.class)); + } + } + + /** + * Represents a DOM + * MouseEvent. + * + *

    + * see also MouseEvent + * Working Draft + *

    + */ + public static class MouseEvent extends UIEvent { + /** + * @param type + * type of event + * @param eventInitDict + * initialization data + */ + public MouseEvent( + final Type type, + final Map eventInitDict) { + super(type, eventInitDict); + } + } + + /** + * Represents a + * DOM + * Pointer Event. + */ + public static class PointerEvent extends MouseEvent { + /** + * Types of Pointer + * Events + */ + public enum PointerEventType implements Type { + pointerover, + pointerenter, + pointerdown, + pointermove, + pointerup, + pointercancel, + pointerout, + pointerleave, + gotpointercapture, + lostpointercapture + } + + /** + * @param type + * type of event + * @param eventInitDict + * initialization data + */ + public PointerEvent( + final PointerEventType type, + final Map eventInitDict) { + super(type, eventInitDict); + } + } + + /** + * Represents a DOM + * UIEvent. + * + *

    + * see also UIEvent + * Working Draft + *

    + */ + public static class UIEvent extends Event { + /** + * @param type + * type of event + * @param eventInitDict + * initialization data + */ + public UIEvent( + final Type type, + final Map eventInitDict) { + super(type, eventInitDict); + } + } + /** * The application native context id. */ @@ -217,8 +343,8 @@ private static Class webDriverClassFor( if (driverClass.isAssignableFrom(SafariDriver.class)) WebDriverManager.safaridriver().setup(); - if (driverClass.isAssignableFrom(OperaDriver.class)) - WebDriverManager.operadriver().setup(); + // if (driverClass.isAssignableFrom(OperaDriver.class)) + // WebDriverManager.operadriver().setup(); // NOTE there are drivers, like WinAppDriver, that are not supported // by WebDriverManager -- in this case we just return the class @@ -262,8 +388,8 @@ public static WebDriver webDriverFor(final Capabilities capabilities) { @SuppressWarnings("unchecked") @edu.umd.cs.findbugs.annotations.SuppressFBWarnings( value = "BC_UNCONFIRMED_CAST") - public AndroidDriver asAndroid() { - return (AndroidDriver) driver; + public AndroidDriver asAndroid() { + return (AndroidDriver) driver; } public WebDriver asGeneric() { @@ -271,8 +397,8 @@ public WebDriver asGeneric() { } @SuppressWarnings("unchecked") - public IOSDriver asIOS() { - return (IOSDriver) driver; + public IOSDriver asIOS() { + return (IOSDriver) driver; } /** @@ -289,26 +415,21 @@ public JavascriptExecutor asJavaScriptExecutor() { } /** - * Casts an WebDriver into a MobileDriver. + * Casts an WebDriver into a RemoteWebDriver. * - * @param - * type of WebElement - * @return the MobileDriver interface + * @return the RemoteWebDriver interface * @throws ClassCastException - * if the driver is not of MobileDriver type + * if the driver is not of RemoteWebDriver type */ - @SuppressWarnings("unchecked") @edu.umd.cs.findbugs.annotations.SuppressFBWarnings( value = "BC_UNCONFIRMED_CAST") - public MobileDriver asMobile() { - return (MobileDriver) driver; + public RemoteWebDriver asRemote() { + return (RemoteWebDriver) driver; } /** * Casts an WebDriver into a WindowsDriver. * - * @param - * type of WebElement * @return the WindowsDriver interface * @throws ClassCastException * if the driver is not of WindowsDriver type @@ -316,21 +437,8 @@ public MobileDriver asMobile() { @SuppressWarnings("unchecked") @edu.umd.cs.findbugs.annotations.SuppressFBWarnings( value = "BC_UNCONFIRMED_CAST") - public WindowsDriver asWindows() { - return (WindowsDriver) driver; - } - - /** - * Casts an WebDriver into a RemoteWebDriver. - * - * @return the RemoteWebDriver interface - * @throws ClassCastException - * if the driver is not of RemoteWebDriver type - */ - @edu.umd.cs.findbugs.annotations.SuppressFBWarnings( - value = "BC_UNCONFIRMED_CAST") - public RemoteWebDriver asRemote() { - return (RemoteWebDriver) driver; + public WindowsDriver asWindows() { + return (WindowsDriver) driver; } /** @@ -436,7 +544,7 @@ public String webContextIdentifier() { e.getFailure()))) .onSuccess(e -> log .debug("found web view context {}", e.getResult())) - .get(() -> asMobile() + .get(() -> ((ContextAware) driver) .getContextHandles() .stream() .peek(contextId -> log.trace("found context {}", contextId)) @@ -445,130 +553,4 @@ public String webContextIdentifier() { .orElseThrow( () -> new TestRuntimeException("no webview available"))); } - - /** - * Represents a DOM - * Event. - */ - @AllArgsConstructor - public static class Event { - /** - * The type of this Pointer Event. - */ - public final Type type; - /** - * Event - * Initialization Dictionary - */ - public final Map eventInitDict; - - /** - * @return JavaScript literal representation of this Event - */ - @Override - public String toString() { - return MessageFormat.format("new {0}(\"{1}\",{2})", - getClass().getSimpleName(), - type, - new Gson().toJson(eventInitDict, Map.class)); - } - - /** - * Represents an event type. - * - * @author Adrian Herscu - */ - public interface Type { - // marker interface - } - } - - /** - * Represents a DOM - * MouseEvent. - * - *

    - * see also MouseEvent - * Working Draft - *

    - */ - public static class MouseEvent extends UIEvent { - /** - * @param type - * type of event - * @param eventInitDict - * initialization data - */ - public MouseEvent( - final Type type, - final Map eventInitDict) { - super(type, eventInitDict); - } - } - - /** - * Represents a - * DOM - * Pointer Event. - */ - public static class PointerEvent extends MouseEvent { - /** - * @param type - * type of event - * @param eventInitDict - * initialization data - */ - public PointerEvent( - final PointerEventType type, - final Map eventInitDict) { - super(type, eventInitDict); - } - - /** - * Types of Pointer - * Events - */ - public enum PointerEventType implements Type { - pointerover, - pointerenter, - pointerdown, - pointermove, - pointerup, - pointercancel, - pointerout, - pointerleave, - gotpointercapture, - lostpointercapture - } - } - - /** - * Represents a DOM - * UIEvent. - * - *

    - * see also UIEvent - * Working Draft - *

    - */ - public static class UIEvent extends Event { - /** - * @param type - * type of event - * @param eventInitDict - * initialization data - */ - public UIEvent( - final Type type, - final Map eventInitDict) { - super(type, eventInitDict); - } - } } diff --git a/qa-jgiven-commons/src/test/java/dev/aherscu/qa/jgiven/commons/scenarios/GenericTest.java b/qa-jgiven-commons/src/test/java/dev/aherscu/qa/jgiven/commons/scenarios/GenericTest.~java similarity index 100% rename from qa-jgiven-commons/src/test/java/dev/aherscu/qa/jgiven/commons/scenarios/GenericTest.java rename to qa-jgiven-commons/src/test/java/dev/aherscu/qa/jgiven/commons/scenarios/GenericTest.~java diff --git a/qa-jgiven-webdriver/src/main/java/dev/aherscu/qa/jgiven/webdriver/steps/WebDriverActions.java b/qa-jgiven-webdriver/src/main/java/dev/aherscu/qa/jgiven/webdriver/steps/WebDriverActions.java index 1f13d86125..b7ed81ef8a 100644 --- a/qa-jgiven-webdriver/src/main/java/dev/aherscu/qa/jgiven/webdriver/steps/WebDriverActions.java +++ b/qa-jgiven-webdriver/src/main/java/dev/aherscu/qa/jgiven/webdriver/steps/WebDriverActions.java @@ -27,6 +27,7 @@ import javax.annotation.concurrent.*; import org.openqa.selenium.*; +import org.openqa.selenium.NoSuchContextException; import org.openqa.selenium.NoSuchElementException; import com.tngtech.jgiven.annotation.*; @@ -34,6 +35,8 @@ import dev.aherscu.qa.jgiven.commons.steps.*; import dev.aherscu.qa.jgiven.commons.utils.*; import dev.aherscu.qa.jgiven.webdriver.model.*; +import io.appium.java_client.*; +import io.appium.java_client.remote.*; import io.appium.java_client.windows.*; import lombok.*; import lombok.extern.slf4j.*; @@ -244,7 +247,7 @@ public SELF opening(final String url) { * @return #self() */ public SELF rotating_device_to(final ScreenOrientation orientation) { - thisWebDriver().asMobile().rotate(orientation); + ((SupportsRotation) thisWebDriver()).rotate(orientation); return self(); } @@ -257,7 +260,7 @@ public SELF rotating_device_to(final ScreenOrientation orientation) { */ public SELF sending_application_to_background_for(final Duration duration) { log.debug("sending application to background for {}", duration); - thisWebDriver().asMobile().runAppInBackground(duration); + ((InteractsWithApps) thisWebDriver()).runAppInBackground(duration); log.debug("returned from background"); return self(); } @@ -288,7 +291,7 @@ public SELF submitting_the_form_containing(final By locator) { public SELF terminating_application(final String appId) { log.debug("application {} was running and stopped successfully: {}", appId, - thisWebDriver().asMobile().terminateApp(appId)); + ((InteractsWithApps) thisWebDriver()).terminateApp(appId)); return self(); } @@ -364,7 +367,7 @@ public SELF terminating_application(final String appId) { @Hidden protected SELF activating_application(final String appId) { log.debug("activating application {}", appId); - thisWebDriver().asMobile().activateApp(appId); + ((InteractsWithApps) thisWebDriver()).activateApp(appId); return self(); } @@ -474,7 +477,7 @@ protected WebElement scrollIntoView(final WebElement element) { */ @Hidden protected SELF switching_to_context(final Predicate byRule) { - return context(byRule, thisWebDriver().asMobile()); + return context(byRule, (ContextAware) thisWebDriver()); } /** diff --git a/qa-jgiven-webdriver/src/main/java/dev/aherscu/qa/jgiven/webdriver/steps/WebDriverFixtures.java b/qa-jgiven-webdriver/src/main/java/dev/aherscu/qa/jgiven/webdriver/steps/WebDriverFixtures.java index e437861a91..738b5bfc8f 100644 --- a/qa-jgiven-webdriver/src/main/java/dev/aherscu/qa/jgiven/webdriver/steps/WebDriverFixtures.java +++ b/qa-jgiven-webdriver/src/main/java/dev/aherscu/qa/jgiven/webdriver/steps/WebDriverFixtures.java @@ -89,18 +89,6 @@ public SELF a_web_driver( return self(); } - /** - * Restarts the mobile application in clean state. - * - * @return #self() - */ - public SELF application_is_restarted_in_clean_state() { - val mobileDriver = thisWebDriver().asMobile(); - log.debug("restarting {}", mobileDriver); - mobileDriver.resetApp(); - return self(); - } - /** * Opens Web application at specified host if not already open. * @@ -138,7 +126,7 @@ && hostOf(currentUrl) */ @Hidden protected SELF context(final Predicate byRule) { - return context(byRule, thisWebDriver().asMobile()); + return context(byRule, (ContextAware) thisWebDriver()); } /** diff --git a/qa-jgiven-webdriver/src/main/java/dev/aherscu/qa/jgiven/webdriver/steps/WebDriverVerifications.java b/qa-jgiven-webdriver/src/main/java/dev/aherscu/qa/jgiven/webdriver/steps/WebDriverVerifications.java index a4c3e5d47b..b5b604ca0f 100644 --- a/qa-jgiven-webdriver/src/main/java/dev/aherscu/qa/jgiven/webdriver/steps/WebDriverVerifications.java +++ b/qa-jgiven-webdriver/src/main/java/dev/aherscu/qa/jgiven/webdriver/steps/WebDriverVerifications.java @@ -31,6 +31,7 @@ import dev.aherscu.qa.jgiven.commons.steps.*; import dev.aherscu.qa.jgiven.commons.utils.*; import dev.aherscu.qa.jgiven.webdriver.model.*; +import io.appium.java_client.*; import io.appium.java_client.appmanagement.*; import lombok.*; import lombok.extern.slf4j.*; @@ -120,7 +121,7 @@ public SELF elements( public SELF the_application(final Matcher matcher, final String appId) { return eventually_assert_that( - () -> thisWebDriver().asMobile().queryAppState(appId), + () -> ((InteractsWithApps) thisWebDriver()).queryAppState(appId), matcher); } diff --git a/qa-testing-example/src/test/java/dev/aherscu/qa/testing/example/scenarios/tutorial4/TestingAndroidApplication.java b/qa-testing-example/src/test/java/dev/aherscu/qa/testing/example/scenarios/tutorial4/TestingAndroidApplication.java index 965f46ddcc..ba9728936f 100644 --- a/qa-testing-example/src/test/java/dev/aherscu/qa/testing/example/scenarios/tutorial4/TestingAndroidApplication.java +++ b/qa-testing-example/src/test/java/dev/aherscu/qa/testing/example/scenarios/tutorial4/TestingAndroidApplication.java @@ -40,8 +40,8 @@ public class TestingAndroidApplication { @java.lang.SuppressWarnings("serial") @SneakyThrows - static AndroidDriver localApp() { - return new AndroidDriver<>( + static AndroidDriver localApp() { + return new AndroidDriver( new URL("http://127.0.0.1:4723/wd/hub"), new DesiredCapabilities() { { diff --git a/qa-testing-example/src/test/java/dev/aherscu/qa/testing/example/scenarios/tutorial4/TestingAndroidOnSauceLabs.java b/qa-testing-example/src/test/java/dev/aherscu/qa/testing/example/scenarios/tutorial4/TestingAndroidOnSauceLabs.java index 6adfd467e3..b1d9fc3d37 100644 --- a/qa-testing-example/src/test/java/dev/aherscu/qa/testing/example/scenarios/tutorial4/TestingAndroidOnSauceLabs.java +++ b/qa-testing-example/src/test/java/dev/aherscu/qa/testing/example/scenarios/tutorial4/TestingAndroidOnSauceLabs.java @@ -43,9 +43,9 @@ public class TestingAndroidOnSauceLabs { @java.lang.SuppressWarnings("serial") @SneakyThrows - static AndroidDriver saucelabsApp( + static AndroidDriver saucelabsApp( final String name) { - return new AndroidDriver<>(new URL( + return new AndroidDriver(new URL( // FIXME should get these credentials from system enviroment // SAUCELABS_USERNAME and SAUCELABS_PASSWORD "https://TBD:TBD@ondemand.saucelabs.com:443/wd/hub"), diff --git a/qa-testing-example/src/test/java/dev/aherscu/qa/testing/example/scenarios/tutorial5/TestingWindowsApplication.java b/qa-testing-example/src/test/java/dev/aherscu/qa/testing/example/scenarios/tutorial5/TestingWindowsApplication.java index ddd2e8fd5e..dc2c8cad15 100644 --- a/qa-testing-example/src/test/java/dev/aherscu/qa/testing/example/scenarios/tutorial5/TestingWindowsApplication.java +++ b/qa-testing-example/src/test/java/dev/aherscu/qa/testing/example/scenarios/tutorial5/TestingWindowsApplication.java @@ -21,6 +21,7 @@ import java.net.*; +import org.openqa.selenium.*; import org.openqa.selenium.remote.*; import org.testng.annotations.*; @@ -30,7 +31,7 @@ public class TestingWindowsApplication { - private WindowsDriver driver; + private WindowsDriver driver; @Test public void shouldOpenCalculator() { @@ -39,10 +40,9 @@ public void shouldOpenCalculator() { @Test public void shouldCalculate() { - driver.findElementByAccessibilityId("CalculatorResults") + driver.findElement(By.id("CalculatorResults")) .sendKeys("8+7="); - assertThat(driver - .findElementByAccessibilityId("CalculatorResults") + assertThat(driver.findElement(By.id("CalculatorResults")) .getText(), stringContainsInOrder("Display is", "15")); } @@ -66,7 +66,7 @@ private void beforeClassOpenWebDriver() { val capabilities = new DesiredCapabilities(); capabilities.setCapability("app", "Microsoft.WindowsCalculator_8wekyb3d8bbwe!App"); - driver = new WindowsDriver<>(new URL("http://127.0.0.1:4723"), + driver = new WindowsDriver(new URL("http://127.0.0.1:4723"), capabilities); // NOTE: should uncomment in order to deal with latencies diff --git a/qa-testing-utils/pom.xml b/qa-testing-utils/pom.xml index 395e3370f4..70dbb126cd 100644 --- a/qa-testing-utils/pom.xml +++ b/qa-testing-utils/pom.xml @@ -95,13 +95,6 @@ 0.4.20 - - - uk.co.probablyfine - java-8-matchers - 1.9 - - com.github.adorow jcurry @@ -214,7 +207,7 @@ com.jayway.jsonpath - json-path-assert + json-path 2.8.0 diff --git a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/Java8Matchers.java b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/Java8Matchers.java new file mode 100644 index 0000000000..852064ee2d --- /dev/null +++ b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/Java8Matchers.java @@ -0,0 +1,150 @@ +package dev.aherscu.qa.testing.utils; + +import static dev.aherscu.qa.testing.utils.internal.DescriptionUtils.withPrefixedArticle; +import static org.hamcrest.Matchers.is; + +import java.util.function.Function; + +import org.hamcrest.Description; +import org.hamcrest.Matcher; +import org.hamcrest.TypeSafeDiagnosingMatcher; + +import dev.aherscu.qa.testing.utils.function.*; + +public final class Java8Matchers { + + /** + * Match a {@code boolean} property of an object which should be + * {@code false}. + * + * @param booleanProperty + * the predicate reolving the {@code boolean} property from the + * object. + */ + public static Matcher whereNot( + DescribablePredicate booleanProperty) { + return whereNot(booleanProperty.getResultDescription(), + booleanProperty); + } + + /** + * Match a {@code boolean} property of an object which should be + * {@code false}. + * + * @param propertyDescription + * a description of the property. + * @param booleanProperty + * the predicate resolving the {@code boolean} property from the + * object. + */ + public static Matcher whereNot(String propertyDescription, + DescribablePredicate booleanProperty) { + String entityDescription = booleanProperty.getArgumentDescription(); + return where(entityDescription, propertyDescription, + booleanProperty::test, is(false)); + } + + /** + * Match a {@code boolean} property of an object which should be + * {@code true}. + * + * @param booleanProperty + * the predicate resolving the {@code boolean} property from the + * object. + */ + public static Matcher where( + DescribablePredicate booleanProperty) { + return where(booleanProperty.getResultDescription(), booleanProperty); + } + + /** + * Match a {@code boolean} property of an object which should be + * {@code true}. + * + * @param propertyDescription + * a description of the property. + * @param booleanProperty + * the predicate resolving the {@code boolean} property from the + * object. + */ + public static Matcher where(String propertyDescription, + DescribablePredicate booleanProperty) { + String entityDescription = booleanProperty.getArgumentDescription(); + return where(entityDescription, propertyDescription, + booleanProperty::test, is(true)); + } + + /** + * Match a value/property derived from an object. + * + * @param property + * the function which resolves the derived value to match. + * @param matcher + * the {@code Matcher} for the derived value. + */ + public static Matcher where( + DescribableFunction property, + Matcher matcher) { + String propertyDescription = property.getResultDescription(); + return where(propertyDescription, property, matcher); + } + + /** + * Match a value/property derived from an object. + * + * @param propertyDescription + * a description of the derived value. + * @param property + * the function which resolves the derived value to match. + * @param matcher + * the {@code Matcher} for the derived value. + */ + public static Matcher where(String propertyDescription, + DescribableFunction property, + Matcher matcher) { + String entityDescription = property.getArgumentDescription(); + return where(entityDescription, propertyDescription, property, matcher); + } + + /** + * Match a value/property derived from an object. + * + * @param entityDescription + * a description of the object the matched value is derived from. + * @param propertyDescription + * a description of the derived value. + * @param property + * the function which resolves the derived value to match. + * @param matcher + * the {@code Matcher} for the derived value. + */ + public static Matcher where(String entityDescription, + String propertyDescription, Function property, + Matcher matcher) { + return new TypeSafeDiagnosingMatcher() { + + @Override + public void describeTo(Description description) { + description.appendText(entityDescription).appendText(" with ") + .appendText(withPrefixedArticle(propertyDescription)) + .appendText(" which ").appendDescriptionOf(matcher); + } + + @Override + protected boolean matchesSafely(I objectToMatch, + Description mismatch) { + O actual = property.apply(objectToMatch); + boolean match = matcher.matches(actual); + if (!match) { + mismatch.appendText("had the ") + .appendText(propertyDescription).appendText(" ") + .appendValue(actual); + } + return match; + } + }; + } + + private Java8Matchers() { + } +} diff --git a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/OptionalMatchers.java b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/OptionalMatchers.java new file mode 100644 index 0000000000..f54d08e4fd --- /dev/null +++ b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/OptionalMatchers.java @@ -0,0 +1,418 @@ +package dev.aherscu.qa.testing.utils; + +import java.util.Optional; +import java.util.OptionalDouble; +import java.util.OptionalInt; +import java.util.OptionalLong; + +import org.hamcrest.Description; +import org.hamcrest.Matcher; +import org.hamcrest.TypeSafeMatcher; + +public class OptionalMatchers { + + /** + * Matches a not present Optional. + */ + public static Matcher> notPresent() { + return new TypeSafeMatcher>() { + @Override + protected boolean matchesSafely(Optional item) { + return !item.isPresent(); + } + + @Override + public void describeTo(Description description) { + description.appendText("An Optional with no value"); + } + }; + } + + /** + * Matches a not present Optional. + * + * @deprecated name clashes with {@link org.hamcrest.Matchers#empty()}, use + * {@link #notPresent()} instead + */ + @Deprecated + public static Matcher> empty() { + return notPresent(); + } + + /** + * Matches a present Optional with the given content + * + * @param content + * Expected contents of the Optional + * @param + * The type of the Optional's content + */ + public static Matcher> present(T content) { + return new TypeSafeMatcher>() { + @Override + protected boolean matchesSafely(Optional item) { + return item.map(content::equals).orElse(false); + } + + @Override + public void describeTo(Description description) { + description.appendText(Optional.of(content).toString()); + } + }; + } + + /** + * Matches a present Optional with the given content + * + * @param content + * Expected contents of the Optional + * @param + * The type of the Optional's content + * + * @deprecated name clashes with + * {@link org.hamcrest.Matchers#contains(Object...)}, use + * {@link #present(Object)} instead + */ + @Deprecated + public static Matcher> contains(T content) { + return present(content); + } + + /** + * Matches a present Optional with content matching the given matcher + * + * @param matcher + * To match against the Optional's content + * @param + * The type of the Optional's content + * @param + * The type matched by the matcher, a subtype of T + */ + public static Matcher> present( + Matcher matcher) { + return new TypeSafeMatcher>() { + @Override + protected boolean matchesSafely(Optional item) { + return item.map(matcher::matches).orElse(false); + } + + @Override + public void describeTo(Description description) { + description.appendText( + "Optional with an item that matches " + matcher); + } + }; + } + + /** + * Matches a present Optional with content matching the given matcher + * + * @param matcher + * To match against the Optional's content + * @param + * The type of the Optional's content + * @param + * The type matched by the matcher, a subtype of T + * @deprecated name clashes with + * {@link org.hamcrest.Matchers#contains(Matcher)}, use + * {@link #present(Matcher)} instead + */ + @Deprecated + public static Matcher> contains( + Matcher matcher) { + return present(matcher); + } + + /** + * Matches an not present OptionalInt. + */ + public static Matcher notPresentInt() { + return new TypeSafeMatcher() { + @Override + protected boolean matchesSafely(OptionalInt item) { + return !item.isPresent(); + } + + @Override + public void describeTo(Description description) { + description.appendText("An OptionalInt with no value"); + } + }; + } + + /** + * Matches a not present OptionalInt. + * + * @deprecated Matcher is replaced with {@link #notPresentInt()} to align + * with naming of {@link #notPresent()}. + */ + @Deprecated + public static Matcher emptyInt() { + return notPresentInt(); + } + + /** + * Matches a present OptionalInt with the given content + * + * @param content + * Expected contents of the Optional + */ + public static Matcher presentInt(int content) { + return new TypeSafeMatcher() { + @Override + protected boolean matchesSafely(OptionalInt item) { + return item.isPresent() && item.getAsInt() == content; + } + + @Override + public void describeTo(Description description) { + description.appendText(Optional.of(content).toString()); + } + }; + } + + /** + * Matches a present OptionalInt with the given content + * + * @param content + * Expected contents of the Optional + * + * @deprecated Matcher is replaced with {@link #presentInt(int)} to align + * with naming of {@link #present(Object)}. + */ + @Deprecated + public static Matcher containsInt(int content) { + return presentInt(content); + } + + /** + * Matches a present OptionalInt with content matching the given matcher + * + * @param matcher + * To match against the OptionalInt's content + */ + public static Matcher presentInt(Matcher matcher) { + return new TypeSafeMatcher() { + @Override + protected boolean matchesSafely(OptionalInt item) { + return item.isPresent() && matcher.matches(item.getAsInt()); + } + + @Override + public void describeTo(Description description) { + description.appendText( + "OptionalInt with an item that matches " + matcher); + } + }; + } + + /** + * Matches a present OptionalInt with content matching the given matcher + * + * @param matcher + * To match against the OptionalInt's content + * + * @deprecated Matcher is replaced with {@link #presentInt(Matcher)} to + * align with naming of {@link #present(Matcher)}. + */ + @Deprecated + public static Matcher containsInt(Matcher matcher) { + return presentInt(matcher); + } + + /** + * Matches an OptionalLong with no value. + */ + public static Matcher notPresentLong() { + return new TypeSafeMatcher() { + @Override + protected boolean matchesSafely(OptionalLong item) { + return !item.isPresent(); + } + + @Override + public void describeTo(Description description) { + description.appendText("An OptionalLong with no value"); + } + }; + } + + /** + * Matches a not present OptionalLong. + * + * @deprecated Matcher is replaced with {@link #notPresentLong()} to align + * with naming of {@link #notPresent()}. + */ + @Deprecated + public static Matcher emptyLong() { + return notPresentLong(); + } + + /** + * Matches a present OptionalLong with the given content + * + * @param content + * Expected contents of the Optional + */ + public static Matcher presentLong(long content) { + return new TypeSafeMatcher() { + @Override + protected boolean matchesSafely(OptionalLong item) { + return item.isPresent() && item.getAsLong() == content; + } + + @Override + public void describeTo(Description description) { + description.appendText(Optional.of(content).toString()); + } + }; + } + + /** + * Matches a present OptionalLong with the given content + * + * @param content + * Expected contents of the Optional + * + * @deprecated Matcher is replaced with {@link #presentLong(long)} to align + * with naming of {@link #present(Object)}. + */ + @Deprecated + public static Matcher containsLong(long content) { + return presentLong(content); + } + + /** + * Matches a present OptionalLong with content matching the given matcher + * + * @param matcher + * To match against the OptionalLong's content + */ + public static Matcher presentLong(Matcher matcher) { + return new TypeSafeMatcher() { + @Override + protected boolean matchesSafely(OptionalLong item) { + return item.isPresent() && matcher.matches(item.getAsLong()); + } + + @Override + public void describeTo(Description description) { + description.appendText( + "OptionalLong with an item that matches " + matcher); + } + }; + } + + /** + * Matches a present OptionalLong with content matching the given matcher + * + * @param matcher + * To match against the OptionalLong's content + * + * @deprecated Matcher is replaced with {@link #presentLong(Matcher)} to + * align with naming of {@link #present(Matcher)}. + */ + @Deprecated + public static Matcher containsLong(Matcher matcher) { + return presentLong(matcher); + } + + /** + * Matches a not present OptionalDouble. + */ + public static Matcher notPresentDouble() { + return new TypeSafeMatcher() { + @Override + protected boolean matchesSafely(OptionalDouble item) { + return !item.isPresent(); + } + + @Override + public void describeTo(Description description) { + description.appendText("An OptionalDouble with no value"); + } + }; + } + + /** + * Matches a not present OptionalDouble. + * + * @deprecated Matcher is replaced with {@link #notPresentDouble()} to align + * with naming of {@link #notPresent()}. + */ + @Deprecated + public static Matcher emptyDouble() { + return notPresentDouble(); + } + + /** + * Matches a present OptionalDouble with the given content + * + * @param content + * Expected contents of the Optional + */ + public static Matcher presentDouble(double content) { + return new TypeSafeMatcher() { + @Override + protected boolean matchesSafely(OptionalDouble item) { + return item.isPresent() && item.getAsDouble() == content; + } + + @Override + public void describeTo(Description description) { + description.appendText(Optional.of(content).toString()); + } + }; + } + + /** + * Matches a present OptionalDouble with the given content + * + * @param content + * Expected contents of the Optional + * + * @deprecated Matcher is replaced with {@link #presentDouble(double)} to + * align with naming of {@link #present(Object)}. + */ + @Deprecated + public static Matcher containsDouble(double content) { + return presentDouble(content); + } + + /** + * Matches a present OptionalDouble with content matching the given matcher + * + * @param matcher + * To match against the OptionalDouble's content + */ + public static Matcher presentDouble( + Matcher matcher) { + return new TypeSafeMatcher() { + @Override + protected boolean matchesSafely(OptionalDouble item) { + return item.isPresent() && matcher.matches(item.getAsDouble()); + } + + @Override + public void describeTo(Description description) { + description.appendText( + "OptionalDouble with an item that matches " + matcher); + } + }; + } + + /** + * Matches a present OptionalDouble with content matching the given matcher + * + * @param matcher + * To match against the OptionalDouble's content + * + * @deprecated Matcher is replaced with {@link #presentDouble(Matcher)} to + * align with naming of {@link #present(Matcher)}. + */ + @Deprecated + public static Matcher containsDouble( + Matcher matcher) { + return presentDouble(matcher); + } +} diff --git a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/StreamMatchers.java b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/StreamMatchers.java new file mode 100644 index 0000000000..487f55e37c --- /dev/null +++ b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/StreamMatchers.java @@ -0,0 +1,1216 @@ +package dev.aherscu.qa.testing.utils; + +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.Objects; +import java.util.PrimitiveIterator; +import java.util.stream.BaseStream; +import java.util.stream.DoubleStream; +import java.util.stream.IntStream; +import java.util.stream.LongStream; +import java.util.stream.Stream; + +import org.hamcrest.Description; +import org.hamcrest.Matcher; +import org.hamcrest.TypeSafeMatcher; + +public class StreamMatchers { + + /** + * Matcher for a stream which yields no elements. + * + * @param + * The type of items + * @param + * The type of the BaseStream + */ + public static > Matcher yieldsNothing() { + return new TypeSafeMatcher() { + + private Iterator actualIterator; + + @Override + protected boolean matchesSafely(S actual) { + actualIterator = actual.iterator(); + return !actualIterator.hasNext(); + } + + @Override + public void describeTo(Description description) { + description.appendText("A Stream yielding no elements"); + } + + @Override + protected void describeMismatchSafely(S item, + Description description) { + description.appendText("the Stream started with ") + .appendValue(actualIterator.next()); + if (actualIterator.hasNext()) { + description + .appendText(" and will yield even more elements"); + } else { + description.appendText(" and is then exhausted"); + } + } + }; + } + + /** + * Matcher for an empty stream. + * + * @param + * The type of items + * @param + * The type of the BaseStream + * + * @deprecated name clashes with {@link org.hamcrest.Matchers#empty()}, use + * {@link #yieldsNothing()} instead + */ + @Deprecated + public static > Matcher empty() { + return yieldsNothing(); + } + + /** + * A matcher for a finite Stream producing the same number of items as the + * expected Stream, and producing equal items as expected in the same order. + * + * For infinite Streams use {@link #startsWith} + * + * @param expected + * A BaseStream against which to compare + * @param + * The type of items produced by each BaseStream + * @param + * The type of BaseStream + * @see #startsWith + * @see #startsWithInt + * @see #startsWithLong + * @see #startsWithDouble + */ + public static > Matcher yieldsSameAs( + S expected) { + return new BaseStreamMatcher() { + @Override + protected boolean matchesSafely(S actual) { + return remainingItemsEqual(expected.iterator(), + actual.iterator()); + } + }; + } + + /** + * A matcher for a finite Stream producing the same number of items as the + * expected Stream, and producing equal items as expected in the same order. + * + * @param expected + * A BaseStream against which to compare + * @param + * The type of items produced by each BaseStream + * @param + * The type of BaseStream + * + * @deprecated name clashes with + * {@link org.hamcrest.Matchers#equalTo(Object)}, use + * {@link #yieldsSameAs(BaseStream)} instead + */ + @Deprecated + public static > Matcher equalTo( + S expected) { + return yieldsSameAs(expected); + } + + /** + * A matcher for potentially infinite Streams of objects where the first + * limit items from each must be equal + * + * @param expected + * A Stream to check against + * @param limit + * Only check this number of items from actual Stream + * @param + * The type of items produced by each Stream + * @see #equalTo + * @see #startsWithInt + * @see #startsWithLong + * @see #startsWithDouble + */ + public static Matcher> startsWith(Stream expected, + long limit) { + return new BaseStreamMatcher>() { + @Override + protected boolean matchesSafely(Stream actual) { + return remainingItemsEqual(expected.limit(limit).iterator(), + actual.limit(limit).iterator()); + } + }; + } + + /** + * A matcher for potentially infinite Streams of primitive doubles where the + * first limit items from each must be equal + * + * @param expected + * A Stream to check against + * @param limit + * Only check this number of items from actual Stream + * @see #equalTo + * @see #startsWith + * @see #startsWithInt + * @see #startsWithLong + */ + public static Matcher startsWith(DoubleStream expected, + long limit) { + return new BaseStreamMatcher() { + @Override + protected boolean matchesSafely(DoubleStream actual) { + return remainingItemsEqual(expected.limit(limit).iterator(), + actual.limit(limit).iterator()); + } + }; + } + + /** + * A matcher for potentially infinite Streams of primitive ints where the + * first limit items from each must be equal + * + * @param expected + * A Stream to check against + * @param limit + * Only check this number of items from actual Stream + * @see #equalTo + * @see #startsWith + * @see #startsWithLong + * @see #startsWithDouble + */ + public static Matcher startsWith(IntStream expected, + long limit) { + return new BaseStreamMatcher() { + @Override + protected boolean matchesSafely(IntStream actual) { + return remainingItemsEqual(expected.limit(limit).iterator(), + actual.limit(limit).iterator()); + } + }; + } + + /** + * A matcher for potentially infinite Streams of primitive ints where the + * first limit items from each must be equal + * + * @param expected + * A Stream to check against + * @param limit + * Only check this number of items from actual Stream + * @see #equalTo + * @see #startsWith + * @see #startsWithInt + * @see #startsWithDouble + */ + public static Matcher startsWith(LongStream expected, + long limit) { + return new BaseStreamMatcher() { + @Override + protected boolean matchesSafely(LongStream actual) { + return remainingItemsEqual(expected.limit(limit).iterator(), + actual.limit(limit).iterator()); + } + }; + } + + private static void describeToStartsAllWith(Description description, + long limit, Matcher matcher) { + description + .appendText("First ") + .appendText(Long.toString(limit)) + .appendText(" to match ") + .appendValue(matcher); + } + + /** + * A matcher for potentially infinite Streams of objects, the first limit of + * which must match the given Matcher + * + * @param matcher + * A matcher to apply to items produced from the Stream + * @param limit + * Only check this number of items from the Stream + * @see #allMatch + * @see #startsWithAllLong + * @see #startsWithAllInt + * @see #startsWithAllDouble + */ + public static Matcher> startsWithAll(Matcher matcher, + long limit) { + return new StreamAllMatches(matcher) { + @Override + protected boolean matchesSafely(Stream actual) { + return super.matchesSafely(actual.limit(limit)); + } + + @Override + public void describeTo(Description description) { + describeToStartsAllWith(description, limit, matcher); + } + }; + + } + + /** + * A matcher for potentially infinite Streams of primitive longs, the first + * limit of which must match the given Matcher + * + * @param matcher + * A matcher to apply to items produced from the Stream + * @param limit + * Only check this number of items from the Stream + * @see #allMatchLong + * @see #startsWithAll + * @see #startsWithAllInt + * @see #startsWithAllDouble + */ + public static Matcher startsWithAllLong(Matcher matcher, + long limit) { + return new LongStreamAllMatches(matcher) { + @Override + protected boolean matchesSafely(LongStream actual) { + return super.matchesSafely(actual.limit(limit)); + } + + @Override + public void describeTo(Description description) { + describeToStartsAllWith(description, limit, matcher); + } + }; + } + + /** + * A matcher for potentially infinite Streams of primitive ints, the first + * limit of which must match the given Matcher + * + * @param matcher + * A matcher to apply to items produced from the Stream + * @param limit + * Only check this number of items from the Stream + * @see #allMatchInt + * @see #startsWithAll + * @see #startsWithAllLong + * @see #startsWithAllDouble + */ + public static Matcher startsWithAllInt(Matcher matcher, + long limit) { + return new IntStreamAllMatches(matcher) { + @Override + protected boolean matchesSafely(IntStream actual) { + return super.matchesSafely(actual.limit(limit)); + } + + @Override + public void describeTo(Description description) { + describeToStartsAllWith(description, limit, matcher); + } + }; + } + + /** + * A matcher for potentially infinite Streams of primitive doubles, the + * first limit of which must match the given Matcher + * + * @param matcher + * A matcher to apply to items produced from the Stream + * @param limit + * Only check this number of items from the Stream + * @see #allMatchDouble + * @see #startsWithAll + * @see #startsWithAllInt + * @see #startsWithAllLong + */ + public static Matcher startsWithAllDouble( + Matcher matcher, long limit) { + return new DoubleStreamAllMatches(matcher) { + @Override + protected boolean matchesSafely(DoubleStream actual) { + return super.matchesSafely(actual.limit(limit)); + } + + @Override + public void describeTo(Description description) { + describeToStartsAllWith(description, limit, matcher); + } + }; + } + + private static void describeToStartsAnyWith(Description description, + long limit, Matcher matcher) { + description + .appendText("Any of first ") + .appendText(Long.toString(limit)) + .appendText(" to match ") + .appendValue(matcher); + } + + /** + * A matcher for potentially infinite Streams of objects, at least one of + * the first limit of which must match the given Matcher + * + * @param matcher + * A matcher to apply to items produced from the Stream + * @param limit + * Only check this number of items from the Stream + * @see #anyMatch + * @see #startsWithAnyInt + * @see #startsWithAnyLong + * @see #startsWithAnyDouble + */ + public static Matcher> startsWithAny(Matcher matcher, + long limit) { + return new StreamAnyMatches(matcher) { + @Override + protected boolean matchesSafely(Stream actual) { + return super.matchesSafely(actual.limit(limit)); + } + + @Override + public void describeTo(Description description) { + describeToStartsAnyWith(description, limit, matcher); + } + }; + } + + /** + * A matcher for potentially infinite Streams of primitive longs, at least + * one of the first limit of which must match the given Matcher + * + * @param matcher + * A matcher to apply to items produced from the Stream + * @param limit + * Only check this number of items from the Stream + * @see #anyMatchLong + * @see #startsWithAny + * @see #startsWithAnyInt + * @see #startsWithAnyDouble + */ + public static Matcher startsWithAnyLong(Matcher matcher, + long limit) { + return new LongStreamAnyMatches(matcher) { + @Override + protected boolean matchesSafely(LongStream actual) { + return super.matchesSafely(actual.limit(limit)); + } + + @Override + public void describeTo(Description description) { + describeToStartsAnyWith(description, limit, matcher); + } + }; + } + + /** + * A matcher for potentially infinite Streams of primitive doubles, at least + * one of the first limit of which must match the given Matcher + * + * @param matcher + * A matcher to apply to items produced from the Stream + * @param limit + * Only check this number of items from the Stream + * @see #anyMatchDouble + * @see #startsWithAny + * @see #startsWithAnyInt + * @see #startsWithAnyLong + */ + public static Matcher startsWithAnyDouble( + Matcher matcher, long limit) { + return new DoubleStreamAnyMatches(matcher) { + @Override + protected boolean matchesSafely(DoubleStream actual) { + return super.matchesSafely(actual.limit(limit)); + } + + @Override + public void describeTo(Description description) { + describeToStartsAnyWith(description, limit, matcher); + } + }; + } + + /** + * A matcher for potentially infinite Streams of primitive ints, at least + * one of the first limit of which must match the given Matcher + * + * @param matcher + * A matcher to apply to items produced from the Stream + * @param limit + * Only check this number of items from the Stream + * @see #anyMatchInt + * @see #startsWithAny + * @see #startsWithAnyLong + * @see #startsWithAnyDouble + */ + public static Matcher startsWithAnyInt(Matcher matcher, + long limit) { + return new IntStreamAnyMatches(matcher) { + @Override + protected boolean matchesSafely(IntStream actual) { + return super.matchesSafely(actual.limit(limit)); + } + + @Override + public void describeTo(Description description) { + describeToStartsAnyWith(description, limit, matcher); + } + }; + } + + /** + * The BaseStream must produce exactly the given expected items in order, + * and no more. + * + * For infinite BaseStreams see {@link #startsWith(Object...)} or a + * primitive stream variant + * + * @param expectedMatchers + * Matchers for the items that should be produced by the + * BaseStream + * @param + * The type of items + * @param + * The type of the BaseStream + * @see #startsWith(Object...) + * @see #startsWithInt(int...) + * @see #startsWithLong(long...) + * @see #startsWithDouble(double...) + */ + @SafeVarargs + public static > Matcher yieldsExactly( + Matcher... expectedMatchers) { + return new BaseMatcherStreamMatcher() { + @Override + protected boolean matchesSafely(S actual) { + return remainingItemsMatch( + new ArrayIterator<>(expectedMatchers), actual.iterator()); + } + }; + } + + /** + * The BaseStream must produce exactly the given expected items in order, + * and no more. + * + * @param expectedMatchers + * Matchers for the items that should be produced by the + * BaseStream + * @param + * The type of items + * @param + * The type of the BaseStream + * + * @deprecated name clashes with + * {@link org.hamcrest.Matchers#contains(Matcher...)}, use + * {@link #yieldsExactly(Matcher...)} instead + */ + @SafeVarargs + @Deprecated + public static > Matcher contains( + Matcher... expectedMatchers) { + return yieldsExactly(expectedMatchers); + } + + /** + * The BaseStream must produce exactly the given expected items in order, + * and no more. + * + * For infinite BaseStreams see {@link #startsWith(Object...)} or a + * primitive stream variant + * + * @param expected + * The items that should be produced by the BaseStream + * @param + * The type of items + * @param + * The type of the BaseStream + * @see #startsWith(Object...) + * @see #startsWithInt(int...) + * @see #startsWithLong(long...) + * @see #startsWithDouble(double...) + */ + @SafeVarargs + public static > Matcher yieldsExactly( + T... expected) { + return new BaseStreamMatcher() { + @Override + protected boolean matchesSafely(S actual) { + return remainingItemsEqual(new ArrayIterator<>(expected), + actual.iterator()); + } + }; + } + + /** + * The BaseStream must produce exactly the given expected items in order, + * and no more. + * + * @param expected + * The items that should be produced by the BaseStream + * @param + * The type of items + * @param + * The type of the BaseStream + * + * @deprecated name clashes with + * {@link org.hamcrest.Matchers#contains(Object...)}, use + * {@link #yieldsExactly(Object...)} instead + */ + @SafeVarargs + @Deprecated + public static > Matcher contains( + T... expected) { + return yieldsExactly(expected); + } + + /** + * A matcher for a finite Stream of objects, all of which must match the + * given Matcher. + * + * For infinite Streams see {@link #startsWithAll} + * + * @param matcher + * A Matcher against which to compare items from the Stream + * @param + * The type of items produced by the Stream + * @see #startsWithAll + * @see #allMatchInt + * @see #allMatchLong + * @see #allMatchDouble + */ + public static Matcher> allMatch(Matcher matcher) { + return new StreamAllMatches(matcher) { + @Override + public void describeTo(Description description) { + description.appendText("All to match ").appendValue(matcher); + } + }; + } + + /** + * A matcher for a finite Stream of primitive ints, all of which must match + * the given Matcher. + * + * For infinite Streams see {@link #startsWithAllInt} + * + * @param matcher + * A Matcher against which to compare items from the Stream + * @see #startsWithAllInt + * @see #allMatch + * @see #allMatchLong + * @see #allMatchDouble + */ + public static Matcher allMatchInt(Matcher matcher) { + return new IntStreamAllMatches(matcher) { + @Override + public void describeTo(Description description) { + description.appendText("All to match ").appendValue(matcher); + } + }; + } + + /** + * A matcher for a finite Stream of primitive longs, all of which must match + * the given Matcher. + * + * For infinite Streams see {@link #startsWithAllLong} + * + * @param matcher + * A Matcher against which to compare items from the Stream + * @see #startsWithAllLong + * @see #allMatch + * @see #allMatchInt + * @see #allMatchDouble + */ + public static Matcher allMatchLong(Matcher matcher) { + return new LongStreamAllMatches(matcher) { + @Override + public void describeTo(Description description) { + description.appendText("All to match ").appendValue(matcher); + } + }; + } + + /** + * A matcher for a finite Stream of primitive doubles, all of which must + * match the given Matcher. + * + * For infinite Streams see {@link #startsWithAllDouble} + * + * @param matcher + * A Matcher against which to compare items from the Stream + * @see #startsWithAllDouble + * @see #allMatch + * @see #allMatchInt + * @see #allMatchLong + */ + public static Matcher allMatchDouble( + Matcher matcher) { + return new DoubleStreamAllMatches(matcher) { + @Override + public void describeTo(Description description) { + description.appendText("All to match ").appendValue(matcher); + } + }; + } + + /** + * A matcher for a finite Stream of objects, at least one of which must + * match the given Matcher. + * + * For infinite Streams see {@link #startsWithAny} + * + * @param matcher + * A Matcher against which to compare items from the Stream + * @param + * The type of items produced by the Stream + * @see #startsWithAny + * @see #anyMatchInt + * @see #anyMatchLong + * @see #anyMatchDouble + */ + public static Matcher> anyMatch(Matcher matcher) { + return new StreamAnyMatches(matcher) { + @Override + public void describeTo(Description description) { + description.appendText("Any to match ").appendValue(matcher); + } + }; + } + + /** + * A matcher for a finite Stream of primitive longs, at least one of which + * must match the given Matcher. + * + * For infinite Streams see {@link #startsWithAnyLong} + * + * @param matcher + * A Matcher against which to compare items from the Stream + * @see #startsWithAnyLong + * @see #anyMatch + * @see #anyMatchInt + * @see #anyMatchDouble + */ + public static Matcher anyMatchLong(Matcher matcher) { + return new LongStreamAnyMatches(matcher) { + @Override + public void describeTo(Description description) { + description.appendText("Any to match ").appendValue(matcher); + } + }; + } + + /** + * A matcher for a finite Stream of primitive doubles, at least one of which + * must match the given Matcher. + * + * For infinite Streams see {@link #startsWithAnyDouble} + * + * @param matcher + * A Matcher against which to compare items from the Stream + * @see #startsWithAnyDouble + * @see #anyMatch + * @see #anyMatchInt + * @see #anyMatchDouble + */ + public static Matcher anyMatchDouble( + Matcher matcher) { + return new DoubleStreamAnyMatches(matcher) { + @Override + public void describeTo(Description description) { + description.appendText("Any to match ").appendValue(matcher); + } + }; + } + + /** + * A matcher for a finite Stream of primitive ints, at least one of which + * must match the given Matcher. + * + * For infinite Streams see {@link #startsWithAnyInt} + * + * @param matcher + * A Matcher against which to compare items from the Stream + * @see #startsWithAnyInt + * @see #anyMatch + * @see #anyMatchLong + * @see #anyMatchDouble + */ + + public static Matcher anyMatchInt(Matcher matcher) { + return new IntStreamAnyMatches(matcher) { + @Override + public void describeTo(Description description) { + description.appendText("Any to match ").appendValue(matcher); + } + }; + } + + /** + * A matcher for a potentially infinite Stream of objects against n expected + * items, matching if the first n items produced by the Stream equal the + * expected items in order. Whether the Stream would subsequently produce + * additional items is irrelevant. + * + * @param expected + * The expected items produced first by the Stream + * @param + * The type of items + * @see #contains + * @see #startsWithInt + * @see #startsWithDouble + * @see #startsWithLong + */ + + @SafeVarargs + public static Matcher> startsWith(T... expected) { + return new BaseStreamMatcher>() { + @Override + protected boolean matchesSafely(Stream actual) { + return remainingItemsEqual(new ArrayIterator<>(expected), + actual.limit(expected.length).iterator()); + } + }; + } + + /** + * A matcher for a potentially infinite Stream of primitive doubles against + * n expected items, matching if the first n items produced by the Stream + * equal the expected items in order. Whether the Stream would subsequently + * produce additional items is irrelevant. + * + * @param expected + * The expected items produced first by the Stream + * @see #contains + * @see #startsWith + * @see #startsWithInt + * @see #startsWithLong + */ + public static Matcher startsWithDouble(double... expected) { + return new BaseStreamMatcher() { + @Override + protected boolean matchesSafely(DoubleStream actual) { + return remainingItemsEqual(new DoubleArrayIterator(expected), + actual.limit(expected.length).iterator()); + } + }; + } + + /** + * A matcher for a potentially infinite Stream of primitive longs against n + * expected items, matching if the first n items produced by the Stream + * equal the expected items in order. Whether the Stream would subsequently + * produce additional items is irrelevant. + * + * @param expected + * The expected items produced first by the Stream + * @see #contains + * @see #startsWith + * @see #startsWithInt + * @see #startsWithDouble + */ + public static Matcher startsWithLong(long... expected) { + return new BaseStreamMatcher() { + @Override + protected boolean matchesSafely(LongStream actual) { + return remainingItemsEqual(new LongArrayIterator(expected), + actual.limit(expected.length).iterator()); + } + }; + } + + /** + * A matcher for a potentially infinite Stream of primitive ints against n + * expected items, matching if the first n items produced by the Stream + * equal the expected items in order. Whether the Stream would subsequently + * produce additional items is irrelevant. + * + * @param expected + * The expected items produced first by the Stream + * @see #contains + * @see #startsWith + * @see #startsWithLong + * @see #startsWithDouble + */ + public static Matcher startsWithInt(int... expected) { + return new BaseStreamMatcher() { + @Override + protected boolean matchesSafely(IntStream actual) { + return remainingItemsEqual(new IntArrayIterator(expected), + actual.limit(expected.length).iterator()); + } + }; + } + + private static abstract class BaseStreamMatcher> + extends TypeSafeMatcher { + final List expectedAccumulator = new LinkedList<>(); + final List actualAccumulator = new LinkedList<>(); + + @Override + public void describeTo(Description description) { + describe(description, expectedAccumulator); + } + + @Override + protected void describeMismatchSafely(S item, Description description) { + describe(description, actualAccumulator); + } + + private void describe(Description description, List values) { + description.appendText("Stream of ").appendValueList("[", ",", "]", + values); + } + + boolean remainingItemsEqual(Iterator expectedIterator, + Iterator actualIterator) { + if (!expectedIterator.hasNext() && !actualIterator.hasNext()) { + return true; + } + if (expectedIterator.hasNext() && actualIterator.hasNext()) { + T nextExpected = expectedIterator.next(); + expectedAccumulator.add(nextExpected); + T nextActual = actualIterator.next(); + actualAccumulator.add(nextActual); + if (Objects.equals(nextExpected, nextActual)) { + return remainingItemsEqual(expectedIterator, + actualIterator); + } + } + expectedIterator.forEachRemaining(expectedAccumulator::add); + actualIterator.forEachRemaining(actualAccumulator::add); + return false; + } + } + + private static abstract class BaseMatcherStreamMatcher> + extends TypeSafeMatcher { + final List> expectedAccumulator = new LinkedList<>(); + final List actualAccumulator = new LinkedList<>(); + + @Override + protected void describeMismatchSafely(S item, Description description) { + description.appendText("Stream of ").appendValueList("[", ",", "]", + actualAccumulator); + } + + @Override + public void describeTo(Description description) { + description.appendText("Stream of ").appendValueList("[", ",", "]", + expectedAccumulator); + } + + boolean remainingItemsMatch(Iterator> expectedIterator, + Iterator actualIterator) { + if (!expectedIterator.hasNext() && !actualIterator.hasNext()) { + return true; + } + if (expectedIterator.hasNext() && actualIterator.hasNext()) { + Matcher nextExpected = expectedIterator.next(); + expectedAccumulator.add(nextExpected); + T nextActual = actualIterator.next(); + actualAccumulator.add(nextActual); + if (nextExpected.matches(nextActual)) { + return remainingItemsMatch(expectedIterator, + actualIterator); + } + } + expectedIterator.forEachRemaining(expectedAccumulator::add); + actualIterator.forEachRemaining(actualAccumulator::add); + return false; + } + } + + private static void allMatchMismatch(Description mismatchDescription, + long position, Object nonMatch) { + mismatchDescription.appendText("Item ") + .appendText(Long.toString(position)) + .appendText(" failed to match: ").appendValue(nonMatch); + } + + private static abstract class StreamAllMatches + extends TypeSafeMatcher> { + private T nonMatching; + private long positionNonMatching = -1L; + private final Matcher matcher; + + StreamAllMatches(Matcher matcher) { + this.matcher = matcher; + } + + @Override + protected boolean matchesSafely(Stream actual) { + return actual + .peek(i -> { + nonMatching = i; + positionNonMatching++; + }) + .allMatch(matcher::matches); + } + + @Override + protected void describeMismatchSafely(Stream actual, + Description mismatchDescription) { + allMatchMismatch(mismatchDescription, positionNonMatching, + nonMatching); + } + } + + private static abstract class IntStreamAllMatches + extends TypeSafeMatcher { + private int nonMatching; + private long positionNonMatching = -1L; + private final Matcher matcher; + + IntStreamAllMatches(Matcher matcher) { + this.matcher = matcher; + } + + @Override + protected boolean matchesSafely(IntStream actual) { + return actual + .peek(i -> { + nonMatching = i; + positionNonMatching++; + }) + .allMatch(matcher::matches); + } + + @Override + protected void describeMismatchSafely(IntStream actual, + Description mismatchDescription) { + allMatchMismatch(mismatchDescription, positionNonMatching, + nonMatching); + } + } + + private static abstract class LongStreamAllMatches + extends TypeSafeMatcher { + private long nonMatching; + private long positionNonMatching = -1L; + private final Matcher matcher; + + LongStreamAllMatches(Matcher matcher) { + this.matcher = matcher; + } + + @Override + protected boolean matchesSafely(LongStream actual) { + return actual + .peek(i -> { + nonMatching = i; + positionNonMatching++; + }) + .allMatch(matcher::matches); + } + + @Override + protected void describeMismatchSafely(LongStream actual, + Description mismatchDescription) { + allMatchMismatch(mismatchDescription, positionNonMatching, + nonMatching); + } + } + + private static abstract class DoubleStreamAllMatches + extends TypeSafeMatcher { + private double nonMatching; + private long positionNonMatching = -1L; + private final Matcher matcher; + + DoubleStreamAllMatches(Matcher matcher) { + this.matcher = matcher; + } + + @Override + protected boolean matchesSafely(DoubleStream actual) { + return actual + .peek(i -> { + nonMatching = i; + positionNonMatching++; + }) + .allMatch(matcher::matches); + } + + @Override + protected void describeMismatchSafely(DoubleStream actual, + Description mismatchDescription) { + allMatchMismatch(mismatchDescription, positionNonMatching, + nonMatching); + } + } + + private static void anyMatchMismatch(Description mismatchDescription, + List accumulator) { + mismatchDescription + .appendText("None of these items matched: ") + .appendValueList("[", ",", "]", accumulator); + } + + private static abstract class StreamAnyMatches + extends TypeSafeMatcher> { + final List accumulator = new LinkedList<>(); + final Matcher matcher; + + StreamAnyMatches(Matcher matcher) { + this.matcher = matcher; + } + + @Override + protected boolean matchesSafely(Stream actual) { + return actual.peek(accumulator::add).anyMatch(matcher::matches); + } + + @Override + protected void describeMismatchSafely(Stream actual, + Description mismatchDescription) { + anyMatchMismatch(mismatchDescription, accumulator); + } + } + + private static abstract class LongStreamAnyMatches + extends TypeSafeMatcher { + final List accumulator = new LinkedList<>(); + final Matcher matcher; + + LongStreamAnyMatches(Matcher matcher) { + this.matcher = matcher; + } + + @Override + protected boolean matchesSafely(LongStream actual) { + return actual.peek(accumulator::add).anyMatch(matcher::matches); + } + + @Override + protected void describeMismatchSafely(LongStream actual, + Description mismatchDescription) { + anyMatchMismatch(mismatchDescription, accumulator); + } + } + + private static abstract class IntStreamAnyMatches + extends TypeSafeMatcher { + final List accumulator = new LinkedList<>(); + final Matcher matcher; + + IntStreamAnyMatches(Matcher matcher) { + this.matcher = matcher; + } + + @Override + protected boolean matchesSafely(IntStream actual) { + return actual.peek(accumulator::add).anyMatch(matcher::matches); + } + + @Override + protected void describeMismatchSafely(IntStream actual, + Description mismatchDescription) { + anyMatchMismatch(mismatchDescription, accumulator); + } + } + + private static abstract class DoubleStreamAnyMatches + extends TypeSafeMatcher { + final List accumulator = new LinkedList<>(); + final Matcher matcher; + + DoubleStreamAnyMatches(Matcher matcher) { + this.matcher = matcher; + } + + @Override + protected boolean matchesSafely(DoubleStream actual) { + return actual.peek(accumulator::add).anyMatch(matcher::matches); + } + + @Override + protected void describeMismatchSafely(DoubleStream actual, + Description mismatchDescription) { + anyMatchMismatch(mismatchDescription, accumulator); + } + } + + private static class ArrayIterator implements Iterator { + private final T[] expected; + private int currentPos = 0; + + @SafeVarargs + public ArrayIterator(T... expected) { + this.expected = expected; + } + + @Override + public boolean hasNext() { + return currentPos < expected.length; + } + + @Override + public T next() { + return expected[currentPos++]; + } + } + + private static class IntArrayIterator implements PrimitiveIterator.OfInt { + private final int[] expected; + private int currentPos = 0; + + public IntArrayIterator(int... expected) { + this.expected = expected; + } + + @Override + public boolean hasNext() { + return currentPos < expected.length; + } + + @Override + public int nextInt() { + return expected[currentPos++]; + } + } + + private static class LongArrayIterator implements PrimitiveIterator.OfLong { + private final long[] expected; + private int currentPos = 0; + + public LongArrayIterator(long... expected) { + this.expected = expected; + } + + @Override + public boolean hasNext() { + return currentPos < expected.length; + } + + @Override + public long nextLong() { + return expected[currentPos++]; + } + } + + private static class DoubleArrayIterator + implements PrimitiveIterator.OfDouble { + private final double[] expected; + private int currentPos = 0; + + public DoubleArrayIterator(double... expected) { + this.expected = expected; + } + + @Override + public boolean hasNext() { + return currentPos < expected.length; + } + + @Override + public double nextDouble() { + return expected[currentPos++]; + } + } +} diff --git a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/StreamMatchersExtensions.java b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/StreamMatchersExtensions.java index 3762fc0fc9..fd2a0d73ac 100644 --- a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/StreamMatchersExtensions.java +++ b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/StreamMatchersExtensions.java @@ -29,7 +29,6 @@ import com.google.common.collect.*; import edu.umd.cs.findbugs.annotations.*; -import uk.co.probablyfine.matchers.*; // NOTE cannot use lombok.val/var here on JDK 16 // ISSUE https://github.com/projectlombok/lombok/issues/2839 diff --git a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/TimeMatchers.java b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/TimeMatchers.java new file mode 100644 index 0000000000..3866679cde --- /dev/null +++ b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/TimeMatchers.java @@ -0,0 +1,159 @@ +package dev.aherscu.qa.testing.utils; + +import java.time.Period; +import java.time.temporal.Temporal; +import java.time.temporal.TemporalAmount; + +import org.hamcrest.Description; +import org.hamcrest.Matcher; +import org.hamcrest.TypeSafeMatcher; + +public class TimeMatchers { + + /** + * Matches a time strictly after that given + * + * @param time + * Time for comparison + * @param + * The type of time, e.g. Instant or LocalDateTime + */ + public static & Temporal> Matcher after( + T time) { + return new TypeSafeMatcher() { + @Override + protected boolean matchesSafely(T actual) { + return actual.compareTo(time) > 0; + } + + @Override + public void describeTo(Description description) { + description.appendText("after ").appendValue(time); + } + }; + } + + /** + * Matches a time strictly before that given + * + * @param time + * Time for comparison + * @param + * The type of time, e.g. Instant or LocalDateTime + */ + public static & Temporal> Matcher before( + T time) { + return new TypeSafeMatcher() { + @Override + protected boolean matchesSafely(T actual) { + return actual.compareTo(time) < 0; + } + + @Override + public void describeTo(Description description) { + description.appendText("before ").appendValue(time); + } + }; + } + + /** + * Matches a Comparable value greater than or equal to the first given value + * and less than or equal to the second given value + * + * @param + * The type to compare, e.g. Temporal or TemporalAmount + */ + public static > Matcher between(T earlierOrEqual, + T laterOrEqual) { + return new TypeSafeMatcher() { + @Override + protected boolean matchesSafely(T actual) { + return actual.compareTo(earlierOrEqual) >= 0 + && actual.compareTo(laterOrEqual) <= 0; + } + + @Override + public void describeTo(Description description) { + description.appendText("between ").appendValue(earlierOrEqual) + .appendText(" and ") + .appendValue(laterOrEqual) + .appendText(" inclusive"); + } + }; + } + + /** + * Matches an amount of time strictly longer than that specified + * + * @param amount + * amount of time for comparison + * @param + * The type to compare, typically Duration + */ + public static & TemporalAmount> Matcher longerThan( + T amount) { + return new TypeSafeMatcher() { + + @Override + protected boolean matchesSafely(T actual) { + return actual.compareTo(amount) > 0; + } + + @Override + public void describeTo(Description description) { + description.appendText("longer than ").appendValue(amount); + } + }; + } + + /** + * Matches an amount of time strictly shorter than that specified + * + * @param amount + * amount of time for comparison + * @param + * The type to compare, typically Duration + */ + public static & TemporalAmount> Matcher shorterThan( + T amount) { + return new TypeSafeMatcher() { + + @Override + protected boolean matchesSafely(T actual) { + return actual.compareTo(amount) < 0; + } + + @Override + public void describeTo(Description description) { + description.appendText("shorter than ").appendValue(amount); + } + }; + } + + /** + * Matches any Period for which the years, months and days match the + * provided matchers + */ + public static Matcher matches(Matcher yearsMatcher, + Matcher monthsMatcher, Matcher daysMatcher) { + return new TypeSafeMatcher() { + @Override + protected boolean matchesSafely(Period item) { + return yearsMatcher.matches(item.getYears()) + && monthsMatcher.matches(item.getMonths()) + && daysMatcher.matches(item.getDays()); + } + + @Override + public void describeTo(Description description) { + description + .appendText("a Period with years matching ") + .appendValue(yearsMatcher) + .appendText(" months matching ") + .appendValue(yearsMatcher) + .appendText(" and days matching ") + .appendValue(daysMatcher); + } + }; + } +} diff --git a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/assertions/IsJson.java b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/assertions/IsJson.java new file mode 100644 index 0000000000..e9101903ea --- /dev/null +++ b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/assertions/IsJson.java @@ -0,0 +1,70 @@ +package dev.aherscu.qa.testing.utils.assertions; + +import java.io.File; +import java.io.IOException; + +import org.hamcrest.Description; +import org.hamcrest.Matcher; +import org.hamcrest.TypeSafeMatcher; + +import com.jayway.jsonpath.JsonPath; +import com.jayway.jsonpath.JsonPathException; +import com.jayway.jsonpath.ReadContext; + +public class IsJson extends TypeSafeMatcher { + private final Matcher jsonMatcher; + + public IsJson(Matcher jsonMatcher) { + this.jsonMatcher = jsonMatcher; + } + + @Override + protected boolean matchesSafely(T json) { + try { + ReadContext context = parse(json); + return jsonMatcher.matches(context); + } catch (JsonPathException e) { + return false; + } catch (IOException e) { + return false; + } + } + + public void describeTo(Description description) { + description.appendText("is json ").appendDescriptionOf(jsonMatcher); + } + + @Override + protected void describeMismatchSafely(T json, + Description mismatchDescription) { + try { + ReadContext context = parse(json); + jsonMatcher.describeMismatch(context, mismatchDescription); + } catch (JsonPathException e) { + buildMismatchDescription(json, mismatchDescription, e); + } catch (IOException e) { + buildMismatchDescription(json, mismatchDescription, e); + } + } + + private static void buildMismatchDescription(Object json, + Description mismatchDescription, Exception e) { + mismatchDescription + .appendText("was ") + .appendValue(json) + .appendText(" which failed with ") + .appendValue(e.getMessage()); + } + + private static ReadContext parse(Object object) throws IOException { + if (object instanceof String) { + return JsonPath.parse((String) object); + } else if (object instanceof File) { + return JsonPath.parse((File) object); + } else if (object instanceof ReadContext) { + return (ReadContext) object; + } else { + return JsonPath.parse(object); + } + } +} diff --git a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/assertions/JXPathAssert.java b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/assertions/JXPathAssert.java index 40db810996..713f2438ae 100644 --- a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/assertions/JXPathAssert.java +++ b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/assertions/JXPathAssert.java @@ -15,8 +15,6 @@ */ package dev.aherscu.qa.testing.utils.assertions; -import com.jayway.jsonassert.*; - import lombok.extern.slf4j.*; /** diff --git a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/assertions/JsonAssert.java b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/assertions/JsonAssert.java new file mode 100644 index 0000000000..23984ff688 --- /dev/null +++ b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/assertions/JsonAssert.java @@ -0,0 +1,106 @@ +package dev.aherscu.qa.testing.utils.assertions; + +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.Reader; +import java.io.StringWriter; +import java.io.Writer; +import java.text.ParseException; +import java.util.Collection; +import java.util.Map; + +import org.hamcrest.Matcher; + +import com.jayway.jsonpath.JsonPath; + +import dev.aherscu.qa.testing.utils.assertions.impl.*; +import dev.aherscu.qa.testing.utils.assertions.impl.matcher.*; + +public class JsonAssert { + + /** + * Creates a JSONAsserter + * + * @param json + * the JSON document to create a JSONAsserter for + * @return a JSON asserter initialized with the provided document + * @throws ParseException + * when the given JSON could not be parsed + */ + public static JsonAsserter with(String json) { + return new JsonAsserterImpl(JsonPath.parse(json).json()); + } + + /** + * Creates a JSONAsserter + * + * @param reader + * the reader of the json document + * @return a JSON asserter initialized with the provided document + * @throws ParseException + * when the given JSON could not be parsed + */ + public static JsonAsserter with(Reader reader) throws IOException { + return new JsonAsserterImpl( + JsonPath.parse(convertReaderToString(reader)).json()); + + } + + /** + * Creates a JSONAsserter + * + * @param is + * the input stream + * @return a JSON asserter initialized with the provided document + * @throws ParseException + * when the given JSON could not be parsed + */ + public static JsonAsserter with(InputStream is) throws IOException { + Reader reader = new InputStreamReader(is); + return with(reader); + } + + // Matchers + + public static CollectionMatcher collectionWithSize( + Matcher sizeMatcher) { + return new IsCollectionWithSize(sizeMatcher); + } + + public static Matcher> mapContainingKey( + Matcher keyMatcher) { + return new IsMapContainingKey(keyMatcher); + } + + public static Matcher> mapContainingValue( + Matcher valueMatcher) { + return new IsMapContainingValue(valueMatcher); + } + + public static Matcher> emptyCollection() { + return new IsEmptyCollection(); + } + + private static String convertReaderToString(Reader reader) + throws IOException { + + if (reader != null) { + Writer writer = new StringWriter(); + + char[] buffer = new char[1024]; + try { + int n; + while ((n = reader.read(buffer)) != -1) { + writer.write(buffer, 0, n); + } + } finally { + reader.close(); + } + return writer.toString(); + } else { + return ""; + } + } + +} diff --git a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/assertions/JsonAssertEx.java b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/assertions/JsonAssertEx.java index 9e1220488e..23d1eef534 100644 --- a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/assertions/JsonAssertEx.java +++ b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/assertions/JsonAssertEx.java @@ -15,7 +15,6 @@ */ package dev.aherscu.qa.testing.utils.assertions; -import com.jayway.jsonassert.*; import com.jayway.jsonpath.*; import lombok.extern.slf4j.*; diff --git a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/assertions/JsonAsserter.java b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/assertions/JsonAsserter.java new file mode 100644 index 0000000000..8b6a5f606f --- /dev/null +++ b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/assertions/JsonAsserter.java @@ -0,0 +1,105 @@ +package dev.aherscu.qa.testing.utils.assertions; + +import org.hamcrest.Matcher; + +public interface JsonAsserter { + + /** + * Asserts that object specified by path satisfies the condition specified + * by matcher. If not, an AssertionError is thrown with information about + * the matcher and failing value. Example: + *

    + * + * with(json).assertThat("items[0].name", equalTo("Bobby")) + * .assertThat("items[0].age" , equalTo(24L)) + * + * + * @param path + * the json path specifying the value being compared + * @param matcher + * an expression, built of Matchers, specifying allowed values + * @param + * the static type accepted by the matcher + * @return this to allow fluent assertion chains + */ + JsonAsserter assertThat(String path, Matcher matcher); + + /** + * @param path + * the json path specifying the value being compared + * @param matcher + * an expression, built of Matchers, specifying allowed values + * @param message + * the explanation message + * @param + * the static type that should be returned by the path + * @return this to allow fluent assertion chains + */ + JsonAsserter assertThat(String path, Matcher matcher, + String message); + + /** + * Asserts that object specified by path is equal to the expected value. If + * they are not, an AssertionError is thrown with the given message. + * + * @param path + * the json path specifying the value being compared + * @param expected + * the expected value + * @param + * the static type that should be returned by the path + * @return this to allow fluent assertion chains + */ + JsonAsserter assertEquals(String path, T expected); + + JsonAsserter assertEquals(String path, T expected, String message); + + /** + * Checks that a path is not defined within a document. If the document + * contains the given path, an AssertionError is thrown + * + * @param path + * the path to make sure not exists + * @return this + */ + JsonAsserter assertNotDefined(String path); + + JsonAsserter assertNotDefined(String path, String message); + + /** + * Asserts that object specified by path is null. If it is not, an + * AssertionError is thrown with the given message. + * + * @param path + * the json path specifying the value that should be null + * @return this to allow fluent assertion chains + */ + JsonAsserter assertNull(String path); + + JsonAsserter assertNull(String path, String message); + + /** + * Asserts that object specified by path is NOT null. If it is, an + * AssertionError is thrown with the given message. + * + * @param path + * the json path specifying the value that should be NOT null + * @return this to allow fluent assertion chains + */ + JsonAsserter assertNotNull(String path); + + JsonAsserter assertNotNull(String path, String message); + + /** + * Syntactic sugar to allow chaining assertions with a separating and() + * statement + *

    + *

    + * + * with(json).assertThat("firstName", is(equalTo("Bobby"))).and().assertThat("lastName", is(equalTo("Ewing"))) + * + * + * @return this to allow fluent assertion chains + */ + JsonAsserter and(); +} diff --git a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/assertions/JsonAsserterEx.java b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/assertions/JsonAsserterEx.java index ce2ce26d07..73639f751e 100644 --- a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/assertions/JsonAsserterEx.java +++ b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/assertions/JsonAsserterEx.java @@ -15,8 +15,6 @@ */ package dev.aherscu.qa.testing.utils.assertions; -import com.jayway.jsonassert.*; - /** * Supports asserting on multiple JSON paths. * diff --git a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/assertions/JsonAsserterExImpl.java b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/assertions/JsonAsserterExImpl.java index e580413662..86abfc43bb 100644 --- a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/assertions/JsonAsserterExImpl.java +++ b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/assertions/JsonAsserterExImpl.java @@ -20,9 +20,7 @@ import java.util.ArrayList; -import com.jayway.jsonassert.*; -import com.jayway.jsonassert.impl.*; - +import dev.aherscu.qa.testing.utils.assertions.impl.*; import lombok.*; /** diff --git a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/assertions/JsonPathMatchers.java b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/assertions/JsonPathMatchers.java new file mode 100644 index 0000000000..2755049cd6 --- /dev/null +++ b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/assertions/JsonPathMatchers.java @@ -0,0 +1,83 @@ +package dev.aherscu.qa.testing.utils.assertions; + +import static org.hamcrest.Matchers.*; + +import java.io.File; +import java.util.List; +import java.util.Map; + +import org.hamcrest.Matcher; + +import com.jayway.jsonpath.*; + +public class JsonPathMatchers { + + private JsonPathMatchers() { + throw new AssertionError("prevent instantiation"); + } + + public static Matcher hasJsonPath(String jsonPath) { + return describedAs("has json path %0", + isJson(withJsonPath(jsonPath)), + jsonPath); + } + + public static Matcher hasJsonPath(String jsonPath, + Matcher resultMatcher) { + return isJson(withJsonPath(jsonPath, resultMatcher)); + } + + public static Matcher hasNoJsonPath(String jsonPath) { + return isJson(withoutJsonPath(jsonPath)); + } + + public static Matcher isJson() { + return isJson(withJsonPath("$", + anyOf(instanceOf(Map.class), instanceOf(List.class)))); + } + + public static Matcher isJson(Matcher matcher) { + return new IsJson(matcher); + } + + public static Matcher isJsonString( + Matcher matcher) { + return new IsJson(matcher); + } + + public static Matcher isJsonFile( + Matcher matcher) { + return new IsJson(matcher); + } + + public static Matcher withJsonPath(String jsonPath, + Predicate... filters) { + return withJsonPath(JsonPath.compile(jsonPath, filters)); + } + + public static Matcher withJsonPath(JsonPath jsonPath) { + return describedAs("with json path %0", + withJsonPath(jsonPath, anything()), + jsonPath.getPath()); + } + + public static Matcher withoutJsonPath(String jsonPath, + Predicate... filters) { + return withoutJsonPath(JsonPath.compile(jsonPath, filters)); + } + + public static Matcher withoutJsonPath( + JsonPath jsonPath) { + return new WithoutJsonPath(jsonPath); + } + + public static Matcher withJsonPath(String jsonPath, + Matcher resultMatcher) { + return withJsonPath(JsonPath.compile(jsonPath), resultMatcher); + } + + public static Matcher withJsonPath( + JsonPath jsonPath, Matcher resultMatcher) { + return new WithJsonPath(jsonPath, resultMatcher); + } +} diff --git a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/assertions/WithJsonPath.java b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/assertions/WithJsonPath.java new file mode 100644 index 0000000000..e083b01663 --- /dev/null +++ b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/assertions/WithJsonPath.java @@ -0,0 +1,62 @@ +package dev.aherscu.qa.testing.utils.assertions; + +import org.hamcrest.Description; +import org.hamcrest.Matcher; +import org.hamcrest.TypeSafeMatcher; + +import com.jayway.jsonpath.JsonPath; +import com.jayway.jsonpath.JsonPathException; +import com.jayway.jsonpath.PathNotFoundException; +import com.jayway.jsonpath.ReadContext; + +public class WithJsonPath extends TypeSafeMatcher { + private final JsonPath jsonPath; + private final Matcher resultMatcher; + + public WithJsonPath(JsonPath jsonPath, Matcher resultMatcher) { + this.jsonPath = jsonPath; + this.resultMatcher = resultMatcher; + } + + @Override + protected boolean matchesSafely(ReadContext context) { + try { + T value = context.read(jsonPath); + return resultMatcher.matches(value); + } catch (JsonPathException e) { + return false; + } + } + + public void describeTo(Description description) { + description + .appendText("with json path ") + .appendValue(jsonPath.getPath()) + .appendText(" evaluated to ") + .appendDescriptionOf(resultMatcher); + } + + @Override + protected void describeMismatchSafely(ReadContext context, + Description mismatchDescription) { + try { + T value = jsonPath.read(context.jsonString()); + mismatchDescription + .appendText("json path ") + .appendValue(jsonPath.getPath()) + .appendText(" was evaluated to ") + .appendValue(value); + } catch (PathNotFoundException e) { + mismatchDescription + .appendText("json path ") + .appendValue(jsonPath.getPath()) + .appendText(" was not found in ") + .appendValue(context.json()); + } catch (JsonPathException e) { + mismatchDescription + .appendText("was ") + .appendValue(context.json()); + } + } + +} diff --git a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/assertions/WithoutJsonPath.java b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/assertions/WithoutJsonPath.java new file mode 100644 index 0000000000..87eb1bebda --- /dev/null +++ b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/assertions/WithoutJsonPath.java @@ -0,0 +1,37 @@ +package dev.aherscu.qa.testing.utils.assertions; + +import org.hamcrest.Description; +import org.hamcrest.TypeSafeDiagnosingMatcher; + +import com.jayway.jsonpath.JsonPath; +import com.jayway.jsonpath.JsonPathException; +import com.jayway.jsonpath.ReadContext; + +public class WithoutJsonPath extends TypeSafeDiagnosingMatcher { + private final JsonPath jsonPath; + + public WithoutJsonPath(JsonPath jsonPath) { + this.jsonPath = jsonPath; + } + + @Override + protected boolean matchesSafely(ReadContext actual, + Description mismatchDescription) { + try { + Object value = actual.read(jsonPath); + mismatchDescription + .appendText(jsonPath.getPath()) + .appendText(" was evaluated to ") + .appendValue(value); + return false; + } catch (JsonPathException e) { + return true; + } + } + + @Override + public void describeTo(Description description) { + description.appendText("without json path ") + .appendValue(jsonPath.getPath()); + } +} diff --git a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/assertions/impl/JsonAsserterImpl.java b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/assertions/impl/JsonAsserterImpl.java new file mode 100644 index 0000000000..fc13c55538 --- /dev/null +++ b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/assertions/impl/JsonAsserterImpl.java @@ -0,0 +1,144 @@ +package dev.aherscu.qa.testing.utils.assertions.impl; + +import static java.lang.String.format; +import static org.hamcrest.Matchers.*; + +import org.hamcrest.Matcher; + +import com.jayway.jsonpath.Configuration; +import com.jayway.jsonpath.JsonPath; +import com.jayway.jsonpath.PathNotFoundException; + +import dev.aherscu.qa.testing.utils.assertions.*; + +public class JsonAsserterImpl implements JsonAsserter { + + private final Object jsonObject; + + /** + * Instantiates a new JSONAsserter + * + * @param jsonObject + * the object to make asserts on + */ + public JsonAsserterImpl(Object jsonObject) { + this.jsonObject = jsonObject; + } + + /** + * {@inheritDoc} + */ + @SuppressWarnings("unchecked") + public JsonAsserter assertThat(String path, Matcher matcher) { + T obj = null; + + try { + obj = JsonPath. read(jsonObject, path); + } catch (Exception e) { + final AssertionError assertionError = new AssertionError( + String.format("Error reading JSON path [%s]", path)); + assertionError.initCause(e); + throw assertionError; + } + + if (!matcher.matches(obj)) { + + throw new AssertionError(String.format( + "JSON path [%s] doesn't match.\nExpected:\n%s\nActual:\n%s", + path, matcher.toString(), obj)); + } + return this; + } + + /** + * {@inheritDoc} + */ + @SuppressWarnings("unchecked") + public JsonAsserter assertThat(String path, Matcher matcher, + String message) { + T obj = JsonPath. read(jsonObject, path); + if (!matcher.matches(obj)) { + throw new AssertionError(String.format( + "JSON Assert Error: %s\nExpected:\n%s\nActual:\n%s", message, + matcher.toString(), obj)); + } + return this; + } + + /** + * {@inheritDoc} + */ + public JsonAsserter assertEquals(String path, T expected) { + return assertThat(path, equalTo(expected)); + } + + /** + * {@inheritDoc} + */ + public JsonAsserter assertNotDefined(String path) { + + try { + Configuration c = Configuration.defaultConfiguration(); + + JsonPath.using(c).parse(jsonObject).read(path); + throw new AssertionError(format( + "Document contains the path <%s> but was expected not to.", + path)); + } catch (PathNotFoundException e) { + } + return this; + } + + @Override + public JsonAsserter assertNotDefined(String path, String message) { + try { + Configuration c = Configuration.defaultConfiguration(); + + JsonPath.using(c).parse(jsonObject).read(path); + + throw new AssertionError(format( + "Document contains the path <%s> but was expected not to.", + path)); + } catch (PathNotFoundException e) { + } + return this; + } + + /** + * {@inheritDoc} + */ + public JsonAsserter assertNull(String path) { + return assertThat(path, nullValue()); + } + + @Override + public JsonAsserter assertNull(String path, String message) { + return assertThat(path, nullValue(), message); + } + + @Override + public JsonAsserter assertEquals(String path, T expected, + String message) { + return assertThat(path, equalTo(expected), message); + } + + /** + * {@inheritDoc} + */ + public JsonAsserter assertNotNull(String path) { + return assertThat(path, notNullValue()); + } + + @Override + public JsonAsserter assertNotNull(String path, String message) { + return assertThat(path, notNullValue(), message); + } + + /** + * {@inheritDoc} + */ + public JsonAsserter and() { + return this; + } + +} diff --git a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/assertions/impl/matcher/CollectionMatcher.java b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/assertions/impl/matcher/CollectionMatcher.java new file mode 100644 index 0000000000..9b54fe0848 --- /dev/null +++ b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/assertions/impl/matcher/CollectionMatcher.java @@ -0,0 +1,47 @@ +/* +BSD License + +Copyright (c) 2000-2006, www.hamcrest.org +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +Redistributions of source code must retain the above copyright notice, this list of +conditions and the following disclaimer. Redistributions in binary form must reproduce +the above copyright notice, this list of conditions and the following disclaimer in +the documentation and/or other materials provided with the distribution. + +Neither the name of Hamcrest nor the names of its contributors may be used to endorse +or promote products derived from this software without specific prior written +permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT +SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED +TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY +WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. +*/ +package dev.aherscu.qa.testing.utils.assertions.impl.matcher; + +import java.util.Collection; + +import org.hamcrest.BaseMatcher; + +public abstract class CollectionMatcher> + extends BaseMatcher { + @SuppressWarnings("unchecked") + public boolean matches(Object item) { + if (!(item instanceof Collection)) { + return false; + } + return matchesSafely((C) item); + } + + protected abstract boolean matchesSafely(C collection); +} diff --git a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/assertions/impl/matcher/IsCollectionWithSize.java b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/assertions/impl/matcher/IsCollectionWithSize.java new file mode 100644 index 0000000000..b33ccd2516 --- /dev/null +++ b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/assertions/impl/matcher/IsCollectionWithSize.java @@ -0,0 +1,79 @@ +/* +BSD License + +Copyright (c) 2000-2006, www.hamcrest.org +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +Redistributions of source code must retain the above copyright notice, this list of +conditions and the following disclaimer. Redistributions in binary form must reproduce +the above copyright notice, this list of conditions and the following disclaimer in +the documentation and/or other materials provided with the distribution. + +Neither the name of Hamcrest nor the names of its contributors may be used to endorse +or promote products derived from this software without specific prior written +permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT +SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED +TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY +WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. +*/ +package dev.aherscu.qa.testing.utils.assertions.impl.matcher; + +import static org.hamcrest.core.IsEqual.equalTo; + +import java.util.Collection; + +import org.hamcrest.Description; +import org.hamcrest.Matcher; + +/** + * Matches if collection size satisfies a nested matcher. + */ +public class IsCollectionWithSize + extends CollectionMatcher> { + private final Matcher sizeMatcher; + + public IsCollectionWithSize(Matcher sizeMatcher) { + this.sizeMatcher = sizeMatcher; + } + + @Override + public boolean matchesSafely(Collection item) { + return sizeMatcher.matches(item.size()); + } + + @Override + public void describeTo(Description description) { + description.appendText("a collection with size ") + .appendDescriptionOf(sizeMatcher); + } + + /** + * Does collection size satisfy a given matcher? + */ + public static Matcher> hasSize( + Matcher size) { + return new IsCollectionWithSize(size); + } + + /** + * This is a shortcut to the frequently used hasSize(equalTo(x)). + * + * For example, assertThat(hasSize(equal_to(x))) vs. assertThat(hasSize(x)) + */ + public static Matcher> hasSize( + int size) { + Matcher matcher = equalTo(size); + return IsCollectionWithSize. hasSize(matcher); + } +} diff --git a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/assertions/impl/matcher/IsEmptyCollection.java b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/assertions/impl/matcher/IsEmptyCollection.java new file mode 100644 index 0000000000..107e6e5fc9 --- /dev/null +++ b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/assertions/impl/matcher/IsEmptyCollection.java @@ -0,0 +1,58 @@ +/* +BSD License + +Copyright (c) 2000-2006, www.hamcrest.org +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +Redistributions of source code must retain the above copyright notice, this list of +conditions and the following disclaimer. Redistributions in binary form must reproduce +the above copyright notice, this list of conditions and the following disclaimer in +the documentation and/or other materials provided with the distribution. + +Neither the name of Hamcrest nor the names of its contributors may be used to endorse +or promote products derived from this software without specific prior written +permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT +SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED +TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY +WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. +*/ +package dev.aherscu.qa.testing.utils.assertions.impl.matcher; + +import java.util.Collection; + +import org.hamcrest.Description; +import org.hamcrest.Matcher; + +/** + * Tests if collection is empty. + */ +public class IsEmptyCollection extends CollectionMatcher> { + + @Override + public boolean matchesSafely(Collection item) { + return item.isEmpty(); + } + + @Override + public void describeTo(Description description) { + description.appendText("an empty collection"); + } + + /** + * Matches an empty collection. + */ + public static Matcher> empty() { + return new IsEmptyCollection(); + } +} diff --git a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/assertions/impl/matcher/IsMapContainingKey.java b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/assertions/impl/matcher/IsMapContainingKey.java new file mode 100644 index 0000000000..920115cc9e --- /dev/null +++ b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/assertions/impl/matcher/IsMapContainingKey.java @@ -0,0 +1,69 @@ +/* +BSD License + +Copyright (c) 2000-2006, www.hamcrest.org +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +Redistributions of source code must retain the above copyright notice, this list of +conditions and the following disclaimer. Redistributions in binary form must reproduce +the above copyright notice, this list of conditions and the following disclaimer in +the documentation and/or other materials provided with the distribution. + +Neither the name of Hamcrest nor the names of its contributors may be used to endorse +or promote products derived from this software without specific prior written +permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT +SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED +TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY +WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. +*/ +package dev.aherscu.qa.testing.utils.assertions.impl.matcher; + +import static org.hamcrest.core.IsEqual.equalTo; + +import java.util.Map; + +import org.hamcrest.Description; +import org.hamcrest.Matcher; + +public class IsMapContainingKey extends MapTypeSafeMatcher> { + private final Matcher keyMatcher; + + public IsMapContainingKey(Matcher keyMatcher) { + this.keyMatcher = keyMatcher; + } + + @Override + public boolean matchesSafely(Map item) { + for (K key : item.keySet()) { + if (keyMatcher.matches(key)) { + return true; + } + } + return false; + } + + @Override + public void describeTo(Description description) { + description.appendText("map with key ") + .appendDescriptionOf(keyMatcher); + } + + public static Matcher> hasKey(K key) { + return hasKey(equalTo(key)); + } + + public static Matcher> hasKey(Matcher keyMatcher) { + return new IsMapContainingKey(keyMatcher); + } +} diff --git a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/assertions/impl/matcher/IsMapContainingValue.java b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/assertions/impl/matcher/IsMapContainingValue.java new file mode 100644 index 0000000000..94091e662d --- /dev/null +++ b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/assertions/impl/matcher/IsMapContainingValue.java @@ -0,0 +1,70 @@ +/* +BSD License + +Copyright (c) 2000-2006, www.hamcrest.org +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +Redistributions of source code must retain the above copyright notice, this list of +conditions and the following disclaimer. Redistributions in binary form must reproduce +the above copyright notice, this list of conditions and the following disclaimer in +the documentation and/or other materials provided with the distribution. + +Neither the name of Hamcrest nor the names of its contributors may be used to endorse +or promote products derived from this software without specific prior written +permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT +SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED +TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY +WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. +*/ +package dev.aherscu.qa.testing.utils.assertions.impl.matcher; + +import static org.hamcrest.core.IsEqual.equalTo; + +import java.util.Map; + +import org.hamcrest.Description; +import org.hamcrest.Matcher; + +public class IsMapContainingValue extends MapTypeSafeMatcher> { + private final Matcher valueMatcher; + + public IsMapContainingValue(Matcher valueMatcher) { + this.valueMatcher = valueMatcher; + } + + @Override + public boolean matchesSafely(Map item) { + for (V value : item.values()) { + if (valueMatcher.matches(value)) { + return true; + } + } + return false; + } + + @Override + public void describeTo(Description description) { + description.appendText("map with value ") + .appendDescriptionOf(valueMatcher); + } + + public static Matcher> hasValue(V value) { + return IsMapContainingValue. hasValue(equalTo(value)); + } + + public static Matcher> hasValue( + Matcher valueMatcher) { + return new IsMapContainingValue(valueMatcher); + } +} diff --git a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/assertions/impl/matcher/MapTypeSafeMatcher.java b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/assertions/impl/matcher/MapTypeSafeMatcher.java new file mode 100644 index 0000000000..c81e81e942 --- /dev/null +++ b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/assertions/impl/matcher/MapTypeSafeMatcher.java @@ -0,0 +1,44 @@ +/* +BSD License + +Copyright (c) 2000-2006, www.hamcrest.org +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +Redistributions of source code must retain the above copyright notice, this list of +conditions and the following disclaimer. Redistributions in binary form must reproduce +the above copyright notice, this list of conditions and the following disclaimer in +the documentation and/or other materials provided with the distribution. + +Neither the name of Hamcrest nor the names of its contributors may be used to endorse +or promote products derived from this software without specific prior written +permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT +SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED +TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY +WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. +*/ +package dev.aherscu.qa.testing.utils.assertions.impl.matcher; + +import java.util.Map; + +import org.hamcrest.BaseMatcher; + +public abstract class MapTypeSafeMatcher> + extends BaseMatcher { + @SuppressWarnings("unchecked") + public boolean matches(Object item) { + return item instanceof Map && matchesSafely((M) item); + } + + protected abstract boolean matchesSafely(M map); +} diff --git a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/function/DescribableFunction.java b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/function/DescribableFunction.java new file mode 100644 index 0000000000..6102c3c16b --- /dev/null +++ b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/function/DescribableFunction.java @@ -0,0 +1,25 @@ +package dev.aherscu.qa.testing.utils.function; + +import static dev.aherscu.qa.testing.utils.internal.DescriptionUtils.withPrefixedArticle; + +import java.lang.invoke.MethodType; +import java.lang.invoke.SerializedLambda; +import java.util.function.Function; + +@FunctionalInterface +public interface DescribableFunction extends Function, + SerializedLambdaResolvable, SingleArgumentDescribableFunctionalInterface { + + default String getResultDescription() { + SerializedLambda lambda = asSerializedLambda(); + MethodType lambdaMethodType = MethodType.fromMethodDescriptorString( + lambda.getImplMethodSignature(), getClass().getClassLoader()); + String resultType = lambdaMethodType.returnType().getSimpleName(); + if (!lambda.getImplMethodName().startsWith("lambda$")) { + return lambda.getImplMethodName() + " (" + + withPrefixedArticle(resultType) + ")"; + } + return resultType; + } + +} diff --git a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/function/DescribablePredicate.java b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/function/DescribablePredicate.java new file mode 100644 index 0000000000..fa43924312 --- /dev/null +++ b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/function/DescribablePredicate.java @@ -0,0 +1,18 @@ +package dev.aherscu.qa.testing.utils.function; + +import java.lang.invoke.SerializedLambda; +import java.util.function.Predicate; + +@FunctionalInterface +public interface DescribablePredicate extends Predicate, + SerializedLambdaResolvable, SingleArgumentDescribableFunctionalInterface { + + default String getResultDescription() { + SerializedLambda lambda = asSerializedLambda(); + if (!lambda.getImplMethodName().startsWith("lambda$")) { + return lambda.getImplMethodName(); + } + return "boolean"; + } + +} diff --git a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/function/SerializedLambdaResolvable.java b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/function/SerializedLambdaResolvable.java new file mode 100644 index 0000000000..6808caf561 --- /dev/null +++ b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/function/SerializedLambdaResolvable.java @@ -0,0 +1,23 @@ +package dev.aherscu.qa.testing.utils.function; + +import java.io.Serializable; +import java.lang.invoke.SerializedLambda; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; + +interface SerializedLambdaResolvable extends Serializable { + + default SerializedLambda asSerializedLambda() { + try { + Method replaceMethod = getClass().getDeclaredMethod("writeReplace"); + replaceMethod.setAccessible(true); + return (SerializedLambda) replaceMethod.invoke(this); + } catch (IllegalAccessException | IllegalArgumentException + | InvocationTargetException | NoSuchMethodException + | SecurityException e) { + throw new RuntimeException( + e.getClass().getSimpleName() + ": '" + e.getMessage() + "'", e); + } + } + +} diff --git a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/function/SingleArgumentDescribableFunctionalInterface.java b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/function/SingleArgumentDescribableFunctionalInterface.java new file mode 100644 index 0000000000..1c486ffdcb --- /dev/null +++ b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/function/SingleArgumentDescribableFunctionalInterface.java @@ -0,0 +1,15 @@ +package dev.aherscu.qa.testing.utils.function; + +import java.lang.invoke.*; + +interface SingleArgumentDescribableFunctionalInterface extends + SerializedLambdaResolvable { + + default String getArgumentDescription() { + MethodType methodType = MethodType.fromMethodDescriptorString( + asSerializedLambda().getInstantiatedMethodType(), + getClass().getClassLoader()); + return methodType.parameterType(0).getSimpleName(); + } + +} diff --git a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/function/UnableToGuessMethodException.java b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/function/UnableToGuessMethodException.java new file mode 100644 index 0000000000..8f54ada79d --- /dev/null +++ b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/function/UnableToGuessMethodException.java @@ -0,0 +1,9 @@ +package dev.aherscu.qa.testing.utils.function; + +import java.lang.invoke.SerializedLambda; + +public class UnableToGuessMethodException extends RuntimeException { + UnableToGuessMethodException(SerializedLambda lambda) { + super("Could not determine the single abstract method of " + lambda); + } +} diff --git a/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/internal/DescriptionUtils.java b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/internal/DescriptionUtils.java new file mode 100644 index 0000000000..c4ee8a7756 --- /dev/null +++ b/qa-testing-utils/src/main/java/dev/aherscu/qa/testing/utils/internal/DescriptionUtils.java @@ -0,0 +1,17 @@ +package dev.aherscu.qa.testing.utils.internal; + +import static java.util.Arrays.binarySearch; + +public final class DescriptionUtils { + + private static final char[] CHARS_FOR_AN = + { 'A', 'E', 'I', 'O', 'a', 'e', 'i', 'o' }; + + public static String withPrefixedArticle(String noun) { + return (binarySearch(CHARS_FOR_AN, noun.charAt(0)) < 0 ? "a " : "an ") + + noun; + } + + private DescriptionUtils() { + } +} From 9c199b15f0c15212779ca45eb1632ef850e37429 Mon Sep 17 00:00:00 2001 From: Adrian Herscu Date: Sat, 14 Oct 2023 21:54:17 +0300 Subject: [PATCH 17/49] testCompile succeeds; still, surefire fails to launch --- qa-jgiven-commons/pom.xml | 61 +++++++++++---------------------------- 1 file changed, 17 insertions(+), 44 deletions(-) diff --git a/qa-jgiven-commons/pom.xml b/qa-jgiven-commons/pom.xml index 03301ce32c..1bc6739527 100644 --- a/qa-jgiven-commons/pom.xml +++ b/qa-jgiven-commons/pom.xml @@ -39,12 +39,17 @@ 2.0.5 - - + + true @@ -92,6 +97,12 @@ + + org.seleniumhq.selenium + selenium-java + 4.14.1 + + io.github.bonigarcia webdrivermanager @@ -271,44 +282,6 @@ ${read.mstimeout} - --illegal-access=permit From b2467cfdd625f9ff751709f055ca60929d658044 Mon Sep 17 00:00:00 2001 From: Adrian Herscu Date: Sat, 14 Oct 2023 21:55:27 +0300 Subject: [PATCH 18/49] fixed to work with jgiven 1.3 --- .../aherscu/qa/jgiven/reporter/QaJGivenPerClassReporter.java | 4 ++-- .../aherscu/qa/jgiven/reporter/QaJGivenPerMethodReporter.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/qa-jgiven-reporter/src/main/java/dev/aherscu/qa/jgiven/reporter/QaJGivenPerClassReporter.java b/qa-jgiven-reporter/src/main/java/dev/aherscu/qa/jgiven/reporter/QaJGivenPerClassReporter.java index 4770e58d1d..e724da0c61 100644 --- a/qa-jgiven-reporter/src/main/java/dev/aherscu/qa/jgiven/reporter/QaJGivenPerClassReporter.java +++ b/qa-jgiven-reporter/src/main/java/dev/aherscu/qa/jgiven/reporter/QaJGivenPerClassReporter.java @@ -38,7 +38,7 @@ @ToString(callSuper = true) public class QaJGivenPerClassReporter extends - AbstractQaJgivenReporter { + AbstractQaJgivenReporter { public static final String DEFAULT_TEMPLATE_RESOURCE = "/qa-jgiven-perclass-reporter.html"; @@ -77,7 +77,7 @@ public void generate() { template() .execute(reportModel(targetReportFile) .toBuilder() - .jgivenReport(new ReportModelFileReader() + .jgivenReport(new ScenarioJsonReader() .apply(reportModelFile)) .screenshotScale(screenshotScale) .datePattern(datePattern) diff --git a/qa-jgiven-reporter/src/main/java/dev/aherscu/qa/jgiven/reporter/QaJGivenPerMethodReporter.java b/qa-jgiven-reporter/src/main/java/dev/aherscu/qa/jgiven/reporter/QaJGivenPerMethodReporter.java index c0b6188fd5..8f6d767c92 100644 --- a/qa-jgiven-reporter/src/main/java/dev/aherscu/qa/jgiven/reporter/QaJGivenPerMethodReporter.java +++ b/qa-jgiven-reporter/src/main/java/dev/aherscu/qa/jgiven/reporter/QaJGivenPerMethodReporter.java @@ -114,8 +114,8 @@ public void generate() { .parallelStream() .peek(reportModelFile -> log .debug("reading " + reportModelFile.getName())) - .flatMap(reportModelFile -> new ReportModelFileReader() - .apply(reportModelFile).model + .flatMap(reportModelFile -> new ScenarioJsonReader() + .apply(reportModelFile) .getScenarios() .stream() .filter(scenarioModel -> scenarioModel From 0479a8f9bf91cd609719c8fef7709d84d35c039b Mon Sep 17 00:00:00 2001 From: Adrian Herscu Date: Sat, 14 Oct 2023 22:46:15 +0300 Subject: [PATCH 19/49] fixed compilation errors --- .../dev/aherscu/qa/testing/example/scenarios/SelfTests.java | 2 +- .../example/scenarios/tutorial3/TestingWebApplication.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/qa-testing-example/src/test/java/dev/aherscu/qa/testing/example/scenarios/SelfTests.java b/qa-testing-example/src/test/java/dev/aherscu/qa/testing/example/scenarios/SelfTests.java index 4e043111a7..40fb13547c 100644 --- a/qa-testing-example/src/test/java/dev/aherscu/qa/testing/example/scenarios/SelfTests.java +++ b/qa-testing-example/src/test/java/dev/aherscu/qa/testing/example/scenarios/SelfTests.java @@ -17,9 +17,9 @@ package dev.aherscu.qa.testing.example.scenarios; import static dev.aherscu.qa.jgiven.commons.utils.UnitilsScenarioTest.*; +import static dev.aherscu.qa.testing.utils.StreamMatchers.allMatch; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static uk.co.probablyfine.matchers.StreamMatchers.*; import java.util.stream.*; diff --git a/qa-testing-example/src/test/java/dev/aherscu/qa/testing/example/scenarios/tutorial3/TestingWebApplication.java b/qa-testing-example/src/test/java/dev/aherscu/qa/testing/example/scenarios/tutorial3/TestingWebApplication.java index 97362bcd96..e6c323092d 100644 --- a/qa-testing-example/src/test/java/dev/aherscu/qa/testing/example/scenarios/tutorial3/TestingWebApplication.java +++ b/qa-testing-example/src/test/java/dev/aherscu/qa/testing/example/scenarios/tutorial3/TestingWebApplication.java @@ -17,10 +17,10 @@ package dev.aherscu.qa.testing.example.scenarios.tutorial3; import static dev.aherscu.qa.jgiven.commons.utils.UnitilsScenarioTest.*; +import static dev.aherscu.qa.testing.utils.StreamMatchers.allMatch; import static java.util.concurrent.TimeUnit.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; -import static uk.co.probablyfine.matchers.StreamMatchers.*; import java.util.function.*; From 2cd832b01b625cbeaf58b22922b4bd44f9b3d367 Mon Sep 17 00:00:00 2001 From: Adrian Herscu Date: Sat, 14 Oct 2023 22:46:43 +0300 Subject: [PATCH 20/49] JGiven 1.3 changed structure of JSON report files --- qa-jgiven-reporter-maven-plugin/pom.xml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/qa-jgiven-reporter-maven-plugin/pom.xml b/qa-jgiven-reporter-maven-plugin/pom.xml index 7a3b52e680..c3e8665f98 100644 --- a/qa-jgiven-reporter-maven-plugin/pom.xml +++ b/qa-jgiven-reporter-maven-plugin/pom.xml @@ -34,6 +34,11 @@ JSON Report files. + + + true + + org.projectlombok From 26e4a6122a763c8cc31aa08411a9a26816ad0469 Mon Sep 17 00:00:00 2001 From: Adrian Herscu Date: Mon, 30 Oct 2023 07:46:29 +0200 Subject: [PATCH 21/49] fixed to prevent logback diagnostic logs --- qa-jgiven-commons/src/test/resources/logback-test.xml | 2 +- qa-jgiven-elasticsearch/src/test/resources/logback-test.xml | 2 +- qa-jgiven-rabbitmq/src/test/resources/logback-test.xml | 2 +- .../src/test/resources/logback-test.xml | 2 +- qa-jgiven-reporter/src/test/resources/logback-test.xml | 2 +- qa-jgiven-rest/src/test/resources/logback-test.xml | 2 +- qa-jgiven-ssh/src/test/resources/logback-test.xml | 2 +- qa-jgiven-webdriver/src/test/resources/logback-test.xml | 2 +- .../src/test/resources/logback-test.xml | 2 +- .../archetype-resources/src/test/resources/logback-common.xml | 2 +- qa-testing-example/src/test/resources/logback-common.xml | 2 +- qa-testing-extra/src/test/resources/logback-test.xml | 2 +- qa-testing-utils/src/test/resources/logback-test.xml | 2 +- qa-testrail-reporter/src/test/resources/logback-test.xml | 2 +- 14 files changed, 14 insertions(+), 14 deletions(-) diff --git a/qa-jgiven-commons/src/test/resources/logback-test.xml b/qa-jgiven-commons/src/test/resources/logback-test.xml index 9c74463cef..deceef0881 100644 --- a/qa-jgiven-commons/src/test/resources/logback-test.xml +++ b/qa-jgiven-commons/src/test/resources/logback-test.xml @@ -58,7 +58,7 @@ - + target/per-thread-logs/test-${threadId}.log false diff --git a/qa-jgiven-elasticsearch/src/test/resources/logback-test.xml b/qa-jgiven-elasticsearch/src/test/resources/logback-test.xml index 81c001e66d..904534a6db 100644 --- a/qa-jgiven-elasticsearch/src/test/resources/logback-test.xml +++ b/qa-jgiven-elasticsearch/src/test/resources/logback-test.xml @@ -56,7 +56,7 @@ - + target/per-thread-logs/test-${threadId}.log false diff --git a/qa-jgiven-rabbitmq/src/test/resources/logback-test.xml b/qa-jgiven-rabbitmq/src/test/resources/logback-test.xml index cee6329f21..a1748d7dd7 100644 --- a/qa-jgiven-rabbitmq/src/test/resources/logback-test.xml +++ b/qa-jgiven-rabbitmq/src/test/resources/logback-test.xml @@ -56,7 +56,7 @@ - + target/per-thread-logs/test-${threadId}.log false diff --git a/qa-jgiven-reporter-maven-plugin/src/test/resources/logback-test.xml b/qa-jgiven-reporter-maven-plugin/src/test/resources/logback-test.xml index 36ea0b6254..d67caa3b54 100644 --- a/qa-jgiven-reporter-maven-plugin/src/test/resources/logback-test.xml +++ b/qa-jgiven-reporter-maven-plugin/src/test/resources/logback-test.xml @@ -55,7 +55,7 @@ - + target/per-thread-logs/test-${threadId}.log false diff --git a/qa-jgiven-reporter/src/test/resources/logback-test.xml b/qa-jgiven-reporter/src/test/resources/logback-test.xml index 9c74463cef..deceef0881 100644 --- a/qa-jgiven-reporter/src/test/resources/logback-test.xml +++ b/qa-jgiven-reporter/src/test/resources/logback-test.xml @@ -58,7 +58,7 @@ - + target/per-thread-logs/test-${threadId}.log false diff --git a/qa-jgiven-rest/src/test/resources/logback-test.xml b/qa-jgiven-rest/src/test/resources/logback-test.xml index 81c001e66d..904534a6db 100644 --- a/qa-jgiven-rest/src/test/resources/logback-test.xml +++ b/qa-jgiven-rest/src/test/resources/logback-test.xml @@ -56,7 +56,7 @@ - + target/per-thread-logs/test-${threadId}.log false diff --git a/qa-jgiven-ssh/src/test/resources/logback-test.xml b/qa-jgiven-ssh/src/test/resources/logback-test.xml index 81c001e66d..904534a6db 100644 --- a/qa-jgiven-ssh/src/test/resources/logback-test.xml +++ b/qa-jgiven-ssh/src/test/resources/logback-test.xml @@ -56,7 +56,7 @@ - + target/per-thread-logs/test-${threadId}.log false diff --git a/qa-jgiven-webdriver/src/test/resources/logback-test.xml b/qa-jgiven-webdriver/src/test/resources/logback-test.xml index 81c001e66d..904534a6db 100644 --- a/qa-jgiven-webdriver/src/test/resources/logback-test.xml +++ b/qa-jgiven-webdriver/src/test/resources/logback-test.xml @@ -56,7 +56,7 @@ - + target/per-thread-logs/test-${threadId}.log false diff --git a/qa-orcanos-publisher-maven-plugin/src/test/resources/logback-test.xml b/qa-orcanos-publisher-maven-plugin/src/test/resources/logback-test.xml index 1013be551f..c5bb1c0144 100644 --- a/qa-orcanos-publisher-maven-plugin/src/test/resources/logback-test.xml +++ b/qa-orcanos-publisher-maven-plugin/src/test/resources/logback-test.xml @@ -55,7 +55,7 @@ - + target/per-thread-logs/test-${threadId}.log false diff --git a/qa-testing-archetype/src/main/resources/archetype-resources/src/test/resources/logback-common.xml b/qa-testing-archetype/src/main/resources/archetype-resources/src/test/resources/logback-common.xml index 95e85bcb68..ab2cebdd70 100644 --- a/qa-testing-archetype/src/main/resources/archetype-resources/src/test/resources/logback-common.xml +++ b/qa-testing-archetype/src/main/resources/archetype-resources/src/test/resources/logback-common.xml @@ -57,7 +57,7 @@ - + target/per-thread-logs/test-${threadId}.log false diff --git a/qa-testing-example/src/test/resources/logback-common.xml b/qa-testing-example/src/test/resources/logback-common.xml index 46a22b52f3..6a5ca90156 100644 --- a/qa-testing-example/src/test/resources/logback-common.xml +++ b/qa-testing-example/src/test/resources/logback-common.xml @@ -57,7 +57,7 @@ - + target/per-thread-logs/test-${threadId}.log false diff --git a/qa-testing-extra/src/test/resources/logback-test.xml b/qa-testing-extra/src/test/resources/logback-test.xml index 8b40abb944..8c3fb8a78b 100644 --- a/qa-testing-extra/src/test/resources/logback-test.xml +++ b/qa-testing-extra/src/test/resources/logback-test.xml @@ -56,7 +56,7 @@ - + target/per-thread-logs/test-${threadId}.log false diff --git a/qa-testing-utils/src/test/resources/logback-test.xml b/qa-testing-utils/src/test/resources/logback-test.xml index e24b17198b..60e1e3f2fd 100644 --- a/qa-testing-utils/src/test/resources/logback-test.xml +++ b/qa-testing-utils/src/test/resources/logback-test.xml @@ -56,7 +56,7 @@ - + target/per-thread-logs/test-${threadId}.log false diff --git a/qa-testrail-reporter/src/test/resources/logback-test.xml b/qa-testrail-reporter/src/test/resources/logback-test.xml index 9c74463cef..deceef0881 100644 --- a/qa-testrail-reporter/src/test/resources/logback-test.xml +++ b/qa-testrail-reporter/src/test/resources/logback-test.xml @@ -58,7 +58,7 @@ - + target/per-thread-logs/test-${threadId}.log false From fddcd48104c165cfd3e288b32ff7cdd7de7e6fae Mon Sep 17 00:00:00 2001 From: Adrian Herscu Date: Tue, 31 Oct 2023 10:51:54 +0200 Subject: [PATCH 22/49] fixed to run with selenium 4 --- .../TestingRemoteWebApplication.java | 113 ++++++++++++++++++ .../tutorial3/TestingWebApplication.java | 55 +++++---- 2 files changed, 144 insertions(+), 24 deletions(-) create mode 100644 qa-testing-example/src/test/java/dev/aherscu/qa/testing/example/scenarios/tutorial3/TestingRemoteWebApplication.java diff --git a/qa-testing-example/src/test/java/dev/aherscu/qa/testing/example/scenarios/tutorial3/TestingRemoteWebApplication.java b/qa-testing-example/src/test/java/dev/aherscu/qa/testing/example/scenarios/tutorial3/TestingRemoteWebApplication.java new file mode 100644 index 0000000000..95d026eb0d --- /dev/null +++ b/qa-testing-example/src/test/java/dev/aherscu/qa/testing/example/scenarios/tutorial3/TestingRemoteWebApplication.java @@ -0,0 +1,113 @@ +/* + * Copyright 2023 Adrian Herscu + * + * 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 + * + * http://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. + */ + +package dev.aherscu.qa.testing.example.scenarios.tutorial3; + +import static dev.aherscu.qa.testing.utils.StreamMatchers.*; +import static java.util.Objects.*; +import static java.util.concurrent.TimeUnit.*; +import static org.hamcrest.MatcherAssert.*; +import static org.hamcrest.Matchers.*; +import static org.openqa.selenium.remote.CapabilityType.*; + +import java.net.*; + +import org.openqa.selenium.*; +import org.openqa.selenium.remote.*; +import org.testng.annotations.*; + +import dev.aherscu.qa.jgiven.commons.utils.*; +import edu.umd.cs.findbugs.annotations.*; +import lombok.*; +import lombok.extern.slf4j.*; + +@Slf4j +public class TestingRemoteWebApplication { + public final static String SAUCELABS_PASSWORD; + public final static String SAUCELABS_URL; + public final static String SAUCELABS_USER; + + static { + SAUCELABS_PASSWORD = + requireNonNull(System.getenv("SAUCELABS_PASSWORD"), + "missing SauceLabs password"); + SAUCELABS_USER = + requireNonNull(System.getenv("SAUCELABS_USER"), + "missing SauceLabs username"); + SAUCELABS_URL = String + .format("https://%s:%s@ondemand.saucelabs.com:443/wd/hub", + SAUCELABS_USER, SAUCELABS_PASSWORD); + } + + private WebDriver webDriver; + + @Test + public void shouldFind() { + // NOTE the search keyword must be unique such that it is not + // translated to other languages or written differently + val SEARCH_KEYWORD = "testng"; + webDriver.findElement(By.name("q")) + .sendKeys(SEARCH_KEYWORD + Keys.ENTER); + assertThat( + webDriver.findElements(By.xpath("//a/h3")) + .stream() + .map(webElement -> webElement.getAttribute("textContent")) + .peek(resultTitle -> log.debug("found {}", resultTitle)), + allMatch(either(containsStringIgnoringCase("testng")) + .or(containsStringIgnoringCase("Try again")) + .or(containsStringIgnoringCase("More results")))); + } + + @Test + public void shouldOpenWeb() { + assertThat(webDriver.getTitle(), containsString("Google")); + } + + @SuppressFBWarnings( + value = "UPM_UNCALLED_PRIVATE_METHOD", + justification = "called by testng framework") + @AfterClass(alwaysRun = true) // important, otherwise we may leak resources + private void afterClassCloseWebDriver() { + webDriver.quit(); + } + + @SuppressFBWarnings( + value = "UPM_UNCALLED_PRIVATE_METHOD", + justification = "called by testng framework") + @BeforeClass + @SneakyThrows + private void beforeClassOpenWebDriver() { + log.trace("connecting saucelabs with {}:{}", + SAUCELABS_USER, SAUCELABS_PASSWORD); + webDriver = new RemoteWebDriver(new URL(SAUCELABS_URL), + new DesiredCapabilitiesEx() + .with(BROWSER_NAME, "firefox") + // NOTE since Selenium 4, non-standard capabilities must be prefixed; + // see https://www.w3.org/TR/webdriver1/#capabilities + // and https://docs.saucelabs.com/dev/test-configuration-options/ + // and + // https://docs.saucelabs.com/dev/test-configuration-options/#desktop-and-mobile-capabilities-sauce-specific--optional + // and + // https://docs.saucelabs.com/mobile-apps/automated-testing/appium/appium-2-migration/ + // For example, + // .with("my:capability", "kuku") + ); + + webDriver.manage().window().maximize(); + webDriver.manage().timeouts().implicitlyWait(10, SECONDS); + webDriver.get("https://google.com?hl=en"); + } +} diff --git a/qa-testing-example/src/test/java/dev/aherscu/qa/testing/example/scenarios/tutorial3/TestingWebApplication.java b/qa-testing-example/src/test/java/dev/aherscu/qa/testing/example/scenarios/tutorial3/TestingWebApplication.java index e6c323092d..f66f8ecdfa 100644 --- a/qa-testing-example/src/test/java/dev/aherscu/qa/testing/example/scenarios/tutorial3/TestingWebApplication.java +++ b/qa-testing-example/src/test/java/dev/aherscu/qa/testing/example/scenarios/tutorial3/TestingWebApplication.java @@ -17,19 +17,23 @@ package dev.aherscu.qa.testing.example.scenarios.tutorial3; import static dev.aherscu.qa.jgiven.commons.utils.UnitilsScenarioTest.*; -import static dev.aherscu.qa.testing.utils.StreamMatchers.allMatch; +import static dev.aherscu.qa.testing.example.scenarios.tutorial3.TestingRemoteWebApplication.*; +import static dev.aherscu.qa.testing.utils.StreamMatchers.*; import static java.util.concurrent.TimeUnit.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; +import static org.openqa.selenium.remote.CapabilityType.*; +import java.net.*; import java.util.function.*; import org.jooq.lambda.*; import org.openqa.selenium.*; import org.openqa.selenium.chrome.*; -import org.openqa.selenium.firefox.*; +import org.openqa.selenium.remote.*; import org.testng.annotations.*; +import dev.aherscu.qa.jgiven.commons.utils.*; import edu.umd.cs.findbugs.annotations.*; import io.github.bonigarcia.wdm.*; import lombok.*; @@ -40,41 +44,37 @@ public class TestingWebApplication { private final WebDriver webDriver; @Factory(dataProvider = INTERNAL_DATA_PROVIDER) - public TestingWebApplication(Supplier webDriver) { + public TestingWebApplication(final Supplier webDriver) { this.webDriver = webDriver.get(); log.trace("testing with {}", webDriver); } - @DataProvider + // NOTE: parallel with @Factory requires parallel=instances + // see https://github.com/testng-team/testng/issues/1951 + @DataProvider(parallel = true) private static Object[][] data() { // NOTE we use suppliers in order to lazily create drivers; // thus, only when the test is constructed by TestNG return new Object[][] { - { Unchecked.supplier(() -> { - log.trace("setting up firefox driver"); - WebDriverManager.firefoxdriver().setup(); - return new FirefoxDriver(); - }) }, + // ISSUE Firefox cannot be installed on certain systems + // { Unchecked.supplier(() -> { + // log.trace("setting up firefox driver"); + // WebDriverManager.firefoxdriver().setup(); + // return new FirefoxDriver(); + // }) }, { Unchecked.supplier(() -> { log.trace("setting up chrome driver"); WebDriverManager.chromedriver().setup(); return new ChromeDriver(); }) }, - // TODO setup Selenium on GitHub runner or wait for SauceLabs - // { Unchecked.supplier(() -> new RemoteWebDriver( - // new URL("http://localhost:4444"), - // new DesiredCapabilitiesEx() { - // { - // setCapability(BROWSER_NAME, "firefox"); - // } - // })) } + { Unchecked.supplier(() -> { + log.trace("setting up remote driver"); + return new RemoteWebDriver( + new URL(SAUCELABS_URL), + new DesiredCapabilitiesEx() + .with(BROWSER_NAME, "firefox")); + }) } }; - - } - - @Test - public void shouldOpenWeb() { - assertThat(webDriver.getTitle(), containsString("Google")); } @Test @@ -82,6 +82,7 @@ public void shouldFind() { // NOTE the search keyword must be unique such that it is not // translated to other languages or written differently val SEARCH_KEYWORD = "testng"; + log.debug("searching for {} on Google", SEARCH_KEYWORD); webDriver.findElement(By.name("q")) .sendKeys(SEARCH_KEYWORD + Keys.ENTER); assertThat( @@ -94,6 +95,12 @@ public void shouldFind() { .or(containsStringIgnoringCase("More results")))); } + @Test + public void shouldOpenWeb() { + log.debug("window title must contain Google"); + assertThat(webDriver.getTitle(), containsString("Google")); + } + @SuppressFBWarnings( value = "UPM_UNCALLED_PRIVATE_METHOD", justification = "called by testng framework") @@ -111,6 +118,6 @@ private void beforeClassOpenWebDriver() { log.trace("before connecting selenium"); webDriver.manage().window().maximize(); webDriver.manage().timeouts().implicitlyWait(10, SECONDS); - webDriver.get("https://google.com"); + webDriver.get("https://google.com?hl=en"); // ensure English } } From 9e4084341382f4ad307879f6940999710c835834 Mon Sep 17 00:00:00 2001 From: Adrian Herscu Date: Tue, 31 Oct 2023 11:08:29 +0200 Subject: [PATCH 23/49] formatting --- .../qa/jgiven/reporter/AbstractQaJgivenReporter.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/qa-jgiven-reporter/src/main/java/dev/aherscu/qa/jgiven/reporter/AbstractQaJgivenReporter.java b/qa-jgiven-reporter/src/main/java/dev/aherscu/qa/jgiven/reporter/AbstractQaJgivenReporter.java index 2b158f507e..b36ac84e8c 100644 --- a/qa-jgiven-reporter/src/main/java/dev/aherscu/qa/jgiven/reporter/AbstractQaJgivenReporter.java +++ b/qa-jgiven-reporter/src/main/java/dev/aherscu/qa/jgiven/reporter/AbstractQaJgivenReporter.java @@ -135,7 +135,7 @@ public AbstractQaJgivenReporter prepare() { /** * Hook for customizing the Mustache compiler. - * + * * @return default Mustache compiler */ protected Mustache.Compiler compiler() { @@ -155,7 +155,7 @@ protected final File reportFile( /** * Hook for initiating a {@link QaJGivenReportModel}; by default, * initializes with a specified JGiven JSON report file. - * + * * @param targetReportFile * JGiven JSON report file * @return the report model @@ -169,7 +169,7 @@ protected QaJGivenReportModel reportModel(final File targetReportFile) { /** * Hook for loading a Mustache template; by default, loads from * {@link #templateResource} specified during construction. - * + * * @return the template */ protected Template template() { From 6c3e5d67e5223dc84f0ce7fdd81452dbc4309904 Mon Sep 17 00:00:00 2001 From: Adrian Herscu Date: Tue, 31 Oct 2023 15:29:56 +0200 Subject: [PATCH 24/49] upgraded findbugs to spotbugs --- pom.xml | 6 +++--- qa-jgiven-commons/pom.xml | 4 ++-- qa-s3-publisher-maven-plugin/pom.xml | 4 ++-- qa-testing-extra/pom.xml | 4 ++-- qa-testing-parent/pom.xml | 4 ++-- qa-testing-utils/pom.xml | 4 ++-- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/pom.xml b/pom.xml index d314c8442a..09624aa9ac 100644 --- a/pom.xml +++ b/pom.xml @@ -249,9 +249,9 @@ 4.4 - com.google.code.findbugs - annotations - 3.0.1u2 + com.github.spotbugs + spotbugs-annotations + 4.8.0 ch.qos.logback diff --git a/qa-jgiven-commons/pom.xml b/qa-jgiven-commons/pom.xml index 1bc6739527..5ca22113c8 100644 --- a/qa-jgiven-commons/pom.xml +++ b/qa-jgiven-commons/pom.xml @@ -69,8 +69,8 @@ - com.google.code.findbugs - annotations + com.github.spotbugs + spotbugs-annotations diff --git a/qa-s3-publisher-maven-plugin/pom.xml b/qa-s3-publisher-maven-plugin/pom.xml index 19a438d5a6..b3d1c423ef 100644 --- a/qa-s3-publisher-maven-plugin/pom.xml +++ b/qa-s3-publisher-maven-plugin/pom.xml @@ -38,8 +38,8 @@ - com.google.code.findbugs - annotations + com.github.spotbugs + spotbugs-annotations diff --git a/qa-testing-extra/pom.xml b/qa-testing-extra/pom.xml index f7e37145f4..6d7edf97c6 100644 --- a/qa-testing-extra/pom.xml +++ b/qa-testing-extra/pom.xml @@ -60,8 +60,8 @@ - com.google.code.findbugs - annotations + com.github.spotbugs + spotbugs-annotations diff --git a/qa-testing-parent/pom.xml b/qa-testing-parent/pom.xml index 37acd2f751..a6c4b2fd8d 100644 --- a/qa-testing-parent/pom.xml +++ b/qa-testing-parent/pom.xml @@ -103,8 +103,8 @@ lombok - com.google.code.findbugs - annotations + com.github.spotbugs + spotbugs-annotations javax.validation diff --git a/qa-testing-utils/pom.xml b/qa-testing-utils/pom.xml index 70dbb126cd..fbbef82ed8 100644 --- a/qa-testing-utils/pom.xml +++ b/qa-testing-utils/pom.xml @@ -62,8 +62,8 @@ - com.google.code.findbugs - annotations + com.github.spotbugs + spotbugs-annotations From 3dc60d9a8652d8a0733dae7c202364499419747f Mon Sep 17 00:00:00 2001 From: Adrian Herscu Date: Tue, 31 Oct 2023 15:57:19 +0200 Subject: [PATCH 25/49] upgraded to appium 9 --- qa-jgiven-commons/pom.xml | 2 +- .../commons/utils/ScenarioTestListenerEx.java | 12 ++++--- .../utils/ScenarioTestListenerExTest.java | 16 ++++++---- .../formatters/WebDriverFormatter.java | 32 ++++++++++--------- .../formatters/WinAppDriverFormatter.java | 30 +++++++++-------- .../tutorial4/TestingAndroidOnSauceLabs.java | 16 ++++++---- 6 files changed, 60 insertions(+), 48 deletions(-) diff --git a/qa-jgiven-commons/pom.xml b/qa-jgiven-commons/pom.xml index 5ca22113c8..81f830d123 100644 --- a/qa-jgiven-commons/pom.xml +++ b/qa-jgiven-commons/pom.xml @@ -88,7 +88,7 @@ io.appium java-client - 8.6.0 + 9.0.0 commons-logging diff --git a/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/ScenarioTestListenerEx.java b/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/ScenarioTestListenerEx.java index ca45552f86..8eadfe8c5a 100644 --- a/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/ScenarioTestListenerEx.java +++ b/qa-jgiven-commons/src/main/java/dev/aherscu/qa/jgiven/commons/utils/ScenarioTestListenerEx.java @@ -18,9 +18,11 @@ import static dev.aherscu.qa.jgiven.commons.utils.WebDriverEx.*; import static dev.aherscu.qa.testing.utils.StringUtilsExtensions.*; -import static io.appium.java_client.remote.MobileCapabilityType.*; +import static io.appium.java_client.remote.options.SupportsDeviceNameOption.*; +import static io.appium.java_client.remote.options.SupportsPlatformVersionOption.*; import static java.util.Objects.*; import static lombok.AccessLevel.*; +import static org.openqa.selenium.remote.CapabilityType.*; import java.util.*; import java.util.stream.*; @@ -108,22 +110,22 @@ private static void reportSession( final WebDriverSessionInfo session, final ScenarioModel scenario) { scenario.addTag(new Tag(DEVICE_NAME_TAG, DEVICE_NAME_TAG, - session.capabilities.getCapability(DEVICE_NAME))); + session.capabilities.getCapability(DEVICE_NAME_OPTION))); scenario.addTag(new Tag(PLATFORM_NAME_TAG, PLATFORM_NAME_TAG, session.capabilities.getCapability(PLATFORM_NAME))); scenario.addTag(new Tag(PLATFORM_VERSION_TAG, PLATFORM_VERSION_TAG, - session.capabilities.getCapability(PLATFORM_VERSION))); + session.capabilities.getCapability(PLATFORM_VERSION_OPTION))); } private static void reportSession( final WebDriverSessionInfo session, final ReportModel reportModel) { reportModel.addTag(new Tag(DEVICE_NAME_TAG, DEVICE_NAME_TAG, - session.capabilities.getCapability(DEVICE_NAME))); + session.capabilities.getCapability(DEVICE_NAME_OPTION))); reportModel.addTag(new Tag(PLATFORM_NAME_TAG, PLATFORM_NAME_TAG, session.capabilities.getCapability(PLATFORM_NAME))); reportModel.addTag(new Tag(PLATFORM_VERSION_TAG, PLATFORM_VERSION_TAG, - session.capabilities.getCapability(PLATFORM_VERSION))); + session.capabilities.getCapability(PLATFORM_VERSION_OPTION))); } @Override diff --git a/qa-jgiven-commons/src/test/java/dev/aherscu/qa/jgiven/commons/utils/ScenarioTestListenerExTest.java b/qa-jgiven-commons/src/test/java/dev/aherscu/qa/jgiven/commons/utils/ScenarioTestListenerExTest.java index 33a96dece7..829e05229b 100644 --- a/qa-jgiven-commons/src/test/java/dev/aherscu/qa/jgiven/commons/utils/ScenarioTestListenerExTest.java +++ b/qa-jgiven-commons/src/test/java/dev/aherscu/qa/jgiven/commons/utils/ScenarioTestListenerExTest.java @@ -18,13 +18,15 @@ import static dev.aherscu.qa.jgiven.commons.utils.ScenarioTestListenerEx.*; import static dev.aherscu.qa.testing.utils.StringUtilsExtensions.*; -import static io.appium.java_client.remote.MobileCapabilityType.*; +import static io.appium.java_client.remote.options.SupportsDeviceNameOption.DEVICE_NAME_OPTION; +import static io.appium.java_client.remote.options.SupportsPlatformVersionOption.PLATFORM_VERSION_OPTION; import static java.util.Arrays.*; import static java.util.Collections.*; import static java.util.stream.Collectors.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; import static org.mockito.Mockito.*; +import static org.openqa.selenium.remote.CapabilityType.*; import java.util.*; @@ -151,24 +153,24 @@ ImmutableMultimap. builder() // NOTE a method can zero or more WebDriver sessions WebDriverSessionInfo.builder() .capabilities(new DesiredCapabilitiesEx() - .with(DEVICE_NAME, T_DEVICE_2) + .with(DEVICE_NAME_OPTION, T_DEVICE_2) .with(PLATFORM_NAME, T_PLATFORM_2) - .with(PLATFORM_VERSION, T_VERSION_2)) + .with(PLATFORM_VERSION_OPTION, T_VERSION_2)) .build(), WebDriverSessionInfo.builder() .capabilities(new DesiredCapabilitiesEx() - .with(DEVICE_NAME, T_DEVICE_1) + .with(DEVICE_NAME_OPTION, T_DEVICE_1) .with(PLATFORM_NAME, T_PLATFORM_1) - .with(PLATFORM_VERSION, T_VERSION_1)) + .with(PLATFORM_VERSION_OPTION, T_VERSION_1)) .build()) .putAll(SessionName.builder() .className(CLASS_INCLUDED) .methodName(METHOD_WITH_ONE_SESSION).build(), WebDriverSessionInfo.builder() .capabilities(new DesiredCapabilitiesEx() - .with(DEVICE_NAME, T_DEVICE_1) + .with(DEVICE_NAME_OPTION, T_DEVICE_1) .with(PLATFORM_NAME, T_PLATFORM_1) - .with(PLATFORM_VERSION, T_VERSION_1)) + .with(PLATFORM_VERSION_OPTION, T_VERSION_1)) .build()) .build()) .onFinish(mockedTestContext); diff --git a/qa-jgiven-webdriver/src/main/java/dev/aherscu/qa/jgiven/webdriver/formatters/WebDriverFormatter.java b/qa-jgiven-webdriver/src/main/java/dev/aherscu/qa/jgiven/webdriver/formatters/WebDriverFormatter.java index 00e89889e5..8778c6472e 100644 --- a/qa-jgiven-webdriver/src/main/java/dev/aherscu/qa/jgiven/webdriver/formatters/WebDriverFormatter.java +++ b/qa-jgiven-webdriver/src/main/java/dev/aherscu/qa/jgiven/webdriver/formatters/WebDriverFormatter.java @@ -15,9 +15,11 @@ */ package dev.aherscu.qa.jgiven.webdriver.formatters; -import static io.appium.java_client.remote.MobileCapabilityType.*; +import static io.appium.java_client.remote.options.SupportsDeviceNameOption.*; +import static io.appium.java_client.remote.options.SupportsPlatformVersionOption.*; import static java.util.Objects.*; import static org.apache.commons.lang3.StringUtils.*; +import static org.openqa.selenium.remote.CapabilityType.*; import java.lang.annotation.*; import java.text.*; @@ -40,20 +42,6 @@ public class WebDriverFormatter implements AnnotationArgumentFormatter { - @Override - public String format(final Object argumentToFormat, - final WebDriverFormatter.Annotation annotation) { - if (isNull(argumentToFormat)) - return EMPTY; - - val capabilities = - ((WebDriverEx) argumentToFormat).originalCapabilities; - return MessageFormat.format("{0} {1} {2}", - capabilities.getCapability(DEVICE_NAME), - capabilities.getCapability(PLATFORM_NAME), - capabilities.getCapability(PLATFORM_VERSION)); - } - /** * Formatter annotation for WebDriver. * @@ -66,4 +54,18 @@ public String format(final Object argumentToFormat, public @interface Annotation { // no parameter to declare } + + @Override + public String format(final Object argumentToFormat, + final WebDriverFormatter.Annotation annotation) { + if (isNull(argumentToFormat)) + return EMPTY; + + val capabilities = + ((WebDriverEx) argumentToFormat).originalCapabilities; + return MessageFormat.format("{0} {1} {2}", + capabilities.getCapability(DEVICE_NAME_OPTION), + capabilities.getCapability(PLATFORM_NAME), + capabilities.getCapability(PLATFORM_VERSION_OPTION)); + } } diff --git a/qa-jgiven-webdriver/src/main/java/dev/aherscu/qa/jgiven/webdriver/formatters/WinAppDriverFormatter.java b/qa-jgiven-webdriver/src/main/java/dev/aherscu/qa/jgiven/webdriver/formatters/WinAppDriverFormatter.java index a32839ae8b..497bda9d38 100644 --- a/qa-jgiven-webdriver/src/main/java/dev/aherscu/qa/jgiven/webdriver/formatters/WinAppDriverFormatter.java +++ b/qa-jgiven-webdriver/src/main/java/dev/aherscu/qa/jgiven/webdriver/formatters/WinAppDriverFormatter.java @@ -16,9 +16,11 @@ package dev.aherscu.qa.jgiven.webdriver.formatters; -import static io.appium.java_client.remote.MobileCapabilityType.*; +import static io.appium.java_client.remote.options.SupportsAppOption.*; +import static io.appium.java_client.remote.options.SupportsPlatformVersionOption.*; import static java.util.Objects.*; import static org.apache.commons.lang3.StringUtils.*; +import static org.openqa.selenium.remote.CapabilityType.*; import java.lang.annotation.*; import java.text.*; @@ -39,19 +41,6 @@ public class WinAppDriverFormatter implements AnnotationArgumentFormatter { - @Override - public String format(final Object argumentToFormat, - final WinAppDriverFormatter.Annotation annotation) { - if (isNull(argumentToFormat)) - return EMPTY; - final org.openqa.selenium.Capabilities capabilities = - ((WebDriverEx) argumentToFormat).originalCapabilities; - return MessageFormat.format("{0} {1} {2}", - capabilities.getCapability(PLATFORM_NAME), - capabilities.getCapability(PLATFORM_VERSION), - capabilities.getCapability("app")); - } - /** * Formatter annotation for WebDriver. * @@ -63,4 +52,17 @@ public String format(final Object argumentToFormat, public @interface Annotation { // no parameter to declare } + + @Override + public String format(final Object argumentToFormat, + final WinAppDriverFormatter.Annotation annotation) { + if (isNull(argumentToFormat)) + return EMPTY; + final org.openqa.selenium.Capabilities capabilities = + ((WebDriverEx) argumentToFormat).originalCapabilities; + return MessageFormat.format("{0} {1} {2}", + capabilities.getCapability(PLATFORM_NAME), + capabilities.getCapability(PLATFORM_VERSION_OPTION), + capabilities.getCapability(APP_OPTION)); + } } diff --git a/qa-testing-example/src/test/java/dev/aherscu/qa/testing/example/scenarios/tutorial4/TestingAndroidOnSauceLabs.java b/qa-testing-example/src/test/java/dev/aherscu/qa/testing/example/scenarios/tutorial4/TestingAndroidOnSauceLabs.java index b1d9fc3d37..29c5ed049e 100644 --- a/qa-testing-example/src/test/java/dev/aherscu/qa/testing/example/scenarios/tutorial4/TestingAndroidOnSauceLabs.java +++ b/qa-testing-example/src/test/java/dev/aherscu/qa/testing/example/scenarios/tutorial4/TestingAndroidOnSauceLabs.java @@ -16,11 +16,15 @@ package dev.aherscu.qa.testing.example.scenarios.tutorial4; -import static io.appium.java_client.remote.MobileCapabilityType.*; import static io.appium.java_client.remote.MobilePlatform.*; +import static io.appium.java_client.remote.options.SupportsAppOption.APP_OPTION; +import static io.appium.java_client.remote.options.SupportsAutoWebViewOption.AUTO_WEB_VIEW_OPTION; +import static io.appium.java_client.remote.options.SupportsDeviceNameOption.DEVICE_NAME_OPTION; +import static io.appium.java_client.remote.options.SupportsPlatformVersionOption.PLATFORM_VERSION_OPTION; import static java.util.concurrent.TimeUnit.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; +import static org.openqa.selenium.remote.CapabilityType.*; import java.net.*; import java.time.*; @@ -47,16 +51,16 @@ static AndroidDriver saucelabsApp( final String name) { return new AndroidDriver(new URL( // FIXME should get these credentials from system enviroment - // SAUCELABS_USERNAME and SAUCELABS_PASSWORD + // SAUCELABS_USERNAME and SAUCELABS_PASSWORD "https://TBD:TBD@ondemand.saucelabs.com:443/wd/hub"), new DesiredCapabilities() { { setCapability(PLATFORM_NAME, ANDROID); - setCapability(PLATFORM_VERSION, "8"); - setCapability(DEVICE_NAME, + setCapability(PLATFORM_VERSION_OPTION, "8"); + setCapability(DEVICE_NAME_OPTION, "Samsung Galaxy S9 Plus WQHD GoogleAPI Emulator"); - setCapability(AUTO_WEBVIEW, true); - setCapability(APP, "sauce-storage:app.apk"); + setCapability(AUTO_WEB_VIEW_OPTION, true); + setCapability(APP_OPTION, "sauce-storage:app.apk"); setCapability("name", name); setCapability("build", "local-" + DateTimeFormatter.ofPattern("yyyyMMddHHmmss") From e23d4d18bc90491ddba490188e7e502223e391c6 Mon Sep 17 00:00:00 2001 From: Adrian Herscu Date: Tue, 31 Oct 2023 18:39:46 +0200 Subject: [PATCH 26/49] formatting --- qa-jgiven-webdriver/pom.xml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/qa-jgiven-webdriver/pom.xml b/qa-jgiven-webdriver/pom.xml index f7edcc1202..4d261abefa 100644 --- a/qa-jgiven-webdriver/pom.xml +++ b/qa-jgiven-webdriver/pom.xml @@ -15,7 +15,9 @@ ~ limitations under the License. --> - + 4.0.0 dev.aherscu.qa From 220f50f53d12ce2555d2a880ee94ab0ba8523726 Mon Sep 17 00:00:00 2001 From: Adrian Herscu Date: Tue, 31 Oct 2023 18:40:23 +0200 Subject: [PATCH 27/49] added/updated failure descriptions --- qa-jgiven-commons/pom.xml | 14 ++++---------- qa-jgiven-webdriver/pom.xml | 1 + 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/qa-jgiven-commons/pom.xml b/qa-jgiven-commons/pom.xml index 81f830d123..51e651df8c 100644 --- a/qa-jgiven-commons/pom.xml +++ b/qa-jgiven-commons/pom.xml @@ -39,16 +39,10 @@ 2.0.5 - + + + + true diff --git a/qa-jgiven-webdriver/pom.xml b/qa-jgiven-webdriver/pom.xml index 4d261abefa..b34611f012 100644 --- a/qa-jgiven-webdriver/pom.xml +++ b/qa-jgiven-webdriver/pom.xml @@ -33,6 +33,7 @@ + true From f36cf5bf6b66466947b34215e9bcf5a34c0b921b Mon Sep 17 00:00:00 2001 From: Adrian Herscu Date: Tue, 31 Oct 2023 18:50:08 +0200 Subject: [PATCH 28/49] added jpms error descriptions --- qa-jgiven-commons/pom.xml | 66 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 62 insertions(+), 4 deletions(-) diff --git a/qa-jgiven-commons/pom.xml b/qa-jgiven-commons/pom.xml index 51e651df8c..507136035b 100644 --- a/qa-jgiven-commons/pom.xml +++ b/qa-jgiven-commons/pom.xml @@ -39,10 +39,11 @@ 2.0.5 - - - - + + + + + true @@ -77,6 +78,37 @@ dev.aherscu.qa qa-testing-utils 1.0.0-SNAPSHOT + + @@ -119,12 +151,26 @@ com.danhaywood.java danhaywood-java-assertjext 0.1.0 + + + + + + + commons-dbutils commons-dbutils 1.8.1 + + + + + + + @@ -167,6 +213,13 @@ com.tngtech.jgiven jgiven-testng ${jgiven.version} + + + + + + + @@ -229,6 +282,11 @@ commons-logging commons-logging + + + + + From 7beac379b08dd5f51fd400413a2eab4c54dc64e9 Mon Sep 17 00:00:00 2001 From: Adrian Herscu Date: Tue, 31 Oct 2023 18:51:20 +0200 Subject: [PATCH 29/49] rebuild full without signing --- .idea/runConfigurations/rebuild_commons.xml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.idea/runConfigurations/rebuild_commons.xml b/.idea/runConfigurations/rebuild_commons.xml index 5d0af085df..e21d6727fd 100644 --- a/.idea/runConfigurations/rebuild_commons.xml +++ b/.idea/runConfigurations/rebuild_commons.xml @@ -11,7 +11,6 @@ + From 1cd2dedac7a44e8497d93441c5ff0d2992b96679 Mon Sep 17 00:00:00 2001 From: Adrian Herscu Date: Tue, 7 Nov 2023 10:17:18 +0200 Subject: [PATCH 44/49] formatted --- .../jgiven/webdriver/scenarios/GenericWebDriverTest.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/qa-jgiven-webdriver/src/test/java/dev/aherscu/qa/jgiven/webdriver/scenarios/GenericWebDriverTest.java b/qa-jgiven-webdriver/src/test/java/dev/aherscu/qa/jgiven/webdriver/scenarios/GenericWebDriverTest.java index 28b476dd08..15680211de 100644 --- a/qa-jgiven-webdriver/src/test/java/dev/aherscu/qa/jgiven/webdriver/scenarios/GenericWebDriverTest.java +++ b/qa-jgiven-webdriver/src/test/java/dev/aherscu/qa/jgiven/webdriver/scenarios/GenericWebDriverTest.java @@ -44,7 +44,8 @@ value = "BC_UNCONFIRMED_CAST_OF_RETURN_VALUE", justification = "JGiven framework limitation") @Slf4j -public final class GenericWebDriverTest extends AbstractWireMockTest, WebDriverActions, WebDriverVerifications> { +public final class GenericWebDriverTest extends + AbstractWireMockTest, WebDriverActions, WebDriverVerifications> { private WebDriverEx driver; @@ -53,9 +54,9 @@ public final class GenericWebDriverTest extends AbstractWireMockTest Date: Tue, 7 Nov 2023 10:17:40 +0200 Subject: [PATCH 45/49] removed irrelevant properties --- .../test/resources/configuration-sources.xml | 5 -- .../required-capabilities.properties | 28 ----------- .../src/test/resources/webdriver.properties | 48 ------------------- 3 files changed, 81 deletions(-) delete mode 100644 qa-jgiven-commons/src/test/resources/required-capabilities.properties delete mode 100644 qa-jgiven-commons/src/test/resources/webdriver.properties diff --git a/qa-jgiven-commons/src/test/resources/configuration-sources.xml b/qa-jgiven-commons/src/test/resources/configuration-sources.xml index 5c543de3e2..4c978b5de5 100644 --- a/qa-jgiven-commons/src/test/resources/configuration-sources.xml +++ b/qa-jgiven-commons/src/test/resources/configuration-sources.xml @@ -20,9 +20,4 @@ - - - - - diff --git a/qa-jgiven-commons/src/test/resources/required-capabilities.properties b/qa-jgiven-commons/src/test/resources/required-capabilities.properties deleted file mode 100644 index 4a0c90b9d5..0000000000 --- a/qa-jgiven-commons/src/test/resources/required-capabilities.properties +++ /dev/null @@ -1,28 +0,0 @@ -# -# Copyright 2022 Adrian Herscu -# -# 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 -# -# http://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. -# - -required.capability0.type =ios - -required.capability1.type =android -required.capability1.deviceName=Google Pixel 3a XL GoogleAPI Emulator - -required.capability2.type =android -required.capability2.deviceName=Google Pixel 3 XL GoogleAPI Emulator - -required.capability3.type =android -required.capability3.deviceName=Google Pixel 3 GoogleAPI Emulator - -required.capability6.type =web diff --git a/qa-jgiven-commons/src/test/resources/webdriver.properties b/qa-jgiven-commons/src/test/resources/webdriver.properties deleted file mode 100644 index bb5933fe4a..0000000000 --- a/qa-jgiven-commons/src/test/resources/webdriver.properties +++ /dev/null @@ -1,48 +0,0 @@ -# -# Copyright 2022 Adrian Herscu -# -# 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 -# -# http://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. -# - -commons.local.url =TBD - -provider.local.windows.url =${commons.local.url} -provider.local.windows.class =io.appium.java_client.windows.WindowsDriver -provider.local.windows.platformName =Windows -provider.local.windows.platformVersion =10 -provider.local.windows.deviceName =WindowsPC -provider.local.windows.app =${application.filename} - -provider.local.web.class =org.openqa.selenium.chrome.ChromeDriver -provider.local.web.binary =${env:WEBDRIVER_HOME}/bin/chromedriver.exe -provider.local.web.platformName = -provider.local.web.target =${web.url} -provider.local.web.args = - -provider.local.android.url =http://127.0.0.1:4723/wd/hub -provider.local.android.class =io.appium.java_client.android.AndroidDriver -provider.local.android.nativeWebScreenshot=true -provider.local.android.automationName =UIAutomator2 -provider.local.android.deviceName =DONTCARE -provider.local.android.platform =android -provider.local.android.app =${user.dir}/${application.filename}.apk -provider.local.android.newCommandTimeout =500 - -provider.local.ios.url =http://127.0.0.1:4723/wd/hub -provider.local.ios.class =io.appium.java_client.ios.IOSDriver -provider.local.ios.automationName =XCuiTest -provider.local.ios.deviceName =iPhone 12 Pro -provider.local.ios.platform =ios -provider.local.ios.platformVersion =14.4 -provider.local.ios.udid =FCA21CD2-9A82-4530-A12D-240C9A53B9B4 -provider.local.ios.app =${user.dir}/${application.filename}.zip From 02b456b28fc88bf44e45a03cbfd18fef0b823532 Mon Sep 17 00:00:00 2001 From: Adrian Herscu Date: Tue, 7 Nov 2023 12:27:09 +0200 Subject: [PATCH 46/49] removed irrelevant jpms argument --- qa-jgiven-commons/pom.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/qa-jgiven-commons/pom.xml b/qa-jgiven-commons/pom.xml index 51bfba143f..8769e74721 100644 --- a/qa-jgiven-commons/pom.xml +++ b/qa-jgiven-commons/pom.xml @@ -247,7 +247,6 @@ ${read.mstimeout} - --illegal-access=debug From edc8bcf6dc132ec60170a20b2d498774f9daef82 Mon Sep 17 00:00:00 2001 From: Adrian Herscu Date: Thu, 9 Nov 2023 13:08:44 -0500 Subject: [PATCH 47/49] validated -- still parallel data providers don not work --- .../steps/ElasticSearchVerifications.java | 16 ++-------------- .../jgiven/rabbitmq/steps/RabbitMqFixtures.java | 3 +++ .../rabbitmq/steps/RabbitMqVerifications.java | 4 ++++ 3 files changed, 9 insertions(+), 14 deletions(-) diff --git a/qa-jgiven-elasticsearch/src/main/java/dev/aherscu/qa/jgiven/elasticsearch/steps/ElasticSearchVerifications.java b/qa-jgiven-elasticsearch/src/main/java/dev/aherscu/qa/jgiven/elasticsearch/steps/ElasticSearchVerifications.java index 5e7803b0eb..86222505ec 100644 --- a/qa-jgiven-elasticsearch/src/main/java/dev/aherscu/qa/jgiven/elasticsearch/steps/ElasticSearchVerifications.java +++ b/qa-jgiven-elasticsearch/src/main/java/dev/aherscu/qa/jgiven/elasticsearch/steps/ElasticSearchVerifications.java @@ -52,8 +52,6 @@ public class ElasticSearchVerifications> hits = new ThreadLocal<>(); - public SELF the_document( final String id, final Matcher matcher) { @@ -73,7 +71,6 @@ public SELF the_index( query.apply(new Query.Builder()).build().toString(), index.get(), documentType.get()); - hits.set(new LinkedList<>()); return eventually_assert_that(Unchecked .supplier(() -> elasticsearchClient .search(s -> s.index(index.get()).query(query), @@ -82,18 +79,9 @@ public SELF the_index( .hits() .stream() .map(Hit::source) + .filter(Objects::nonNull) .peek(tDocument -> log.debug("received document {}", tDocument)) - .peek(hits.get()::add)), + .peek(tDocument -> attach(tDocument.toString()))), matcher); } - - @AfterStage - protected void attachActualResponse() { - attach(hits.get().isEmpty() - ? null - : hits.get() - .stream() - .map(Object::toString) - .collect(Collectors.joining(LF))); - } } diff --git a/qa-jgiven-rabbitmq/src/main/java/dev/aherscu/qa/jgiven/rabbitmq/steps/RabbitMqFixtures.java b/qa-jgiven-rabbitmq/src/main/java/dev/aherscu/qa/jgiven/rabbitmq/steps/RabbitMqFixtures.java index a2269a5615..3bd8c76e5b 100644 --- a/qa-jgiven-rabbitmq/src/main/java/dev/aherscu/qa/jgiven/rabbitmq/steps/RabbitMqFixtures.java +++ b/qa-jgiven-rabbitmq/src/main/java/dev/aherscu/qa/jgiven/rabbitmq/steps/RabbitMqFixtures.java @@ -21,7 +21,9 @@ import dev.aherscu.qa.jgiven.commons.steps.*; import dev.aherscu.qa.jgiven.rabbitmq.model.*; import dev.aherscu.qa.jgiven.rabbitmq.utils.*; +import lombok.extern.slf4j.*; +@Slf4j public class RabbitMqFixtures> extends GenericFixtures { @@ -31,6 +33,7 @@ public class RabbitMqFixtures> public SELF a_queue(@SuppressWarnings("hiding") @POJOFormat( includeFields = { "queue", "channel" }) final QueueHandler queueHandler) { + log.debug("setting queue handler {}", queueHandler); this.queueHandler = queueHandler; return self(); } diff --git a/qa-jgiven-rabbitmq/src/main/java/dev/aherscu/qa/jgiven/rabbitmq/steps/RabbitMqVerifications.java b/qa-jgiven-rabbitmq/src/main/java/dev/aherscu/qa/jgiven/rabbitmq/steps/RabbitMqVerifications.java index f8876e550f..4bbaaf1ef9 100644 --- a/qa-jgiven-rabbitmq/src/main/java/dev/aherscu/qa/jgiven/rabbitmq/steps/RabbitMqVerifications.java +++ b/qa-jgiven-rabbitmq/src/main/java/dev/aherscu/qa/jgiven/rabbitmq/steps/RabbitMqVerifications.java @@ -25,7 +25,9 @@ import dev.aherscu.qa.jgiven.commons.steps.*; import dev.aherscu.qa.jgiven.rabbitmq.model.*; import dev.aherscu.qa.jgiven.rabbitmq.utils.*; +import lombok.extern.slf4j.*; +@Slf4j public class RabbitMqVerifications> extends GenericVerifications { @ExpectedScenarioState @@ -33,6 +35,7 @@ public class RabbitMqVerifications>> matcher) { + log.debug("retrieving all messages"); return eventually_assert_that( () -> queueHandler.recievedMessages().values().stream(), matcher); @@ -41,6 +44,7 @@ public SELF the_retrieved_messages( public SELF the_message_with_$_key( final K key, final Matcher> matcher) { + log.debug("retrieving message by {}", key); return eventually_assert_that( () -> queueHandler.recievedMessages().get(key), matcher); From c8e5324a97376abd8fa9c92f35f42e50f858ebab Mon Sep 17 00:00:00 2001 From: Adrian Herscu Date: Thu, 9 Nov 2023 20:49:57 +0200 Subject: [PATCH 48/49] parallel data providers not supported -- issue opened --- ...JGivenTestNgParallelDataProviderTests.java | 105 ++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 qa-jgiven-commons/src/test/java/dev/aherscu/qa/jgiven/commons/scenarios/JGivenTestNgParallelDataProviderTests.java diff --git a/qa-jgiven-commons/src/test/java/dev/aherscu/qa/jgiven/commons/scenarios/JGivenTestNgParallelDataProviderTests.java b/qa-jgiven-commons/src/test/java/dev/aherscu/qa/jgiven/commons/scenarios/JGivenTestNgParallelDataProviderTests.java new file mode 100644 index 0000000000..e6038615a8 --- /dev/null +++ b/qa-jgiven-commons/src/test/java/dev/aherscu/qa/jgiven/commons/scenarios/JGivenTestNgParallelDataProviderTests.java @@ -0,0 +1,105 @@ +/* + * Copyright 2023 Adrian Herscu + * + * 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 + * + * http://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. + */ + +package dev.aherscu.qa.jgiven.commons.scenarios; + +import static dev.aherscu.qa.jgiven.commons.utils.UnitilsScenarioTest.*; +import static org.hamcrest.CoreMatchers.*; +import static org.hamcrest.MatcherAssert.*; + +import java.util.*; +import java.util.stream.*; + +import org.hamcrest.*; +import org.testng.annotations.*; + +import com.tngtech.jgiven.*; +import com.tngtech.jgiven.annotation.*; +import com.tngtech.jgiven.testng.*; + +import dev.aherscu.qa.jgiven.commons.utils.*; + +/** + * Seems that parallel data providers are not supported. + *

    + * see https://github.com/TNG/JGiven/issues/829 + */ +@Listeners({ ScenarioTestListenerEx.class }) +public class JGivenTestNgParallelDataProviderTests extends + ScenarioTest, JGivenTestNgParallelDataProviderTests.SomeWhen, JGivenTestNgParallelDataProviderTests.SomeThen> { + + public static class OtherGiven> + extends Stage { + @ProvidedScenarioState + protected final ThreadLocal aValue = new ThreadLocal<>(); + + public SELF with(final Integer value) { + aValue.set(value); + return self(); + } + } + + public static class OtherThen> + extends Stage { + @ExpectedScenarioState + protected ThreadLocal aValue; + + public SELF the_value(final Matcher rule) { + // ISSUE: when running with enough parallelism aValue is null + assertThat(aValue.get(), rule); + return self(); + } + } + + public static class OtherWhen> + extends Stage { + // empty + } + + public static class SomeGiven> + extends Stage { + // empty + } + + public static class SomeThen> + extends Stage { + + } + + public static class SomeWhen> + extends Stage { + // empty + } + + @ScenarioStage + protected OtherGiven otherGiven; + @ScenarioStage + protected OtherThen otherThen; + @ScenarioStage + protected OtherWhen otherWhen; + + @DataProvider(parallel = true) + private static Iterator data() { + // ISSUE up to 10 it seems working... with 100 it does not + return IntStream.range(0, 100).iterator(); + } + + @Test(dataProvider = INTERNAL_DATA_PROVIDER) + public void shouldRunWithParallelDataProvider(final Integer aValue) { + otherGiven.with(aValue); + otherThen.the_value(is(aValue)); + } +} From 7486e1a1ff18256a85a255c718e67461f2cb6892 Mon Sep 17 00:00:00 2001 From: Adrian Herscu Date: Thu, 9 Nov 2023 20:50:22 +0200 Subject: [PATCH 49/49] renamed to match its purpose --- ...Tests.java => JGivenTestNgRetryTests.java} | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) rename qa-jgiven-commons/src/test/java/dev/aherscu/qa/jgiven/commons/scenarios/{JGivenSelfTests.java => JGivenTestNgRetryTests.java} (92%) diff --git a/qa-jgiven-commons/src/test/java/dev/aherscu/qa/jgiven/commons/scenarios/JGivenSelfTests.java b/qa-jgiven-commons/src/test/java/dev/aherscu/qa/jgiven/commons/scenarios/JGivenTestNgRetryTests.java similarity index 92% rename from qa-jgiven-commons/src/test/java/dev/aherscu/qa/jgiven/commons/scenarios/JGivenSelfTests.java rename to qa-jgiven-commons/src/test/java/dev/aherscu/qa/jgiven/commons/scenarios/JGivenTestNgRetryTests.java index 22838170a6..d2369f405c 100644 --- a/qa-jgiven-commons/src/test/java/dev/aherscu/qa/jgiven/commons/scenarios/JGivenSelfTests.java +++ b/qa-jgiven-commons/src/test/java/dev/aherscu/qa/jgiven/commons/scenarios/JGivenTestNgRetryTests.java @@ -32,21 +32,8 @@ * https://github.com/TNG/JGiven/pull/422 */ @Listeners({ ScenarioTestListenerEx.class }) -public class JGivenSelfTests extends - ScenarioTest, JGivenSelfTests.SomeWhen, JGivenSelfTests.SomeThen> { - - @Test(retryAnalyzer = TestRetryAnalyzer.class) - @TestRetryAnalyzer.Config(retries = 129, intervalMs = 13) - public void shouldFinallySucceed() { - then().should_fail_sometimes(); - } - - @Ignore // fails after retries as expected - @Test(retryAnalyzer = TestRetryAnalyzer.class) - @TestRetryAnalyzer.Config(retries = 129, intervalMs = 13) - public void shouldNeverSucceed() { - then().should_fail(); - } +public class JGivenTestNgRetryTests extends + ScenarioTest, JGivenTestNgRetryTests.SomeWhen, JGivenTestNgRetryTests.SomeThen> { public static class SomeGiven> extends Stage { @@ -70,4 +57,17 @@ public static class SomeWhen> extends Stage { // empty } + + @Test(retryAnalyzer = TestRetryAnalyzer.class) + @TestRetryAnalyzer.Config(retries = 129, intervalMs = 13) + public void shouldFinallySucceed() { + then().should_fail_sometimes(); + } + + @Ignore // fails after retries as expected + @Test(retryAnalyzer = TestRetryAnalyzer.class) + @TestRetryAnalyzer.Config(retries = 129, intervalMs = 13) + public void shouldNeverSucceed() { + then().should_fail(); + } }