From dd8ec4fc5ab04c35a270409025175343b1a05c05 Mon Sep 17 00:00:00 2001 From: Christoph Pirkl <4711730+kaklakariada@users.noreply.github.com> Date: Mon, 26 Aug 2024 16:28:32 +0200 Subject: [PATCH] #58: Add test for new public method (#59) --- .gitattributes | 27 +-- .github/workflows/broken_links_checker.yml | 5 + .github/workflows/ci-build-next-java.yml | 11 +- .github/workflows/ci-build.yml | 152 +++++++++--- .github/workflows/dependencies_check.yml | 78 ++++--- .github/workflows/dependencies_update.yml | 143 ++++++------ .github/workflows/release.yml | 219 ++++++++++++++++++ ...elease_droid_prepare_original_checksum.yml | 39 ---- .../release_droid_print_quick_checksum.yml | 26 --- ...release_droid_release_on_maven_central.yml | 35 --- ...ase_droid_upload_github_release_assets.yml | 47 ---- .project-keeper.yml | 4 +- .vscode/settings.json | 39 ++-- dependencies.md | 12 +- doc/changes/changelog.md | 1 + doc/changes/changes_1.7.0.md | 40 ++++ pk_generated_parent.pom | 31 ++- pom.xml | 26 ++- release_config.yml | 4 - .../exasol/matcher/EnhancedAllOfMatcher.java | 1 + .../ResultSetStructureMatcherTest.java | 17 +- 21 files changed, 598 insertions(+), 359 deletions(-) create mode 100644 .github/workflows/release.yml delete mode 100644 .github/workflows/release_droid_prepare_original_checksum.yml delete mode 100644 .github/workflows/release_droid_print_quick_checksum.yml delete mode 100644 .github/workflows/release_droid_release_on_maven_central.yml delete mode 100644 .github/workflows/release_droid_upload_github_release_assets.yml create mode 100644 doc/changes/changes_1.7.0.md delete mode 100644 release_config.yml diff --git a/.gitattributes b/.gitattributes index 2ca055d..f22be2f 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,15 +1,12 @@ -pk_generated_parent.pom linguist-generated=true -dependencies.md linguist-generated=true -versionsMavenPluginRules.xml linguist-generated=true -doc/changes/changelog.md linguist-generated=true -.github/workflows/broken_links_checker.yml linguist-generated=true -.github/workflows/ci-build-next-java.yml linguist-generated=true -.github/workflows/ci-build.yml linguist-generated=true -.github/workflows/dependencies_check.yml linguist-generated=true -.github/workflows/dependencies_update.yml linguist-generated=true -.github/workflows/release_droid_prepare_original_checksum.yml linguist-generated=true -.github/workflows/release_droid_print_quick_checksum.yml linguist-generated=true -.github/workflows/release_droid_release_on_maven_central.yml linguist-generated=true -.github/workflows/release_droid_upload_github_release_assets.yml linguist-generated=true -.settings/org.eclipse.jdt.core.prefs linguist-generated=true -.settings/org.eclipse.jdt.ui.prefs linguist-generated=true +pk_generated_parent.pom linguist-generated=true +dependencies.md linguist-generated=true +versionsMavenPluginRules.xml linguist-generated=true +doc/changes/changelog.md linguist-generated=true +.github/workflows/broken_links_checker.yml linguist-generated=true +.github/workflows/ci-build-next-java.yml linguist-generated=true +.github/workflows/ci-build.yml linguist-generated=true +.github/workflows/dependencies_check.yml linguist-generated=true +.github/workflows/dependencies_update.yml linguist-generated=true +.github/workflows/release.yml linguist-generated=true +.settings/org.eclipse.jdt.core.prefs linguist-generated=true +.settings/org.eclipse.jdt.ui.prefs linguist-generated=true diff --git a/.github/workflows/broken_links_checker.yml b/.github/workflows/broken_links_checker.yml index 0fbcad5..39612b7 100644 --- a/.github/workflows/broken_links_checker.yml +++ b/.github/workflows/broken_links_checker.yml @@ -13,6 +13,11 @@ on: jobs: linkChecker: runs-on: ubuntu-latest + permissions: + contents: read + defaults: + run: + shell: "bash" concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true diff --git a/.github/workflows/ci-build-next-java.yml b/.github/workflows/ci-build-next-java.yml index e3acdb7..e8302fe 100644 --- a/.github/workflows/ci-build-next-java.yml +++ b/.github/workflows/ci-build-next-java.yml @@ -10,6 +10,11 @@ on: jobs: java-17-compatibility: runs-on: ubuntu-latest + defaults: + run: + shell: "bash" + permissions: + contents: read concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true @@ -29,9 +34,3 @@ jobs: mvn --batch-mode --update-snapshots clean package -DtrimStackTrace=false \ -Djava.version=17 \ -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn - - name: Publish Test Report for Java 17 - uses: scacap/action-surefire-report@v1 - if: ${{ always() && github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]' }} - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - fail_if_no_tests: false diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index 5f69efc..e5d68a1 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -1,78 +1,164 @@ -# Generated by Project Keeper -# https://github.com/exasol/project-keeper/blob/main/project-keeper/src/main/resources/templates/.github/workflows/ci-build-db-version-matrix.yml +# This file was generated by Project Keeper. name: CI Build on: push: - branches: - - main - pull_request: - + branches: [ + main + ] + + pull_request: null jobs: matrix-build: runs-on: ubuntu-latest - concurrency: - group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.exasol_db_version }} + defaults: + run: { + shell: bash + } + permissions: { + contents: read + } + concurrency: { + group: '${{ github.workflow }}-${{ github.ref }}-${{ matrix.exasol_db_version }}', cancel-in-progress: true + } strategy: fail-fast: false matrix: - exasol_db_version: ["8.25.0", "7.1.25"] - env: - DEFAULT_EXASOL_DB_VERSION: "8.25.0" + exasol_db_version: [ + 8.29.1, + 7.1.29 + ] + + env: { + DEFAULT_EXASOL_DB_VERSION: 8.29.1 + } steps: - name: Free Disk Space + id: free-disk-space if: ${{ false }} run: | sudo rm -rf /usr/local/lib/android sudo rm -rf /usr/share/dotnet - name: Checkout the repository + id: checkout uses: actions/checkout@v4 - with: + with: { fetch-depth: 0 + } - name: Set up JDKs + id: setup-java uses: actions/setup-java@v4 with: - distribution: "temurin" + distribution: temurin java-version: | 11 17 - cache: "maven" + cache: maven - name: Cache SonarCloud packages + id: cache-sonar uses: actions/cache@v4 - with: - path: ~/.sonar/cache - key: ${{ runner.os }}-sonar - restore-keys: ${{ runner.os }}-sonar - - name: Enable testcontainer reuse + with: { + path: ~/.sonar/cache, + key: '${{ runner.os }}-sonar', + restore-keys: '${{ runner.os }}-sonar' + } + - { + name: Enable testcontainer reuse, + id: enable-testcontainer-reuse, run: echo 'testcontainers.reuse.enable=true' > "$HOME/.testcontainers.properties" + } - name: Run tests and build with Maven + id: build-pk-verify run: | mvn --batch-mode clean verify \ -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \ -DtrimStackTrace=false \ -Dcom.exasol.dockerdb.image=${{ matrix.exasol_db_version }} - env: - # Set additional environment variable as in scala projects the scalatest plugin does not forward - # the system property -Dcom.exasol.dockerdb.image to the test's implementation. - EXASOL_DB_VERSION: ${{ matrix.exasol_db_version }} - - name: Publish Test Report for Exasol ${{ matrix.exasol_db_version }} - uses: scacap/action-surefire-report@v1 - if: ${{ always() && github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]' }} - with: - github_token: ${{ secrets.GITHUB_TOKEN }} + env: { + EXASOL_DB_VERSION: '${{ matrix.exasol_db_version }}' + } - name: Sonar analysis + id: sonar-analysis if: ${{ env.SONAR_TOKEN != null && matrix.exasol_db_version == env.DEFAULT_EXASOL_DB_VERSION }} run: | mvn --batch-mode org.sonarsource.scanner.maven:sonar-maven-plugin:sonar \ -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \ -DtrimStackTrace=false \ -Dsonar.token=$SONAR_TOKEN - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - + env: { + GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}', + SONAR_TOKEN: '${{ secrets.SONAR_TOKEN }}' + } + - name: Verify Release Artifacts + id: verify-release-artifacts + run: "print_message() {\n local -r message=$1\n echo \"$message\"\n echo \"$message\" >> \"$GITHUB_STEP_SUMMARY\"\n}\n\nprint_message \"### Release Artifacts\"\n\nIFS=$'\\n' artifacts_array=($ARTIFACTS)\nmissing_files=()\nfor file in \"${artifacts_array[@]}\";\ndo \n echo \"Checking if file $file exists...\"\n if ! [[ -f \"$file\" ]]; then\n print_message \"* ⚠️ \\`$file\\` does not exist ⚠️\"\n echo \"Content of directory $(dirname \"$file\"):\"\n ls \"$(dirname \"$file\")\"\n missing_files+=(\"$file\")\n else\n print_message \"* \\`$file\\` ✅\" \n fi\ndone\nprint_message \"\"\nnumber_of_missing_files=${#missing_files[@]}\nif [[ $number_of_missing_files -gt 0 ]]; then\n print_message \"⚠️ $number_of_missing_files release artifact(s) missing ⚠️\"\n exit 1\nfi\n" + env: { + ARTIFACTS: '${{ steps.build-pk-verify.outputs.release-artifacts }}' + } + - name: Upload artifacts + id: upload-artifacts + uses: actions/upload-artifact@v4 + with: { + name: 'artifacts-exasol-${{ matrix.exasol_db_version }}', + path: '${{ steps.build-pk-verify.outputs.release-artifacts }}', + retention-days: 5 + } build: needs: matrix-build runs-on: ubuntu-latest + defaults: + run: { + shell: bash + } + permissions: { + contents: read, + issues: read + } + outputs: { + release-required: '${{ steps.check-release.outputs.release-required }}' + } steps: - - run: echo "Build successful" + - name: Checkout the repository + uses: actions/checkout@v4 + with: { + fetch-depth: 0 + } + - name: Set up JDKs + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: | + 11 + 17 + cache: maven + - name: Check if release is needed + id: check-release + run: | + if mvn --batch-mode com.exasol:project-keeper-maven-plugin:verify-release --projects .; then + echo "### ✅ Release preconditions met, start release" >> "$GITHUB_STEP_SUMMARY" + echo "release-required=true" >> "$GITHUB_OUTPUT" + else + echo "### 🛑 Not all release preconditions met, skipping release" >> "$GITHUB_STEP_SUMMARY" + echo "See log output for details." >> "$GITHUB_STEP_SUMMARY" + echo "release-required=false" >> "$GITHUB_OUTPUT" + fi + env: { + GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}' + } + start_release: + needs: build + if: ${{ github.ref == 'refs/heads/main' && needs.build.outputs.release-required == 'true' }} + concurrency: { + cancel-in-progress: false, + group: release + } + secrets: inherit + permissions: { + contents: write, + actions: read, + issues: read + } + uses: ./.github/workflows/release.yml + with: { + started-from-ci: true + } diff --git a/.github/workflows/dependencies_check.yml b/.github/workflows/dependencies_check.yml index 6926e55..9c2365c 100644 --- a/.github/workflows/dependencies_check.yml +++ b/.github/workflows/dependencies_check.yml @@ -1,64 +1,80 @@ -# Generated by Project Keeper -# https://github.com/exasol/project-keeper/blob/main/project-keeper/src/main/resources/templates/.github/workflows/dependencies_check.yml +# This file was generated by Project Keeper. name: Report Security Issues on: - workflow_dispatch: + workflow_dispatch: null schedule: - - cron: "0 2 * * *" - + - { + cron: 0 2 * * * + } jobs: report_security_issues: runs-on: ubuntu-latest - permissions: - contents: read + defaults: + run: { + shell: bash + } + permissions: { + contents: read, issues: write - outputs: - created-issues: ${{ steps.security-issues.outputs.created-issues }} + } + outputs: { + created-issues: '${{ steps.security-issues.outputs.created-issues }}' + } + concurrency: { + group: '${{ github.workflow }}-report_security_issues', + cancel-in-progress: true + } steps: - - uses: actions/checkout@v4 - + - { + name: Checkout, + id: checkout, + uses: actions/checkout@v4 + } - name: Set up JDKs + id: setup-jdks uses: actions/setup-java@v4 with: - distribution: "temurin" + distribution: temurin java-version: | 11 17 - cache: "maven" - + cache: maven - name: Generate ossindex report + id: ossindex-report run: | mvn --batch-mode org.sonatype.ossindex.maven:ossindex-maven-plugin:audit \ org.sonatype.ossindex.maven:ossindex-maven-plugin:audit-aggregate \ -Dossindex.reportFile=$(pwd)/ossindex-report.json \ -Dossindex.fail=false - - name: Report Security Issues id: security-issues uses: exasol/python-toolbox/.github/actions/security-issues@main - with: - format: "maven" - command: "cat ossindex-report.json" - github-token: ${{ secrets.GITHUB_TOKEN }} - + with: { + format: maven, + command: cat ossindex-report.json, + github-token: '${{ secrets.GITHUB_TOKEN }}' + } - name: Output security issues (Debugging) + id: debug-print-security-issues run: | echo "$CREATED_ISSUES" > test.jsonl cat test.jsonl - env: - CREATED_ISSUES: ${{ steps.security-issues.outputs.created-issues }} - + env: { + CREATED_ISSUES: '${{ steps.security-issues.outputs.created-issues }}' + } start_dependency_udpate: needs: report_security_issues if: ${{ needs.report_security_issues.outputs.created-issues }} - concurrency: - cancel-in-progress: true - group: "dependency_update" - # Workflow needs secret INTEGRATION_TEAM_SLACK_NOTIFICATION_WEBHOOK + concurrency: { + group: '${{ github.workflow }}-start_dependency_update', + cancel-in-progress: false + } secrets: inherit - permissions: - contents: write + permissions: { + contents: write, pull-requests: write + } uses: ./.github/workflows/dependencies_update.yml - with: - vulnerability_issues: ${{ needs.report_security_issues.outputs.created-issues }} + with: { + vulnerability_issues: '${{ needs.report_security_issues.outputs.created-issues }}' + } diff --git a/.github/workflows/dependencies_update.yml b/.github/workflows/dependencies_update.yml index 58222ba..0fa7180 100644 --- a/.github/workflows/dependencies_update.yml +++ b/.github/workflows/dependencies_update.yml @@ -1,70 +1,68 @@ -# Generated by Project Keeper -# https://github.com/exasol/project-keeper/blob/main/project-keeper/src/main/resources/templates/.github/workflows/dependencies_update.yml +# This file was generated by Project Keeper. name: Update dependencies on: workflow_call: inputs: - vulnerability_issues: - description: "GitHub issues for vulnerable dependencies as JSONL" - required: true + vulnerability_issues: { + description: GitHub issues for vulnerable dependencies as JSONL, + required: true, type: string - workflow_dispatch: - + } + workflow_dispatch: null jobs: update_dependencies: runs-on: ubuntu-latest - permissions: - contents: write + defaults: + run: { + shell: bash + } + permissions: { + contents: write, pull-requests: write - + } + concurrency: { + group: '${{ github.workflow }}', + cancel-in-progress: false + } steps: - uses: actions/checkout@v4 - with: + id: checkout + with: { fetch-depth: 0 - + } - name: Set up JDKs + id: setup-jdks uses: actions/setup-java@v4 with: - distribution: "temurin" + distribution: temurin java-version: | 11 17 - cache: "maven" - + cache: maven - name: Print issues + id: debug-print-issues run: | echo "Issues from Action input: $ISSUES" - env: - ISSUES: ${{ inputs.vulnerability_issues }} - + env: { + ISSUES: '${{ inputs.vulnerability_issues }}' + } - name: Fail if not running on a branch + id: check-branch if: ${{ !startsWith(github.ref, 'refs/heads/') }} uses: actions/github-script@v7 with: script: | core.setFailed('Not running on a branch, github.ref is ${{ github.ref }}. Please start this workflow only on main or a branch') - - name: Update dependencies + id: update-dependencies run: | mvn --batch-mode com.exasol:project-keeper-maven-plugin:update-dependencies --projects . \ -Dproject-keeper:vulnerabilities="$CREATED_ISSUES" - env: - CREATED_ISSUES: ${{ inputs.vulnerability_issues }} - - - name: Project Keeper Fix - run: | - mvn --batch-mode com.exasol:project-keeper-maven-plugin:fix --projects . - - - name: Project Keeper Fix for updated Project Keeper version - # Calling PK fix a second time is necessary because the first invocation potentially updated PK itself. - # So we need to run PK fix again with the latest PK version. - # [impl->dsn~dependency-updater.workflow.start-pk-fix~1] - run: | - mvn --batch-mode com.exasol:project-keeper-maven-plugin:fix --projects . - + env: { + CREATED_ISSUES: '${{ inputs.vulnerability_issues }}' + } - name: Generate Pull Request comment id: pr-comment - # [impl->dsn~dependency-updater.workflow.pull-request-trigger-ci-build~1] run: | echo 'comment<> "$GITHUB_OUTPUT" echo 'This Pull Request was created by [`dependencies_update.yml`](https://github.com/exasol/project-keeper/blob/main/project-keeper/src/main/resources/templates/.github/workflows/dependencies_update.yml) workflow.' >> "$GITHUB_OUTPUT" @@ -75,15 +73,19 @@ jobs: echo 'It updates dependencies.' >> "$GITHUB_OUTPUT" fi echo >> "$GITHUB_OUTPUT" - echo '# ⚠️ This PR does not trigger CI workflows by default ⚠️' >> "$GITHUB_OUTPUT" + echo '# ⚠️ Notes ⚠️' >> "$GITHUB_OUTPUT" + echo '## Run PK fix manually' >> "$GITHUB_OUTPUT" + echo 'Due to restrictions workflow `dependencies_update.yml` cannot update other workflows, see https://github.com/exasol/project-keeper/issues/578 for details.' >> "$GITHUB_OUTPUT" + echo 'Please checkout this PR locally and run `mvn com.exasol:project-keeper-maven-plugin:fix --projects .`' >> "$GITHUB_OUTPUT" + echo '## This PR does not trigger CI workflows' >> "$GITHUB_OUTPUT" echo 'Please click the **Close pull request** button and then **Reopen pull request** to trigger running checks.' >> "$GITHUB_OUTPUT" echo 'See https://github.com/exasol/project-keeper/issues/534 for details.' >> "$GITHUB_OUTPUT" echo 'EOF' >> "$GITHUB_OUTPUT" cat "$GITHUB_OUTPUT" - env: - CREATED_ISSUES: ${{ inputs.vulnerability_issues }} - + env: { + CREATED_ISSUES: '${{ inputs.vulnerability_issues }}' + } - name: Generate Pull Request Title id: pr-title run: | @@ -96,22 +98,23 @@ jobs: fi cat "$GITHUB_OUTPUT" - env: - CREATED_ISSUES: ${{ inputs.vulnerability_issues }} - + env: { + CREATED_ISSUES: '${{ inputs.vulnerability_issues }}' + } - name: Configure git + id: configure-git run: | git config --global user.email "opensource@exasol.com" git config --global user.name "Automatic Dependency Updater" - - name: Create branch + id: create-branch if: ${{ github.ref == 'refs/heads/main' }} run: | branch_name="dependency-update/$(date "+%Y%m%d%H%M%S")" echo "Creating branch $branch_name" git checkout -b "$branch_name" - - name: Commit changes & push + id: publish-branch if: ${{ startsWith(github.ref, 'refs/heads/' ) }} run: | branch_name=$(git rev-parse --abbrev-ref HEAD) @@ -129,9 +132,9 @@ jobs: echo "Pushing branch $branch_name..." git push --set-upstream origin "$branch_name" echo "Done." - env: - TITLE: ${{ steps.pr-title.outputs.title }} - + env: { + TITLE: '${{ steps.pr-title.outputs.title }}' + } - name: Create pull request id: create-pr if: ${{ github.ref == 'refs/heads/main' }} @@ -139,31 +142,35 @@ jobs: pr_url=$(gh pr create --base main --title "$TITLE" --body "$COMMENT") echo "Created Pull Request: $pr_url" echo "pr_url=$pr_url" >> "$GITHUB_OUTPUT" - env: - COMMENT: ${{ steps.pr-comment.outputs.comment }} - TITLE: ${{ steps.pr-title.outputs.title }} - GH_TOKEN: ${{ github.token }} - + env: { + COMMENT: '${{ steps.pr-comment.outputs.comment }}', + TITLE: '${{ steps.pr-title.outputs.title }}', + GH_TOKEN: '${{ github.token }}' + } - name: Report failure Status to Slack channel - # Also run this step in case of failures + id: report-failure-slack if: ${{ always() }} uses: ravsamhq/notify-slack-action@v2 - with: - status: ${{ job.status }} - token: ${{ secrets.GITHUB_TOKEN }} - notification_title: "Dependency check in {repo} has {status_message}" - message_format: "{emoji} *{workflow}* {status_message} in <{repo_url}|{repo}>" - notify_when: "failure,cancelled,warnings" - env: - SLACK_WEBHOOK_URL: ${{ secrets.INTEGRATION_TEAM_SLACK_NOTIFICATION_WEBHOOK }} - + with: { + status: '${{ job.status }}', + token: '${{ secrets.GITHUB_TOKEN }}', + notification_title: 'Dependency check in {repo} has {status_message}', + message_format: '{emoji} *{workflow}* {status_message} in <{repo_url}|{repo}>', + notify_when: 'failure,cancelled,warnings' + } + env: { + SLACK_WEBHOOK_URL: '${{ secrets.INTEGRATION_TEAM_SLACK_NOTIFICATION_WEBHOOK }}' + } - name: Report new Pull Request to Slack channel + id: report-pr-slack if: ${{ steps.create-pr.outputs.pr_url }} uses: ravsamhq/notify-slack-action@v2 - with: - status: ${{ job.status }} - token: ${{ secrets.GITHUB_TOKEN }} - notification_title: "Dependency update for {repo} created a Pull Request" - message_format: "{workflow} created Pull Request ${{ steps.create-pr.outputs.pr_url }}" - env: - SLACK_WEBHOOK_URL: ${{ secrets.INTEGRATION_TEAM_SLACK_NOTIFICATION_WEBHOOK }} + with: { + status: '${{ job.status }}', + token: '${{ secrets.GITHUB_TOKEN }}', + notification_title: 'Dependency update for {repo} created a Pull Request', + message_format: '{workflow} created Pull Request ${{ steps.create-pr.outputs.pr_url }}' + } + env: { + SLACK_WEBHOOK_URL: '${{ secrets.INTEGRATION_TEAM_SLACK_NOTIFICATION_WEBHOOK }}' + } diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..5be64c8 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,219 @@ +# This file was generated by Project Keeper. +name: Release +on: + workflow_call: + inputs: + started-from-ci: { + description: 'Marks this release as started from CI, skipping precondition check', + type: boolean, + required: true, + default: false + } + workflow_dispatch: + inputs: + skip-maven-central: { + description: Skip deployment to Maven Central, + required: true, + type: boolean, + default: false + } + skip-github-release: { + description: Skip creating the GitHub release, + required: true, + type: boolean, + default: false + } +jobs: + release: + runs-on: ubuntu-latest + defaults: + run: { + shell: bash + } + concurrency: { + group: '${{ github.workflow }}', + cancel-in-progress: false + } + permissions: { + contents: write, + actions: read, + issues: read + } + steps: + - name: Checkout the repository + id: checkout + uses: actions/checkout@v4 + with: { + fetch-depth: 0 + } + - name: Set up Maven Central Repository + id: configure-maven-central-credentials + if: ${{ true }} + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: | + 11 + 17 + cache: maven + server-id: ossrh + server-username: MAVEN_USERNAME + server-password: MAVEN_PASSWORD + gpg-private-key: ${{ secrets.OSSRH_GPG_SECRET_KEY }} + gpg-passphrase: MAVEN_GPG_PASSPHRASE + - name: Set up JDKs + id: setup-jdks + if: ${{ ! true }} + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: | + 11 + 17 + cache: maven + - name: Fail if not running on main branch + id: check-main-branch + if: ${{ github.ref != 'refs/heads/main' }} + uses: actions/github-script@v7 + with: + script: | + core.setFailed('Not running on main branch, github.ref is ${{ github.ref }}. Please start this workflow only on main') + - name: Check CI build of this commit succeeded + id: check-ci-build-status + if: ${{ ! inputs.started-from-ci }} + run: | + echo "Commit SHA: $COMMIT_SHA" + gh run list --workflow ci-build.yml --branch main --event push --commit $COMMIT_SHA + ci_build_status=$(gh run list --workflow ci-build.yml --branch main --event push --commit $COMMIT_SHA --json conclusion --template '{{range .}}{{.conclusion}}{{"\n"}}{{end}}') + echo "CI build status at commit $COMMIT_SHA was '$ci_build_status'" + if [[ "$ci_build_status" != "success" ]]; then + gh run list --workflow ci-build.yml --commit $COMMIT_SHA >> $GITHUB_STEP_SUMMARY + echo "Status of CI build for commit $COMMIT_SHA was '$ci_build_status', expected 'success'" >> $GITHUB_STEP_SUMMARY + cat $GITHUB_STEP_SUMMARY + exit 1 + fi + env: { + COMMIT_SHA: '${{ github.sha }}', + GH_TOKEN: '${{ github.token }}' + } + - name: Verify release preconditions + id: verify-release + run: | + mvn --batch-mode com.exasol:project-keeper-maven-plugin:verify-release --projects . + echo "$GITHUB_OUTPUT" + env: { + GITHUB_TOKEN: '${{ github.token }}' + } + - { + name: Build project, + id: build, + run: mvn --batch-mode -DskipTests clean verify + } + - { + name: List secret GPG keys, + id: list-secret-gpg-keys, + if: '${{ true && (! inputs.skip-maven-central) }}', + run: gpg --list-secret-keys + } + - name: Publish to Central Repository + id: deploy-maven-central + if: ${{ true && (! inputs.skip-maven-central) }} + run: | + echo "#### Maven Central Release" >> "$GITHUB_STEP_SUMMARY" + mvn --batch-mode -Dgpg.skip=false -DskipTests deploy + echo "Published to Maven Central ✅" >> "$GITHUB_STEP_SUMMARY" + env: { + MAVEN_USERNAME: '${{ secrets.OSSRH_USERNAME }}', + MAVEN_PASSWORD: '${{ secrets.OSSRH_PASSWORD }}', + MAVEN_GPG_PASSPHRASE: '${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }}' + } + - name: Calculate Artifact Checksums + id: artifact-checksum + if: ${{ ! inputs.skip-github-release }} + run: | + echo "Calculating sha256 checksum for artifact files" + echo "artifacts<> "$GITHUB_OUTPUT" + IFS=$'\n' artifacts_array=($ARTIFACTS) + for file in "${artifacts_array[@]}"; + do + full_path=$(realpath "$file") + echo "Calculate sha256sum for file '$full_path'" + file_dir="$(dirname "$full_path")" + file_name=$(basename "$full_path") + pushd "$file_dir" + checksum_file_name="${file_name}.sha256" + sha256sum "$file_name" > "$checksum_file_name" + echo "$full_path" >> "$GITHUB_OUTPUT" + echo "${file_dir}/$checksum_file_name" >> "$GITHUB_OUTPUT" + popd + done + echo "EOF" >> "$GITHUB_OUTPUT" + echo "Full artifact file list" + cat "$GITHUB_OUTPUT" + env: { + ARTIFACTS: '${{ steps.verify-release.outputs.release-artifacts }}' + } + - name: Create GitHub Release + id: create-github-release + if: ${{ ! inputs.skip-github-release }} + run: | + echo "### GitHub Release" >> "$GITHUB_STEP_SUMMARY" + IFS=$'\n' artifacts_array=($ARTIFACTS) + echo "#### Attaching Release Artifacts" >> "$GITHUB_STEP_SUMMARY" + for file in "${artifacts_array[@]}"; + do + echo "Attaching artifact '$file'" + echo "* \`$file\`" >> "$GITHUB_STEP_SUMMARY" + done + echo "" >> "$GITHUB_STEP_SUMMARY" + release_url=$(gh release create --latest --title "$TITLE" --notes "$NOTES" --target main $TAG "${artifacts_array[@]}") + echo "Created release $TAG with title '$TITLE' at $release_url ✅" >> "$GITHUB_STEP_SUMMARY" + echo "release-url=$release_url" >> "$GITHUB_OUTPUT" + + # [impl->dsn~release-workflow.create-golang-tags~1] + echo "#### Creating Additional Tags" >> "$GITHUB_STEP_SUMMARY" + IFS=$'\n' tags_array=($ADDITIONAL_TAGS) + for tag in "${tags_array[@]}"; + do + echo "Creating tag '$tag'" + git tag "$tag" + git push origin "$tag" + echo "* \`$tag\`" >> "$GITHUB_STEP_SUMMARY" + done + + git fetch --tags origin + env: { + GH_TOKEN: '${{ github.token }}', + TAG: '${{ steps.verify-release.outputs.release-tag }}', + ADDITIONAL_TAGS: '${{ steps.verify-release.outputs.additional-release-tags }}', + NOTES: '${{ steps.verify-release.outputs.release-notes }}', + TITLE: '${{ steps.verify-release.outputs.release-title }}', + ARTIFACTS: '${{ steps.artifact-checksum.outputs.artifacts }}' + } + - name: Report failure Status to Slack channel + id: report-failure-status-slack + if: ${{ always() }} + uses: ravsamhq/notify-slack-action@v2 + with: { + status: '${{ job.status }}', + token: '${{ github.token }}', + notification_title: 'Release build in {repo} has {status_message}', + message_format: '{emoji} *{workflow}* {status_message} in <{repo_url}|{repo}>', + notify_when: 'failure,cancelled,warnings,skipped' + } + env: { + SLACK_WEBHOOK_URL: '${{ secrets.INTEGRATION_TEAM_SLACK_NOTIFICATION_WEBHOOK }}' + } + - name: Report new release to Slack channel + id: report-new-release-slack + if: ${{ steps.create-github-release.outputs.release-url }} + uses: ravsamhq/notify-slack-action@v2 + with: { + status: '${{ job.status }}', + token: '${{ github.token }}', + notification_title: 'Release build for {repo} created a new release', + message_format: '{workflow} created release ${{ steps.create-github-release.outputs.release-url }}' + } + env: { + SLACK_WEBHOOK_URL: '${{ secrets.INTEGRATION_TEAM_SLACK_NOTIFICATION_WEBHOOK }}' + } diff --git a/.github/workflows/release_droid_prepare_original_checksum.yml b/.github/workflows/release_droid_prepare_original_checksum.yml deleted file mode 100644 index 9801107..0000000 --- a/.github/workflows/release_droid_prepare_original_checksum.yml +++ /dev/null @@ -1,39 +0,0 @@ -# Generated by Project Keeper -# https://github.com/exasol/project-keeper/blob/main/project-keeper/src/main/resources/templates/.github/workflows/release_droid_prepare_original_checksum.yml -name: Release Droid - Prepare Original Checksum -on: - workflow_dispatch: - -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Free Disk Space - if: ${{ false }} - run: | - sudo rm -rf /usr/local/lib/android - sudo rm -rf /usr/share/dotnet - - name: Checkout the repository - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Set up JDKs - uses: actions/setup-java@v4 - with: - distribution: "temurin" - java-version: | - 11 - 17 - cache: "maven" - - name: Enable testcontainer reuse - run: echo 'testcontainers.reuse.enable=true' > "$HOME/.testcontainers.properties" - - name: Run tests and build with Maven - run: mvn --batch-mode clean verify --file pom.xml - - name: Prepare checksum - run: find target -maxdepth 1 -name *.jar -exec sha256sum "{}" + > original_checksum - - name: Upload checksum to the artifactory - uses: actions/upload-artifact@v4 - with: - name: original_checksum - retention-days: 5 - path: original_checksum diff --git a/.github/workflows/release_droid_print_quick_checksum.yml b/.github/workflows/release_droid_print_quick_checksum.yml deleted file mode 100644 index 86979cd..0000000 --- a/.github/workflows/release_droid_print_quick_checksum.yml +++ /dev/null @@ -1,26 +0,0 @@ -# Generated by Project Keeper -# https://github.com/exasol/project-keeper/blob/main/project-keeper/src/main/resources/templates/.github/workflows/release_droid_print_quick_checksum.yml -name: Release Droid - Print Quick Checksum -on: - workflow_dispatch: - -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Checkout the repository - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Set up JDKs - uses: actions/setup-java@v4 - with: - distribution: "temurin" - java-version: | - 11 - 17 - cache: "maven" - - name: Build with Maven skipping tests - run: mvn --batch-mode clean verify -DskipTests - - name: Print checksum - run: echo 'checksum_start==';find target -maxdepth 1 -name *.jar -exec sha256sum "{}" + | xargs;echo '==checksum_end' diff --git a/.github/workflows/release_droid_release_on_maven_central.yml b/.github/workflows/release_droid_release_on_maven_central.yml deleted file mode 100644 index 0a5ee04..0000000 --- a/.github/workflows/release_droid_release_on_maven_central.yml +++ /dev/null @@ -1,35 +0,0 @@ -# Generated by Project Keeper -# https://github.com/exasol/project-keeper/blob/main/project-keeper/src/main/resources/templates/.github/workflows/release_droid_release_on_maven_central.yml -name: Release Droid - Release On Maven Central -on: - workflow_dispatch: - -jobs: - publish: - runs-on: ubuntu-latest - steps: - - name: Checkout the repository - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Set up Maven Central Repository - uses: actions/setup-java@v4 - with: - distribution: "temurin" - java-version: | - 11 - 17 - cache: "maven" - server-id: ossrh - server-username: MAVEN_USERNAME - server-password: MAVEN_PASSWORD - gpg-private-key: ${{ secrets.OSSRH_GPG_SECRET_KEY }} - gpg-passphrase: MAVEN_GPG_PASSPHRASE - - name: List secret GPG keys - run: gpg --list-secret-keys - - name: Publish to Central Repository - run: mvn --batch-mode -Dgpg.skip=false -DskipTests clean deploy - env: - MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} - MAVEN_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} - MAVEN_GPG_PASSPHRASE: ${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }} diff --git a/.github/workflows/release_droid_upload_github_release_assets.yml b/.github/workflows/release_droid_upload_github_release_assets.yml deleted file mode 100644 index b19f7cf..0000000 --- a/.github/workflows/release_droid_upload_github_release_assets.yml +++ /dev/null @@ -1,47 +0,0 @@ -# Generated by Project Keeper -# https://github.com/exasol/project-keeper/blob/main/project-keeper/src/main/resources/templates/.github/workflows/release_droid_upload_github_release_assets.yml -name: Release Droid - Upload GitHub Release Assets -on: - workflow_dispatch: - inputs: - upload_url: - description: "Assets upload URL" - required: true - -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Checkout the repository - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Set up JDKs - uses: actions/setup-java@v4 - with: - distribution: "temurin" - java-version: | - 11 - 17 - cache: "maven" - - name: Build with Maven skipping tests - run: mvn --batch-mode clean verify -DskipTests - - name: Generate sha256sum files - run: | - cd target - find . -maxdepth 1 -name \*.jar -exec bash -c 'sha256sum {} > {}.sha256' \; - - name: Upload assets to the GitHub release draft - uses: shogo82148/actions-upload-release-asset@v1 - with: - upload_url: ${{ github.event.inputs.upload_url }} - asset_path: target/*.jar - - name: Upload sha256sum files - uses: shogo82148/actions-upload-release-asset@v1 - with: - upload_url: ${{ github.event.inputs.upload_url }} - asset_path: target/*.sha256 - - name: Upload error-code-report - uses: shogo82148/actions-upload-release-asset@v1 - with: - upload_url: ${{ github.event.inputs.upload_url }} - asset_path: target/error_code_report.json diff --git a/.project-keeper.yml b/.project-keeper.yml index 00203c5..5ab4603 100644 --- a/.project-keeper.yml +++ b/.project-keeper.yml @@ -6,5 +6,5 @@ sources: - integration_tests build: exasolDbVersions: - - "8.25.0" - - "7.1.25" + - "8.29.1" + - "7.1.29" diff --git a/.vscode/settings.json b/.vscode/settings.json index 3299e21..61150c5 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,21 +1,22 @@ { - "editor.formatOnSave": true, - "editor.codeActionsOnSave": { - "source.organizeImports": "explicit", - "source.generate.finalModifiers": "explicit", - "source.fixAll": "explicit" -}, - "java.codeGeneration.useBlocks": true, - "java.saveActions.organizeImports": true, - "java.sources.organizeImports.starThreshold": 3, - "java.sources.organizeImports.staticStarThreshold": 3, - "java.test.config": { - "vmArgs": [ - "-Djava.util.logging.config.file=src/test/resources/logging.properties" - ] - }, - "sonarlint.connectedMode.project": { - "connectionId": "exasol", - "projectKey": "com.exasol:hamcrest-resultset-matcher" - } + "editor.formatOnSave": true, + "editor.codeActionsOnSave": { + "source.organizeImports": "explicit", + "source.generate.finalModifiers": "explicit", + "source.fixAll": "explicit" + }, + "java.codeGeneration.useBlocks": true, + "java.saveActions.organizeImports": true, + "java.sources.organizeImports.starThreshold": 3, + "java.sources.organizeImports.staticStarThreshold": 3, + "java.test.config": { + "vmArgs": [ + "-Djava.util.logging.config.file=src/test/resources/logging.properties", + "-Dcom.exasol.dockerdb.image=8.29.1" + ] + }, + "sonarlint.connectedMode.project": { + "connectionId": "exasol", + "projectKey": "com.exasol:hamcrest-resultset-matcher" + } } diff --git a/dependencies.md b/dependencies.md index 50c032f..0f8c2bb 100644 --- a/dependencies.md +++ b/dependencies.md @@ -3,9 +3,9 @@ ## Compile Dependencies -| Dependency | License | -| ------------- | ------------------ | -| [Hamcrest][0] | [BSD License 3][1] | +| Dependency | License | +| ------------- | ----------------- | +| [Hamcrest][0] | [BSD-3-Clause][1] | ## Test Dependencies @@ -24,7 +24,7 @@ | Dependency | License | | ------------------------------------------------------- | --------------------------------- | | [SonarQube Scanner for Maven][12] | [GNU LGPL 3][13] | -| [Apache Maven Toolchains Plugin][14] | [Apache License, Version 2.0][15] | +| [Apache Maven Toolchains Plugin][14] | [Apache-2.0][15] | | [Apache Maven Compiler Plugin][16] | [Apache-2.0][15] | | [Apache Maven Enforcer Plugin][17] | [Apache-2.0][15] | | [Maven Flatten Plugin][18] | [Apache Software Licenese][15] | @@ -39,12 +39,12 @@ | [Apache Maven Javadoc Plugin][29] | [Apache-2.0][15] | | [Nexus Staging Maven Plugin][30] | [Eclipse Public License][31] | | [Maven Failsafe Plugin][32] | [Apache-2.0][15] | -| [JaCoCo :: Maven Plugin][33] | [Eclipse Public License 2.0][34] | +| [JaCoCo :: Maven Plugin][33] | [EPL-2.0][34] | | [error-code-crawler-maven-plugin][35] | [MIT License][36] | | [Reproducible Build Maven Plugin][37] | [Apache 2.0][5] | [0]: http://hamcrest.org/JavaHamcrest/ -[1]: http://opensource.org/licenses/BSD-3-Clause +[1]: https://raw.githubusercontent.com/hamcrest/JavaHamcrest/master/LICENSE [2]: https://junit.org/junit5/ [3]: https://www.eclipse.org/legal/epl-v20.html [4]: http://db.apache.org/derby/ diff --git a/doc/changes/changelog.md b/doc/changes/changelog.md index 12cc534..09153bf 100644 --- a/doc/changes/changelog.md +++ b/doc/changes/changelog.md @@ -1,5 +1,6 @@ # Changes +* [1.7.0](changes_1.7.0.md) * [1.6.5](changes_1.6.5.md) * [1.6.4](changes_1.6.4.md) * [1.6.3](changes_1.6.3.md) diff --git a/doc/changes/changes_1.7.0.md b/doc/changes/changes_1.7.0.md new file mode 100644 index 0000000..637e8a9 --- /dev/null +++ b/doc/changes/changes_1.7.0.md @@ -0,0 +1,40 @@ +# Matcher for SQL Result Sets 1.7.0, released 2024-08-26 + +Code name: Add `matchesInAnyOrder()` with type check mode + +## Summary + +This release makes matcher `matchesInAnyOrder()` with argument `TypeMatchMode` public. This allows matching rows in any order, ignoring Java types. Thanks to [@JakubJablonski2-TomTom](https://github.com/JakubJablonski2-TomTom) for contributing this in PR #57. + +## Features + +* #58: Added `matchesInAnyOrder()` with type check mode (contributed by [@JakubJablonski2-TomTom](https://github.com/JakubJablonski2-TomTom) in PR #57) + +## Dependency Updates + +### Compile Dependency Updates + +* Updated `org.hamcrest:hamcrest:2.2` to `3.0` + +### Test Dependency Updates + +* Updated `com.exasol:exasol-testcontainers:7.0.1` to `7.1.1` +* Updated `org.junit.jupiter:junit-jupiter-engine:5.10.2` to `5.11.0` +* Updated `org.junit.jupiter:junit-jupiter-params:5.10.2` to `5.11.0` +* Updated `org.slf4j:slf4j-jdk14:2.0.12` to `2.0.16` +* Updated `org.testcontainers:jdbc:1.19.6` to `1.20.1` +* Updated `org.testcontainers:junit-jupiter:1.19.6` to `1.20.1` + +### Plugin Dependency Updates + +* Updated `com.exasol:error-code-crawler-maven-plugin:2.0.0` to `2.0.3` +* Updated `com.exasol:project-keeper-maven-plugin:4.1.0` to `4.3.3` +* Updated `org.apache.maven.plugins:maven-compiler-plugin:3.12.1` to `3.13.0` +* Updated `org.apache.maven.plugins:maven-deploy-plugin:3.1.1` to `3.1.2` +* Updated `org.apache.maven.plugins:maven-enforcer-plugin:3.4.1` to `3.5.0` +* Updated `org.apache.maven.plugins:maven-gpg-plugin:3.1.0` to `3.2.4` +* Updated `org.apache.maven.plugins:maven-javadoc-plugin:3.6.3` to `3.7.0` +* Updated `org.apache.maven.plugins:maven-toolchains-plugin:3.1.0` to `3.2.0` +* Updated `org.jacoco:jacoco-maven-plugin:0.8.11` to `0.8.12` +* Updated `org.sonarsource.scanner.maven:sonar-maven-plugin:3.10.0.2594` to `4.0.0.4121` +* Updated `org.sonatype.plugins:nexus-staging-maven-plugin:1.6.13` to `1.7.0` diff --git a/pk_generated_parent.pom b/pk_generated_parent.pom index b0b86c0..bef876d 100644 --- a/pk_generated_parent.pom +++ b/pk_generated_parent.pom @@ -3,7 +3,7 @@ 4.0.0 com.exasol hamcrest-resultset-matcher-generated-parent - 1.6.5 + 1.7.0 pom UTF-8 @@ -50,12 +50,12 @@ org.sonarsource.scanner.maven sonar-maven-plugin - 3.10.0.2594 + 4.0.0.4121 org.apache.maven.plugins maven-toolchains-plugin - 3.1.0 + 3.2.0 @@ -74,22 +74,21 @@ org.apache.maven.plugins maven-compiler-plugin - 3.12.1 + 3.13.0 ${java.version} ${java.version} true - - -Xlint:all,-processing - + -Xlint:all + -Werror org.apache.maven.plugins maven-enforcer-plugin - 3.4.1 + 3.5.0 enforce-maven @@ -216,7 +215,7 @@ org.apache.maven.plugins maven-deploy-plugin - 3.1.1 + 3.1.2 true @@ -224,7 +223,7 @@ org.apache.maven.plugins maven-gpg-plugin - 3.1.0 + 3.2.4 sign-artifacts @@ -245,8 +244,8 @@ org.apache.maven.plugins maven-source-plugin + Failed to execute goal org.apache.maven.plugins:maven-source-plugin:3.3.0:jar-no-fork (attach-sources) on project project-keeper-shared-model-classes: Presumably you have configured maven-source-plugn to execute twice times in your build. You have to configure a classifier for at least on of them. + Using goal "jar-no-fork" didn't help. See https://stackoverflow.com/questions/76305897/maven-build-fails-after-upgrading-to-maven-source-plugin-from-3-2-1-to-3-3-0 --> 3.2.1 @@ -260,7 +259,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 3.6.3 + 3.7.0 attach-javadocs @@ -282,7 +281,7 @@ org.sonatype.plugins nexus-staging-maven-plugin - 1.6.13 + 1.7.0 true ossrh @@ -323,7 +322,7 @@ org.jacoco jacoco-maven-plugin - 0.8.11 + 0.8.12 prepare-agent @@ -364,7 +363,7 @@ com.exasol error-code-crawler-maven-plugin - 2.0.0 + 2.0.3 verify diff --git a/pom.xml b/pom.xml index 1e0bf49..607d378 100644 --- a/pom.xml +++ b/pom.xml @@ -2,19 +2,19 @@ 4.0.0 hamcrest-resultset-matcher - 1.6.5 + 1.7.0 Matcher for SQL Result Sets This project provides hamcrest matcher that compares java.sql.ResultSet objects. https://github.com/exasol/hamcrest-resultset-matcher/ - 5.10.2 - 1.19.6 + 5.11.0 + 1.20.1 org.hamcrest hamcrest - 2.2 + 3.0 org.junit.jupiter @@ -38,7 +38,7 @@ com.exasol exasol-testcontainers - 7.0.1 + 7.1.1 test @@ -57,16 +57,26 @@ org.slf4j slf4j-jdk14 - 2.0.12 + 2.0.16 test + + org.apache.maven.plugins + maven-compiler-plugin + + + -Xlint:all,-path + -Werror + + + com.exasol project-keeper-maven-plugin - 4.1.0 + 4.3.3 @@ -101,7 +111,7 @@ hamcrest-resultset-matcher-generated-parent com.exasol - 1.6.5 + 1.7.0 pk_generated_parent.pom diff --git a/release_config.yml b/release_config.yml deleted file mode 100644 index 473c219..0000000 --- a/release_config.yml +++ /dev/null @@ -1,4 +0,0 @@ -release-platforms: - - GitHub - - Maven -language: Java diff --git a/src/main/java/com/exasol/matcher/EnhancedAllOfMatcher.java b/src/main/java/com/exasol/matcher/EnhancedAllOfMatcher.java index 9b77c82..be6a1d5 100644 --- a/src/main/java/com/exasol/matcher/EnhancedAllOfMatcher.java +++ b/src/main/java/com/exasol/matcher/EnhancedAllOfMatcher.java @@ -24,6 +24,7 @@ private EnhancedAllOfMatcher(final Iterable> matchers) { * @return built {@link EnhancedAllOfMatcher} */ @SafeVarargs + @SuppressWarnings("varargs") public static Matcher enhancedAllOf(final Matcher... matchers) { return new EnhancedAllOfMatcher(Arrays.asList(matchers)); } diff --git a/src/test/java/com/exasol/matcher/ResultSetStructureMatcherTest.java b/src/test/java/com/exasol/matcher/ResultSetStructureMatcherTest.java index ec1c41d..4301128 100644 --- a/src/test/java/com/exasol/matcher/ResultSetStructureMatcherTest.java +++ b/src/test/java/com/exasol/matcher/ResultSetStructureMatcherTest.java @@ -180,7 +180,7 @@ void testMatchInAnyOrder() { execute("INSERT INTO IN_ANY_ORDER_MATCHER VALUES ('first', 1), ('second', 2), ('third', 3)"); assertThat(query("SELECT * FROM IN_ANY_ORDER_MATCHER"), table() // .row("second", 2) // - .row("third", 3) + .row("third", 3) // .row("first", 1).matchesInAnyOrder()); } @@ -190,7 +190,7 @@ void testMatchInAnyOrderWithNestedMatcher() { execute("INSERT INTO IN_ANY_ORDER_MATCHER_NESTED VALUES ('first', 1), ('second', 2), ('third', 3)"); assertThat(query("SELECT * FROM IN_ANY_ORDER_MATCHER_NESTED"), table() // .row(containsString("con"), 2) // - .row("third", greaterThan(2)) + .row("third", greaterThan(2)) // .row("first", 1).matchesInAnyOrder()); } @@ -199,7 +199,7 @@ void testMatchInAnyOrderFailsBecauseTooManyRows() { execute("CREATE TABLE IN_ANY_ORDER_MATCHER_TOO_MANY_ROWS(COL1 VARCHAR(10), COL2 INTEGER)"); execute("INSERT INTO IN_ANY_ORDER_MATCHER_TOO_MANY_ROWS VALUES ('first', 1), ('second', 2), ('third', 3)"); assertQueryResultNotMatched("SELECT * FROM IN_ANY_ORDER_MATCHER_TOO_MANY_ROWS", // - table().row("second", 2).row("third", 3).matchesInAnyOrder(), + table().row("second", 2).row("third", 3).matchesInAnyOrder(), // "ResultSet with <2> rows and <2> columns", // "ResultSet with <3> rows and <2> columns" + " where row <1> was the first that did not match any expected row"); @@ -226,7 +226,6 @@ void testMatchInAnyOrderFailsBecauseOfUnmatchedRow() { + " where row <3> was the first that did not match any expected row"); } - @Test void testMatchInAnyOrderFailsBecauseOfAmbiguousMatch() { execute("CREATE TABLE IN_ANY_ORDER_MATCHER_AMBIGUOUS(COL1 VARCHAR(10))"); @@ -248,4 +247,14 @@ void testMatchInAnyOrderFailsBecauseOfTypeMismatch() { "ResultSet with <3> rows and <1> columns (CHAR(10))", // "ResultSet with <3> rows and <1> columns (VARCHAR)"); } + + @Test + void testMatchInAnyOrderWithNestedMatcherWithTypeCheckMode() { + execute("CREATE TABLE IN_ANY_ORDER_MATCHER_WITH_TYPE_CHECK_MODE(COL1 VARCHAR(10), COL2 INTEGER)"); + execute("INSERT INTO IN_ANY_ORDER_MATCHER_WITH_TYPE_CHECK_MODE VALUES ('first', 1), ('second', 2), ('third', 3)"); + assertThat(query("SELECT * FROM IN_ANY_ORDER_MATCHER_WITH_TYPE_CHECK_MODE order by col2"), table() // + .row("second", (long) 2) // + .row("third", (byte) 3) // + .row("first", 1).matchesInAnyOrder(TypeMatchMode.NO_JAVA_TYPE_CHECK)); + } }