From a258586567eaf8916619fa7f9dd2a5a271738b81 Mon Sep 17 00:00:00 2001 From: Maxim Grischenko Date: Mon, 29 Jan 2024 19:06:11 +0100 Subject: [PATCH 01/28] release workflow --- .github/workflows/pull-request.yml | 44 ++++++++++++++++++++++++ .github/workflows/pull-requests.yml | 22 ------------ .github/workflows/push-develop.yml | 53 +++++++++++++++++++++++++++++ .github/workflows/release.yml | 37 ++++++++++++++++++++ .travis/codecov_bash.sh | 11 ------ .travis/deploy.sh | 8 ----- pom.xml | 24 ++++--------- scripts/mvn_deploy.sh | 8 +++++ {.travis => scripts}/settings.xml | 0 9 files changed, 148 insertions(+), 59 deletions(-) create mode 100644 .github/workflows/pull-request.yml delete mode 100644 .github/workflows/pull-requests.yml create mode 100644 .github/workflows/push-develop.yml create mode 100644 .github/workflows/release.yml delete mode 100644 .travis/codecov_bash.sh delete mode 100644 .travis/deploy.sh create mode 100755 scripts/mvn_deploy.sh rename {.travis => scripts}/settings.xml (100%) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml new file mode 100644 index 000000000..988ae1ee7 --- /dev/null +++ b/.github/workflows/pull-request.yml @@ -0,0 +1,44 @@ +name: Actions on pull requests +on: + pull_request: + branches: + - develop + - master + +jobs: + pull-request-job: + runs-on: ubuntu-latest + steps: + - name: Step 1 - Checkout repository code + uses: actions/checkout@v4 + + - name: Step 2 - Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' + cache: 'maven' + + - name: Step 3 - Cache Docker images. + uses: ScribeMD/docker-cache@0.3.7 + with: + key: docker-${{ runner.os }} + + - name: Step 4 - Build & Test + run: mvn clean verify -ntp + + - name: Step 5 - Upload coverage unittests reports to Codecov + uses: codecov/codecov-action@v3 + with: + token: ${{ secrets.CODECOV_TOKEN }} + gcov_ignore: '!*datasafe-business*' + flags: unittests + verbose: true + + - name: Step 6 - Upload coverage e2e tests reports to Codecov + uses: codecov/codecov-action@v3 + with: + token: ${{ secrets.CODECOV_TOKEN }} + gcov_include: '*datasafe-business*' + flags: e2e_tests + verbose: true \ No newline at end of file diff --git a/.github/workflows/pull-requests.yml b/.github/workflows/pull-requests.yml deleted file mode 100644 index 0891234c0..000000000 --- a/.github/workflows/pull-requests.yml +++ /dev/null @@ -1,22 +0,0 @@ -# Builds Pull-requests to key branches -name: Pull request CI - -on: - pull_request: - branches: - - develop - - master - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Set up JDK 17 - uses: actions/setup-java@v3 - with: - java-version: 17 - distribution: 'adopt' - - - name: Build project and run default test suite - run: mvn clean verify -ntp diff --git a/.github/workflows/push-develop.yml b/.github/workflows/push-develop.yml new file mode 100644 index 000000000..14dc23fc3 --- /dev/null +++ b/.github/workflows/push-develop.yml @@ -0,0 +1,53 @@ +name: Develop branch build +on: + push: + branches: + - develop + +jobs: + develop-build-job: + runs-on: ubuntu-latest + steps: + - name: Step 1 - Checkout repository code + uses: actions/checkout@v4 + + - name: Step 2 - Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' + cache: 'maven' + + - name: Step 3 - Cache Docker images. + uses: ScribeMD/docker-cache@0.3.7 + with: + key: docker-${{ runner.os }} + + - name: Step 4 - Build & Test + run: mvn clean verify -ntp + + - name: Step 5 - Deploy Snapshot + run: ./scripts/mvn_deploy.sh + env: + SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} + SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} + GPG_EXECUTABLE: gpg + GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} + GPG_SECRET_KEY: ${{ secrets.GPG_SECRET_KEY }} + GPG_OWNERTRUST: ${{ secrets.GPG_OWNERTRUST }} + + - name: Step 6 - Upload coverage unittests reports to Codecov + uses: codecov/codecov-action@v3 + with: + token: ${{ secrets.CODECOV_TOKEN }} + gcov_ignore: '!*datasafe-business*' + flags: unittests + verbose: true + + - name: Step 7 - Upload coverage e2e tests reports to Codecov + uses: codecov/codecov-action@v3 + with: + token: ${{ secrets.CODECOV_TOKEN }} + gcov_include: '*datasafe-business*' + flags: e2e_tests + verbose: true \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000..2ecc29728 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,37 @@ +name: Release to Maven Central +on: + push: + tags: + - v* + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Step 1 - Checkout repository code + uses: actions/checkout@v4 + + - name: Step 2 - Setup JDK + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' + cache: 'maven' + + - name: Step 3 - Cache Docker images. + uses: ScribeMD/docker-cache@0.3.7 + with: + key: docker-${{ runner.os }} + + - name: Step 4 - Maven deploy release + run: ./scripts/mvn_deploy.sh + env: + SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} + SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} + GPG_EXECUTABLE: gpg + GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} + GPG_SECRET_KEY: ${{ secrets.GPG_SECRET_KEY }} + GPG_OWNERTRUST: ${{ secrets.GPG_OWNERTRUST }} + +# - name: Step 4 - Push JavaDoc to GitHub Pages +# run: ./scripts/push-javadoc-to-gh-pages.sh diff --git a/.travis/codecov_bash.sh b/.travis/codecov_bash.sh deleted file mode 100644 index a11db3d6a..000000000 --- a/.travis/codecov_bash.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env bash - -BRANCH="$TRAVIS_BRANCH" -if [[ -n "$TRAVIS_PULL_REQUEST_BRANCH" ]]; then - BRANCH="$TRAVIS_PULL_REQUEST_BRANCH" - echo "Pull request branch identified: $TRAVIS_PULL_REQUEST_BRANCH" -fi - -echo "Sending test results to codecov using $BRANCH" -bash <(curl -s https://codecov.io/bash) -f '!*datasafe-business*' -F unittests -B "$BRANCH"; -bash <(curl -s https://codecov.io/bash) -s '*datasafe-business*' -F e2e_tests -B "$BRANCH"; \ No newline at end of file diff --git a/.travis/deploy.sh b/.travis/deploy.sh deleted file mode 100644 index 3f1052e59..000000000 --- a/.travis/deploy.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash - -echo "$GPG_SECRET_KEY" | base64 --decode | "$GPG_EXECUTABLE" --import -echo "$GPG_OWNERTRUST" | base64 --decode | "$GPG_EXECUTABLE" --import-ownertrust - -set -e - -mvn --settings .travis/settings.xml package gpg:sign deploy -Prelease -DskipTests -B -U; diff --git a/pom.xml b/pom.xml index 0eeb0d03d..34c85459e 100644 --- a/pom.xml +++ b/pom.xml @@ -74,15 +74,14 @@ src/main/java src/test/java - - ${basedir}/../../target/jacoco.exec - ${basedir}/../target/jacoco-e2e.exec + ${maven.multiModuleProjectDirectory}/target/jacoco.exec + ${maven.multiModuleProjectDirectory}/target/jacoco-e2e.exec 19.2.0 3.11.0 17 17 - 3.6.0 + 3.6.1 1.18.30 2.8.9 2.46.1 @@ -96,7 +95,7 @@ UTF-8 false 1.18.3 - 0.8.10 + 0.8.11 2.5 2.0.7 9.44.0.Final @@ -387,6 +386,7 @@ + org.apache.maven.plugins maven-dependency-plugin ${maven.dependency.plugin.version} @@ -519,6 +519,7 @@ org.apache.maven.plugins maven-compiler-plugin + ${maven.compiler.plugin.version} @@ -586,8 +587,6 @@ sonatype https://oss.sonatype.org/ true - true - 30 @@ -608,11 +607,6 @@ maven-gpg-plugin ${maven-gpg-plugin.version} - opensource@adorsys.de - - --pinentry-mode - loopback - @@ -621,12 +615,6 @@ sign - - - --pinentry-mode - loopback - - diff --git a/scripts/mvn_deploy.sh b/scripts/mvn_deploy.sh new file mode 100755 index 000000000..dbf870f1f --- /dev/null +++ b/scripts/mvn_deploy.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +set -e + +echo "$GPG_SECRET_KEY" | base64 --decode | $GPG_EXECUTABLE --import --no-tty --batch --yes || true +echo "$GPG_OWNERTRUST" | base64 --decode | $GPG_EXECUTABLE --import-ownertrust --no-tty --batch --yes || true + +mvn clean deploy -ntp --settings scripts/settings.xml gpg:sign -Prelease -DskipTests -U || exit 1 \ No newline at end of file diff --git a/.travis/settings.xml b/scripts/settings.xml similarity index 100% rename from .travis/settings.xml rename to scripts/settings.xml From 40e3b8100f8002f61af8288586cc3228c207dba8 Mon Sep 17 00:00:00 2001 From: Maxim Grischenko Date: Mon, 29 Jan 2024 22:40:52 +0100 Subject: [PATCH 02/28] Start next iteration with 2.0.1-SNAPSHOT --- datasafe-business/pom.xml | 2 +- datasafe-cli/pom.xml | 2 +- datasafe-directory/datasafe-directory-api/pom.xml | 2 +- datasafe-directory/datasafe-directory-impl/pom.xml | 2 +- datasafe-directory/pom.xml | 2 +- datasafe-encryption/datasafe-encryption-api/pom.xml | 2 +- datasafe-encryption/datasafe-encryption-impl/pom.xml | 2 +- datasafe-encryption/pom.xml | 2 +- datasafe-examples/datasafe-examples-business/pom.xml | 2 +- datasafe-examples/datasafe-examples-customize-dagger/pom.xml | 2 +- datasafe-examples/datasafe-examples-multidfs/pom.xml | 2 +- datasafe-examples/datasafe-examples-versioned-s3/pom.xml | 2 +- datasafe-examples/pom.xml | 2 +- datasafe-inbox/datasafe-inbox-api/pom.xml | 2 +- datasafe-inbox/datasafe-inbox-impl/pom.xml | 2 +- datasafe-inbox/pom.xml | 2 +- .../datasafe-business-tests-random-actions/pom.xml | 2 +- datasafe-long-run-tests/pom.xml | 2 +- datasafe-metainfo/datasafe-metainfo-version-api/pom.xml | 2 +- datasafe-metainfo/datasafe-metainfo-version-impl/pom.xml | 2 +- datasafe-metainfo/pom.xml | 2 +- datasafe-privatestore/datasafe-privatestore-api/pom.xml | 2 +- datasafe-privatestore/datasafe-privatestore-impl/pom.xml | 2 +- datasafe-privatestore/pom.xml | 2 +- datasafe-rest-impl/pom.xml | 3 +-- datasafe-runtime-delegate/pom.xml | 2 +- datasafe-simple-adapter/datasafe-simple-adapter-api/pom.xml | 2 +- datasafe-simple-adapter/datasafe-simple-adapter-impl/pom.xml | 2 +- datasafe-simple-adapter/datasafe-simple-adapter-spring/pom.xml | 2 +- datasafe-simple-adapter/pom.xml | 2 +- datasafe-storage/datasafe-storage-api/pom.xml | 2 +- datasafe-storage/datasafe-storage-impl-db/pom.xml | 2 +- datasafe-storage/datasafe-storage-impl-fs/pom.xml | 2 +- datasafe-storage/datasafe-storage-impl-s3/pom.xml | 2 +- datasafe-storage/pom.xml | 2 +- datasafe-test-storages/pom.xml | 2 +- datasafe-types-api/pom.xml | 2 +- last-module-codecoverage-check/pom.xml | 2 +- pom.xml | 2 +- 39 files changed, 39 insertions(+), 40 deletions(-) diff --git a/datasafe-business/pom.xml b/datasafe-business/pom.xml index 4c814b1ec..675cd26a4 100644 --- a/datasafe-business/pom.xml +++ b/datasafe-business/pom.xml @@ -5,7 +5,7 @@ datasafe de.adorsys - 2.0.2 + 2.0.1-SNAPSHOT 4.0.0 diff --git a/datasafe-cli/pom.xml b/datasafe-cli/pom.xml index a185dc1ad..1475c1449 100644 --- a/datasafe-cli/pom.xml +++ b/datasafe-cli/pom.xml @@ -5,7 +5,7 @@ de.adorsys datasafe - 2.0.2 + 2.0.1-SNAPSHOT datasafe-cli diff --git a/datasafe-directory/datasafe-directory-api/pom.xml b/datasafe-directory/datasafe-directory-api/pom.xml index 64078b587..e24d8ed7c 100644 --- a/datasafe-directory/datasafe-directory-api/pom.xml +++ b/datasafe-directory/datasafe-directory-api/pom.xml @@ -3,7 +3,7 @@ de.adorsys datasafe-directory - 2.0.2 + 2.0.1-SNAPSHOT datasafe-directory-api diff --git a/datasafe-directory/datasafe-directory-impl/pom.xml b/datasafe-directory/datasafe-directory-impl/pom.xml index 8d01a516a..072b6e852 100644 --- a/datasafe-directory/datasafe-directory-impl/pom.xml +++ b/datasafe-directory/datasafe-directory-impl/pom.xml @@ -3,7 +3,7 @@ de.adorsys datasafe-directory - 2.0.2 + 2.0.1-SNAPSHOT datasafe-directory-impl diff --git a/datasafe-directory/pom.xml b/datasafe-directory/pom.xml index 7bbf7574f..0f8669f57 100644 --- a/datasafe-directory/pom.xml +++ b/datasafe-directory/pom.xml @@ -5,7 +5,7 @@ datasafe de.adorsys - 2.0.2 + 2.0.1-SNAPSHOT 4.0.0 diff --git a/datasafe-encryption/datasafe-encryption-api/pom.xml b/datasafe-encryption/datasafe-encryption-api/pom.xml index 4e453c981..6bc3dc850 100644 --- a/datasafe-encryption/datasafe-encryption-api/pom.xml +++ b/datasafe-encryption/datasafe-encryption-api/pom.xml @@ -5,7 +5,7 @@ de.adorsys datasafe-encryption - 2.0.2 + 2.0.1-SNAPSHOT datasafe-encryption-api diff --git a/datasafe-encryption/datasafe-encryption-impl/pom.xml b/datasafe-encryption/datasafe-encryption-impl/pom.xml index 7109cd9b4..f93d60838 100644 --- a/datasafe-encryption/datasafe-encryption-impl/pom.xml +++ b/datasafe-encryption/datasafe-encryption-impl/pom.xml @@ -5,7 +5,7 @@ de.adorsys datasafe-encryption - 2.0.2 + 2.0.1-SNAPSHOT datasafe-encryption-impl diff --git a/datasafe-encryption/pom.xml b/datasafe-encryption/pom.xml index e8597d40f..80172392b 100644 --- a/datasafe-encryption/pom.xml +++ b/datasafe-encryption/pom.xml @@ -5,7 +5,7 @@ datasafe de.adorsys - 2.0.2 + 2.0.1-SNAPSHOT 4.0.0 diff --git a/datasafe-examples/datasafe-examples-business/pom.xml b/datasafe-examples/datasafe-examples-business/pom.xml index 6d9e1e396..bad2ba76c 100644 --- a/datasafe-examples/datasafe-examples-business/pom.xml +++ b/datasafe-examples/datasafe-examples-business/pom.xml @@ -5,7 +5,7 @@ de.adorsys datasafe-examples - 2.0.2 + 2.0.1-SNAPSHOT datasafe-examples-business diff --git a/datasafe-examples/datasafe-examples-customize-dagger/pom.xml b/datasafe-examples/datasafe-examples-customize-dagger/pom.xml index bd2050378..0a86d584b 100644 --- a/datasafe-examples/datasafe-examples-customize-dagger/pom.xml +++ b/datasafe-examples/datasafe-examples-customize-dagger/pom.xml @@ -5,7 +5,7 @@ de.adorsys datasafe-examples - 2.0.2 + 2.0.1-SNAPSHOT datasafe-examples-customize-dagger diff --git a/datasafe-examples/datasafe-examples-multidfs/pom.xml b/datasafe-examples/datasafe-examples-multidfs/pom.xml index 1693f8ab1..7a9ef6e4c 100644 --- a/datasafe-examples/datasafe-examples-multidfs/pom.xml +++ b/datasafe-examples/datasafe-examples-multidfs/pom.xml @@ -5,7 +5,7 @@ de.adorsys datasafe-examples - 2.0.2 + 2.0.1-SNAPSHOT datasafe-examples-multidfs diff --git a/datasafe-examples/datasafe-examples-versioned-s3/pom.xml b/datasafe-examples/datasafe-examples-versioned-s3/pom.xml index fe1bd76db..cf14cf1da 100644 --- a/datasafe-examples/datasafe-examples-versioned-s3/pom.xml +++ b/datasafe-examples/datasafe-examples-versioned-s3/pom.xml @@ -5,7 +5,7 @@ de.adorsys datasafe-examples - 2.0.2 + 2.0.1-SNAPSHOT datasafe-examples-versioned-s3 diff --git a/datasafe-examples/pom.xml b/datasafe-examples/pom.xml index 98d612712..2873df125 100644 --- a/datasafe-examples/pom.xml +++ b/datasafe-examples/pom.xml @@ -5,7 +5,7 @@ datasafe de.adorsys - 2.0.2 + 2.0.1-SNAPSHOT 4.0.0 diff --git a/datasafe-inbox/datasafe-inbox-api/pom.xml b/datasafe-inbox/datasafe-inbox-api/pom.xml index bd7523ee2..84a7fa66c 100644 --- a/datasafe-inbox/datasafe-inbox-api/pom.xml +++ b/datasafe-inbox/datasafe-inbox-api/pom.xml @@ -5,7 +5,7 @@ de.adorsys datasafe-inbox - 2.0.2 + 2.0.1-SNAPSHOT datasafe-inbox-api diff --git a/datasafe-inbox/datasafe-inbox-impl/pom.xml b/datasafe-inbox/datasafe-inbox-impl/pom.xml index 19feb8c4d..f1b68c166 100644 --- a/datasafe-inbox/datasafe-inbox-impl/pom.xml +++ b/datasafe-inbox/datasafe-inbox-impl/pom.xml @@ -5,7 +5,7 @@ de.adorsys datasafe-inbox - 2.0.2 + 2.0.1-SNAPSHOT datasafe-inbox-impl diff --git a/datasafe-inbox/pom.xml b/datasafe-inbox/pom.xml index 84bdb7ab9..093fcb2c6 100644 --- a/datasafe-inbox/pom.xml +++ b/datasafe-inbox/pom.xml @@ -5,7 +5,7 @@ datasafe de.adorsys - 2.0.2 + 2.0.1-SNAPSHOT 4.0.0 diff --git a/datasafe-long-run-tests/datasafe-business-tests-random-actions/pom.xml b/datasafe-long-run-tests/datasafe-business-tests-random-actions/pom.xml index 9fe35e5b0..cd4ba8107 100644 --- a/datasafe-long-run-tests/datasafe-business-tests-random-actions/pom.xml +++ b/datasafe-long-run-tests/datasafe-business-tests-random-actions/pom.xml @@ -5,7 +5,7 @@ datasafe-long-run-tests de.adorsys - 2.0.2 + 2.0.1-SNAPSHOT 4.0.0 diff --git a/datasafe-long-run-tests/pom.xml b/datasafe-long-run-tests/pom.xml index 71593ffc8..a550f9048 100644 --- a/datasafe-long-run-tests/pom.xml +++ b/datasafe-long-run-tests/pom.xml @@ -5,7 +5,7 @@ datasafe de.adorsys - 2.0.2 + 2.0.1-SNAPSHOT 4.0.0 diff --git a/datasafe-metainfo/datasafe-metainfo-version-api/pom.xml b/datasafe-metainfo/datasafe-metainfo-version-api/pom.xml index e0bc9924f..98e102c38 100644 --- a/datasafe-metainfo/datasafe-metainfo-version-api/pom.xml +++ b/datasafe-metainfo/datasafe-metainfo-version-api/pom.xml @@ -5,7 +5,7 @@ de.adorsys datasafe-metainfo - 2.0.2 + 2.0.1-SNAPSHOT datasafe-metainfo-version-api diff --git a/datasafe-metainfo/datasafe-metainfo-version-impl/pom.xml b/datasafe-metainfo/datasafe-metainfo-version-impl/pom.xml index d07acfb1f..bafb3174f 100644 --- a/datasafe-metainfo/datasafe-metainfo-version-impl/pom.xml +++ b/datasafe-metainfo/datasafe-metainfo-version-impl/pom.xml @@ -5,7 +5,7 @@ de.adorsys datasafe-metainfo - 2.0.2 + 2.0.1-SNAPSHOT datasafe-metainfo-version-impl diff --git a/datasafe-metainfo/pom.xml b/datasafe-metainfo/pom.xml index 9811a2401..17ed12b50 100644 --- a/datasafe-metainfo/pom.xml +++ b/datasafe-metainfo/pom.xml @@ -5,7 +5,7 @@ datasafe de.adorsys - 2.0.2 + 2.0.1-SNAPSHOT 4.0.0 diff --git a/datasafe-privatestore/datasafe-privatestore-api/pom.xml b/datasafe-privatestore/datasafe-privatestore-api/pom.xml index 662e128c0..4ca010e4a 100644 --- a/datasafe-privatestore/datasafe-privatestore-api/pom.xml +++ b/datasafe-privatestore/datasafe-privatestore-api/pom.xml @@ -5,7 +5,7 @@ datasafe-privatestore de.adorsys - 2.0.2 + 2.0.1-SNAPSHOT 4.0.0 diff --git a/datasafe-privatestore/datasafe-privatestore-impl/pom.xml b/datasafe-privatestore/datasafe-privatestore-impl/pom.xml index 1ba432ee7..cb0a4d431 100644 --- a/datasafe-privatestore/datasafe-privatestore-impl/pom.xml +++ b/datasafe-privatestore/datasafe-privatestore-impl/pom.xml @@ -5,7 +5,7 @@ datasafe-privatestore de.adorsys - 2.0.2 + 2.0.1-SNAPSHOT 4.0.0 diff --git a/datasafe-privatestore/pom.xml b/datasafe-privatestore/pom.xml index 56ac365c5..50494d46c 100644 --- a/datasafe-privatestore/pom.xml +++ b/datasafe-privatestore/pom.xml @@ -5,7 +5,7 @@ datasafe de.adorsys - 2.0.2 + 2.0.1-SNAPSHOT 4.0.0 diff --git a/datasafe-rest-impl/pom.xml b/datasafe-rest-impl/pom.xml index fe3dc62b6..c1f246611 100644 --- a/datasafe-rest-impl/pom.xml +++ b/datasafe-rest-impl/pom.xml @@ -5,11 +5,10 @@ datasafe de.adorsys - 2.0.2 + 2.0.1-SNAPSHOT datasafe-rest-impl - 2.0.2 datasafe-rest-impl Spring Boot DataSafe Application diff --git a/datasafe-runtime-delegate/pom.xml b/datasafe-runtime-delegate/pom.xml index f1e6e5d9c..37aace1bd 100644 --- a/datasafe-runtime-delegate/pom.xml +++ b/datasafe-runtime-delegate/pom.xml @@ -5,7 +5,7 @@ de.adorsys datasafe - 2.0.2 + 2.0.1-SNAPSHOT datasafe-runtime-delegate diff --git a/datasafe-simple-adapter/datasafe-simple-adapter-api/pom.xml b/datasafe-simple-adapter/datasafe-simple-adapter-api/pom.xml index af5ce5a90..12b256919 100644 --- a/datasafe-simple-adapter/datasafe-simple-adapter-api/pom.xml +++ b/datasafe-simple-adapter/datasafe-simple-adapter-api/pom.xml @@ -5,7 +5,7 @@ datasafe-simple-adapter de.adorsys - 2.0.2 + 2.0.1-SNAPSHOT 4.0.0 diff --git a/datasafe-simple-adapter/datasafe-simple-adapter-impl/pom.xml b/datasafe-simple-adapter/datasafe-simple-adapter-impl/pom.xml index d9cf19796..9b19be43f 100644 --- a/datasafe-simple-adapter/datasafe-simple-adapter-impl/pom.xml +++ b/datasafe-simple-adapter/datasafe-simple-adapter-impl/pom.xml @@ -5,7 +5,7 @@ datasafe-simple-adapter de.adorsys - 2.0.2 + 2.0.1-SNAPSHOT 4.0.0 diff --git a/datasafe-simple-adapter/datasafe-simple-adapter-spring/pom.xml b/datasafe-simple-adapter/datasafe-simple-adapter-spring/pom.xml index 4e1543476..2749d36fd 100644 --- a/datasafe-simple-adapter/datasafe-simple-adapter-spring/pom.xml +++ b/datasafe-simple-adapter/datasafe-simple-adapter-spring/pom.xml @@ -5,7 +5,7 @@ datasafe-simple-adapter de.adorsys - 2.0.2 + 2.0.1-SNAPSHOT 4.0.0 diff --git a/datasafe-simple-adapter/pom.xml b/datasafe-simple-adapter/pom.xml index 1db1b4c3c..4c8fe5f8f 100644 --- a/datasafe-simple-adapter/pom.xml +++ b/datasafe-simple-adapter/pom.xml @@ -5,7 +5,7 @@ datasafe de.adorsys - 2.0.2 + 2.0.1-SNAPSHOT 4.0.0 diff --git a/datasafe-storage/datasafe-storage-api/pom.xml b/datasafe-storage/datasafe-storage-api/pom.xml index 640b8bb51..fa57d90aa 100644 --- a/datasafe-storage/datasafe-storage-api/pom.xml +++ b/datasafe-storage/datasafe-storage-api/pom.xml @@ -5,7 +5,7 @@ de.adorsys datasafe-storage - 2.0.2 + 2.0.1-SNAPSHOT datasafe-storage-api diff --git a/datasafe-storage/datasafe-storage-impl-db/pom.xml b/datasafe-storage/datasafe-storage-impl-db/pom.xml index b54ca648e..aed79cfa5 100644 --- a/datasafe-storage/datasafe-storage-impl-db/pom.xml +++ b/datasafe-storage/datasafe-storage-impl-db/pom.xml @@ -5,7 +5,7 @@ datasafe-storage de.adorsys - 2.0.2 + 2.0.1-SNAPSHOT 4.0.0 diff --git a/datasafe-storage/datasafe-storage-impl-fs/pom.xml b/datasafe-storage/datasafe-storage-impl-fs/pom.xml index 5c38d1b0a..386f41627 100644 --- a/datasafe-storage/datasafe-storage-impl-fs/pom.xml +++ b/datasafe-storage/datasafe-storage-impl-fs/pom.xml @@ -5,7 +5,7 @@ datasafe-storage de.adorsys - 2.0.2 + 2.0.1-SNAPSHOT 4.0.0 diff --git a/datasafe-storage/datasafe-storage-impl-s3/pom.xml b/datasafe-storage/datasafe-storage-impl-s3/pom.xml index e1ee5a8c4..40157d81b 100644 --- a/datasafe-storage/datasafe-storage-impl-s3/pom.xml +++ b/datasafe-storage/datasafe-storage-impl-s3/pom.xml @@ -5,7 +5,7 @@ datasafe-storage de.adorsys - 2.0.2 + 2.0.1-SNAPSHOT 4.0.0 diff --git a/datasafe-storage/pom.xml b/datasafe-storage/pom.xml index 70881ff1e..1158c9bb8 100644 --- a/datasafe-storage/pom.xml +++ b/datasafe-storage/pom.xml @@ -5,7 +5,7 @@ datasafe de.adorsys - 2.0.2 + 2.0.1-SNAPSHOT 4.0.0 diff --git a/datasafe-test-storages/pom.xml b/datasafe-test-storages/pom.xml index e1fa0d67b..ecaddb7dd 100644 --- a/datasafe-test-storages/pom.xml +++ b/datasafe-test-storages/pom.xml @@ -5,7 +5,7 @@ datasafe de.adorsys - 2.0.2 + 2.0.1-SNAPSHOT 4.0.0 diff --git a/datasafe-types-api/pom.xml b/datasafe-types-api/pom.xml index 97ceaa5d9..52c18bd1a 100644 --- a/datasafe-types-api/pom.xml +++ b/datasafe-types-api/pom.xml @@ -5,7 +5,7 @@ de.adorsys datasafe - 2.0.2 + 2.0.1-SNAPSHOT datasafe-types-api diff --git a/last-module-codecoverage-check/pom.xml b/last-module-codecoverage-check/pom.xml index fd80ffd30..4f455a30e 100644 --- a/last-module-codecoverage-check/pom.xml +++ b/last-module-codecoverage-check/pom.xml @@ -5,7 +5,7 @@ datasafe de.adorsys - 2.0.2 + 2.0.1-SNAPSHOT 4.0.0 diff --git a/pom.xml b/pom.xml index 34c85459e..b355e6f67 100644 --- a/pom.xml +++ b/pom.xml @@ -25,7 +25,7 @@ de.adorsys datasafe - 2.0.2 + 2.0.1-SNAPSHOT datasafe Datasafe https://github.com/adorsys/datasafe From 790a35069c908e9f9d9b299b81bf599cda1519b0 Mon Sep 17 00:00:00 2001 From: Maxim Grischenko Date: Tue, 30 Jan 2024 08:55:31 +0100 Subject: [PATCH 03/28] bump aws-java-sdk-s3 and aws-java-sdk-core to 1.12.646 --- pom.xml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/pom.xml b/pom.xml index b355e6f67..694c0e33f 100644 --- a/pom.xml +++ b/pom.xml @@ -73,10 +73,6 @@ none src/main/java src/test/java - - ${maven.multiModuleProjectDirectory}/target/jacoco.exec - ${maven.multiModuleProjectDirectory}/target/jacoco-e2e.exec - 19.2.0 3.11.0 17 @@ -102,7 +98,7 @@ 1.18.20.0 3.0.0 1.0.2 - 1.12.402 + 1.12.646 3.0.0 1 1.9.0 From ac01c9238c87a3ab65478a056d0ee97db072f98a Mon Sep 17 00:00:00 2001 From: Maxim Grischenko Date: Tue, 30 Jan 2024 16:04:27 +0100 Subject: [PATCH 04/28] Prepare release 2.0.1 --- datasafe-business/pom.xml | 2 +- datasafe-cli/pom.xml | 2 +- datasafe-directory/datasafe-directory-api/pom.xml | 2 +- datasafe-directory/datasafe-directory-impl/pom.xml | 2 +- datasafe-directory/pom.xml | 2 +- datasafe-encryption/datasafe-encryption-api/pom.xml | 2 +- datasafe-encryption/datasafe-encryption-impl/pom.xml | 2 +- datasafe-encryption/pom.xml | 2 +- datasafe-examples/datasafe-examples-business/pom.xml | 2 +- datasafe-examples/datasafe-examples-customize-dagger/pom.xml | 2 +- datasafe-examples/datasafe-examples-multidfs/pom.xml | 2 +- datasafe-examples/datasafe-examples-versioned-s3/pom.xml | 2 +- datasafe-examples/pom.xml | 2 +- datasafe-inbox/datasafe-inbox-api/pom.xml | 2 +- datasafe-inbox/datasafe-inbox-impl/pom.xml | 2 +- datasafe-inbox/pom.xml | 2 +- .../datasafe-business-tests-random-actions/pom.xml | 2 +- datasafe-long-run-tests/pom.xml | 2 +- datasafe-metainfo/datasafe-metainfo-version-api/pom.xml | 2 +- datasafe-metainfo/datasafe-metainfo-version-impl/pom.xml | 2 +- datasafe-metainfo/pom.xml | 2 +- datasafe-privatestore/datasafe-privatestore-api/pom.xml | 2 +- datasafe-privatestore/datasafe-privatestore-impl/pom.xml | 2 +- datasafe-privatestore/pom.xml | 2 +- datasafe-rest-impl/pom.xml | 2 +- datasafe-runtime-delegate/pom.xml | 2 +- datasafe-simple-adapter/datasafe-simple-adapter-api/pom.xml | 2 +- datasafe-simple-adapter/datasafe-simple-adapter-impl/pom.xml | 2 +- datasafe-simple-adapter/datasafe-simple-adapter-spring/pom.xml | 2 +- datasafe-simple-adapter/pom.xml | 2 +- datasafe-storage/datasafe-storage-api/pom.xml | 2 +- datasafe-storage/datasafe-storage-impl-db/pom.xml | 2 +- datasafe-storage/datasafe-storage-impl-fs/pom.xml | 2 +- datasafe-storage/datasafe-storage-impl-s3/pom.xml | 2 +- datasafe-storage/pom.xml | 2 +- datasafe-test-storages/pom.xml | 2 +- datasafe-types-api/pom.xml | 2 +- last-module-codecoverage-check/pom.xml | 2 +- pom.xml | 2 +- 39 files changed, 39 insertions(+), 39 deletions(-) diff --git a/datasafe-business/pom.xml b/datasafe-business/pom.xml index 675cd26a4..53a4d3248 100644 --- a/datasafe-business/pom.xml +++ b/datasafe-business/pom.xml @@ -5,7 +5,7 @@ datasafe de.adorsys - 2.0.1-SNAPSHOT + 2.0.1 4.0.0 diff --git a/datasafe-cli/pom.xml b/datasafe-cli/pom.xml index 1475c1449..bdb4c22c2 100644 --- a/datasafe-cli/pom.xml +++ b/datasafe-cli/pom.xml @@ -5,7 +5,7 @@ de.adorsys datasafe - 2.0.1-SNAPSHOT + 2.0.1 datasafe-cli diff --git a/datasafe-directory/datasafe-directory-api/pom.xml b/datasafe-directory/datasafe-directory-api/pom.xml index e24d8ed7c..1729b407f 100644 --- a/datasafe-directory/datasafe-directory-api/pom.xml +++ b/datasafe-directory/datasafe-directory-api/pom.xml @@ -3,7 +3,7 @@ de.adorsys datasafe-directory - 2.0.1-SNAPSHOT + 2.0.1 datasafe-directory-api diff --git a/datasafe-directory/datasafe-directory-impl/pom.xml b/datasafe-directory/datasafe-directory-impl/pom.xml index 072b6e852..b237067df 100644 --- a/datasafe-directory/datasafe-directory-impl/pom.xml +++ b/datasafe-directory/datasafe-directory-impl/pom.xml @@ -3,7 +3,7 @@ de.adorsys datasafe-directory - 2.0.1-SNAPSHOT + 2.0.1 datasafe-directory-impl diff --git a/datasafe-directory/pom.xml b/datasafe-directory/pom.xml index 0f8669f57..0e574a805 100644 --- a/datasafe-directory/pom.xml +++ b/datasafe-directory/pom.xml @@ -5,7 +5,7 @@ datasafe de.adorsys - 2.0.1-SNAPSHOT + 2.0.1 4.0.0 diff --git a/datasafe-encryption/datasafe-encryption-api/pom.xml b/datasafe-encryption/datasafe-encryption-api/pom.xml index 6bc3dc850..4bd72cee4 100644 --- a/datasafe-encryption/datasafe-encryption-api/pom.xml +++ b/datasafe-encryption/datasafe-encryption-api/pom.xml @@ -5,7 +5,7 @@ de.adorsys datasafe-encryption - 2.0.1-SNAPSHOT + 2.0.1 datasafe-encryption-api diff --git a/datasafe-encryption/datasafe-encryption-impl/pom.xml b/datasafe-encryption/datasafe-encryption-impl/pom.xml index f93d60838..fb463cd25 100644 --- a/datasafe-encryption/datasafe-encryption-impl/pom.xml +++ b/datasafe-encryption/datasafe-encryption-impl/pom.xml @@ -5,7 +5,7 @@ de.adorsys datasafe-encryption - 2.0.1-SNAPSHOT + 2.0.1 datasafe-encryption-impl diff --git a/datasafe-encryption/pom.xml b/datasafe-encryption/pom.xml index 80172392b..edae50b9c 100644 --- a/datasafe-encryption/pom.xml +++ b/datasafe-encryption/pom.xml @@ -5,7 +5,7 @@ datasafe de.adorsys - 2.0.1-SNAPSHOT + 2.0.1 4.0.0 diff --git a/datasafe-examples/datasafe-examples-business/pom.xml b/datasafe-examples/datasafe-examples-business/pom.xml index bad2ba76c..f8cdb51ae 100644 --- a/datasafe-examples/datasafe-examples-business/pom.xml +++ b/datasafe-examples/datasafe-examples-business/pom.xml @@ -5,7 +5,7 @@ de.adorsys datasafe-examples - 2.0.1-SNAPSHOT + 2.0.1 datasafe-examples-business diff --git a/datasafe-examples/datasafe-examples-customize-dagger/pom.xml b/datasafe-examples/datasafe-examples-customize-dagger/pom.xml index 0a86d584b..a4067f9ec 100644 --- a/datasafe-examples/datasafe-examples-customize-dagger/pom.xml +++ b/datasafe-examples/datasafe-examples-customize-dagger/pom.xml @@ -5,7 +5,7 @@ de.adorsys datasafe-examples - 2.0.1-SNAPSHOT + 2.0.1 datasafe-examples-customize-dagger diff --git a/datasafe-examples/datasafe-examples-multidfs/pom.xml b/datasafe-examples/datasafe-examples-multidfs/pom.xml index 7a9ef6e4c..c6ec4d139 100644 --- a/datasafe-examples/datasafe-examples-multidfs/pom.xml +++ b/datasafe-examples/datasafe-examples-multidfs/pom.xml @@ -5,7 +5,7 @@ de.adorsys datasafe-examples - 2.0.1-SNAPSHOT + 2.0.1 datasafe-examples-multidfs diff --git a/datasafe-examples/datasafe-examples-versioned-s3/pom.xml b/datasafe-examples/datasafe-examples-versioned-s3/pom.xml index cf14cf1da..c869cb813 100644 --- a/datasafe-examples/datasafe-examples-versioned-s3/pom.xml +++ b/datasafe-examples/datasafe-examples-versioned-s3/pom.xml @@ -5,7 +5,7 @@ de.adorsys datasafe-examples - 2.0.1-SNAPSHOT + 2.0.1 datasafe-examples-versioned-s3 diff --git a/datasafe-examples/pom.xml b/datasafe-examples/pom.xml index 2873df125..f3994a10a 100644 --- a/datasafe-examples/pom.xml +++ b/datasafe-examples/pom.xml @@ -5,7 +5,7 @@ datasafe de.adorsys - 2.0.1-SNAPSHOT + 2.0.1 4.0.0 diff --git a/datasafe-inbox/datasafe-inbox-api/pom.xml b/datasafe-inbox/datasafe-inbox-api/pom.xml index 84a7fa66c..253bc7577 100644 --- a/datasafe-inbox/datasafe-inbox-api/pom.xml +++ b/datasafe-inbox/datasafe-inbox-api/pom.xml @@ -5,7 +5,7 @@ de.adorsys datasafe-inbox - 2.0.1-SNAPSHOT + 2.0.1 datasafe-inbox-api diff --git a/datasafe-inbox/datasafe-inbox-impl/pom.xml b/datasafe-inbox/datasafe-inbox-impl/pom.xml index f1b68c166..cb416cea9 100644 --- a/datasafe-inbox/datasafe-inbox-impl/pom.xml +++ b/datasafe-inbox/datasafe-inbox-impl/pom.xml @@ -5,7 +5,7 @@ de.adorsys datasafe-inbox - 2.0.1-SNAPSHOT + 2.0.1 datasafe-inbox-impl diff --git a/datasafe-inbox/pom.xml b/datasafe-inbox/pom.xml index 093fcb2c6..7c8f01f32 100644 --- a/datasafe-inbox/pom.xml +++ b/datasafe-inbox/pom.xml @@ -5,7 +5,7 @@ datasafe de.adorsys - 2.0.1-SNAPSHOT + 2.0.1 4.0.0 diff --git a/datasafe-long-run-tests/datasafe-business-tests-random-actions/pom.xml b/datasafe-long-run-tests/datasafe-business-tests-random-actions/pom.xml index cd4ba8107..8d838d7a5 100644 --- a/datasafe-long-run-tests/datasafe-business-tests-random-actions/pom.xml +++ b/datasafe-long-run-tests/datasafe-business-tests-random-actions/pom.xml @@ -5,7 +5,7 @@ datasafe-long-run-tests de.adorsys - 2.0.1-SNAPSHOT + 2.0.1 4.0.0 diff --git a/datasafe-long-run-tests/pom.xml b/datasafe-long-run-tests/pom.xml index a550f9048..5b098fa87 100644 --- a/datasafe-long-run-tests/pom.xml +++ b/datasafe-long-run-tests/pom.xml @@ -5,7 +5,7 @@ datasafe de.adorsys - 2.0.1-SNAPSHOT + 2.0.1 4.0.0 diff --git a/datasafe-metainfo/datasafe-metainfo-version-api/pom.xml b/datasafe-metainfo/datasafe-metainfo-version-api/pom.xml index 98e102c38..d911534e0 100644 --- a/datasafe-metainfo/datasafe-metainfo-version-api/pom.xml +++ b/datasafe-metainfo/datasafe-metainfo-version-api/pom.xml @@ -5,7 +5,7 @@ de.adorsys datasafe-metainfo - 2.0.1-SNAPSHOT + 2.0.1 datasafe-metainfo-version-api diff --git a/datasafe-metainfo/datasafe-metainfo-version-impl/pom.xml b/datasafe-metainfo/datasafe-metainfo-version-impl/pom.xml index bafb3174f..d9eaa8867 100644 --- a/datasafe-metainfo/datasafe-metainfo-version-impl/pom.xml +++ b/datasafe-metainfo/datasafe-metainfo-version-impl/pom.xml @@ -5,7 +5,7 @@ de.adorsys datasafe-metainfo - 2.0.1-SNAPSHOT + 2.0.1 datasafe-metainfo-version-impl diff --git a/datasafe-metainfo/pom.xml b/datasafe-metainfo/pom.xml index 17ed12b50..34ce68e9c 100644 --- a/datasafe-metainfo/pom.xml +++ b/datasafe-metainfo/pom.xml @@ -5,7 +5,7 @@ datasafe de.adorsys - 2.0.1-SNAPSHOT + 2.0.1 4.0.0 diff --git a/datasafe-privatestore/datasafe-privatestore-api/pom.xml b/datasafe-privatestore/datasafe-privatestore-api/pom.xml index 4ca010e4a..bb699901a 100644 --- a/datasafe-privatestore/datasafe-privatestore-api/pom.xml +++ b/datasafe-privatestore/datasafe-privatestore-api/pom.xml @@ -5,7 +5,7 @@ datasafe-privatestore de.adorsys - 2.0.1-SNAPSHOT + 2.0.1 4.0.0 diff --git a/datasafe-privatestore/datasafe-privatestore-impl/pom.xml b/datasafe-privatestore/datasafe-privatestore-impl/pom.xml index cb0a4d431..f53e09367 100644 --- a/datasafe-privatestore/datasafe-privatestore-impl/pom.xml +++ b/datasafe-privatestore/datasafe-privatestore-impl/pom.xml @@ -5,7 +5,7 @@ datasafe-privatestore de.adorsys - 2.0.1-SNAPSHOT + 2.0.1 4.0.0 diff --git a/datasafe-privatestore/pom.xml b/datasafe-privatestore/pom.xml index 50494d46c..fbf863855 100644 --- a/datasafe-privatestore/pom.xml +++ b/datasafe-privatestore/pom.xml @@ -5,7 +5,7 @@ datasafe de.adorsys - 2.0.1-SNAPSHOT + 2.0.1 4.0.0 diff --git a/datasafe-rest-impl/pom.xml b/datasafe-rest-impl/pom.xml index c1f246611..c1395a3c1 100644 --- a/datasafe-rest-impl/pom.xml +++ b/datasafe-rest-impl/pom.xml @@ -5,7 +5,7 @@ datasafe de.adorsys - 2.0.1-SNAPSHOT + 2.0.1 datasafe-rest-impl diff --git a/datasafe-runtime-delegate/pom.xml b/datasafe-runtime-delegate/pom.xml index 37aace1bd..f83c9197b 100644 --- a/datasafe-runtime-delegate/pom.xml +++ b/datasafe-runtime-delegate/pom.xml @@ -5,7 +5,7 @@ de.adorsys datasafe - 2.0.1-SNAPSHOT + 2.0.1 datasafe-runtime-delegate diff --git a/datasafe-simple-adapter/datasafe-simple-adapter-api/pom.xml b/datasafe-simple-adapter/datasafe-simple-adapter-api/pom.xml index 12b256919..87d84c37a 100644 --- a/datasafe-simple-adapter/datasafe-simple-adapter-api/pom.xml +++ b/datasafe-simple-adapter/datasafe-simple-adapter-api/pom.xml @@ -5,7 +5,7 @@ datasafe-simple-adapter de.adorsys - 2.0.1-SNAPSHOT + 2.0.1 4.0.0 diff --git a/datasafe-simple-adapter/datasafe-simple-adapter-impl/pom.xml b/datasafe-simple-adapter/datasafe-simple-adapter-impl/pom.xml index 9b19be43f..17b269f6f 100644 --- a/datasafe-simple-adapter/datasafe-simple-adapter-impl/pom.xml +++ b/datasafe-simple-adapter/datasafe-simple-adapter-impl/pom.xml @@ -5,7 +5,7 @@ datasafe-simple-adapter de.adorsys - 2.0.1-SNAPSHOT + 2.0.1 4.0.0 diff --git a/datasafe-simple-adapter/datasafe-simple-adapter-spring/pom.xml b/datasafe-simple-adapter/datasafe-simple-adapter-spring/pom.xml index 2749d36fd..1bc1c5feb 100644 --- a/datasafe-simple-adapter/datasafe-simple-adapter-spring/pom.xml +++ b/datasafe-simple-adapter/datasafe-simple-adapter-spring/pom.xml @@ -5,7 +5,7 @@ datasafe-simple-adapter de.adorsys - 2.0.1-SNAPSHOT + 2.0.1 4.0.0 diff --git a/datasafe-simple-adapter/pom.xml b/datasafe-simple-adapter/pom.xml index 4c8fe5f8f..d28c3af93 100644 --- a/datasafe-simple-adapter/pom.xml +++ b/datasafe-simple-adapter/pom.xml @@ -5,7 +5,7 @@ datasafe de.adorsys - 2.0.1-SNAPSHOT + 2.0.1 4.0.0 diff --git a/datasafe-storage/datasafe-storage-api/pom.xml b/datasafe-storage/datasafe-storage-api/pom.xml index fa57d90aa..f90294668 100644 --- a/datasafe-storage/datasafe-storage-api/pom.xml +++ b/datasafe-storage/datasafe-storage-api/pom.xml @@ -5,7 +5,7 @@ de.adorsys datasafe-storage - 2.0.1-SNAPSHOT + 2.0.1 datasafe-storage-api diff --git a/datasafe-storage/datasafe-storage-impl-db/pom.xml b/datasafe-storage/datasafe-storage-impl-db/pom.xml index aed79cfa5..764825140 100644 --- a/datasafe-storage/datasafe-storage-impl-db/pom.xml +++ b/datasafe-storage/datasafe-storage-impl-db/pom.xml @@ -5,7 +5,7 @@ datasafe-storage de.adorsys - 2.0.1-SNAPSHOT + 2.0.1 4.0.0 diff --git a/datasafe-storage/datasafe-storage-impl-fs/pom.xml b/datasafe-storage/datasafe-storage-impl-fs/pom.xml index 386f41627..8a31094fc 100644 --- a/datasafe-storage/datasafe-storage-impl-fs/pom.xml +++ b/datasafe-storage/datasafe-storage-impl-fs/pom.xml @@ -5,7 +5,7 @@ datasafe-storage de.adorsys - 2.0.1-SNAPSHOT + 2.0.1 4.0.0 diff --git a/datasafe-storage/datasafe-storage-impl-s3/pom.xml b/datasafe-storage/datasafe-storage-impl-s3/pom.xml index 40157d81b..341810d84 100644 --- a/datasafe-storage/datasafe-storage-impl-s3/pom.xml +++ b/datasafe-storage/datasafe-storage-impl-s3/pom.xml @@ -5,7 +5,7 @@ datasafe-storage de.adorsys - 2.0.1-SNAPSHOT + 2.0.1 4.0.0 diff --git a/datasafe-storage/pom.xml b/datasafe-storage/pom.xml index 1158c9bb8..7547515f2 100644 --- a/datasafe-storage/pom.xml +++ b/datasafe-storage/pom.xml @@ -5,7 +5,7 @@ datasafe de.adorsys - 2.0.1-SNAPSHOT + 2.0.1 4.0.0 diff --git a/datasafe-test-storages/pom.xml b/datasafe-test-storages/pom.xml index ecaddb7dd..c961573ed 100644 --- a/datasafe-test-storages/pom.xml +++ b/datasafe-test-storages/pom.xml @@ -5,7 +5,7 @@ datasafe de.adorsys - 2.0.1-SNAPSHOT + 2.0.1 4.0.0 diff --git a/datasafe-types-api/pom.xml b/datasafe-types-api/pom.xml index 52c18bd1a..2450208b9 100644 --- a/datasafe-types-api/pom.xml +++ b/datasafe-types-api/pom.xml @@ -5,7 +5,7 @@ de.adorsys datasafe - 2.0.1-SNAPSHOT + 2.0.1 datasafe-types-api diff --git a/last-module-codecoverage-check/pom.xml b/last-module-codecoverage-check/pom.xml index 4f455a30e..4022225ac 100644 --- a/last-module-codecoverage-check/pom.xml +++ b/last-module-codecoverage-check/pom.xml @@ -5,7 +5,7 @@ datasafe de.adorsys - 2.0.1-SNAPSHOT + 2.0.1 4.0.0 diff --git a/pom.xml b/pom.xml index 694c0e33f..227ad2ae0 100644 --- a/pom.xml +++ b/pom.xml @@ -25,7 +25,7 @@ de.adorsys datasafe - 2.0.1-SNAPSHOT + 2.0.1 datasafe Datasafe https://github.com/adorsys/datasafe From 306367dc9fe0f6bc9ed7f66f220e19b31adc0484 Mon Sep 17 00:00:00 2001 From: Maxim Grischenko Date: Tue, 30 Jan 2024 16:04:29 +0100 Subject: [PATCH 05/28] Start next iteration with 2.0.2-SNAPSHOT --- datasafe-business/pom.xml | 2 +- datasafe-cli/pom.xml | 2 +- datasafe-directory/datasafe-directory-api/pom.xml | 2 +- datasafe-directory/datasafe-directory-impl/pom.xml | 2 +- datasafe-directory/pom.xml | 2 +- datasafe-encryption/datasafe-encryption-api/pom.xml | 2 +- datasafe-encryption/datasafe-encryption-impl/pom.xml | 2 +- datasafe-encryption/pom.xml | 2 +- datasafe-examples/datasafe-examples-business/pom.xml | 2 +- datasafe-examples/datasafe-examples-customize-dagger/pom.xml | 2 +- datasafe-examples/datasafe-examples-multidfs/pom.xml | 2 +- datasafe-examples/datasafe-examples-versioned-s3/pom.xml | 2 +- datasafe-examples/pom.xml | 2 +- datasafe-inbox/datasafe-inbox-api/pom.xml | 2 +- datasafe-inbox/datasafe-inbox-impl/pom.xml | 2 +- datasafe-inbox/pom.xml | 2 +- .../datasafe-business-tests-random-actions/pom.xml | 2 +- datasafe-long-run-tests/pom.xml | 2 +- datasafe-metainfo/datasafe-metainfo-version-api/pom.xml | 2 +- datasafe-metainfo/datasafe-metainfo-version-impl/pom.xml | 2 +- datasafe-metainfo/pom.xml | 2 +- datasafe-privatestore/datasafe-privatestore-api/pom.xml | 2 +- datasafe-privatestore/datasafe-privatestore-impl/pom.xml | 2 +- datasafe-privatestore/pom.xml | 2 +- datasafe-rest-impl/pom.xml | 2 +- datasafe-runtime-delegate/pom.xml | 2 +- datasafe-simple-adapter/datasafe-simple-adapter-api/pom.xml | 2 +- datasafe-simple-adapter/datasafe-simple-adapter-impl/pom.xml | 2 +- datasafe-simple-adapter/datasafe-simple-adapter-spring/pom.xml | 2 +- datasafe-simple-adapter/pom.xml | 2 +- datasafe-storage/datasafe-storage-api/pom.xml | 2 +- datasafe-storage/datasafe-storage-impl-db/pom.xml | 2 +- datasafe-storage/datasafe-storage-impl-fs/pom.xml | 2 +- datasafe-storage/datasafe-storage-impl-s3/pom.xml | 2 +- datasafe-storage/pom.xml | 2 +- datasafe-test-storages/pom.xml | 2 +- datasafe-types-api/pom.xml | 2 +- last-module-codecoverage-check/pom.xml | 2 +- pom.xml | 2 +- 39 files changed, 39 insertions(+), 39 deletions(-) diff --git a/datasafe-business/pom.xml b/datasafe-business/pom.xml index 53a4d3248..2ea45d796 100644 --- a/datasafe-business/pom.xml +++ b/datasafe-business/pom.xml @@ -5,7 +5,7 @@ datasafe de.adorsys - 2.0.1 + 2.0.2-SNAPSHOT 4.0.0 diff --git a/datasafe-cli/pom.xml b/datasafe-cli/pom.xml index bdb4c22c2..13134382c 100644 --- a/datasafe-cli/pom.xml +++ b/datasafe-cli/pom.xml @@ -5,7 +5,7 @@ de.adorsys datasafe - 2.0.1 + 2.0.2-SNAPSHOT datasafe-cli diff --git a/datasafe-directory/datasafe-directory-api/pom.xml b/datasafe-directory/datasafe-directory-api/pom.xml index 1729b407f..151e3b189 100644 --- a/datasafe-directory/datasafe-directory-api/pom.xml +++ b/datasafe-directory/datasafe-directory-api/pom.xml @@ -3,7 +3,7 @@ de.adorsys datasafe-directory - 2.0.1 + 2.0.2-SNAPSHOT datasafe-directory-api diff --git a/datasafe-directory/datasafe-directory-impl/pom.xml b/datasafe-directory/datasafe-directory-impl/pom.xml index b237067df..1cf886ad9 100644 --- a/datasafe-directory/datasafe-directory-impl/pom.xml +++ b/datasafe-directory/datasafe-directory-impl/pom.xml @@ -3,7 +3,7 @@ de.adorsys datasafe-directory - 2.0.1 + 2.0.2-SNAPSHOT datasafe-directory-impl diff --git a/datasafe-directory/pom.xml b/datasafe-directory/pom.xml index 0e574a805..4c0fac14c 100644 --- a/datasafe-directory/pom.xml +++ b/datasafe-directory/pom.xml @@ -5,7 +5,7 @@ datasafe de.adorsys - 2.0.1 + 2.0.2-SNAPSHOT 4.0.0 diff --git a/datasafe-encryption/datasafe-encryption-api/pom.xml b/datasafe-encryption/datasafe-encryption-api/pom.xml index 4bd72cee4..59b38cfe2 100644 --- a/datasafe-encryption/datasafe-encryption-api/pom.xml +++ b/datasafe-encryption/datasafe-encryption-api/pom.xml @@ -5,7 +5,7 @@ de.adorsys datasafe-encryption - 2.0.1 + 2.0.2-SNAPSHOT datasafe-encryption-api diff --git a/datasafe-encryption/datasafe-encryption-impl/pom.xml b/datasafe-encryption/datasafe-encryption-impl/pom.xml index fb463cd25..3cc2627a9 100644 --- a/datasafe-encryption/datasafe-encryption-impl/pom.xml +++ b/datasafe-encryption/datasafe-encryption-impl/pom.xml @@ -5,7 +5,7 @@ de.adorsys datasafe-encryption - 2.0.1 + 2.0.2-SNAPSHOT datasafe-encryption-impl diff --git a/datasafe-encryption/pom.xml b/datasafe-encryption/pom.xml index edae50b9c..b7ac67034 100644 --- a/datasafe-encryption/pom.xml +++ b/datasafe-encryption/pom.xml @@ -5,7 +5,7 @@ datasafe de.adorsys - 2.0.1 + 2.0.2-SNAPSHOT 4.0.0 diff --git a/datasafe-examples/datasafe-examples-business/pom.xml b/datasafe-examples/datasafe-examples-business/pom.xml index f8cdb51ae..af89b9596 100644 --- a/datasafe-examples/datasafe-examples-business/pom.xml +++ b/datasafe-examples/datasafe-examples-business/pom.xml @@ -5,7 +5,7 @@ de.adorsys datasafe-examples - 2.0.1 + 2.0.2-SNAPSHOT datasafe-examples-business diff --git a/datasafe-examples/datasafe-examples-customize-dagger/pom.xml b/datasafe-examples/datasafe-examples-customize-dagger/pom.xml index a4067f9ec..7a874ae12 100644 --- a/datasafe-examples/datasafe-examples-customize-dagger/pom.xml +++ b/datasafe-examples/datasafe-examples-customize-dagger/pom.xml @@ -5,7 +5,7 @@ de.adorsys datasafe-examples - 2.0.1 + 2.0.2-SNAPSHOT datasafe-examples-customize-dagger diff --git a/datasafe-examples/datasafe-examples-multidfs/pom.xml b/datasafe-examples/datasafe-examples-multidfs/pom.xml index c6ec4d139..c6b349de3 100644 --- a/datasafe-examples/datasafe-examples-multidfs/pom.xml +++ b/datasafe-examples/datasafe-examples-multidfs/pom.xml @@ -5,7 +5,7 @@ de.adorsys datasafe-examples - 2.0.1 + 2.0.2-SNAPSHOT datasafe-examples-multidfs diff --git a/datasafe-examples/datasafe-examples-versioned-s3/pom.xml b/datasafe-examples/datasafe-examples-versioned-s3/pom.xml index c869cb813..a9944fdbb 100644 --- a/datasafe-examples/datasafe-examples-versioned-s3/pom.xml +++ b/datasafe-examples/datasafe-examples-versioned-s3/pom.xml @@ -5,7 +5,7 @@ de.adorsys datasafe-examples - 2.0.1 + 2.0.2-SNAPSHOT datasafe-examples-versioned-s3 diff --git a/datasafe-examples/pom.xml b/datasafe-examples/pom.xml index f3994a10a..94dea6288 100644 --- a/datasafe-examples/pom.xml +++ b/datasafe-examples/pom.xml @@ -5,7 +5,7 @@ datasafe de.adorsys - 2.0.1 + 2.0.2-SNAPSHOT 4.0.0 diff --git a/datasafe-inbox/datasafe-inbox-api/pom.xml b/datasafe-inbox/datasafe-inbox-api/pom.xml index 253bc7577..a5f5d3603 100644 --- a/datasafe-inbox/datasafe-inbox-api/pom.xml +++ b/datasafe-inbox/datasafe-inbox-api/pom.xml @@ -5,7 +5,7 @@ de.adorsys datasafe-inbox - 2.0.1 + 2.0.2-SNAPSHOT datasafe-inbox-api diff --git a/datasafe-inbox/datasafe-inbox-impl/pom.xml b/datasafe-inbox/datasafe-inbox-impl/pom.xml index cb416cea9..fbc4773a9 100644 --- a/datasafe-inbox/datasafe-inbox-impl/pom.xml +++ b/datasafe-inbox/datasafe-inbox-impl/pom.xml @@ -5,7 +5,7 @@ de.adorsys datasafe-inbox - 2.0.1 + 2.0.2-SNAPSHOT datasafe-inbox-impl diff --git a/datasafe-inbox/pom.xml b/datasafe-inbox/pom.xml index 7c8f01f32..53836fc16 100644 --- a/datasafe-inbox/pom.xml +++ b/datasafe-inbox/pom.xml @@ -5,7 +5,7 @@ datasafe de.adorsys - 2.0.1 + 2.0.2-SNAPSHOT 4.0.0 diff --git a/datasafe-long-run-tests/datasafe-business-tests-random-actions/pom.xml b/datasafe-long-run-tests/datasafe-business-tests-random-actions/pom.xml index 8d838d7a5..a7f4bdd31 100644 --- a/datasafe-long-run-tests/datasafe-business-tests-random-actions/pom.xml +++ b/datasafe-long-run-tests/datasafe-business-tests-random-actions/pom.xml @@ -5,7 +5,7 @@ datasafe-long-run-tests de.adorsys - 2.0.1 + 2.0.2-SNAPSHOT 4.0.0 diff --git a/datasafe-long-run-tests/pom.xml b/datasafe-long-run-tests/pom.xml index 5b098fa87..92351d15c 100644 --- a/datasafe-long-run-tests/pom.xml +++ b/datasafe-long-run-tests/pom.xml @@ -5,7 +5,7 @@ datasafe de.adorsys - 2.0.1 + 2.0.2-SNAPSHOT 4.0.0 diff --git a/datasafe-metainfo/datasafe-metainfo-version-api/pom.xml b/datasafe-metainfo/datasafe-metainfo-version-api/pom.xml index d911534e0..f8bfb9be9 100644 --- a/datasafe-metainfo/datasafe-metainfo-version-api/pom.xml +++ b/datasafe-metainfo/datasafe-metainfo-version-api/pom.xml @@ -5,7 +5,7 @@ de.adorsys datasafe-metainfo - 2.0.1 + 2.0.2-SNAPSHOT datasafe-metainfo-version-api diff --git a/datasafe-metainfo/datasafe-metainfo-version-impl/pom.xml b/datasafe-metainfo/datasafe-metainfo-version-impl/pom.xml index d9eaa8867..edd675f42 100644 --- a/datasafe-metainfo/datasafe-metainfo-version-impl/pom.xml +++ b/datasafe-metainfo/datasafe-metainfo-version-impl/pom.xml @@ -5,7 +5,7 @@ de.adorsys datasafe-metainfo - 2.0.1 + 2.0.2-SNAPSHOT datasafe-metainfo-version-impl diff --git a/datasafe-metainfo/pom.xml b/datasafe-metainfo/pom.xml index 34ce68e9c..73a68b219 100644 --- a/datasafe-metainfo/pom.xml +++ b/datasafe-metainfo/pom.xml @@ -5,7 +5,7 @@ datasafe de.adorsys - 2.0.1 + 2.0.2-SNAPSHOT 4.0.0 diff --git a/datasafe-privatestore/datasafe-privatestore-api/pom.xml b/datasafe-privatestore/datasafe-privatestore-api/pom.xml index bb699901a..a010a6239 100644 --- a/datasafe-privatestore/datasafe-privatestore-api/pom.xml +++ b/datasafe-privatestore/datasafe-privatestore-api/pom.xml @@ -5,7 +5,7 @@ datasafe-privatestore de.adorsys - 2.0.1 + 2.0.2-SNAPSHOT 4.0.0 diff --git a/datasafe-privatestore/datasafe-privatestore-impl/pom.xml b/datasafe-privatestore/datasafe-privatestore-impl/pom.xml index f53e09367..4c16ea2cf 100644 --- a/datasafe-privatestore/datasafe-privatestore-impl/pom.xml +++ b/datasafe-privatestore/datasafe-privatestore-impl/pom.xml @@ -5,7 +5,7 @@ datasafe-privatestore de.adorsys - 2.0.1 + 2.0.2-SNAPSHOT 4.0.0 diff --git a/datasafe-privatestore/pom.xml b/datasafe-privatestore/pom.xml index fbf863855..95e360d08 100644 --- a/datasafe-privatestore/pom.xml +++ b/datasafe-privatestore/pom.xml @@ -5,7 +5,7 @@ datasafe de.adorsys - 2.0.1 + 2.0.2-SNAPSHOT 4.0.0 diff --git a/datasafe-rest-impl/pom.xml b/datasafe-rest-impl/pom.xml index c1395a3c1..df7dad36e 100644 --- a/datasafe-rest-impl/pom.xml +++ b/datasafe-rest-impl/pom.xml @@ -5,7 +5,7 @@ datasafe de.adorsys - 2.0.1 + 2.0.2-SNAPSHOT datasafe-rest-impl diff --git a/datasafe-runtime-delegate/pom.xml b/datasafe-runtime-delegate/pom.xml index f83c9197b..e099bed80 100644 --- a/datasafe-runtime-delegate/pom.xml +++ b/datasafe-runtime-delegate/pom.xml @@ -5,7 +5,7 @@ de.adorsys datasafe - 2.0.1 + 2.0.2-SNAPSHOT datasafe-runtime-delegate diff --git a/datasafe-simple-adapter/datasafe-simple-adapter-api/pom.xml b/datasafe-simple-adapter/datasafe-simple-adapter-api/pom.xml index 87d84c37a..3d5755e2a 100644 --- a/datasafe-simple-adapter/datasafe-simple-adapter-api/pom.xml +++ b/datasafe-simple-adapter/datasafe-simple-adapter-api/pom.xml @@ -5,7 +5,7 @@ datasafe-simple-adapter de.adorsys - 2.0.1 + 2.0.2-SNAPSHOT 4.0.0 diff --git a/datasafe-simple-adapter/datasafe-simple-adapter-impl/pom.xml b/datasafe-simple-adapter/datasafe-simple-adapter-impl/pom.xml index 17b269f6f..af98b24da 100644 --- a/datasafe-simple-adapter/datasafe-simple-adapter-impl/pom.xml +++ b/datasafe-simple-adapter/datasafe-simple-adapter-impl/pom.xml @@ -5,7 +5,7 @@ datasafe-simple-adapter de.adorsys - 2.0.1 + 2.0.2-SNAPSHOT 4.0.0 diff --git a/datasafe-simple-adapter/datasafe-simple-adapter-spring/pom.xml b/datasafe-simple-adapter/datasafe-simple-adapter-spring/pom.xml index 1bc1c5feb..853af91b2 100644 --- a/datasafe-simple-adapter/datasafe-simple-adapter-spring/pom.xml +++ b/datasafe-simple-adapter/datasafe-simple-adapter-spring/pom.xml @@ -5,7 +5,7 @@ datasafe-simple-adapter de.adorsys - 2.0.1 + 2.0.2-SNAPSHOT 4.0.0 diff --git a/datasafe-simple-adapter/pom.xml b/datasafe-simple-adapter/pom.xml index d28c3af93..02e9a2f82 100644 --- a/datasafe-simple-adapter/pom.xml +++ b/datasafe-simple-adapter/pom.xml @@ -5,7 +5,7 @@ datasafe de.adorsys - 2.0.1 + 2.0.2-SNAPSHOT 4.0.0 diff --git a/datasafe-storage/datasafe-storage-api/pom.xml b/datasafe-storage/datasafe-storage-api/pom.xml index f90294668..17e0d4f93 100644 --- a/datasafe-storage/datasafe-storage-api/pom.xml +++ b/datasafe-storage/datasafe-storage-api/pom.xml @@ -5,7 +5,7 @@ de.adorsys datasafe-storage - 2.0.1 + 2.0.2-SNAPSHOT datasafe-storage-api diff --git a/datasafe-storage/datasafe-storage-impl-db/pom.xml b/datasafe-storage/datasafe-storage-impl-db/pom.xml index 764825140..e408805e0 100644 --- a/datasafe-storage/datasafe-storage-impl-db/pom.xml +++ b/datasafe-storage/datasafe-storage-impl-db/pom.xml @@ -5,7 +5,7 @@ datasafe-storage de.adorsys - 2.0.1 + 2.0.2-SNAPSHOT 4.0.0 diff --git a/datasafe-storage/datasafe-storage-impl-fs/pom.xml b/datasafe-storage/datasafe-storage-impl-fs/pom.xml index 8a31094fc..48588ce8e 100644 --- a/datasafe-storage/datasafe-storage-impl-fs/pom.xml +++ b/datasafe-storage/datasafe-storage-impl-fs/pom.xml @@ -5,7 +5,7 @@ datasafe-storage de.adorsys - 2.0.1 + 2.0.2-SNAPSHOT 4.0.0 diff --git a/datasafe-storage/datasafe-storage-impl-s3/pom.xml b/datasafe-storage/datasafe-storage-impl-s3/pom.xml index 341810d84..4f16cd52d 100644 --- a/datasafe-storage/datasafe-storage-impl-s3/pom.xml +++ b/datasafe-storage/datasafe-storage-impl-s3/pom.xml @@ -5,7 +5,7 @@ datasafe-storage de.adorsys - 2.0.1 + 2.0.2-SNAPSHOT 4.0.0 diff --git a/datasafe-storage/pom.xml b/datasafe-storage/pom.xml index 7547515f2..505e45a0f 100644 --- a/datasafe-storage/pom.xml +++ b/datasafe-storage/pom.xml @@ -5,7 +5,7 @@ datasafe de.adorsys - 2.0.1 + 2.0.2-SNAPSHOT 4.0.0 diff --git a/datasafe-test-storages/pom.xml b/datasafe-test-storages/pom.xml index c961573ed..5b3956ce8 100644 --- a/datasafe-test-storages/pom.xml +++ b/datasafe-test-storages/pom.xml @@ -5,7 +5,7 @@ datasafe de.adorsys - 2.0.1 + 2.0.2-SNAPSHOT 4.0.0 diff --git a/datasafe-types-api/pom.xml b/datasafe-types-api/pom.xml index 2450208b9..1ede06a31 100644 --- a/datasafe-types-api/pom.xml +++ b/datasafe-types-api/pom.xml @@ -5,7 +5,7 @@ de.adorsys datasafe - 2.0.1 + 2.0.2-SNAPSHOT datasafe-types-api diff --git a/last-module-codecoverage-check/pom.xml b/last-module-codecoverage-check/pom.xml index 4022225ac..1d5806c75 100644 --- a/last-module-codecoverage-check/pom.xml +++ b/last-module-codecoverage-check/pom.xml @@ -5,7 +5,7 @@ datasafe de.adorsys - 2.0.1 + 2.0.2-SNAPSHOT 4.0.0 diff --git a/pom.xml b/pom.xml index 227ad2ae0..e48bb3c2a 100644 --- a/pom.xml +++ b/pom.xml @@ -25,7 +25,7 @@ de.adorsys datasafe - 2.0.1 + 2.0.2-SNAPSHOT datasafe Datasafe https://github.com/adorsys/datasafe From 4e7367781d1d42e2a851ed459bde32d2cc73d023 Mon Sep 17 00:00:00 2001 From: Maxim Grischenko Date: Tue, 30 Jan 2024 13:10:53 +0100 Subject: [PATCH 06/28] bump jackson to 2.16.1, jjwt to 0.12.3 --- .../datasafe-encryption-impl/pom.xml | 5 ---- datasafe-rest-impl/pom.xml | 22 ++++------------- .../impl/security/JwtAuthorizationFilter.java | 14 ++++++----- pom.xml | 24 +++++++++++++++++-- 4 files changed, 34 insertions(+), 31 deletions(-) diff --git a/datasafe-encryption/datasafe-encryption-impl/pom.xml b/datasafe-encryption/datasafe-encryption-impl/pom.xml index 3cc2627a9..dc95d9b60 100644 --- a/datasafe-encryption/datasafe-encryption-impl/pom.xml +++ b/datasafe-encryption/datasafe-encryption-impl/pom.xml @@ -98,29 +98,24 @@ test-jar test - com.fasterxml.jackson.core jackson-databind - ${jackson-databind.version} test com.fasterxml.jackson.dataformat jackson-dataformat-yaml - ${jackson.version} test com.fasterxml.jackson.core jackson-annotations - ${jackson.version} test com.fasterxml.jackson.core jackson-core - ${jackson.version} test diff --git a/datasafe-rest-impl/pom.xml b/datasafe-rest-impl/pom.xml index df7dad36e..666cbd40e 100644 --- a/datasafe-rest-impl/pom.xml +++ b/datasafe-rest-impl/pom.xml @@ -15,11 +15,11 @@ 3.1.2 2.9.2 - 0.10.5 + 0.12.4 3.0.0 2.2.4 1.6.0 - 3.0.2 + 3.0.2 @@ -59,11 +59,6 @@ spring-boot-starter-web ${spring-boot.version} - - org.yaml - snakeyaml - 2.1 - org.springframework.boot spring-boot-starter-actuator @@ -81,20 +76,11 @@ ${spring-boot.version} true + jakarta.validation jakarta.validation-api - ${jakarta.validation-api.varsion} - - - com.fasterxml.jackson.core - jackson-databind - ${jackson-databind.version} - - - com.fasterxml.jackson.core - jackson-core - ${jackson.version} + ${jakarta.validation-api.version} io.jsonwebtoken diff --git a/datasafe-rest-impl/src/main/java/de/adorsys/datasafe/rest/impl/security/JwtAuthorizationFilter.java b/datasafe-rest-impl/src/main/java/de/adorsys/datasafe/rest/impl/security/JwtAuthorizationFilter.java index 592f16087..a444f0423 100644 --- a/datasafe-rest-impl/src/main/java/de/adorsys/datasafe/rest/impl/security/JwtAuthorizationFilter.java +++ b/datasafe-rest-impl/src/main/java/de/adorsys/datasafe/rest/impl/security/JwtAuthorizationFilter.java @@ -7,6 +7,7 @@ import io.jsonwebtoken.Jwts; import io.jsonwebtoken.MalformedJwtException; import io.jsonwebtoken.UnsupportedJwtException; +import io.jsonwebtoken.security.Keys; import io.jsonwebtoken.security.SignatureException; import jakarta.servlet.FilterChain; import jakarta.servlet.ServletException; @@ -19,9 +20,9 @@ import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.web.authentication.www.BasicAuthenticationFilter; +import javax.crypto.SecretKey; import java.io.IOException; import java.util.List; -import java.util.stream.Collectors; @Slf4j public class JwtAuthorizationFilter extends BasicAuthenticationFilter { @@ -74,19 +75,20 @@ private UsernamePasswordAuthenticationToken getAuthentication(HttpServletRequest private UsernamePasswordAuthenticationToken tryAuthenticate(String token) { byte[] signingKey = securityProperties.getJwtSecret().getBytes(); + SecretKey secret = Keys.hmacShaKeyFor(signingKey); Jws parsedToken = Jwts.parser() - .setSigningKey(signingKey) - .parseClaimsJws(token.replace(SecurityConstants.TOKEN_PREFIX, "")); + .verifyWith(secret).build() + .parseSignedClaims(token.replace(SecurityConstants.TOKEN_PREFIX, "")); String username = parsedToken - .getBody() + .getPayload() .getSubject(); - List authorities = ((List) parsedToken.getBody() + List authorities = ((List) parsedToken.getPayload() .get(SecurityConstants.ROLES_NAME)).stream() .map(authority -> new SimpleGrantedAuthority((String) authority)) - .collect(Collectors.toList()); + .toList(); if (!Strings.isNullOrEmpty(username)) { return new UsernamePasswordAuthenticationToken(username, null, authorities); diff --git a/pom.xml b/pom.xml index e48bb3c2a..b6588564d 100644 --- a/pom.xml +++ b/pom.xml @@ -112,8 +112,7 @@ 6.0.11 3.1.2 1.4.4 - 2.12.7 - 2.12.7.1 + 2.16.1 0.0.9 2.1.1 2.3.1 @@ -334,6 +333,27 @@ jaxb-api ${jaxb-api.version} + + com.fasterxml.jackson.core + jackson-core + ${jackson.version} + + + com.fasterxml.jackson.core + jackson-databind + ${jackson.version} + + + com.fasterxml.jackson.core + jackson-annotations + ${jackson.version} + + + com.fasterxml.jackson.dataformat + jackson-dataformat-yaml + ${jackson.version} + test + From 6f87d72dc4258628d90da33f240e246848e3ddae Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 21 Feb 2024 00:00:41 +0000 Subject: [PATCH 07/28] Bump org.apache.commons:commons-compress from 1.21 to 1.26.0 Bumps org.apache.commons:commons-compress from 1.21 to 1.26.0. --- updated-dependencies: - dependency-name: org.apache.commons:commons-compress dependency-type: direct:development ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index e48bb3c2a..1b782863d 100644 --- a/pom.xml +++ b/pom.xml @@ -87,7 +87,7 @@ 3.12.2 5.5.0 3.1.2 - 1.21 + 1.26.0 UTF-8 false 1.18.3 From f8acd524ffb45d4ba21e4abe8626b921f5c0353f Mon Sep 17 00:00:00 2001 From: AssahBismarkabah Date: Thu, 11 Apr 2024 12:58:46 +0100 Subject: [PATCH 08/28] fix: updated data-storage-impl-s3 Test Files --- ...eamTest.java => MultipartUploadS3StorageOutputStreamIT.java} | 2 +- ...ceTest.java => MultipartUploadS3SystemStorageServiceIT.java} | 2 +- ...temStorageServiceTest.java => S3SystemStorageServiceIT.java} | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) rename datasafe-storage/datasafe-storage-impl-s3/src/test/java/de/adorsys/datasafe/storage/impl/s3/{MultipartUploadS3StorageOutputStreamTest.java => MultipartUploadS3StorageOutputStreamIT.java} (99%) rename datasafe-storage/datasafe-storage-impl-s3/src/test/java/de/adorsys/datasafe/storage/impl/s3/{MultipartUploadS3SystemStorageServiceTest.java => MultipartUploadS3SystemStorageServiceIT.java} (98%) rename datasafe-storage/datasafe-storage-impl-s3/src/test/java/de/adorsys/datasafe/storage/impl/s3/{S3SystemStorageServiceTest.java => S3SystemStorageServiceIT.java} (99%) diff --git a/datasafe-storage/datasafe-storage-impl-s3/src/test/java/de/adorsys/datasafe/storage/impl/s3/MultipartUploadS3StorageOutputStreamTest.java b/datasafe-storage/datasafe-storage-impl-s3/src/test/java/de/adorsys/datasafe/storage/impl/s3/MultipartUploadS3StorageOutputStreamIT.java similarity index 99% rename from datasafe-storage/datasafe-storage-impl-s3/src/test/java/de/adorsys/datasafe/storage/impl/s3/MultipartUploadS3StorageOutputStreamTest.java rename to datasafe-storage/datasafe-storage-impl-s3/src/test/java/de/adorsys/datasafe/storage/impl/s3/MultipartUploadS3StorageOutputStreamIT.java index bdbae0d63..df98f6d62 100644 --- a/datasafe-storage/datasafe-storage-impl-s3/src/test/java/de/adorsys/datasafe/storage/impl/s3/MultipartUploadS3StorageOutputStreamTest.java +++ b/datasafe-storage/datasafe-storage-impl-s3/src/test/java/de/adorsys/datasafe/storage/impl/s3/MultipartUploadS3StorageOutputStreamIT.java @@ -30,7 +30,7 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -class MultipartUploadS3StorageOutputStreamTest extends BaseMockitoTest { +class MultipartUploadS3StorageOutputStreamIT extends BaseMockitoTest { private final byte[] shortChunk = randomBytes(100); private final byte[] exactOneMultipartChunk = randomBytes(BUFFER_SIZE); diff --git a/datasafe-storage/datasafe-storage-impl-s3/src/test/java/de/adorsys/datasafe/storage/impl/s3/MultipartUploadS3SystemStorageServiceTest.java b/datasafe-storage/datasafe-storage-impl-s3/src/test/java/de/adorsys/datasafe/storage/impl/s3/MultipartUploadS3SystemStorageServiceIT.java similarity index 98% rename from datasafe-storage/datasafe-storage-impl-s3/src/test/java/de/adorsys/datasafe/storage/impl/s3/MultipartUploadS3SystemStorageServiceTest.java rename to datasafe-storage/datasafe-storage-impl-s3/src/test/java/de/adorsys/datasafe/storage/impl/s3/MultipartUploadS3SystemStorageServiceIT.java index e8b52f3a8..f0b82c537 100644 --- a/datasafe-storage/datasafe-storage-impl-s3/src/test/java/de/adorsys/datasafe/storage/impl/s3/MultipartUploadS3SystemStorageServiceTest.java +++ b/datasafe-storage/datasafe-storage-impl-s3/src/test/java/de/adorsys/datasafe/storage/impl/s3/MultipartUploadS3SystemStorageServiceIT.java @@ -28,7 +28,7 @@ import static org.assertj.core.api.Assertions.fail; @Slf4j -public class MultipartUploadS3SystemStorageServiceTest extends S3SystemStorageServiceTest { +public class MultipartUploadS3SystemStorageServiceIT extends S3SystemStorageServiceIT { @TempDir protected Path tempDir; diff --git a/datasafe-storage/datasafe-storage-impl-s3/src/test/java/de/adorsys/datasafe/storage/impl/s3/S3SystemStorageServiceTest.java b/datasafe-storage/datasafe-storage-impl-s3/src/test/java/de/adorsys/datasafe/storage/impl/s3/S3SystemStorageServiceIT.java similarity index 99% rename from datasafe-storage/datasafe-storage-impl-s3/src/test/java/de/adorsys/datasafe/storage/impl/s3/S3SystemStorageServiceTest.java rename to datasafe-storage/datasafe-storage-impl-s3/src/test/java/de/adorsys/datasafe/storage/impl/s3/S3SystemStorageServiceIT.java index cb808a6d0..ee66097af 100644 --- a/datasafe-storage/datasafe-storage-impl-s3/src/test/java/de/adorsys/datasafe/storage/impl/s3/S3SystemStorageServiceTest.java +++ b/datasafe-storage/datasafe-storage-impl-s3/src/test/java/de/adorsys/datasafe/storage/impl/s3/S3SystemStorageServiceIT.java @@ -34,7 +34,7 @@ @Slf4j //TODO: Extract stuff related container start/stop/clear to separate class. Used in datasafe-business and in datasafe-storage-impl-s3 -class S3SystemStorageServiceTest extends BaseMockitoTest { +class S3SystemStorageServiceIT extends BaseMockitoTest { private static final String FILE = "file"; private static final String MESSAGE = "hello"; From 375a04c596f3d410f83e556957da3055273bf03b Mon Sep 17 00:00:00 2001 From: forkimenjeckayang Date: Thu, 11 Apr 2024 13:18:51 +0100 Subject: [PATCH 09/28] Renamed file(datasafe-examples): Renamed MultiDfsWithCredentialsExampleTest file to MultiDfsWithCredentialsExampleIT since it contains an integration test --- .../s3/MultiDfsWithCredentialsExampleIT.java | 255 ++++++++++++++++++ 1 file changed, 255 insertions(+) create mode 100644 datasafe-examples/datasafe-examples-multidfs/src/test/java/de/adorsys/datasafe/examples/business/s3/MultiDfsWithCredentialsExampleIT.java diff --git a/datasafe-examples/datasafe-examples-multidfs/src/test/java/de/adorsys/datasafe/examples/business/s3/MultiDfsWithCredentialsExampleIT.java b/datasafe-examples/datasafe-examples-multidfs/src/test/java/de/adorsys/datasafe/examples/business/s3/MultiDfsWithCredentialsExampleIT.java new file mode 100644 index 000000000..cf779ff93 --- /dev/null +++ b/datasafe-examples/datasafe-examples-multidfs/src/test/java/de/adorsys/datasafe/examples/business/s3/MultiDfsWithCredentialsExampleIT.java @@ -0,0 +1,255 @@ +package de.adorsys.datasafe.examples.business.s3; + +import com.amazonaws.services.s3.AmazonS3; +import dagger.Lazy; +import de.adorsys.datasafe.business.impl.service.DaggerDefaultDatasafeServices; +import de.adorsys.datasafe.business.impl.service.DefaultDatasafeServices; +import de.adorsys.datasafe.directory.api.profile.keys.StorageKeyStoreOperations; +import de.adorsys.datasafe.directory.api.types.StorageCredentials; +import de.adorsys.datasafe.directory.api.types.UserPrivateProfile; +import de.adorsys.datasafe.directory.impl.profile.config.DFSConfigWithStorageCreds; +import de.adorsys.datasafe.directory.impl.profile.dfs.BucketAccessServiceImpl; +import de.adorsys.datasafe.directory.impl.profile.dfs.BucketAccessServiceImplRuntimeDelegatable; +import de.adorsys.datasafe.directory.impl.profile.dfs.RegexAccessServiceWithStorageCredentialsImpl; +import de.adorsys.datasafe.encrypiton.api.types.UserIDAuth; +import de.adorsys.datasafe.storage.api.RegexDelegatingStorage; +import de.adorsys.datasafe.storage.api.StorageService; +import de.adorsys.datasafe.storage.api.UriBasedAuthStorageService; +import de.adorsys.datasafe.storage.impl.s3.S3ClientFactory; +import de.adorsys.datasafe.storage.impl.s3.S3StorageService; +import de.adorsys.datasafe.types.api.actions.ReadRequest; +import de.adorsys.datasafe.types.api.actions.WriteRequest; +import de.adorsys.datasafe.types.api.context.BaseOverridesRegistry; +import de.adorsys.datasafe.types.api.context.overrides.OverridesRegistry; +import de.adorsys.datasafe.types.api.resource.AbsoluteLocation; +import de.adorsys.datasafe.types.api.resource.BasePrivateResource; +import de.adorsys.datasafe.types.api.resource.StorageIdentifier; +import de.adorsys.datasafe.types.api.shared.AwsClientRetry; +import de.adorsys.datasafe.types.api.utils.ExecutorServiceUtil; +import lombok.SneakyThrows; +import lombok.experimental.Delegate; +import lombok.extern.slf4j.Slf4j; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; +import org.testcontainers.containers.GenericContainer; +import org.testcontainers.containers.wait.strategy.Wait; +import org.testcontainers.shaded.com.google.common.collect.ImmutableMap; + +import java.io.OutputStream; +import java.net.URI; +import java.nio.charset.StandardCharsets; +import java.util.Arrays; +import java.util.EnumMap; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.ExecutorService; +import java.util.regex.Pattern; + +import static de.adorsys.datasafe.examples.business.s3.MinioContainerId.DIRECTORY_BUCKET; +import static de.adorsys.datasafe.examples.business.s3.MinioContainerId.FILES_BUCKET_ONE; +import static de.adorsys.datasafe.examples.business.s3.MinioContainerId.FILES_BUCKET_TWO; +import static org.assertj.core.api.Assertions.assertThat; + +/** + * This example shows how client can register storage system and securely store its access details. + * Here, we will use 2 Datasafe class instances - one for securely storing user access credentials + * - configBucket and another is for accessing users' private files stored in + * filesBucketOne, filesBucketTwo. + */ +@Slf4j +class MultiDfsWithCredentialsExampleTest { + + private static final String REGION = "eu-central-1"; + private static final ExecutorService EXECUTOR = ExecutorServiceUtil.submitterExecutesOnStarvationExecutingService(4, 4); + + private static Map minios = new EnumMap<>(MinioContainerId.class); + private static AmazonS3 directoryClient = null; + private static Map endpointsByHost = new HashMap<>(); + + @BeforeAll + static void startup() { + // Create all required minio-backed S3 buckets: + Arrays.stream(MinioContainerId.values()).forEach(it -> { + GenericContainer minio = createAndStartMinio(it.getAccessKey(), it.getSecretKey()); + minios.put(it, minio); + + String endpoint = getDockerUri("http://127.0.0.1") + ":" + minio.getFirstMappedPort() + "/"; + endpointsByHost.put(it, endpoint + REGION + "/" + it.getBucketName() + "/"); + log.info("MINIO for {} is available at: {} with access: '{}'/'{}'", it, endpoint, it.getAccessKey(), + it.getSecretKey()); + + AmazonS3 client = S3ClientFactory.getClient( + endpoint, + REGION, + it.getAccessKey(), + it.getSecretKey() + ); + + AwsClientRetry.createBucketWithRetry(client, it.getBucketName()); + + if (it.equals(DIRECTORY_BUCKET)) { + directoryClient = client; + } + }); + } + + @AfterAll + static void shutdown() { + minios.values().forEach(GenericContainer::stop); + } + + @Test + @SneakyThrows + void testMultiUserStorageUserSetup() { + // BEGIN_SNIPPET:Datasafe with multi-dfs setup + String directoryBucketS3Uri = "s3://" + DIRECTORY_BUCKET.getBucketName() + "/"; + // static client that will be used to access `directory` bucket: + StorageService directoryStorage = new S3StorageService( + directoryClient, + DIRECTORY_BUCKET.getBucketName(), + EXECUTOR + ); + + OverridesRegistry registry = new BaseOverridesRegistry(); + DefaultDatasafeServices multiDfsDatasafe = DaggerDefaultDatasafeServices + .builder() + .config(new DFSConfigWithStorageCreds(directoryBucketS3Uri, "PAZZWORT"::toCharArray)) + // This storage service will route requests to proper bucket based on URI content: + // URI with directoryBucket to `directoryStorage` + // URI with filesBucketOne will get dynamically generated S3Storage + // URI with filesBucketTwo will get dynamically generated S3Storage + .storage( + new RegexDelegatingStorage( + ImmutableMap.builder() + // bind URI that contains `directoryBucket` to directoryStorage + .put(Pattern.compile(directoryBucketS3Uri + ".+"), directoryStorage) + .put( + Pattern.compile(getDockerUri("http://127.0.0.1") + ".+"), + // Dynamically creates S3 client with bucket name equal to host value + new UriBasedAuthStorageService( + acc -> new S3StorageService( + S3ClientFactory.getClient( + acc.getEndpoint(), + acc.getRegion(), + acc.getAccessKey(), + acc.getSecretKey() + ), + // Bucket name is encoded in first path segment + acc.getBucketName(), + EXECUTOR + ) + ) + ).build() + ) + ) + .overridesRegistry(registry) + .build(); + // Instead of default BucketAccessService we will use service that reads storage access credentials from + // keystore + BucketAccessServiceImplRuntimeDelegatable.overrideWith( + registry, args -> new WithCredentialProvider(args.getStorageKeyStoreOperations()) + ); + + // John will have all his private files stored on `filesBucketOne` and `filesBucketOne`. + // Depending on path of file - filesBucketOne or filesBucketTwo - requests will be routed to proper bucket. + // I.e. path filesBucketOne/path/to/file will end up in `filesBucketOne` with key path/to/file + // his profile and access credentials for `filesBucketOne` will be in `configBucket` + UserIDAuth john = new UserIDAuth("john", "secret"::toCharArray); + // Here, nothing expects John has own storage credentials: + multiDfsDatasafe.userProfile().registerUsingDefaults(john); + + // Tell system that John will use his own storage credentials - regex match: + StorageIdentifier bucketOne = new StorageIdentifier(endpointsByHost.get(FILES_BUCKET_ONE) + ".+"); + StorageIdentifier bucketTwo = new StorageIdentifier(endpointsByHost.get(FILES_BUCKET_TWO) + ".+"); + // Set location for John's credentials keystore and put storage credentials into it: + UserPrivateProfile profile = multiDfsDatasafe.userProfile().privateProfile(john); + profile.getPrivateStorage().put( + bucketOne, + new AbsoluteLocation<>(BasePrivateResource.forPrivate(endpointsByHost.get(FILES_BUCKET_ONE) + "/")) + ); + profile.getPrivateStorage().put( + bucketTwo, + new AbsoluteLocation<>(BasePrivateResource.forPrivate(endpointsByHost.get(FILES_BUCKET_TWO) + "/")) + ); + multiDfsDatasafe.userProfile().updatePrivateProfile(john, profile); + + // register John's DFS access for `filesBucketOne` minio bucket + multiDfsDatasafe.userProfile().registerStorageCredentials( + john, + bucketOne, + new StorageCredentials( + FILES_BUCKET_ONE.getAccessKey(), + FILES_BUCKET_ONE.getSecretKey() + ) + ); + // register John's DFS access for `filesBucketTwo` minio bucket + multiDfsDatasafe.userProfile().registerStorageCredentials( + john, + bucketTwo, + new StorageCredentials( + FILES_BUCKET_TWO.getAccessKey(), + FILES_BUCKET_TWO.getSecretKey() + ) + ); + + // Configuring multi-storage is done, user can use his multi-storage: + + // store this file on `filesBucketOne` + try (OutputStream os = multiDfsDatasafe.privateService() + .write(WriteRequest.forPrivate(john, bucketOne, "my/file.txt"))) { + os.write("Content on bucket number ONE".getBytes(StandardCharsets.UTF_8)); + } + + // store this file on `filesBucketTwo` + try (OutputStream os = multiDfsDatasafe.privateService() + .write(WriteRequest.forPrivate(john, bucketTwo, "my/file.txt"))) { + os.write("Content on bucket number TWO".getBytes(StandardCharsets.UTF_8)); + } + + // read file from `filesBucketOne` + assertThat(multiDfsDatasafe.privateService() + .read(ReadRequest.forPrivate(john, bucketOne, "my/file.txt")) + ).hasContent("Content on bucket number ONE"); + + // read file from `filesBucketTwo` + assertThat(multiDfsDatasafe.privateService() + .read(ReadRequest.forPrivate(john, bucketTwo, "my/file.txt")) + ).hasContent("Content on bucket number TWO"); + // END_SNIPPET + } + + private static GenericContainer createAndStartMinio(String accessKey, String secretKey) { + GenericContainer minioContainer = new GenericContainer("minio/minio") + .withExposedPorts(9000) + .withEnv("MINIO_ACCESS_KEY", accessKey) + .withEnv("MINIO_SECRET_KEY", secretKey) + .withCommand("server /data") + .waitingFor(Wait.defaultWaitStrategy()); + + minioContainer.start(); + return minioContainer; + } + + private static class WithCredentialProvider extends BucketAccessServiceImpl { + + @Delegate + private final RegexAccessServiceWithStorageCredentialsImpl delegate; + + private WithCredentialProvider(Lazy storageKeyStoreOperations) { + super(null); + this.delegate = new RegexAccessServiceWithStorageCredentialsImpl(storageKeyStoreOperations); + } + } + + @SneakyThrows + private static String getDockerUri(String defaultUri) { + String dockerHost = System.getenv("DOCKER_HOST"); + if (dockerHost == null) { + return defaultUri; + } + + URI dockerUri = new URI(dockerHost); + return "http://" + dockerUri.getHost(); + } +} From 29b6c3602f94ab132233c8d1f41bd3c16aed9153 Mon Sep 17 00:00:00 2001 From: forkimenjeckayang Date: Thu, 11 Apr 2024 13:21:14 +0100 Subject: [PATCH 10/28] Renamed file(datasafe-examples): Renamed BaseUserOperationsWithDefaultDatasafeOnVersionedStorageTest file to BaseUserOperationsWithDefaultDatasafeOnVersionedStorageIT since it contains an integration test --- ...thDefaultDatasafeOnVersionedStorageIT.java | 247 ++++++++++++++++++ 1 file changed, 247 insertions(+) create mode 100644 datasafe-examples/datasafe-examples-versioned-s3/src/test/java/de/adorsys/datasafe/examples/business/s3/BaseUserOperationsWithDefaultDatasafeOnVersionedStorageIT.java diff --git a/datasafe-examples/datasafe-examples-versioned-s3/src/test/java/de/adorsys/datasafe/examples/business/s3/BaseUserOperationsWithDefaultDatasafeOnVersionedStorageIT.java b/datasafe-examples/datasafe-examples-versioned-s3/src/test/java/de/adorsys/datasafe/examples/business/s3/BaseUserOperationsWithDefaultDatasafeOnVersionedStorageIT.java new file mode 100644 index 000000000..0f41f74b9 --- /dev/null +++ b/datasafe-examples/datasafe-examples-versioned-s3/src/test/java/de/adorsys/datasafe/examples/business/s3/BaseUserOperationsWithDefaultDatasafeOnVersionedStorageIT.java @@ -0,0 +1,247 @@ +package de.adorsys.datasafe.examples.business.s3; + +import com.amazonaws.auth.AWSStaticCredentialsProvider; +import com.amazonaws.auth.BasicAWSCredentials; +import com.amazonaws.client.builder.AwsClientBuilder; +import com.amazonaws.services.s3.AmazonS3; +import com.amazonaws.services.s3.AmazonS3ClientBuilder; +import com.amazonaws.services.s3.model.AmazonS3Exception; +import com.amazonaws.services.s3.model.BucketVersioningConfiguration; +import com.amazonaws.services.s3.model.SetBucketVersioningConfigurationRequest; +import de.adorsys.datasafe.business.impl.service.DaggerDefaultDatasafeServices; +import de.adorsys.datasafe.business.impl.service.DefaultDatasafeServices; +import de.adorsys.datasafe.directory.impl.profile.config.DefaultDFSConfig; +import de.adorsys.datasafe.encrypiton.api.types.UserIDAuth; +import de.adorsys.datasafe.storage.impl.s3.S3StorageService; +import de.adorsys.datasafe.types.api.actions.ListRequest; +import de.adorsys.datasafe.types.api.actions.ReadRequest; +import de.adorsys.datasafe.types.api.actions.RemoveRequest; +import de.adorsys.datasafe.types.api.actions.WriteRequest; +import de.adorsys.datasafe.types.api.callback.PhysicalVersionCallback; +import de.adorsys.datasafe.types.api.resource.StorageVersion; +import de.adorsys.datasafe.types.api.utils.ExecutorServiceUtil; +import lombok.SneakyThrows; +import lombok.extern.slf4j.Slf4j; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.DisabledIfSystemProperty; +import org.testcontainers.containers.GenericContainer; +import org.testcontainers.containers.wait.strategy.Wait; + +import java.io.OutputStream; +import java.net.URI; +import java.nio.charset.StandardCharsets; +import java.util.concurrent.atomic.AtomicReference; + +import static org.assertj.core.api.AssertionsForInterfaceTypes.assertThat; +import static org.junit.jupiter.api.Assertions.assertThrows; + +/** + * This test shows simplistic usage of Datasafe default services that reside on versioned storage system. + */ +@Slf4j +@DisabledIfSystemProperty(named = "SKIP_CEPH", matches = "true") +class BaseUserOperationsWithDefaultDatasafeOnVersionedStorageTest { + + private static final String MY_OWN_FILE_TXT = "my/own/file.txt"; + + private static final String VERSIONED_BUCKET_NAME = "home"; + private static final String ACCESS_KEY = "access"; + private static final String SECRET_KEY = "secret"; + + private static GenericContainer cephContainer; + private static AmazonS3 cephS3; + private static String cephMappedUrl; + + private DefaultDatasafeServices defaultDatasafeServices; + + /** + * This creates CEPH Rados gateway in docker container and creates S3 client for it. + */ + @BeforeAll + static void createServices() { + log.info("Starting CEPH"); + // Create CEPH container: + cephContainer = new GenericContainer("ceph/daemon") + .withExposedPorts(8000, 5000) + .withEnv("RGW_FRONTEND_PORT", "8000") + .withEnv("SREE_PORT", "5000") + .withEnv("DEBUG", "verbose") + .withEnv("CEPH_DEMO_UID", "nano") + .withEnv("MON_IP", "127.0.0.1") + .withEnv("CEPH_PUBLIC_NETWORK", "0.0.0.0/0") + .withEnv("CEPH_DAEMON", "demo") + .withEnv("DEMO_DAEMONS", "mon,mgr,osd,rgw") + .withEnv("CEPH_DEMO_ACCESS_KEY", ACCESS_KEY) + .withEnv("CEPH_DEMO_SECRET_KEY", SECRET_KEY) + .withCommand("mkdir -p /etc/ceph && mkdir -p /var/lib/ceph && /entrypoint.sh") + .waitingFor(Wait.defaultWaitStrategy()); + + cephContainer.start(); + Integer mappedPort = cephContainer.getMappedPort(8000); + // URL for S3 API/bucket root: + cephMappedUrl = getDockerUri("http://0.0.0.0") + ":" + mappedPort; + log.info("Ceph mapped URL: {}", cephMappedUrl); + cephS3 = AmazonS3ClientBuilder.standard() + .withEndpointConfiguration( + new AwsClientBuilder.EndpointConfiguration(cephMappedUrl, "us-east-1") + ) + .withCredentials( + new AWSStaticCredentialsProvider( + new BasicAWSCredentials(ACCESS_KEY, SECRET_KEY) + ) + ) + .enablePathStyleAccess() + .build(); + + // Create bucket in CEPH that will support versioning + cephS3.createBucket(VERSIONED_BUCKET_NAME); + cephS3.setBucketVersioningConfiguration( + new SetBucketVersioningConfigurationRequest( + VERSIONED_BUCKET_NAME, + new BucketVersioningConfiguration(BucketVersioningConfiguration.ENABLED) + ) + ); + + + } + + @AfterAll + static void stopCeph() { + cephContainer.stop(); + } + + @BeforeEach + void init() { + // this will create all Datasafe files and user documents under S3 bucket root, we assume that + // S3 versioned bucket was already created + defaultDatasafeServices = DaggerDefaultDatasafeServices.builder() + .config(new DefaultDFSConfig(cephMappedUrl, "secret"::toCharArray)) + .storage(new S3StorageService( + cephS3, + VERSIONED_BUCKET_NAME, + ExecutorServiceUtil.submitterExecutesOnStarvationExecutingService())) + .build(); + } + + /** + * S3 storage adapter supports sending back file version (if S3 storage returns it) when storing object to + * bucket and it allows reading object using its version too. + */ + @Test + @SneakyThrows + void writeFileThenReadLatestAndReadByVersion() { + // BEGIN_SNIPPET:Versioned storage support - writing file and reading back + // creating new user + UserIDAuth user = registerUser("john"); + + // writing data to my/own/file.txt 3 times with different content: + // 1st time, writing into my/own/file.txt: + // Expanded snippet of how to capture file version when writing object: + AtomicReference version = new AtomicReference<>(); + try (OutputStream os = defaultDatasafeServices.privateService() + .write(WriteRequest.forDefaultPrivate(user, MY_OWN_FILE_TXT) + .toBuilder() + .callback((PhysicalVersionCallback) version::set) + .build()) + ) { + // Initial version will contain "Hello 1": + os.write("Hello 1".getBytes(StandardCharsets.UTF_8)); + } + // this variable has our initial file version: + String version1 = version.get(); + + // Write 2 more times different data to same file - my/own/file.txt: + String version2 = writeToPrivate(user, MY_OWN_FILE_TXT, "Hello 2"); + // Last version will contain "Hello 3": + String version3 = writeToPrivate(user, MY_OWN_FILE_TXT, "Hello 3"); + + // now, when we read file without specifying version - we see latest file content: + assertThat(defaultDatasafeServices.privateService().read( + ReadRequest.forDefaultPrivate(user, MY_OWN_FILE_TXT)) + ).hasContent("Hello 3"); + + // but if we specify file version - we get content for it: + assertThat(defaultDatasafeServices.privateService().read( + ReadRequest.forDefaultPrivateWithVersion(user, MY_OWN_FILE_TXT, new StorageVersion(version1))) + ).hasContent("Hello 1"); + // END_SNIPPET + + log.debug("version 1 " + version1); + log.debug("version 2 " + version2); + log.debug("version 3 " + version3); + assertThat(defaultDatasafeServices.privateService().list(ListRequest.forDefaultPrivate(user, ""))).hasSize(1); + assertThat(version1.equals(version2)).isFalse(); + assertThat(version1.equals(version3)).isFalse(); + } + + /** + * Example of how to remove specific version id + */ + @Test + @SneakyThrows + void removeSpecificVersionId() { + // BEGIN_SNIPPET:Versioned storage support - removing specific version + // creating new user + UserIDAuth user = registerUser("john"); + + // writing data to my/own/file.txt 2 times with different content: + String versionId = writeToPrivate(user, MY_OWN_FILE_TXT, "Hello 1"); + writeToPrivate(user, MY_OWN_FILE_TXT, "Hello 2"); + + // now, we read old file version + assertThat(defaultDatasafeServices.privateService().read( + ReadRequest.forDefaultPrivateWithVersion(user, MY_OWN_FILE_TXT, new StorageVersion(versionId))) + ).hasContent("Hello 1"); + + // now, we remove old file version + defaultDatasafeServices.privateService().remove( + RemoveRequest.forDefaultPrivateWithVersion(user, MY_OWN_FILE_TXT, new StorageVersion(versionId)) + ); + + // it is removed from storage, so when we read it we get exception + assertThrows(AmazonS3Exception.class, () -> defaultDatasafeServices.privateService().read( + ReadRequest.forDefaultPrivateWithVersion(user, MY_OWN_FILE_TXT, new StorageVersion(versionId))) + ); + + // but latest file version is still available + assertThat(defaultDatasafeServices.privateService().read( + ReadRequest.forDefaultPrivate(user, MY_OWN_FILE_TXT)) + ).hasContent("Hello 2"); + // END_SNIPPET + } + + @SneakyThrows + private String writeToPrivate(UserIDAuth user, String path, String fileContent) { + AtomicReference version = new AtomicReference<>(); + try (OutputStream os = defaultDatasafeServices.privateService() + .write(WriteRequest.forDefaultPrivate(user, path) + .toBuilder() + .callback((PhysicalVersionCallback) version::set) + .build()) + ) { + os.write(fileContent.getBytes(StandardCharsets.UTF_8)); + } + + return version.get(); + } + + private UserIDAuth registerUser(String username) { + UserIDAuth creds = new UserIDAuth(username, ("passwrd" + username)::toCharArray); + defaultDatasafeServices.userProfile().registerUsingDefaults(creds); + return creds; + } + + @SneakyThrows + private static String getDockerUri(String defaultUri) { + String dockerHost = System.getenv("DOCKER_HOST"); + if (dockerHost == null) { + return defaultUri; + } + + URI dockerUri = new URI(dockerHost); + return "http://" + dockerUri.getHost(); + } +} From d2c14e1ef9664e4d4843cc7730206477dcd2c7c3 Mon Sep 17 00:00:00 2001 From: Awambeng Date: Thu, 11 Apr 2024 13:33:27 +0100 Subject: [PATCH 11/28] Update datasafe-simple-adapter-spring test files to distinguish unit and integration test --- .../adapter/spring/InjectionForMinioIT.java | 48 ++++++++ .../simple/adapter/spring/InjectionIT.java | 116 ++++++++++++++++++ ...nWithoutPathEncryptionForFilesystemIT.java | 42 +++++++ ...ectionWithoutPathEncryptionForMinioIT.java | 49 ++++++++ 4 files changed, 255 insertions(+) create mode 100644 datasafe-simple-adapter/datasafe-simple-adapter-spring/src/test/java/de/adorsys/datasafe/simple/adapter/spring/InjectionForMinioIT.java create mode 100644 datasafe-simple-adapter/datasafe-simple-adapter-spring/src/test/java/de/adorsys/datasafe/simple/adapter/spring/InjectionIT.java create mode 100644 datasafe-simple-adapter/datasafe-simple-adapter-spring/src/test/java/de/adorsys/datasafe/simple/adapter/spring/InjectionWithoutPathEncryptionForFilesystemIT.java create mode 100644 datasafe-simple-adapter/datasafe-simple-adapter-spring/src/test/java/de/adorsys/datasafe/simple/adapter/spring/InjectionWithoutPathEncryptionForMinioIT.java diff --git a/datasafe-simple-adapter/datasafe-simple-adapter-spring/src/test/java/de/adorsys/datasafe/simple/adapter/spring/InjectionForMinioIT.java b/datasafe-simple-adapter/datasafe-simple-adapter-spring/src/test/java/de/adorsys/datasafe/simple/adapter/spring/InjectionForMinioIT.java new file mode 100644 index 000000000..92dac7b94 --- /dev/null +++ b/datasafe-simple-adapter/datasafe-simple-adapter-spring/src/test/java/de/adorsys/datasafe/simple/adapter/spring/InjectionForMinioIT.java @@ -0,0 +1,48 @@ +package de.adorsys.datasafe.simple.adapter.spring; + +import de.adorsys.datasafe.simple.adapter.api.SimpleDatasafeService; +import de.adorsys.datasafe.simple.adapter.spring.annotations.UseDatasafeSpringConfiguration; +import de.adorsys.datasafe.simple.adapter.spring.factory.SpringSimpleDatasafeServiceFactory; +import de.adorsys.datasafe.simple.adapter.spring.properties.SpringDFSCredentialProperties; +import de.adorsys.datasafe.simple.adapter.spring.properties.SpringDatasafeEncryptionProperties; +import de.adorsys.datasafe.teststorage.WithStorageProvider; +import lombok.extern.slf4j.Slf4j; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.context.ActiveProfiles; + +import java.util.stream.Stream; + + +@Slf4j +@ActiveProfiles("minio") +@UseDatasafeSpringConfiguration +public class InjectionForMinioIT extends InjectionIT { + + @Autowired + private SpringDFSCredentialProperties dfsCredentialProperties; + + @Autowired + private SpringDatasafeEncryptionProperties encryptionProperties; + + @BeforeAll + static void startMinio() { + minio().getStorageService().get(); + System.setProperty("MINIO_URL", minio().getMappedUrl()); + } + + private static Stream minioonly() { + return Stream.of(minio()); + } + + @ParameterizedTest + @MethodSource("minioonly") + public void plainService(WithStorageProvider.StorageDescriptor descriptor) { + log.info("descriptor is " + descriptor.getName()); + SpringSimpleDatasafeServiceFactory springSimpleDatasafeServiceFactory = new SpringSimpleDatasafeServiceFactory(SpringPropertiesToDFSCredentialsUtil.dfsCredentials(dfsCredentialProperties), encryptionProperties); + SimpleDatasafeService service = springSimpleDatasafeServiceFactory.getSimpleDataSafeServiceWithSubdir("subdir"); + testCreateUser(service); + } +} diff --git a/datasafe-simple-adapter/datasafe-simple-adapter-spring/src/test/java/de/adorsys/datasafe/simple/adapter/spring/InjectionIT.java b/datasafe-simple-adapter/datasafe-simple-adapter-spring/src/test/java/de/adorsys/datasafe/simple/adapter/spring/InjectionIT.java new file mode 100644 index 000000000..76b2c0505 --- /dev/null +++ b/datasafe-simple-adapter/datasafe-simple-adapter-spring/src/test/java/de/adorsys/datasafe/simple/adapter/spring/InjectionIT.java @@ -0,0 +1,116 @@ +package de.adorsys.datasafe.simple.adapter.spring; + +import de.adorsys.datasafe.encrypiton.api.types.UserID; +import de.adorsys.datasafe.encrypiton.api.types.UserIDAuth; +import de.adorsys.datasafe.simple.adapter.api.SimpleDatasafeService; +import de.adorsys.datasafe.simple.adapter.api.types.AmazonS3DFSCredentials; +import de.adorsys.datasafe.simple.adapter.api.types.DFSCredentials; +import de.adorsys.datasafe.simple.adapter.api.types.DSDocument; +import de.adorsys.datasafe.simple.adapter.api.types.DocumentContent; +import de.adorsys.datasafe.simple.adapter.api.types.DocumentFQN; +import de.adorsys.datasafe.simple.adapter.api.types.FilesystemDFSCredentials; +import de.adorsys.datasafe.simple.adapter.impl.SimpleDatasafeServiceImpl; +import de.adorsys.datasafe.simple.adapter.spring.annotations.UseDatasafeSpringConfiguration; +import de.adorsys.datasafe.teststorage.WithStorageProvider; +import de.adorsys.datasafe.types.api.resource.AbsoluteLocation; +import de.adorsys.datasafe.types.api.resource.BasePrivateResource; +import de.adorsys.datasafe.types.api.resource.PrivateResource; +import de.adorsys.datasafe.types.api.resource.ResolvedResource; +import de.adorsys.datasafe.types.api.types.ReadKeyPassword; +import de.adorsys.datasafe.types.api.utils.ReadKeyPasswordTestFactory; +import lombok.SneakyThrows; +import lombok.extern.slf4j.Slf4j; +import org.jetbrains.annotations.Nullable; +import org.junit.jupiter.api.extension.ExtendWith; +import org.springframework.boot.SpringBootConfiguration; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit.jupiter.SpringExtension; +import org.testcontainers.shaded.org.apache.commons.io.IOUtils; + +import java.io.InputStream; +import java.io.StringWriter; +import java.net.URI; +import java.nio.file.FileSystems; +import java.nio.file.Path; +import java.util.Optional; +import java.util.stream.Stream; + +import static java.nio.charset.StandardCharsets.UTF_8; +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.Assert.assertFalse; +import static org.junit.jupiter.api.Assertions.assertEquals; + +@Slf4j +@SpringBootTest +@ExtendWith(SpringExtension.class) +@ContextConfiguration +@SpringBootConfiguration +@UseDatasafeSpringConfiguration +public class InjectionIT extends WithStorageProvider { + + public void testCreateUser(SimpleDatasafeService datasafeService) { + assertThat(datasafeService).isNotNull(); + UserID userid = new UserID("peter"); + ReadKeyPassword password = ReadKeyPasswordTestFactory.getForString("password"); + UserIDAuth userIDAuth = new UserIDAuth(userid, password); + assertThat(datasafeService.userExists(userid)).isFalse(); + datasafeService.createUser(userIDAuth); + assertThat(datasafeService.userExists(userid)).isTrue(); + datasafeService.destroyUser(userIDAuth); + } + + @SneakyThrows + void testWithoutPathEncryption(SimpleDatasafeService simpleDatasafeServiceApi, DFSCredentials dfsCredentials) { + if (!(simpleDatasafeServiceApi instanceof SimpleDatasafeServiceImpl)) { + throw new TestException("Did expect instance of SimpleDatasafeServiceImpl"); + } + AbsoluteLocation rootLocation = getPrivateResourceAbsoluteLocation(dfsCredentials); + SimpleDatasafeServiceImpl simpleDatasafeService = (SimpleDatasafeServiceImpl) simpleDatasafeServiceApi; + + UserIDAuth userIDAuth = new UserIDAuth(new UserID("peter"), ReadKeyPasswordTestFactory.getForString("password")); + String content = "content of document"; + String path = "a/b/c.txt"; + DSDocument document = new DSDocument(new DocumentFQN(path), new DocumentContent(content.getBytes())); + simpleDatasafeService.createUser(userIDAuth); + simpleDatasafeService.storeDocument(userIDAuth, document); + + try (Stream> absoluteLocationStream = simpleDatasafeService.getStorageService().list(rootLocation)) { + assertEquals(1, absoluteLocationStream.filter(el -> el.location().toASCIIString().contains(path)).count()); + } + try (Stream> absoluteLocationStream = simpleDatasafeService.getStorageService().list(rootLocation)) { + Optional> first = absoluteLocationStream.filter(el -> el.location().toASCIIString().contains(path)).findFirst(); + if (!first.isPresent()) { + throw new TestException("expeceted absoluteLocatinn stream to have at least one element"); + } + + try (InputStream read = simpleDatasafeService.getStorageService().read(first.get())) { + StringWriter writer = new StringWriter(); + IOUtils.copy(read, writer, UTF_8); + assertFalse(writer.toString().equals(content)); + } + } + simpleDatasafeService.destroyUser(userIDAuth); + } + + @Nullable + @SneakyThrows + private AbsoluteLocation getPrivateResourceAbsoluteLocation(DFSCredentials dfsCredentials) { + if (dfsCredentials instanceof FilesystemDFSCredentials) { + String root = ((FilesystemDFSCredentials) dfsCredentials).getRoot(); + Path listpath = FileSystems.getDefault().getPath(root); + return new AbsoluteLocation<>(BasePrivateResource.forPrivate(listpath.toUri())); + } + if (dfsCredentials instanceof AmazonS3DFSCredentials) { + AmazonS3DFSCredentials a = (AmazonS3DFSCredentials) dfsCredentials; + return new AbsoluteLocation<>(BasePrivateResource.forPrivate(new URI(a.getUrl() + "/" + a.getRootBucket()))); + } + throw new TestException("NYI"); + } + + static class TestException extends RuntimeException { + public TestException(String message) { + super(message); + } + } +} diff --git a/datasafe-simple-adapter/datasafe-simple-adapter-spring/src/test/java/de/adorsys/datasafe/simple/adapter/spring/InjectionWithoutPathEncryptionForFilesystemIT.java b/datasafe-simple-adapter/datasafe-simple-adapter-spring/src/test/java/de/adorsys/datasafe/simple/adapter/spring/InjectionWithoutPathEncryptionForFilesystemIT.java new file mode 100644 index 000000000..f7ab930ac --- /dev/null +++ b/datasafe-simple-adapter/datasafe-simple-adapter-spring/src/test/java/de/adorsys/datasafe/simple/adapter/spring/InjectionWithoutPathEncryptionForFilesystemIT.java @@ -0,0 +1,42 @@ +package de.adorsys.datasafe.simple.adapter.spring; + +import de.adorsys.datasafe.simple.adapter.api.SimpleDatasafeService; +import de.adorsys.datasafe.simple.adapter.api.types.DFSCredentials; +import de.adorsys.datasafe.simple.adapter.spring.annotations.UseDatasafeSpringConfiguration; +import de.adorsys.datasafe.simple.adapter.spring.factory.SpringSimpleDatasafeServiceFactory; +import de.adorsys.datasafe.simple.adapter.spring.properties.SpringDFSCredentialProperties; +import de.adorsys.datasafe.simple.adapter.spring.properties.SpringDatasafeEncryptionProperties; +import de.adorsys.datasafe.teststorage.WithStorageProvider; +import lombok.extern.slf4j.Slf4j; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.context.ActiveProfiles; + +import java.util.stream.Stream; + +@Slf4j +@ActiveProfiles("fs-withoutPathEncryption") +@UseDatasafeSpringConfiguration +public class InjectionWithoutPathEncryptionForFilesystemIT extends InjectionIT { + @Autowired + private SpringDFSCredentialProperties dfsCredentialProperties; + + @Autowired + private SpringDatasafeEncryptionProperties encryptionProperties; + + private static Stream fsonly() { + return Stream.of(fs()); + } + + @ParameterizedTest + @MethodSource("fsonly") + public void plainService(WithStorageProvider.StorageDescriptor descriptor) { + log.info("descriptor is {}", descriptor.getName()); + DFSCredentials dfsCredentials = SpringPropertiesToDFSCredentialsUtil.dfsCredentials(dfsCredentialProperties); + SpringSimpleDatasafeServiceFactory springSimpleDatasafeServiceFactory = new SpringSimpleDatasafeServiceFactory(dfsCredentials, encryptionProperties); + SimpleDatasafeService service = springSimpleDatasafeServiceFactory.getSimpleDataSafeServiceWithSubdir("subdir"); + testWithoutPathEncryption(service, dfsCredentials); + } + +} diff --git a/datasafe-simple-adapter/datasafe-simple-adapter-spring/src/test/java/de/adorsys/datasafe/simple/adapter/spring/InjectionWithoutPathEncryptionForMinioIT.java b/datasafe-simple-adapter/datasafe-simple-adapter-spring/src/test/java/de/adorsys/datasafe/simple/adapter/spring/InjectionWithoutPathEncryptionForMinioIT.java new file mode 100644 index 000000000..e97aad298 --- /dev/null +++ b/datasafe-simple-adapter/datasafe-simple-adapter-spring/src/test/java/de/adorsys/datasafe/simple/adapter/spring/InjectionWithoutPathEncryptionForMinioIT.java @@ -0,0 +1,49 @@ +package de.adorsys.datasafe.simple.adapter.spring; + +import de.adorsys.datasafe.simple.adapter.api.SimpleDatasafeService; +import de.adorsys.datasafe.simple.adapter.api.types.DFSCredentials; +import de.adorsys.datasafe.simple.adapter.spring.annotations.UseDatasafeSpringConfiguration; +import de.adorsys.datasafe.simple.adapter.spring.factory.SpringSimpleDatasafeServiceFactory; +import de.adorsys.datasafe.simple.adapter.spring.properties.SpringDFSCredentialProperties; +import de.adorsys.datasafe.simple.adapter.spring.properties.SpringDatasafeEncryptionProperties; +import de.adorsys.datasafe.teststorage.WithStorageProvider; +import lombok.extern.slf4j.Slf4j; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.context.ActiveProfiles; + +import java.util.stream.Stream; + +@Slf4j +@ActiveProfiles("minio-withoutPathEncryption") +@UseDatasafeSpringConfiguration +public class InjectionWithoutPathEncryptionForMinioIT extends InjectionIT { + @Autowired + private SpringDFSCredentialProperties dfsCredentialProperties; + + @Autowired + private SpringDatasafeEncryptionProperties encryptionProperties; + + @BeforeAll + static void startMinio() { + minio().getStorageService().get(); + System.setProperty("MINIO_URL", minio().getMappedUrl()); + } + + private static Stream minioonly() { + return Stream.of(minio()); + } + + @ParameterizedTest + @MethodSource("minioonly") + public void plainService(WithStorageProvider.StorageDescriptor descriptor) { + log.info("descriptor is {}", descriptor.getName()); + DFSCredentials dfsCredentials = SpringPropertiesToDFSCredentialsUtil.dfsCredentials(dfsCredentialProperties); + SpringSimpleDatasafeServiceFactory springSimpleDatasafeServiceFactory = new SpringSimpleDatasafeServiceFactory(dfsCredentials, encryptionProperties); + SimpleDatasafeService service = springSimpleDatasafeServiceFactory.getSimpleDataSafeServiceWithSubdir("subdir"); + testWithoutPathEncryption(service, dfsCredentials); + } + +} From c38600cacb73f8b3c5fc2597d6b234f59baa643f Mon Sep 17 00:00:00 2001 From: Elwizzy12 Date: Thu, 11 Apr 2024 13:35:53 +0100 Subject: [PATCH 12/28] 293-rename-datasafe-business-integration-test-files-for-clear-separation --- ...ityTest.java => BasicFunctionalityIT.java} | 2 +- ...est.java => BasicFunctionalityUtf8IT.java} | 2 +- ... BasicFunctionalityWithConcurrencyIT.java} | 2 +- ...sicFunctionalityWithPasswordChangeIT.java} | 2 +- ...st.java => DataTamperingResistanceIT.java} | 2 +- ...reTest.java => KeyStoreTypeCompareIT.java} | 2 +- ...Test.java => MultiDFSFunctionalityIT.java} | 2 +- ...ationTest.java => SchemeDelegationIT.java} | 46 +++++++++---------- ...est.java => SchemeDelegationWithDbIT.java} | 2 +- ...est.java => StorageBasedVersioningIT.java} | 2 +- ...f8Test.java => UserProfileWithUtf8IT.java} | 2 +- ...onedDataTest.java => VersionedDataIT.java} | 2 +- 12 files changed, 34 insertions(+), 34 deletions(-) rename datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/{BasicFunctionalityTest.java => BasicFunctionalityIT.java} (99%) rename datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/{BasicFunctionalityUtf8Test.java => BasicFunctionalityUtf8IT.java} (99%) rename datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/{BasicFunctionalityWithConcurrencyTest.java => BasicFunctionalityWithConcurrencyIT.java} (99%) rename datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/{BasicFunctionalityWithPasswordChangeTest.java => BasicFunctionalityWithPasswordChangeIT.java} (99%) rename datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/{DataTamperingResistanceTest.java => DataTamperingResistanceIT.java} (99%) rename datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/{KeyStoreTypeCompareTest.java => KeyStoreTypeCompareIT.java} (98%) rename datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/{MultiDFSFunctionalityTest.java => MultiDFSFunctionalityIT.java} (99%) rename datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/{SchemeDelegationTest.java => SchemeDelegationIT.java} (81%) rename datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/{SchemeDelegationWithDbTest.java => SchemeDelegationWithDbIT.java} (98%) rename datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/{StorageBasedVersioningTest.java => StorageBasedVersioningIT.java} (98%) rename datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/{UserProfileWithUtf8Test.java => UserProfileWithUtf8IT.java} (98%) rename datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/{VersionedDataTest.java => VersionedDataIT.java} (99%) diff --git a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BasicFunctionalityTest.java b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BasicFunctionalityIT.java similarity index 99% rename from datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BasicFunctionalityTest.java rename to datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BasicFunctionalityIT.java index 8ee49c217..4139e2a73 100644 --- a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BasicFunctionalityTest.java +++ b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BasicFunctionalityIT.java @@ -47,7 +47,7 @@ * Tests that validates basic functionality - storing data to inbox, privatespace, listing files, etc. */ @Slf4j -class BasicFunctionalityTest extends BaseE2ETest { +class BasicFunctionalityIT extends BaseE2ETest { private static final int LARGE_SIZE = 10 * 1024 * 1024 + 100; diff --git a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BasicFunctionalityUtf8Test.java b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BasicFunctionalityUtf8IT.java similarity index 99% rename from datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BasicFunctionalityUtf8Test.java rename to datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BasicFunctionalityUtf8IT.java index 7d9c233c1..5b2697852 100644 --- a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BasicFunctionalityUtf8Test.java +++ b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BasicFunctionalityUtf8IT.java @@ -15,7 +15,7 @@ * Tests that validates basic functionality - storing data to inbox, privatespace, listing files, etc. using UTF-8 paths. */ @Slf4j -class BasicFunctionalityUtf8Test extends BaseE2ETest { +class BasicFunctionalityUtf8IT extends BaseE2ETest { private static final String MESSAGE_ONE = "Hello here 1"; private static final String FOLDER = "folder1"; diff --git a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BasicFunctionalityWithConcurrencyTest.java b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BasicFunctionalityWithConcurrencyIT.java similarity index 99% rename from datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BasicFunctionalityWithConcurrencyTest.java rename to datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BasicFunctionalityWithConcurrencyIT.java index 7a219bf06..238fff129 100644 --- a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BasicFunctionalityWithConcurrencyTest.java +++ b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BasicFunctionalityWithConcurrencyIT.java @@ -56,7 +56,7 @@ * Multithreaded test of basic operations. */ @Slf4j -class BasicFunctionalityWithConcurrencyTest extends BaseE2ETest { +class BasicFunctionalityWithConcurrencyIT extends BaseE2ETest { private static final int TIMEOUT_S = 30; diff --git a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BasicFunctionalityWithPasswordChangeTest.java b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BasicFunctionalityWithPasswordChangeIT.java similarity index 99% rename from datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BasicFunctionalityWithPasswordChangeTest.java rename to datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BasicFunctionalityWithPasswordChangeIT.java index e970bcd3c..ad5f3c320 100644 --- a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BasicFunctionalityWithPasswordChangeTest.java +++ b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BasicFunctionalityWithPasswordChangeIT.java @@ -28,7 +28,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertThrows; -class BasicFunctionalityWithPasswordChangeTest extends BaseE2ETest { +class BasicFunctionalityWithPasswordChangeIT extends BaseE2ETest { @SneakyThrows @ParameterizedTest diff --git a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/DataTamperingResistanceTest.java b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/DataTamperingResistanceIT.java similarity index 99% rename from datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/DataTamperingResistanceTest.java rename to datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/DataTamperingResistanceIT.java index 9fcedfe97..202f3ef83 100644 --- a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/DataTamperingResistanceTest.java +++ b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/DataTamperingResistanceIT.java @@ -38,7 +38,7 @@ * attacker is unable to modify encrypted text without being detected. */ @Slf4j -class DataTamperingResistanceTest extends BaseE2ETest { +class DataTamperingResistanceIT extends BaseE2ETest { private static final Set NOT_TO_REPLACE_IN_PATH = ImmutableSet.of('=', '/'); diff --git a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/KeyStoreTypeCompareTest.java b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/KeyStoreTypeCompareIT.java similarity index 98% rename from datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/KeyStoreTypeCompareTest.java rename to datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/KeyStoreTypeCompareIT.java index 76e75fcc4..24672c5ba 100644 --- a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/KeyStoreTypeCompareTest.java +++ b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/KeyStoreTypeCompareIT.java @@ -24,7 +24,7 @@ import static org.assertj.core.api.Assertions.assertThat; @Slf4j -public class KeyStoreTypeCompareTest extends BaseE2ETest { +public class KeyStoreTypeCompareIT extends BaseE2ETest { private final static int NUMBER_WRITES = 100; private final static int NUMBER_READS = 100; diff --git a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/MultiDFSFunctionalityTest.java b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/MultiDFSFunctionalityIT.java similarity index 99% rename from datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/MultiDFSFunctionalityTest.java rename to datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/MultiDFSFunctionalityIT.java index a4e5830b8..c58607ac9 100644 --- a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/MultiDFSFunctionalityTest.java +++ b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/MultiDFSFunctionalityIT.java @@ -70,7 +70,7 @@ * access `credentialsBucket` that has user profile and his storage access keystore. */ @Slf4j -class MultiDFSFunctionalityTest extends BaseMockitoTest { +class MultiDFSFunctionalityIT extends BaseMockitoTest { private static final String REGION = "eu-central-1"; private static final String LOCALHOST = getDockerUri("http://127.0.0.1"); diff --git a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/SchemeDelegationTest.java b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/SchemeDelegationIT.java similarity index 81% rename from datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/SchemeDelegationTest.java rename to datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/SchemeDelegationIT.java index f6396957e..b8977d334 100644 --- a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/SchemeDelegationTest.java +++ b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/SchemeDelegationIT.java @@ -32,32 +32,32 @@ import static org.assertj.core.api.Assertions.assertThat; -class SchemeDelegationTest extends WithStorageProvider { - - private Path fsPath; - private Uri minioPath; - private StorageService minio; - private StorageService filesystem; - private DefaultDatasafeServices datasafeServices; - - @BeforeEach - void initialize(@TempDir Path tempDir) { - WithStorageProvider.StorageDescriptor minioDescriptor = minio(); - this.fsPath = tempDir; - this.minio = minioDescriptor.getStorageService().get(); - this.filesystem = new FileSystemStorageService(tempDir); - this.minioPath = minioDescriptor.getLocation(); - StorageService multiDfs = new SchemeDelegatingStorage( - ImmutableMap.of( - "s3", minio, - "file", filesystem - ) - ); - this.datasafeServices = DaggerDefaultDatasafeServices .builder() .config(new ProfilesOnFsDataOnMinio(minioPath, tempDir)) - .storage(multiDfs) + + class SchemeDelegationTest extends WithStorageProvider { + + private Path fsPath; + private Uri minioPath; + private StorageService minio; + private StorageService filesystem; + private DefaultDatasafeServices datasafeServices; + + @BeforeEach + void initialize(@TempDir Path tempDir) { + WithStorageProvider.StorageDescriptor minioDescriptor = minio(); + this.fsPath = tempDir; + this.minio = minioDescriptor.getStorageService().get(); + this.filesystem = new FileSystemStorageService(tempDir); + this.minioPath = minioDescriptor.getLocation(); + StorageService multiDfs = new SchemeDelegatingStorage( + ImmutableMap.of( + "s3", minio, + "file", filesystem + ) + ); + .storage(multiDfs) .build(); } diff --git a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/SchemeDelegationWithDbTest.java b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/SchemeDelegationWithDbIT.java similarity index 98% rename from datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/SchemeDelegationWithDbTest.java rename to datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/SchemeDelegationWithDbIT.java index 21a0b0397..59f526289 100644 --- a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/SchemeDelegationWithDbTest.java +++ b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/SchemeDelegationWithDbIT.java @@ -38,7 +38,7 @@ import static de.adorsys.datasafe.types.api.global.PathEncryptionId.AES_SIV; import static org.assertj.core.api.Assertions.assertThat; -class SchemeDelegationWithDbTest extends WithStorageProvider { +class SchemeDelegationWithDbIT extends WithStorageProvider { private static final Set ALLOWED_TABLES = ImmutableSet.of("users", "private_profiles", "public_profiles"); diff --git a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/StorageBasedVersioningTest.java b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/StorageBasedVersioningIT.java similarity index 98% rename from datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/StorageBasedVersioningTest.java rename to datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/StorageBasedVersioningIT.java index f82960a16..4da2b6b51 100644 --- a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/StorageBasedVersioningTest.java +++ b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/StorageBasedVersioningIT.java @@ -25,7 +25,7 @@ import static org.junit.jupiter.api.Assertions.assertThrows; @DisabledIfSystemProperty(named = WithStorageProvider.SKIP_CEPH, matches = "true") -class StorageBasedVersioningTest extends BaseE2ETest { +class StorageBasedVersioningIT extends BaseE2ETest { private static final String FILE = "file.txt"; diff --git a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/UserProfileWithUtf8Test.java b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/UserProfileWithUtf8IT.java similarity index 98% rename from datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/UserProfileWithUtf8Test.java rename to datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/UserProfileWithUtf8IT.java index eebdc6f71..4a71a3cc1 100644 --- a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/UserProfileWithUtf8Test.java +++ b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/UserProfileWithUtf8IT.java @@ -32,7 +32,7 @@ import static de.adorsys.datasafe.types.api.shared.Dirs.computeRelativePreventingDoubleUrlEncode; import static org.assertj.core.api.Assertions.assertThat; -class UserProfileWithUtf8Test extends WithStorageProvider { +class UserProfileWithUtf8IT extends WithStorageProvider { private Path fsPath; private Uri minioPath; diff --git a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/VersionedDataTest.java b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/VersionedDataIT.java similarity index 99% rename from datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/VersionedDataTest.java rename to datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/VersionedDataIT.java index d331737e1..f791a6c87 100644 --- a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/VersionedDataTest.java +++ b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/VersionedDataIT.java @@ -36,7 +36,7 @@ * Validates software versioned operations. */ @Slf4j -public class VersionedDataTest extends BaseE2ETest { +public class VersionedDataIT extends BaseE2ETest { private static final String MESSAGE_ONE = "Hello here 1"; private static final String MESSAGE_TWO = "Hello here 2"; From c1548d6ef50bc43e60edb876700d44f0fb4129f7 Mon Sep 17 00:00:00 2001 From: forkimenjeckayang Date: Thu, 11 Apr 2024 14:43:18 +0100 Subject: [PATCH 13/28] Renamed Duplicates(datasafe-examples):removed duplicate files --- .../MultiDfsWithCredentialsExampleTest.java | 255 ------------------ ...DefaultDatasafeOnVersionedStorageTest.java | 247 ----------------- 2 files changed, 502 deletions(-) delete mode 100644 datasafe-examples/datasafe-examples-multidfs/src/test/java/de/adorsys/datasafe/examples/business/s3/MultiDfsWithCredentialsExampleTest.java delete mode 100644 datasafe-examples/datasafe-examples-versioned-s3/src/test/java/de/adorsys/datasafe/examples/business/s3/BaseUserOperationsWithDefaultDatasafeOnVersionedStorageTest.java diff --git a/datasafe-examples/datasafe-examples-multidfs/src/test/java/de/adorsys/datasafe/examples/business/s3/MultiDfsWithCredentialsExampleTest.java b/datasafe-examples/datasafe-examples-multidfs/src/test/java/de/adorsys/datasafe/examples/business/s3/MultiDfsWithCredentialsExampleTest.java deleted file mode 100644 index cf779ff93..000000000 --- a/datasafe-examples/datasafe-examples-multidfs/src/test/java/de/adorsys/datasafe/examples/business/s3/MultiDfsWithCredentialsExampleTest.java +++ /dev/null @@ -1,255 +0,0 @@ -package de.adorsys.datasafe.examples.business.s3; - -import com.amazonaws.services.s3.AmazonS3; -import dagger.Lazy; -import de.adorsys.datasafe.business.impl.service.DaggerDefaultDatasafeServices; -import de.adorsys.datasafe.business.impl.service.DefaultDatasafeServices; -import de.adorsys.datasafe.directory.api.profile.keys.StorageKeyStoreOperations; -import de.adorsys.datasafe.directory.api.types.StorageCredentials; -import de.adorsys.datasafe.directory.api.types.UserPrivateProfile; -import de.adorsys.datasafe.directory.impl.profile.config.DFSConfigWithStorageCreds; -import de.adorsys.datasafe.directory.impl.profile.dfs.BucketAccessServiceImpl; -import de.adorsys.datasafe.directory.impl.profile.dfs.BucketAccessServiceImplRuntimeDelegatable; -import de.adorsys.datasafe.directory.impl.profile.dfs.RegexAccessServiceWithStorageCredentialsImpl; -import de.adorsys.datasafe.encrypiton.api.types.UserIDAuth; -import de.adorsys.datasafe.storage.api.RegexDelegatingStorage; -import de.adorsys.datasafe.storage.api.StorageService; -import de.adorsys.datasafe.storage.api.UriBasedAuthStorageService; -import de.adorsys.datasafe.storage.impl.s3.S3ClientFactory; -import de.adorsys.datasafe.storage.impl.s3.S3StorageService; -import de.adorsys.datasafe.types.api.actions.ReadRequest; -import de.adorsys.datasafe.types.api.actions.WriteRequest; -import de.adorsys.datasafe.types.api.context.BaseOverridesRegistry; -import de.adorsys.datasafe.types.api.context.overrides.OverridesRegistry; -import de.adorsys.datasafe.types.api.resource.AbsoluteLocation; -import de.adorsys.datasafe.types.api.resource.BasePrivateResource; -import de.adorsys.datasafe.types.api.resource.StorageIdentifier; -import de.adorsys.datasafe.types.api.shared.AwsClientRetry; -import de.adorsys.datasafe.types.api.utils.ExecutorServiceUtil; -import lombok.SneakyThrows; -import lombok.experimental.Delegate; -import lombok.extern.slf4j.Slf4j; -import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; -import org.testcontainers.containers.GenericContainer; -import org.testcontainers.containers.wait.strategy.Wait; -import org.testcontainers.shaded.com.google.common.collect.ImmutableMap; - -import java.io.OutputStream; -import java.net.URI; -import java.nio.charset.StandardCharsets; -import java.util.Arrays; -import java.util.EnumMap; -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.ExecutorService; -import java.util.regex.Pattern; - -import static de.adorsys.datasafe.examples.business.s3.MinioContainerId.DIRECTORY_BUCKET; -import static de.adorsys.datasafe.examples.business.s3.MinioContainerId.FILES_BUCKET_ONE; -import static de.adorsys.datasafe.examples.business.s3.MinioContainerId.FILES_BUCKET_TWO; -import static org.assertj.core.api.Assertions.assertThat; - -/** - * This example shows how client can register storage system and securely store its access details. - * Here, we will use 2 Datasafe class instances - one for securely storing user access credentials - * - configBucket and another is for accessing users' private files stored in - * filesBucketOne, filesBucketTwo. - */ -@Slf4j -class MultiDfsWithCredentialsExampleTest { - - private static final String REGION = "eu-central-1"; - private static final ExecutorService EXECUTOR = ExecutorServiceUtil.submitterExecutesOnStarvationExecutingService(4, 4); - - private static Map minios = new EnumMap<>(MinioContainerId.class); - private static AmazonS3 directoryClient = null; - private static Map endpointsByHost = new HashMap<>(); - - @BeforeAll - static void startup() { - // Create all required minio-backed S3 buckets: - Arrays.stream(MinioContainerId.values()).forEach(it -> { - GenericContainer minio = createAndStartMinio(it.getAccessKey(), it.getSecretKey()); - minios.put(it, minio); - - String endpoint = getDockerUri("http://127.0.0.1") + ":" + minio.getFirstMappedPort() + "/"; - endpointsByHost.put(it, endpoint + REGION + "/" + it.getBucketName() + "/"); - log.info("MINIO for {} is available at: {} with access: '{}'/'{}'", it, endpoint, it.getAccessKey(), - it.getSecretKey()); - - AmazonS3 client = S3ClientFactory.getClient( - endpoint, - REGION, - it.getAccessKey(), - it.getSecretKey() - ); - - AwsClientRetry.createBucketWithRetry(client, it.getBucketName()); - - if (it.equals(DIRECTORY_BUCKET)) { - directoryClient = client; - } - }); - } - - @AfterAll - static void shutdown() { - minios.values().forEach(GenericContainer::stop); - } - - @Test - @SneakyThrows - void testMultiUserStorageUserSetup() { - // BEGIN_SNIPPET:Datasafe with multi-dfs setup - String directoryBucketS3Uri = "s3://" + DIRECTORY_BUCKET.getBucketName() + "/"; - // static client that will be used to access `directory` bucket: - StorageService directoryStorage = new S3StorageService( - directoryClient, - DIRECTORY_BUCKET.getBucketName(), - EXECUTOR - ); - - OverridesRegistry registry = new BaseOverridesRegistry(); - DefaultDatasafeServices multiDfsDatasafe = DaggerDefaultDatasafeServices - .builder() - .config(new DFSConfigWithStorageCreds(directoryBucketS3Uri, "PAZZWORT"::toCharArray)) - // This storage service will route requests to proper bucket based on URI content: - // URI with directoryBucket to `directoryStorage` - // URI with filesBucketOne will get dynamically generated S3Storage - // URI with filesBucketTwo will get dynamically generated S3Storage - .storage( - new RegexDelegatingStorage( - ImmutableMap.builder() - // bind URI that contains `directoryBucket` to directoryStorage - .put(Pattern.compile(directoryBucketS3Uri + ".+"), directoryStorage) - .put( - Pattern.compile(getDockerUri("http://127.0.0.1") + ".+"), - // Dynamically creates S3 client with bucket name equal to host value - new UriBasedAuthStorageService( - acc -> new S3StorageService( - S3ClientFactory.getClient( - acc.getEndpoint(), - acc.getRegion(), - acc.getAccessKey(), - acc.getSecretKey() - ), - // Bucket name is encoded in first path segment - acc.getBucketName(), - EXECUTOR - ) - ) - ).build() - ) - ) - .overridesRegistry(registry) - .build(); - // Instead of default BucketAccessService we will use service that reads storage access credentials from - // keystore - BucketAccessServiceImplRuntimeDelegatable.overrideWith( - registry, args -> new WithCredentialProvider(args.getStorageKeyStoreOperations()) - ); - - // John will have all his private files stored on `filesBucketOne` and `filesBucketOne`. - // Depending on path of file - filesBucketOne or filesBucketTwo - requests will be routed to proper bucket. - // I.e. path filesBucketOne/path/to/file will end up in `filesBucketOne` with key path/to/file - // his profile and access credentials for `filesBucketOne` will be in `configBucket` - UserIDAuth john = new UserIDAuth("john", "secret"::toCharArray); - // Here, nothing expects John has own storage credentials: - multiDfsDatasafe.userProfile().registerUsingDefaults(john); - - // Tell system that John will use his own storage credentials - regex match: - StorageIdentifier bucketOne = new StorageIdentifier(endpointsByHost.get(FILES_BUCKET_ONE) + ".+"); - StorageIdentifier bucketTwo = new StorageIdentifier(endpointsByHost.get(FILES_BUCKET_TWO) + ".+"); - // Set location for John's credentials keystore and put storage credentials into it: - UserPrivateProfile profile = multiDfsDatasafe.userProfile().privateProfile(john); - profile.getPrivateStorage().put( - bucketOne, - new AbsoluteLocation<>(BasePrivateResource.forPrivate(endpointsByHost.get(FILES_BUCKET_ONE) + "/")) - ); - profile.getPrivateStorage().put( - bucketTwo, - new AbsoluteLocation<>(BasePrivateResource.forPrivate(endpointsByHost.get(FILES_BUCKET_TWO) + "/")) - ); - multiDfsDatasafe.userProfile().updatePrivateProfile(john, profile); - - // register John's DFS access for `filesBucketOne` minio bucket - multiDfsDatasafe.userProfile().registerStorageCredentials( - john, - bucketOne, - new StorageCredentials( - FILES_BUCKET_ONE.getAccessKey(), - FILES_BUCKET_ONE.getSecretKey() - ) - ); - // register John's DFS access for `filesBucketTwo` minio bucket - multiDfsDatasafe.userProfile().registerStorageCredentials( - john, - bucketTwo, - new StorageCredentials( - FILES_BUCKET_TWO.getAccessKey(), - FILES_BUCKET_TWO.getSecretKey() - ) - ); - - // Configuring multi-storage is done, user can use his multi-storage: - - // store this file on `filesBucketOne` - try (OutputStream os = multiDfsDatasafe.privateService() - .write(WriteRequest.forPrivate(john, bucketOne, "my/file.txt"))) { - os.write("Content on bucket number ONE".getBytes(StandardCharsets.UTF_8)); - } - - // store this file on `filesBucketTwo` - try (OutputStream os = multiDfsDatasafe.privateService() - .write(WriteRequest.forPrivate(john, bucketTwo, "my/file.txt"))) { - os.write("Content on bucket number TWO".getBytes(StandardCharsets.UTF_8)); - } - - // read file from `filesBucketOne` - assertThat(multiDfsDatasafe.privateService() - .read(ReadRequest.forPrivate(john, bucketOne, "my/file.txt")) - ).hasContent("Content on bucket number ONE"); - - // read file from `filesBucketTwo` - assertThat(multiDfsDatasafe.privateService() - .read(ReadRequest.forPrivate(john, bucketTwo, "my/file.txt")) - ).hasContent("Content on bucket number TWO"); - // END_SNIPPET - } - - private static GenericContainer createAndStartMinio(String accessKey, String secretKey) { - GenericContainer minioContainer = new GenericContainer("minio/minio") - .withExposedPorts(9000) - .withEnv("MINIO_ACCESS_KEY", accessKey) - .withEnv("MINIO_SECRET_KEY", secretKey) - .withCommand("server /data") - .waitingFor(Wait.defaultWaitStrategy()); - - minioContainer.start(); - return minioContainer; - } - - private static class WithCredentialProvider extends BucketAccessServiceImpl { - - @Delegate - private final RegexAccessServiceWithStorageCredentialsImpl delegate; - - private WithCredentialProvider(Lazy storageKeyStoreOperations) { - super(null); - this.delegate = new RegexAccessServiceWithStorageCredentialsImpl(storageKeyStoreOperations); - } - } - - @SneakyThrows - private static String getDockerUri(String defaultUri) { - String dockerHost = System.getenv("DOCKER_HOST"); - if (dockerHost == null) { - return defaultUri; - } - - URI dockerUri = new URI(dockerHost); - return "http://" + dockerUri.getHost(); - } -} diff --git a/datasafe-examples/datasafe-examples-versioned-s3/src/test/java/de/adorsys/datasafe/examples/business/s3/BaseUserOperationsWithDefaultDatasafeOnVersionedStorageTest.java b/datasafe-examples/datasafe-examples-versioned-s3/src/test/java/de/adorsys/datasafe/examples/business/s3/BaseUserOperationsWithDefaultDatasafeOnVersionedStorageTest.java deleted file mode 100644 index 0f41f74b9..000000000 --- a/datasafe-examples/datasafe-examples-versioned-s3/src/test/java/de/adorsys/datasafe/examples/business/s3/BaseUserOperationsWithDefaultDatasafeOnVersionedStorageTest.java +++ /dev/null @@ -1,247 +0,0 @@ -package de.adorsys.datasafe.examples.business.s3; - -import com.amazonaws.auth.AWSStaticCredentialsProvider; -import com.amazonaws.auth.BasicAWSCredentials; -import com.amazonaws.client.builder.AwsClientBuilder; -import com.amazonaws.services.s3.AmazonS3; -import com.amazonaws.services.s3.AmazonS3ClientBuilder; -import com.amazonaws.services.s3.model.AmazonS3Exception; -import com.amazonaws.services.s3.model.BucketVersioningConfiguration; -import com.amazonaws.services.s3.model.SetBucketVersioningConfigurationRequest; -import de.adorsys.datasafe.business.impl.service.DaggerDefaultDatasafeServices; -import de.adorsys.datasafe.business.impl.service.DefaultDatasafeServices; -import de.adorsys.datasafe.directory.impl.profile.config.DefaultDFSConfig; -import de.adorsys.datasafe.encrypiton.api.types.UserIDAuth; -import de.adorsys.datasafe.storage.impl.s3.S3StorageService; -import de.adorsys.datasafe.types.api.actions.ListRequest; -import de.adorsys.datasafe.types.api.actions.ReadRequest; -import de.adorsys.datasafe.types.api.actions.RemoveRequest; -import de.adorsys.datasafe.types.api.actions.WriteRequest; -import de.adorsys.datasafe.types.api.callback.PhysicalVersionCallback; -import de.adorsys.datasafe.types.api.resource.StorageVersion; -import de.adorsys.datasafe.types.api.utils.ExecutorServiceUtil; -import lombok.SneakyThrows; -import lombok.extern.slf4j.Slf4j; -import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.condition.DisabledIfSystemProperty; -import org.testcontainers.containers.GenericContainer; -import org.testcontainers.containers.wait.strategy.Wait; - -import java.io.OutputStream; -import java.net.URI; -import java.nio.charset.StandardCharsets; -import java.util.concurrent.atomic.AtomicReference; - -import static org.assertj.core.api.AssertionsForInterfaceTypes.assertThat; -import static org.junit.jupiter.api.Assertions.assertThrows; - -/** - * This test shows simplistic usage of Datasafe default services that reside on versioned storage system. - */ -@Slf4j -@DisabledIfSystemProperty(named = "SKIP_CEPH", matches = "true") -class BaseUserOperationsWithDefaultDatasafeOnVersionedStorageTest { - - private static final String MY_OWN_FILE_TXT = "my/own/file.txt"; - - private static final String VERSIONED_BUCKET_NAME = "home"; - private static final String ACCESS_KEY = "access"; - private static final String SECRET_KEY = "secret"; - - private static GenericContainer cephContainer; - private static AmazonS3 cephS3; - private static String cephMappedUrl; - - private DefaultDatasafeServices defaultDatasafeServices; - - /** - * This creates CEPH Rados gateway in docker container and creates S3 client for it. - */ - @BeforeAll - static void createServices() { - log.info("Starting CEPH"); - // Create CEPH container: - cephContainer = new GenericContainer("ceph/daemon") - .withExposedPorts(8000, 5000) - .withEnv("RGW_FRONTEND_PORT", "8000") - .withEnv("SREE_PORT", "5000") - .withEnv("DEBUG", "verbose") - .withEnv("CEPH_DEMO_UID", "nano") - .withEnv("MON_IP", "127.0.0.1") - .withEnv("CEPH_PUBLIC_NETWORK", "0.0.0.0/0") - .withEnv("CEPH_DAEMON", "demo") - .withEnv("DEMO_DAEMONS", "mon,mgr,osd,rgw") - .withEnv("CEPH_DEMO_ACCESS_KEY", ACCESS_KEY) - .withEnv("CEPH_DEMO_SECRET_KEY", SECRET_KEY) - .withCommand("mkdir -p /etc/ceph && mkdir -p /var/lib/ceph && /entrypoint.sh") - .waitingFor(Wait.defaultWaitStrategy()); - - cephContainer.start(); - Integer mappedPort = cephContainer.getMappedPort(8000); - // URL for S3 API/bucket root: - cephMappedUrl = getDockerUri("http://0.0.0.0") + ":" + mappedPort; - log.info("Ceph mapped URL: {}", cephMappedUrl); - cephS3 = AmazonS3ClientBuilder.standard() - .withEndpointConfiguration( - new AwsClientBuilder.EndpointConfiguration(cephMappedUrl, "us-east-1") - ) - .withCredentials( - new AWSStaticCredentialsProvider( - new BasicAWSCredentials(ACCESS_KEY, SECRET_KEY) - ) - ) - .enablePathStyleAccess() - .build(); - - // Create bucket in CEPH that will support versioning - cephS3.createBucket(VERSIONED_BUCKET_NAME); - cephS3.setBucketVersioningConfiguration( - new SetBucketVersioningConfigurationRequest( - VERSIONED_BUCKET_NAME, - new BucketVersioningConfiguration(BucketVersioningConfiguration.ENABLED) - ) - ); - - - } - - @AfterAll - static void stopCeph() { - cephContainer.stop(); - } - - @BeforeEach - void init() { - // this will create all Datasafe files and user documents under S3 bucket root, we assume that - // S3 versioned bucket was already created - defaultDatasafeServices = DaggerDefaultDatasafeServices.builder() - .config(new DefaultDFSConfig(cephMappedUrl, "secret"::toCharArray)) - .storage(new S3StorageService( - cephS3, - VERSIONED_BUCKET_NAME, - ExecutorServiceUtil.submitterExecutesOnStarvationExecutingService())) - .build(); - } - - /** - * S3 storage adapter supports sending back file version (if S3 storage returns it) when storing object to - * bucket and it allows reading object using its version too. - */ - @Test - @SneakyThrows - void writeFileThenReadLatestAndReadByVersion() { - // BEGIN_SNIPPET:Versioned storage support - writing file and reading back - // creating new user - UserIDAuth user = registerUser("john"); - - // writing data to my/own/file.txt 3 times with different content: - // 1st time, writing into my/own/file.txt: - // Expanded snippet of how to capture file version when writing object: - AtomicReference version = new AtomicReference<>(); - try (OutputStream os = defaultDatasafeServices.privateService() - .write(WriteRequest.forDefaultPrivate(user, MY_OWN_FILE_TXT) - .toBuilder() - .callback((PhysicalVersionCallback) version::set) - .build()) - ) { - // Initial version will contain "Hello 1": - os.write("Hello 1".getBytes(StandardCharsets.UTF_8)); - } - // this variable has our initial file version: - String version1 = version.get(); - - // Write 2 more times different data to same file - my/own/file.txt: - String version2 = writeToPrivate(user, MY_OWN_FILE_TXT, "Hello 2"); - // Last version will contain "Hello 3": - String version3 = writeToPrivate(user, MY_OWN_FILE_TXT, "Hello 3"); - - // now, when we read file without specifying version - we see latest file content: - assertThat(defaultDatasafeServices.privateService().read( - ReadRequest.forDefaultPrivate(user, MY_OWN_FILE_TXT)) - ).hasContent("Hello 3"); - - // but if we specify file version - we get content for it: - assertThat(defaultDatasafeServices.privateService().read( - ReadRequest.forDefaultPrivateWithVersion(user, MY_OWN_FILE_TXT, new StorageVersion(version1))) - ).hasContent("Hello 1"); - // END_SNIPPET - - log.debug("version 1 " + version1); - log.debug("version 2 " + version2); - log.debug("version 3 " + version3); - assertThat(defaultDatasafeServices.privateService().list(ListRequest.forDefaultPrivate(user, ""))).hasSize(1); - assertThat(version1.equals(version2)).isFalse(); - assertThat(version1.equals(version3)).isFalse(); - } - - /** - * Example of how to remove specific version id - */ - @Test - @SneakyThrows - void removeSpecificVersionId() { - // BEGIN_SNIPPET:Versioned storage support - removing specific version - // creating new user - UserIDAuth user = registerUser("john"); - - // writing data to my/own/file.txt 2 times with different content: - String versionId = writeToPrivate(user, MY_OWN_FILE_TXT, "Hello 1"); - writeToPrivate(user, MY_OWN_FILE_TXT, "Hello 2"); - - // now, we read old file version - assertThat(defaultDatasafeServices.privateService().read( - ReadRequest.forDefaultPrivateWithVersion(user, MY_OWN_FILE_TXT, new StorageVersion(versionId))) - ).hasContent("Hello 1"); - - // now, we remove old file version - defaultDatasafeServices.privateService().remove( - RemoveRequest.forDefaultPrivateWithVersion(user, MY_OWN_FILE_TXT, new StorageVersion(versionId)) - ); - - // it is removed from storage, so when we read it we get exception - assertThrows(AmazonS3Exception.class, () -> defaultDatasafeServices.privateService().read( - ReadRequest.forDefaultPrivateWithVersion(user, MY_OWN_FILE_TXT, new StorageVersion(versionId))) - ); - - // but latest file version is still available - assertThat(defaultDatasafeServices.privateService().read( - ReadRequest.forDefaultPrivate(user, MY_OWN_FILE_TXT)) - ).hasContent("Hello 2"); - // END_SNIPPET - } - - @SneakyThrows - private String writeToPrivate(UserIDAuth user, String path, String fileContent) { - AtomicReference version = new AtomicReference<>(); - try (OutputStream os = defaultDatasafeServices.privateService() - .write(WriteRequest.forDefaultPrivate(user, path) - .toBuilder() - .callback((PhysicalVersionCallback) version::set) - .build()) - ) { - os.write(fileContent.getBytes(StandardCharsets.UTF_8)); - } - - return version.get(); - } - - private UserIDAuth registerUser(String username) { - UserIDAuth creds = new UserIDAuth(username, ("passwrd" + username)::toCharArray); - defaultDatasafeServices.userProfile().registerUsingDefaults(creds); - return creds; - } - - @SneakyThrows - private static String getDockerUri(String defaultUri) { - String dockerHost = System.getenv("DOCKER_HOST"); - if (dockerHost == null) { - return defaultUri; - } - - URI dockerUri = new URI(dockerHost); - return "http://" + dockerUri.getHost(); - } -} From 8853a6305dcaafbc66f4627dff142fd117889156 Mon Sep 17 00:00:00 2001 From: Elwizzy12 Date: Thu, 11 Apr 2024 15:13:45 +0100 Subject: [PATCH 14/28] 293-rename-datasafe-business-integration-test-files-for-clear-separation --- .../business/impl/e2e/{BaseE2ETest.java => BaseE2EIT.java} | 2 +- .../datasafe/business/impl/e2e/BasicFunctionalityIT.java | 2 +- .../datasafe/business/impl/e2e/BasicFunctionalityUtf8IT.java | 2 +- .../business/impl/e2e/BasicFunctionalityWithConcurrencyIT.java | 2 +- .../impl/e2e/BasicFunctionalityWithPasswordChangeIT.java | 2 +- .../datasafe/business/impl/e2e/DataTamperingResistanceIT.java | 2 +- .../datasafe/business/impl/e2e/KeyStoreTypeCompareIT.java | 2 +- .../business/impl/e2e/ProfileContainsDatasafeVersionTest.java | 2 +- .../datasafe/business/impl/e2e/StorageBasedVersioningIT.java | 2 +- .../de/adorsys/datasafe/business/impl/e2e/VersionedDataIT.java | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) rename datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/{BaseE2ETest.java => BaseE2EIT.java} (99%) diff --git a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BaseE2ETest.java b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BaseE2EIT.java similarity index 99% rename from datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BaseE2ETest.java rename to datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BaseE2EIT.java index d544e2842..9cf4118e6 100644 --- a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BaseE2ETest.java +++ b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BaseE2EIT.java @@ -52,7 +52,7 @@ @Slf4j @RequiredArgsConstructor -public abstract class BaseE2ETest extends WithStorageProvider { +public abstract class BaseE2EIT extends WithStorageProvider { protected static final String PRIVATE_COMPONENT = "private"; protected static final String PRIVATE_FILES_COMPONENT = PRIVATE_COMPONENT + "/files"; diff --git a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BasicFunctionalityIT.java b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BasicFunctionalityIT.java index 4139e2a73..ce249ce74 100644 --- a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BasicFunctionalityIT.java +++ b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BasicFunctionalityIT.java @@ -47,7 +47,7 @@ * Tests that validates basic functionality - storing data to inbox, privatespace, listing files, etc. */ @Slf4j -class BasicFunctionalityIT extends BaseE2ETest { +class BasicFunctionalityIT extends BaseE2EIT { private static final int LARGE_SIZE = 10 * 1024 * 1024 + 100; diff --git a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BasicFunctionalityUtf8IT.java b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BasicFunctionalityUtf8IT.java index 5b2697852..344099e55 100644 --- a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BasicFunctionalityUtf8IT.java +++ b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BasicFunctionalityUtf8IT.java @@ -15,7 +15,7 @@ * Tests that validates basic functionality - storing data to inbox, privatespace, listing files, etc. using UTF-8 paths. */ @Slf4j -class BasicFunctionalityUtf8IT extends BaseE2ETest { +class BasicFunctionalityUtf8IT extends BaseE2EIT { private static final String MESSAGE_ONE = "Hello here 1"; private static final String FOLDER = "folder1"; diff --git a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BasicFunctionalityWithConcurrencyIT.java b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BasicFunctionalityWithConcurrencyIT.java index 238fff129..665666f61 100644 --- a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BasicFunctionalityWithConcurrencyIT.java +++ b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BasicFunctionalityWithConcurrencyIT.java @@ -56,7 +56,7 @@ * Multithreaded test of basic operations. */ @Slf4j -class BasicFunctionalityWithConcurrencyIT extends BaseE2ETest { +class BasicFunctionalityWithConcurrencyIT extends BaseE2EIT { private static final int TIMEOUT_S = 30; diff --git a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BasicFunctionalityWithPasswordChangeIT.java b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BasicFunctionalityWithPasswordChangeIT.java index ad5f3c320..714696659 100644 --- a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BasicFunctionalityWithPasswordChangeIT.java +++ b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BasicFunctionalityWithPasswordChangeIT.java @@ -28,7 +28,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertThrows; -class BasicFunctionalityWithPasswordChangeIT extends BaseE2ETest { +class BasicFunctionalityWithPasswordChangeIT extends BaseE2EIT { @SneakyThrows @ParameterizedTest diff --git a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/DataTamperingResistanceIT.java b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/DataTamperingResistanceIT.java index 202f3ef83..9d2a623fb 100644 --- a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/DataTamperingResistanceIT.java +++ b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/DataTamperingResistanceIT.java @@ -38,7 +38,7 @@ * attacker is unable to modify encrypted text without being detected. */ @Slf4j -class DataTamperingResistanceIT extends BaseE2ETest { +class DataTamperingResistanceIT extends BaseE2EIT { private static final Set NOT_TO_REPLACE_IN_PATH = ImmutableSet.of('=', '/'); diff --git a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/KeyStoreTypeCompareIT.java b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/KeyStoreTypeCompareIT.java index 24672c5ba..d07bd839a 100644 --- a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/KeyStoreTypeCompareIT.java +++ b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/KeyStoreTypeCompareIT.java @@ -24,7 +24,7 @@ import static org.assertj.core.api.Assertions.assertThat; @Slf4j -public class KeyStoreTypeCompareIT extends BaseE2ETest { +public class KeyStoreTypeCompareIT extends BaseE2EIT { private final static int NUMBER_WRITES = 100; private final static int NUMBER_READS = 100; diff --git a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/ProfileContainsDatasafeVersionTest.java b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/ProfileContainsDatasafeVersionTest.java index cf7afb707..9b8e7fffd 100644 --- a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/ProfileContainsDatasafeVersionTest.java +++ b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/ProfileContainsDatasafeVersionTest.java @@ -8,7 +8,7 @@ import static org.assertj.core.api.Assertions.assertThat; -class ProfileContainsDatasafeVersionTest extends BaseE2ETest { +class ProfileContainsDatasafeVersionTest extends BaseE2EIT { @Test @SneakyThrows diff --git a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/StorageBasedVersioningIT.java b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/StorageBasedVersioningIT.java index 4da2b6b51..5445cbaf3 100644 --- a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/StorageBasedVersioningIT.java +++ b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/StorageBasedVersioningIT.java @@ -25,7 +25,7 @@ import static org.junit.jupiter.api.Assertions.assertThrows; @DisabledIfSystemProperty(named = WithStorageProvider.SKIP_CEPH, matches = "true") -class StorageBasedVersioningIT extends BaseE2ETest { +class StorageBasedVersioningIT extends BaseE2EIT { private static final String FILE = "file.txt"; diff --git a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/VersionedDataIT.java b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/VersionedDataIT.java index f791a6c87..a4a583237 100644 --- a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/VersionedDataIT.java +++ b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/VersionedDataIT.java @@ -36,7 +36,7 @@ * Validates software versioned operations. */ @Slf4j -public class VersionedDataIT extends BaseE2ETest { +public class VersionedDataIT extends BaseE2EIT { private static final String MESSAGE_ONE = "Hello here 1"; private static final String MESSAGE_TWO = "Hello here 2"; From 6b83afcf61569321475ab4c75d178c4e731ee977 Mon Sep 17 00:00:00 2001 From: Elwizzy12 Date: Thu, 11 Apr 2024 15:27:25 +0100 Subject: [PATCH 15/28] rename-datasafe-business-integration-test-files-for-clear-separation --- .../e2e/{BaseE2EIT.java => BaseE2ETest.java} | 2 +- .../impl/e2e/BasicFunctionalityIT.java | 2 +- .../impl/e2e/BasicFunctionalityUtf8IT.java | 2 +- .../BasicFunctionalityWithConcurrencyIT.java | 2 +- ...asicFunctionalityWithPasswordChangeIT.java | 2 +- .../impl/e2e/DataTamperingResistanceIT.java | 2 +- .../impl/e2e/KeyStoreTypeCompareIT.java | 2 +- .../ProfileContainsDatasafeVersionTest.java | 2 +- .../business/impl/e2e/SchemeDelegationIT.java | 77 +++++++------------ .../impl/e2e/StorageBasedVersioningIT.java | 2 +- .../business/impl/e2e/VersionedDataIT.java | 2 +- 11 files changed, 38 insertions(+), 59 deletions(-) rename datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/{BaseE2EIT.java => BaseE2ETest.java} (99%) diff --git a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BaseE2EIT.java b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BaseE2ETest.java similarity index 99% rename from datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BaseE2EIT.java rename to datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BaseE2ETest.java index 9cf4118e6..d544e2842 100644 --- a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BaseE2EIT.java +++ b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BaseE2ETest.java @@ -52,7 +52,7 @@ @Slf4j @RequiredArgsConstructor -public abstract class BaseE2EIT extends WithStorageProvider { +public abstract class BaseE2ETest extends WithStorageProvider { protected static final String PRIVATE_COMPONENT = "private"; protected static final String PRIVATE_FILES_COMPONENT = PRIVATE_COMPONENT + "/files"; diff --git a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BasicFunctionalityIT.java b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BasicFunctionalityIT.java index ce249ce74..4139e2a73 100644 --- a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BasicFunctionalityIT.java +++ b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BasicFunctionalityIT.java @@ -47,7 +47,7 @@ * Tests that validates basic functionality - storing data to inbox, privatespace, listing files, etc. */ @Slf4j -class BasicFunctionalityIT extends BaseE2EIT { +class BasicFunctionalityIT extends BaseE2ETest { private static final int LARGE_SIZE = 10 * 1024 * 1024 + 100; diff --git a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BasicFunctionalityUtf8IT.java b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BasicFunctionalityUtf8IT.java index 344099e55..5b2697852 100644 --- a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BasicFunctionalityUtf8IT.java +++ b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BasicFunctionalityUtf8IT.java @@ -15,7 +15,7 @@ * Tests that validates basic functionality - storing data to inbox, privatespace, listing files, etc. using UTF-8 paths. */ @Slf4j -class BasicFunctionalityUtf8IT extends BaseE2EIT { +class BasicFunctionalityUtf8IT extends BaseE2ETest { private static final String MESSAGE_ONE = "Hello here 1"; private static final String FOLDER = "folder1"; diff --git a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BasicFunctionalityWithConcurrencyIT.java b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BasicFunctionalityWithConcurrencyIT.java index 665666f61..238fff129 100644 --- a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BasicFunctionalityWithConcurrencyIT.java +++ b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BasicFunctionalityWithConcurrencyIT.java @@ -56,7 +56,7 @@ * Multithreaded test of basic operations. */ @Slf4j -class BasicFunctionalityWithConcurrencyIT extends BaseE2EIT { +class BasicFunctionalityWithConcurrencyIT extends BaseE2ETest { private static final int TIMEOUT_S = 30; diff --git a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BasicFunctionalityWithPasswordChangeIT.java b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BasicFunctionalityWithPasswordChangeIT.java index 714696659..ad5f3c320 100644 --- a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BasicFunctionalityWithPasswordChangeIT.java +++ b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BasicFunctionalityWithPasswordChangeIT.java @@ -28,7 +28,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertThrows; -class BasicFunctionalityWithPasswordChangeIT extends BaseE2EIT { +class BasicFunctionalityWithPasswordChangeIT extends BaseE2ETest { @SneakyThrows @ParameterizedTest diff --git a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/DataTamperingResistanceIT.java b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/DataTamperingResistanceIT.java index 9d2a623fb..202f3ef83 100644 --- a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/DataTamperingResistanceIT.java +++ b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/DataTamperingResistanceIT.java @@ -38,7 +38,7 @@ * attacker is unable to modify encrypted text without being detected. */ @Slf4j -class DataTamperingResistanceIT extends BaseE2EIT { +class DataTamperingResistanceIT extends BaseE2ETest { private static final Set NOT_TO_REPLACE_IN_PATH = ImmutableSet.of('=', '/'); diff --git a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/KeyStoreTypeCompareIT.java b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/KeyStoreTypeCompareIT.java index d07bd839a..24672c5ba 100644 --- a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/KeyStoreTypeCompareIT.java +++ b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/KeyStoreTypeCompareIT.java @@ -24,7 +24,7 @@ import static org.assertj.core.api.Assertions.assertThat; @Slf4j -public class KeyStoreTypeCompareIT extends BaseE2EIT { +public class KeyStoreTypeCompareIT extends BaseE2ETest { private final static int NUMBER_WRITES = 100; private final static int NUMBER_READS = 100; diff --git a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/ProfileContainsDatasafeVersionTest.java b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/ProfileContainsDatasafeVersionTest.java index 9b8e7fffd..cf7afb707 100644 --- a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/ProfileContainsDatasafeVersionTest.java +++ b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/ProfileContainsDatasafeVersionTest.java @@ -8,7 +8,7 @@ import static org.assertj.core.api.Assertions.assertThat; -class ProfileContainsDatasafeVersionTest extends BaseE2EIT { +class ProfileContainsDatasafeVersionTest extends BaseE2ETest { @Test @SneakyThrows diff --git a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/SchemeDelegationIT.java b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/SchemeDelegationIT.java index b8977d334..9b4d05dde 100644 --- a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/SchemeDelegationIT.java +++ b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/SchemeDelegationIT.java @@ -1,5 +1,4 @@ package de.adorsys.datasafe.business.impl.e2e; - import de.adorsys.datasafe.business.impl.service.DaggerDefaultDatasafeServices; import de.adorsys.datasafe.business.impl.service.DefaultDatasafeServices; import de.adorsys.datasafe.directory.impl.profile.config.DefaultDFSConfig; @@ -12,59 +11,52 @@ import de.adorsys.datasafe.types.api.actions.WriteRequest; import de.adorsys.datasafe.types.api.resource.AbsoluteLocation; import de.adorsys.datasafe.types.api.resource.BasePrivateResource; -import de.adorsys.datasafe.types.api.resource.ResolvedResource; import de.adorsys.datasafe.types.api.resource.Uri; -import de.adorsys.datasafe.types.api.types.ReadStorePassword; -import de.adorsys.datasafe.types.api.utils.ReadKeyPasswordTestFactory; import lombok.SneakyThrows; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.io.TempDir; import org.testcontainers.shaded.com.google.common.collect.ImmutableMap; -import java.io.IOException; import java.io.OutputStream; import java.nio.file.Files; import java.nio.file.Path; -import java.util.List; -import java.util.stream.Collectors; -import java.util.stream.Stream; import static org.assertj.core.api.Assertions.assertThat; +class SchemeDelegationTest extends WithStorageProvider { + + private Path fsPath; + private Uri minioPath; + private StorageService minio; + private StorageService filesystem; + private DefaultDatasafeServices datasafeServices; + + @BeforeEach + void initialize(@TempDir Path tempDir) { + WithStorageProvider.StorageDescriptor minioDescriptor = minio(); + this.fsPath = tempDir; + this.minio = minioDescriptor.getStorageService().get(); + this.filesystem = new FileSystemStorageService(tempDir); + this.minioPath = minioDescriptor.getLocation(); + StorageService multiDfs = new SchemeDelegatingStorage( + ImmutableMap.of( + "s3", minio, + "file", filesystem + ) + ); + this.datasafeServices = DaggerDefaultDatasafeServices .builder() .config(new ProfilesOnFsDataOnMinio(minioPath, tempDir)) - - class SchemeDelegationTest extends WithStorageProvider { - - private Path fsPath; - private Uri minioPath; - private StorageService minio; - private StorageService filesystem; - private DefaultDatasafeServices datasafeServices; - - @BeforeEach - void initialize(@TempDir Path tempDir) { - WithStorageProvider.StorageDescriptor minioDescriptor = minio(); - this.fsPath = tempDir; - this.minio = minioDescriptor.getStorageService().get(); - this.filesystem = new FileSystemStorageService(tempDir); - this.minioPath = minioDescriptor.getLocation(); - StorageService multiDfs = new SchemeDelegatingStorage( - ImmutableMap.of( - "s3", minio, - "file", filesystem - ) - ); - .storage(multiDfs) + .storage(multiDfs) .build(); } @Test @SneakyThrows void testProfileOnFsDataOnMinioWorks() { - UserIDAuth userJohn = new UserIDAuth("john", ReadKeyPasswordTestFactory.getForString("doe")); + UserIDAuth userJohn = new UserIDAuth("john", "doe"); // John's profile will be saved to filesystem datasafeServices.userProfile().registerUsingDefaults(userJohn); @@ -76,12 +68,12 @@ void testProfileOnFsDataOnMinioWorks() { } // Profiles are on FS - assertThat(listFs()) + assertThat(Files.walk(fsPath)) .extracting(it -> fsPath.relativize(it)) .extracting(Path::toString) .containsExactlyInAnyOrder("", "public-john", "private-john"); // File and keystore/pub keys are on minio - assertThat(listMinio()) + assertThat(minio.list(new AbsoluteLocation<>(BasePrivateResource.forPrivate(minioPath.resolve(""))))) .extracting(it -> minioPath.relativize(it.location())) .extracting(it -> it.asURI().toString()) .contains("users/john/private/keystore", "users/john/public/pubkeys") @@ -89,25 +81,12 @@ void testProfileOnFsDataOnMinioWorks() { .hasSize(3); } - private List> listMinio() { - try (Stream> ls = - minio.list(new AbsoluteLocation<>(BasePrivateResource.forPrivate(minioPath.resolve(""))))) { - return ls.collect(Collectors.toList()); - } - } - - private List listFs() throws IOException { - try (Stream ls = Files.walk(fsPath)) { - return ls.collect(Collectors.toList()); - } - } - static class ProfilesOnFsDataOnMinio extends DefaultDFSConfig { private final Path profilesPath; ProfilesOnFsDataOnMinio(Uri minioBucketPath, Path profilesPath) { - super(minioBucketPath, new ReadStorePassword("PAZZWORT")); + super(minioBucketPath, "PAZZWORT"); this.profilesPath = profilesPath; } @@ -125,4 +104,4 @@ public AbsoluteLocation privateProfile(UserID forUser) { ); } } -} +} \ No newline at end of file diff --git a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/StorageBasedVersioningIT.java b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/StorageBasedVersioningIT.java index 5445cbaf3..4da2b6b51 100644 --- a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/StorageBasedVersioningIT.java +++ b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/StorageBasedVersioningIT.java @@ -25,7 +25,7 @@ import static org.junit.jupiter.api.Assertions.assertThrows; @DisabledIfSystemProperty(named = WithStorageProvider.SKIP_CEPH, matches = "true") -class StorageBasedVersioningIT extends BaseE2EIT { +class StorageBasedVersioningIT extends BaseE2ETest { private static final String FILE = "file.txt"; diff --git a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/VersionedDataIT.java b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/VersionedDataIT.java index a4a583237..f791a6c87 100644 --- a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/VersionedDataIT.java +++ b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/VersionedDataIT.java @@ -36,7 +36,7 @@ * Validates software versioned operations. */ @Slf4j -public class VersionedDataIT extends BaseE2EIT { +public class VersionedDataIT extends BaseE2ETest { private static final String MESSAGE_ONE = "Hello here 1"; private static final String MESSAGE_TWO = "Hello here 2"; From c5be1394461e5108982a867824768d2b30e1b9a3 Mon Sep 17 00:00:00 2001 From: Awambeng Date: Thu, 11 Apr 2024 15:50:19 +0100 Subject: [PATCH 16/28] fix: remove duplicated file --- .../spring/InjectionForFilesystemTest.java | 2 +- .../adapter/spring/InjectionForMinioTest.java | 48 -------- .../simple/adapter/spring/InjectionTest.java | 116 ------------------ ...ithoutPathEncryptionForFilesystemTest.java | 42 ------- ...tionWithoutPathEncryptionForMinioTest.java | 49 -------- 5 files changed, 1 insertion(+), 256 deletions(-) delete mode 100644 datasafe-simple-adapter/datasafe-simple-adapter-spring/src/test/java/de/adorsys/datasafe/simple/adapter/spring/InjectionForMinioTest.java delete mode 100644 datasafe-simple-adapter/datasafe-simple-adapter-spring/src/test/java/de/adorsys/datasafe/simple/adapter/spring/InjectionTest.java delete mode 100644 datasafe-simple-adapter/datasafe-simple-adapter-spring/src/test/java/de/adorsys/datasafe/simple/adapter/spring/InjectionWithoutPathEncryptionForFilesystemTest.java delete mode 100644 datasafe-simple-adapter/datasafe-simple-adapter-spring/src/test/java/de/adorsys/datasafe/simple/adapter/spring/InjectionWithoutPathEncryptionForMinioTest.java diff --git a/datasafe-simple-adapter/datasafe-simple-adapter-spring/src/test/java/de/adorsys/datasafe/simple/adapter/spring/InjectionForFilesystemTest.java b/datasafe-simple-adapter/datasafe-simple-adapter-spring/src/test/java/de/adorsys/datasafe/simple/adapter/spring/InjectionForFilesystemTest.java index 44b1c37ca..f6f6277bf 100644 --- a/datasafe-simple-adapter/datasafe-simple-adapter-spring/src/test/java/de/adorsys/datasafe/simple/adapter/spring/InjectionForFilesystemTest.java +++ b/datasafe-simple-adapter/datasafe-simple-adapter-spring/src/test/java/de/adorsys/datasafe/simple/adapter/spring/InjectionForFilesystemTest.java @@ -6,7 +6,7 @@ import org.springframework.test.context.ActiveProfiles; @ActiveProfiles("filesystem") -public class InjectionForFilesystemTest extends InjectionTest { +public class InjectionForFilesystemTest extends InjectionIT { @Autowired SimpleDatasafeService datasafeService; diff --git a/datasafe-simple-adapter/datasafe-simple-adapter-spring/src/test/java/de/adorsys/datasafe/simple/adapter/spring/InjectionForMinioTest.java b/datasafe-simple-adapter/datasafe-simple-adapter-spring/src/test/java/de/adorsys/datasafe/simple/adapter/spring/InjectionForMinioTest.java deleted file mode 100644 index 0a4f14085..000000000 --- a/datasafe-simple-adapter/datasafe-simple-adapter-spring/src/test/java/de/adorsys/datasafe/simple/adapter/spring/InjectionForMinioTest.java +++ /dev/null @@ -1,48 +0,0 @@ -package de.adorsys.datasafe.simple.adapter.spring; - -import de.adorsys.datasafe.simple.adapter.api.SimpleDatasafeService; -import de.adorsys.datasafe.simple.adapter.spring.annotations.UseDatasafeSpringConfiguration; -import de.adorsys.datasafe.simple.adapter.spring.factory.SpringSimpleDatasafeServiceFactory; -import de.adorsys.datasafe.simple.adapter.spring.properties.SpringDFSCredentialProperties; -import de.adorsys.datasafe.simple.adapter.spring.properties.SpringDatasafeEncryptionProperties; -import de.adorsys.datasafe.teststorage.WithStorageProvider; -import lombok.extern.slf4j.Slf4j; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.MethodSource; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.context.ActiveProfiles; - -import java.util.stream.Stream; - - -@Slf4j -@ActiveProfiles("minio") -@UseDatasafeSpringConfiguration -public class InjectionForMinioTest extends InjectionTest { - - @Autowired - private SpringDFSCredentialProperties dfsCredentialProperties; - - @Autowired - private SpringDatasafeEncryptionProperties encryptionProperties; - - @BeforeAll - static void startMinio() { - minio().getStorageService().get(); - System.setProperty("MINIO_URL", minio().getMappedUrl()); - } - - private static Stream minioonly() { - return Stream.of(minio()); - } - - @ParameterizedTest - @MethodSource("minioonly") - public void plainService(WithStorageProvider.StorageDescriptor descriptor) { - log.info("descriptor is " + descriptor.getName()); - SpringSimpleDatasafeServiceFactory springSimpleDatasafeServiceFactory = new SpringSimpleDatasafeServiceFactory(SpringPropertiesToDFSCredentialsUtil.dfsCredentials(dfsCredentialProperties), encryptionProperties); - SimpleDatasafeService service = springSimpleDatasafeServiceFactory.getSimpleDataSafeServiceWithSubdir("subdir"); - testCreateUser(service); - } -} diff --git a/datasafe-simple-adapter/datasafe-simple-adapter-spring/src/test/java/de/adorsys/datasafe/simple/adapter/spring/InjectionTest.java b/datasafe-simple-adapter/datasafe-simple-adapter-spring/src/test/java/de/adorsys/datasafe/simple/adapter/spring/InjectionTest.java deleted file mode 100644 index e10f39431..000000000 --- a/datasafe-simple-adapter/datasafe-simple-adapter-spring/src/test/java/de/adorsys/datasafe/simple/adapter/spring/InjectionTest.java +++ /dev/null @@ -1,116 +0,0 @@ -package de.adorsys.datasafe.simple.adapter.spring; - -import de.adorsys.datasafe.encrypiton.api.types.UserID; -import de.adorsys.datasafe.encrypiton.api.types.UserIDAuth; -import de.adorsys.datasafe.simple.adapter.api.SimpleDatasafeService; -import de.adorsys.datasafe.simple.adapter.api.types.AmazonS3DFSCredentials; -import de.adorsys.datasafe.simple.adapter.api.types.DFSCredentials; -import de.adorsys.datasafe.simple.adapter.api.types.DSDocument; -import de.adorsys.datasafe.simple.adapter.api.types.DocumentContent; -import de.adorsys.datasafe.simple.adapter.api.types.DocumentFQN; -import de.adorsys.datasafe.simple.adapter.api.types.FilesystemDFSCredentials; -import de.adorsys.datasafe.simple.adapter.impl.SimpleDatasafeServiceImpl; -import de.adorsys.datasafe.simple.adapter.spring.annotations.UseDatasafeSpringConfiguration; -import de.adorsys.datasafe.teststorage.WithStorageProvider; -import de.adorsys.datasafe.types.api.resource.AbsoluteLocation; -import de.adorsys.datasafe.types.api.resource.BasePrivateResource; -import de.adorsys.datasafe.types.api.resource.PrivateResource; -import de.adorsys.datasafe.types.api.resource.ResolvedResource; -import de.adorsys.datasafe.types.api.types.ReadKeyPassword; -import de.adorsys.datasafe.types.api.utils.ReadKeyPasswordTestFactory; -import lombok.SneakyThrows; -import lombok.extern.slf4j.Slf4j; -import org.jetbrains.annotations.Nullable; -import org.junit.jupiter.api.extension.ExtendWith; -import org.springframework.boot.SpringBootConfiguration; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; -import org.testcontainers.shaded.org.apache.commons.io.IOUtils; - -import java.io.InputStream; -import java.io.StringWriter; -import java.net.URI; -import java.nio.file.FileSystems; -import java.nio.file.Path; -import java.util.Optional; -import java.util.stream.Stream; - -import static java.nio.charset.StandardCharsets.UTF_8; -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.Assert.assertFalse; -import static org.junit.jupiter.api.Assertions.assertEquals; - -@Slf4j -@SpringBootTest -@ExtendWith(SpringExtension.class) -@ContextConfiguration -@SpringBootConfiguration -@UseDatasafeSpringConfiguration -public class InjectionTest extends WithStorageProvider { - - public void testCreateUser(SimpleDatasafeService datasafeService) { - assertThat(datasafeService).isNotNull(); - UserID userid = new UserID("peter"); - ReadKeyPassword password = ReadKeyPasswordTestFactory.getForString("password"); - UserIDAuth userIDAuth = new UserIDAuth(userid, password); - assertThat(datasafeService.userExists(userid)).isFalse(); - datasafeService.createUser(userIDAuth); - assertThat(datasafeService.userExists(userid)).isTrue(); - datasafeService.destroyUser(userIDAuth); - } - - @SneakyThrows - void testWithoutPathEncryption(SimpleDatasafeService simpleDatasafeServiceApi, DFSCredentials dfsCredentials) { - if (!(simpleDatasafeServiceApi instanceof SimpleDatasafeServiceImpl)) { - throw new TestException("Did expect instance of SimpleDatasafeServiceImpl"); - } - AbsoluteLocation rootLocation = getPrivateResourceAbsoluteLocation(dfsCredentials); - SimpleDatasafeServiceImpl simpleDatasafeService = (SimpleDatasafeServiceImpl) simpleDatasafeServiceApi; - - UserIDAuth userIDAuth = new UserIDAuth(new UserID("peter"), ReadKeyPasswordTestFactory.getForString("password")); - String content = "content of document"; - String path = "a/b/c.txt"; - DSDocument document = new DSDocument(new DocumentFQN(path), new DocumentContent(content.getBytes())); - simpleDatasafeService.createUser(userIDAuth); - simpleDatasafeService.storeDocument(userIDAuth, document); - - try (Stream> absoluteLocationStream = simpleDatasafeService.getStorageService().list(rootLocation)) { - assertEquals(1, absoluteLocationStream.filter(el -> el.location().toASCIIString().contains(path)).count()); - } - try (Stream> absoluteLocationStream = simpleDatasafeService.getStorageService().list(rootLocation)) { - Optional> first = absoluteLocationStream.filter(el -> el.location().toASCIIString().contains(path)).findFirst(); - if (!first.isPresent()) { - throw new TestException("expeceted absoluteLocatinn stream to have at least one element"); - } - - try (InputStream read = simpleDatasafeService.getStorageService().read(first.get())) { - StringWriter writer = new StringWriter(); - IOUtils.copy(read, writer, UTF_8); - assertFalse(writer.toString().equals(content)); - } - } - simpleDatasafeService.destroyUser(userIDAuth); - } - - @Nullable - @SneakyThrows - private AbsoluteLocation getPrivateResourceAbsoluteLocation(DFSCredentials dfsCredentials) { - if (dfsCredentials instanceof FilesystemDFSCredentials) { - String root = ((FilesystemDFSCredentials) dfsCredentials).getRoot(); - Path listpath = FileSystems.getDefault().getPath(root); - return new AbsoluteLocation<>(BasePrivateResource.forPrivate(listpath.toUri())); - } - if (dfsCredentials instanceof AmazonS3DFSCredentials) { - AmazonS3DFSCredentials a = (AmazonS3DFSCredentials) dfsCredentials; - return new AbsoluteLocation<>(BasePrivateResource.forPrivate(new URI(a.getUrl() + "/" + a.getRootBucket()))); - } - throw new TestException("NYI"); - } - - static class TestException extends RuntimeException { - public TestException(String message) { - super(message); - } - } -} diff --git a/datasafe-simple-adapter/datasafe-simple-adapter-spring/src/test/java/de/adorsys/datasafe/simple/adapter/spring/InjectionWithoutPathEncryptionForFilesystemTest.java b/datasafe-simple-adapter/datasafe-simple-adapter-spring/src/test/java/de/adorsys/datasafe/simple/adapter/spring/InjectionWithoutPathEncryptionForFilesystemTest.java deleted file mode 100644 index 52b6636ea..000000000 --- a/datasafe-simple-adapter/datasafe-simple-adapter-spring/src/test/java/de/adorsys/datasafe/simple/adapter/spring/InjectionWithoutPathEncryptionForFilesystemTest.java +++ /dev/null @@ -1,42 +0,0 @@ -package de.adorsys.datasafe.simple.adapter.spring; - -import de.adorsys.datasafe.simple.adapter.api.SimpleDatasafeService; -import de.adorsys.datasafe.simple.adapter.api.types.DFSCredentials; -import de.adorsys.datasafe.simple.adapter.spring.annotations.UseDatasafeSpringConfiguration; -import de.adorsys.datasafe.simple.adapter.spring.factory.SpringSimpleDatasafeServiceFactory; -import de.adorsys.datasafe.simple.adapter.spring.properties.SpringDFSCredentialProperties; -import de.adorsys.datasafe.simple.adapter.spring.properties.SpringDatasafeEncryptionProperties; -import de.adorsys.datasafe.teststorage.WithStorageProvider; -import lombok.extern.slf4j.Slf4j; -import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.MethodSource; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.context.ActiveProfiles; - -import java.util.stream.Stream; - -@Slf4j -@ActiveProfiles("fs-withoutPathEncryption") -@UseDatasafeSpringConfiguration -public class InjectionWithoutPathEncryptionForFilesystemTest extends InjectionTest { - @Autowired - private SpringDFSCredentialProperties dfsCredentialProperties; - - @Autowired - private SpringDatasafeEncryptionProperties encryptionProperties; - - private static Stream fsonly() { - return Stream.of(fs()); - } - - @ParameterizedTest - @MethodSource("fsonly") - public void plainService(WithStorageProvider.StorageDescriptor descriptor) { - log.info("descriptor is {}", descriptor.getName()); - DFSCredentials dfsCredentials = SpringPropertiesToDFSCredentialsUtil.dfsCredentials(dfsCredentialProperties); - SpringSimpleDatasafeServiceFactory springSimpleDatasafeServiceFactory = new SpringSimpleDatasafeServiceFactory(dfsCredentials, encryptionProperties); - SimpleDatasafeService service = springSimpleDatasafeServiceFactory.getSimpleDataSafeServiceWithSubdir("subdir"); - testWithoutPathEncryption(service, dfsCredentials); - } - -} diff --git a/datasafe-simple-adapter/datasafe-simple-adapter-spring/src/test/java/de/adorsys/datasafe/simple/adapter/spring/InjectionWithoutPathEncryptionForMinioTest.java b/datasafe-simple-adapter/datasafe-simple-adapter-spring/src/test/java/de/adorsys/datasafe/simple/adapter/spring/InjectionWithoutPathEncryptionForMinioTest.java deleted file mode 100644 index 023f93952..000000000 --- a/datasafe-simple-adapter/datasafe-simple-adapter-spring/src/test/java/de/adorsys/datasafe/simple/adapter/spring/InjectionWithoutPathEncryptionForMinioTest.java +++ /dev/null @@ -1,49 +0,0 @@ -package de.adorsys.datasafe.simple.adapter.spring; - -import de.adorsys.datasafe.simple.adapter.api.SimpleDatasafeService; -import de.adorsys.datasafe.simple.adapter.api.types.DFSCredentials; -import de.adorsys.datasafe.simple.adapter.spring.annotations.UseDatasafeSpringConfiguration; -import de.adorsys.datasafe.simple.adapter.spring.factory.SpringSimpleDatasafeServiceFactory; -import de.adorsys.datasafe.simple.adapter.spring.properties.SpringDFSCredentialProperties; -import de.adorsys.datasafe.simple.adapter.spring.properties.SpringDatasafeEncryptionProperties; -import de.adorsys.datasafe.teststorage.WithStorageProvider; -import lombok.extern.slf4j.Slf4j; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.MethodSource; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.context.ActiveProfiles; - -import java.util.stream.Stream; - -@Slf4j -@ActiveProfiles("minio-withoutPathEncryption") -@UseDatasafeSpringConfiguration -public class InjectionWithoutPathEncryptionForMinioTest extends InjectionTest { - @Autowired - private SpringDFSCredentialProperties dfsCredentialProperties; - - @Autowired - private SpringDatasafeEncryptionProperties encryptionProperties; - - @BeforeAll - static void startMinio() { - minio().getStorageService().get(); - System.setProperty("MINIO_URL", minio().getMappedUrl()); - } - - private static Stream minioonly() { - return Stream.of(minio()); - } - - @ParameterizedTest - @MethodSource("minioonly") - public void plainService(WithStorageProvider.StorageDescriptor descriptor) { - log.info("descriptor is {}", descriptor.getName()); - DFSCredentials dfsCredentials = SpringPropertiesToDFSCredentialsUtil.dfsCredentials(dfsCredentialProperties); - SpringSimpleDatasafeServiceFactory springSimpleDatasafeServiceFactory = new SpringSimpleDatasafeServiceFactory(dfsCredentials, encryptionProperties); - SimpleDatasafeService service = springSimpleDatasafeServiceFactory.getSimpleDataSafeServiceWithSubdir("subdir"); - testWithoutPathEncryption(service, dfsCredentials); - } - -} From eca059a3552aa1b9f1f6b7ca3bc29e7597c21a2b Mon Sep 17 00:00:00 2001 From: Elwizzy12 Date: Thu, 11 Apr 2024 16:12:22 +0100 Subject: [PATCH 17/28] rename-datasafe-business-integration-test-files-for-clear-separation --- .../business/impl/e2e/SchemeDelegationIT.java | 115 ++++++++++++------ 1 file changed, 80 insertions(+), 35 deletions(-) diff --git a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/SchemeDelegationIT.java b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/SchemeDelegationIT.java index 9b4d05dde..846c11ea1 100644 --- a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/SchemeDelegationIT.java +++ b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/SchemeDelegationIT.java @@ -1,4 +1,7 @@ package de.adorsys.datasafe.business.impl.e2e; + +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; import de.adorsys.datasafe.business.impl.service.DaggerDefaultDatasafeServices; import de.adorsys.datasafe.business.impl.service.DefaultDatasafeServices; import de.adorsys.datasafe.directory.impl.profile.config.DefaultDFSConfig; @@ -6,101 +9,143 @@ import de.adorsys.datasafe.encrypiton.api.types.UserIDAuth; import de.adorsys.datasafe.storage.api.SchemeDelegatingStorage; import de.adorsys.datasafe.storage.api.StorageService; +import de.adorsys.datasafe.storage.impl.db.DatabaseConnectionRegistry; +import de.adorsys.datasafe.storage.impl.db.DatabaseCredentials; +import de.adorsys.datasafe.storage.impl.db.DatabaseStorageService; import de.adorsys.datasafe.storage.impl.fs.FileSystemStorageService; import de.adorsys.datasafe.teststorage.WithStorageProvider; import de.adorsys.datasafe.types.api.actions.WriteRequest; import de.adorsys.datasafe.types.api.resource.AbsoluteLocation; import de.adorsys.datasafe.types.api.resource.BasePrivateResource; +import de.adorsys.datasafe.types.api.resource.ResolvedResource; import de.adorsys.datasafe.types.api.resource.Uri; +import de.adorsys.datasafe.types.api.types.ReadStorePassword; +import de.adorsys.datasafe.types.api.utils.ReadKeyPasswordTestFactory; import lombok.SneakyThrows; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.io.TempDir; -import org.testcontainers.shaded.com.google.common.collect.ImmutableMap; import java.io.OutputStream; +import java.net.URI; import java.nio.file.Files; import java.nio.file.Path; +import java.util.List; +import java.util.Set; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import static de.adorsys.datasafe.types.api.global.PathEncryptionId.AES_SIV; import static org.assertj.core.api.Assertions.assertThat; -class SchemeDelegationTest extends WithStorageProvider { +class SchemeDelegationWithDbTest extends WithStorageProvider { + + private static final Set ALLOWED_TABLES = ImmutableSet.of("users", "private_profiles", "public_profiles"); private Path fsPath; - private Uri minioPath; - private StorageService minio; - private StorageService filesystem; + private StorageService db; private DefaultDatasafeServices datasafeServices; @BeforeEach void initialize(@TempDir Path tempDir) { - WithStorageProvider.StorageDescriptor minioDescriptor = minio(); this.fsPath = tempDir; - this.minio = minioDescriptor.getStorageService().get(); - this.filesystem = new FileSystemStorageService(tempDir); - this.minioPath = minioDescriptor.getLocation(); + StorageService filesystem = new FileSystemStorageService(tempDir); + this.db = new DatabaseStorageService(ALLOWED_TABLES, new DatabaseConnectionRegistry( + uri -> uri.location().getWrapped().getScheme() + ":" + uri.location().getPath().split("/")[1], + ImmutableMap.of("jdbc://localhost:9999", new DatabaseCredentials("sa", "sa"))) + ); + StorageService multiDfs = new SchemeDelegatingStorage( ImmutableMap.of( - "s3", minio, - "file", filesystem + "file", filesystem, + "jdbc", db ) ); this.datasafeServices = DaggerDefaultDatasafeServices .builder() - .config(new ProfilesOnFsDataOnMinio(minioPath, tempDir)) + .config(new ProfilesOnDbDataOnFs(tempDir.toUri(), URI.create("jdbc://localhost:9999/h2:mem:test/"))) .storage(multiDfs) .build(); } @Test @SneakyThrows - void testProfileOnFsDataOnMinioWorks() { - UserIDAuth userJohn = new UserIDAuth("john", "doe"); + void testProfileOnDbDataOnFsWorks() { + UserIDAuth userJohn = new UserIDAuth("john", ReadKeyPasswordTestFactory.getForString("doe")); - // John's profile will be saved to filesystem + // John's profile will be saved to Database datasafeServices.userProfile().registerUsingDefaults(userJohn); - // But this data - it will be saved to minio + // But this data - it will be saved to FS try (OutputStream os = datasafeServices.privateService().write(WriteRequest.forDefaultPrivate(userJohn, "file.txt"))) { os.write("Hello".getBytes()); } - // Profiles are on FS - assertThat(Files.walk(fsPath)) - .extracting(it -> fsPath.relativize(it)) - .extracting(Path::toString) - .containsExactlyInAnyOrder("", "public-john", "private-john"); - // File and keystore/pub keys are on minio - assertThat(minio.list(new AbsoluteLocation<>(BasePrivateResource.forPrivate(minioPath.resolve(""))))) - .extracting(it -> minioPath.relativize(it.location())) - .extracting(it -> it.asURI().toString()) - .contains("users/john/private/keystore", "users/john/public/pubkeys") - .anyMatch(it -> it.startsWith("users/john/private/files/")) - .hasSize(3); + // Profiles are on DB + assertThat(listDb("jdbc://localhost:9999/h2:mem:test/private_profiles/")) + .containsExactly("jdbc://localhost:9999/h2:mem:test/private_profiles/john"); + assertThat(listDb("jdbc://localhost:9999/h2:mem:test/public_profiles/")) + .containsExactly("jdbc://localhost:9999/h2:mem:test/public_profiles/john"); + + Path path = fsPath.resolve(new Uri("users/john/private/files/").resolve(AES_SIV.asUriRoot()).asString()); + Path encryptedFile = walk(path).get(1); + // File and keystore/pub keys are on FS + assertThat(walk(fsPath)) + .extracting(it -> fsPath.toUri().relativize(it.toUri())) + .extracting(URI::toString) + .containsExactlyInAnyOrder( + "", + "users/", + "users/john/", + "users/john/public/", + "users/john/public/pubkeys", + "users/john/private/", + "users/john/private/keystore", + "users/john/private/files/", + "users/john/private/files/SIV/", + fsPath.toUri().relativize(encryptedFile.toUri()).toString() + ); + } + + @SneakyThrows + private List walk(Path at) { + try (Stream ls = Files.walk(at)) { + return ls.collect(Collectors.toList()); + } + } + + private List listDb(String path) { + try (Stream> stream = db.list(BasePrivateResource.forAbsolutePrivate(URI.create(path)))){ + return stream.map(it -> it.location().asURI().toString()).collect(Collectors.toList()); + } } - static class ProfilesOnFsDataOnMinio extends DefaultDFSConfig { + static class ProfilesOnDbDataOnFs extends DefaultDFSConfig { - private final Path profilesPath; + private final Uri profilesPath; - ProfilesOnFsDataOnMinio(Uri minioBucketPath, Path profilesPath) { - super(minioBucketPath, "PAZZWORT"); - this.profilesPath = profilesPath; + ProfilesOnDbDataOnFs(URI fsPath, URI profilesPath) { + super(fsPath, new ReadStorePassword("PAZZWORT")); + this.profilesPath = new Uri(profilesPath); } @Override public AbsoluteLocation publicProfile(UserID forUser) { return new AbsoluteLocation<>( - BasePrivateResource.forPrivate(profilesPath.resolve("public-" + forUser.getValue()).toUri()) + BasePrivateResource.forPrivate( + profilesPath.resolve("public_profiles/").resolve(forUser.getValue()) + ) ); } @Override public AbsoluteLocation privateProfile(UserID forUser) { return new AbsoluteLocation<>( - BasePrivateResource.forPrivate(profilesPath.resolve("private-" + forUser.getValue()).toUri()) + BasePrivateResource.forPrivate( + profilesPath.resolve("private_profiles/").resolve(forUser.getValue()) + ) ); } } From c43c2e177c8025a61d99f3fa1fc0175b25e037f6 Mon Sep 17 00:00:00 2001 From: Elwizzy12 Date: Thu, 11 Apr 2024 16:48:53 +0100 Subject: [PATCH 18/28] rename-datasafe-business-integration-test-files-for-clear-separation --- last-module-codecoverage-check/pom.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/last-module-codecoverage-check/pom.xml b/last-module-codecoverage-check/pom.xml index 1d5806c75..fdaeb0053 100644 --- a/last-module-codecoverage-check/pom.xml +++ b/last-module-codecoverage-check/pom.xml @@ -7,6 +7,7 @@ de.adorsys 2.0.2-SNAPSHOT + 4.0.0 last-module-codecoverage-check From f37d1d510f6902af5a044e5e8c449008a193e822 Mon Sep 17 00:00:00 2001 From: forkimenjeckayang Date: Thu, 11 Apr 2024 17:14:05 +0100 Subject: [PATCH 19/28] Modification(datasafe-example):Modified MultiDfsWithCredentialsExample file --- .../examples/business/s3/MultiDfsWithCredentialsExampleIT.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/datasafe-examples/datasafe-examples-multidfs/src/test/java/de/adorsys/datasafe/examples/business/s3/MultiDfsWithCredentialsExampleIT.java b/datasafe-examples/datasafe-examples-multidfs/src/test/java/de/adorsys/datasafe/examples/business/s3/MultiDfsWithCredentialsExampleIT.java index cf779ff93..29b7e5f36 100644 --- a/datasafe-examples/datasafe-examples-multidfs/src/test/java/de/adorsys/datasafe/examples/business/s3/MultiDfsWithCredentialsExampleIT.java +++ b/datasafe-examples/datasafe-examples-multidfs/src/test/java/de/adorsys/datasafe/examples/business/s3/MultiDfsWithCredentialsExampleIT.java @@ -58,7 +58,7 @@ * filesBucketOne, filesBucketTwo. */ @Slf4j -class MultiDfsWithCredentialsExampleTest { +class MultiDfsWithCredentialsExampleIT{ private static final String REGION = "eu-central-1"; private static final ExecutorService EXECUTOR = ExecutorServiceUtil.submitterExecutesOnStarvationExecutingService(4, 4); From 25ae87db56ba17e9f01dcd79688c85acc345a828 Mon Sep 17 00:00:00 2001 From: Awambeng <114798938+Awambeng@users.noreply.github.com> Date: Thu, 11 Apr 2024 17:16:36 +0100 Subject: [PATCH 20/28] Merge pull request #298 * Add IT profile for integration testing in the top level project * updated pom.xml --- pom.xml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/pom.xml b/pom.xml index e48bb3c2a..426305f12 100644 --- a/pom.xml +++ b/pom.xml @@ -700,6 +700,25 @@ + + IT + + + + org.apache.maven.plugins + maven-surefire-plugin + ${surefire.version} + + false + + **/*Test + **/*IT + + + + + + From f0cbb26403e8f1c09608786bb881b4afc5acc1d6 Mon Sep 17 00:00:00 2001 From: forkimenjeckayang Date: Thu, 11 Apr 2024 17:36:18 +0100 Subject: [PATCH 21/28] Modification(datasafe-example):Modified BaseUserOperationsWithDefaultDatasafeOnVersionedStorageIT file --- ...seUserOperationsWithDefaultDatasafeOnVersionedStorageIT.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/datasafe-examples/datasafe-examples-versioned-s3/src/test/java/de/adorsys/datasafe/examples/business/s3/BaseUserOperationsWithDefaultDatasafeOnVersionedStorageIT.java b/datasafe-examples/datasafe-examples-versioned-s3/src/test/java/de/adorsys/datasafe/examples/business/s3/BaseUserOperationsWithDefaultDatasafeOnVersionedStorageIT.java index 0f41f74b9..c8429a2cb 100644 --- a/datasafe-examples/datasafe-examples-versioned-s3/src/test/java/de/adorsys/datasafe/examples/business/s3/BaseUserOperationsWithDefaultDatasafeOnVersionedStorageIT.java +++ b/datasafe-examples/datasafe-examples-versioned-s3/src/test/java/de/adorsys/datasafe/examples/business/s3/BaseUserOperationsWithDefaultDatasafeOnVersionedStorageIT.java @@ -43,7 +43,7 @@ */ @Slf4j @DisabledIfSystemProperty(named = "SKIP_CEPH", matches = "true") -class BaseUserOperationsWithDefaultDatasafeOnVersionedStorageTest { +class BaseUserOperationsWithDefaultDatasafeOnVersionedStorageIT{ private static final String MY_OWN_FILE_TXT = "my/own/file.txt"; From 0a03ddd5e87d714bf2d0cdcc48244d198559c14b Mon Sep 17 00:00:00 2001 From: AssahBismarkabah Date: Thu, 11 Apr 2024 17:43:01 +0100 Subject: [PATCH 22/28] fix: updated datasafe-long-run-tests --- datasafe-long-run-tests/README.md | 48 +++++++++---------- .../README.md | 16 +++---- ...st.java => RandomActionsOnDatasafeIT.java} | 2 +- ...java => RandomActionsOnMultiBucketIT.java} | 2 +- 4 files changed, 34 insertions(+), 34 deletions(-) rename datasafe-long-run-tests/datasafe-business-tests-random-actions/src/test/java/de/adorsys/datasafe/business/impl/e2e/randomactions/{RandomActionsOnDatasafeTest.java => RandomActionsOnDatasafeIT.java} (97%) rename datasafe-long-run-tests/datasafe-business-tests-random-actions/src/test/java/de/adorsys/datasafe/business/impl/e2e/randomactions/{RandomActionsOnMultiBucketTest.java => RandomActionsOnMultiBucketIT.java} (97%) diff --git a/datasafe-long-run-tests/README.md b/datasafe-long-run-tests/README.md index d49af3632..64fd0dce8 100644 --- a/datasafe-long-run-tests/README.md +++ b/datasafe-long-run-tests/README.md @@ -2,7 +2,7 @@ ### 1. Testing environment preparation Datasafe throughput tests was run on different Amazon EC2 instances. On each instance after creation was installed JDK, maven and git. Then datasafe project was pulled and executed -[RandomActionsOnDatasafeTest](datasafe-business-tests-random-actions/src/test/java/de/adorsys/datasafe/business/impl/e2e/randomactions/RandomActionsOnDatasafeTest.java) which uses one bucket. Test was launched with all combinations of 2, 4, 8 and 16 parallel threads and 100kb, 1mb and 10mb file sizes. +[RandomActionsOnDatasafeIT](datasafe-business-tests-random-actions/src/test/java/de/adorsys/datasafe/business/impl/e2e/randomactions/RandomActionsOnDatasafeIT.java) which uses one bucket. Test was launched with all combinations of 2, 4, 8 and 16 parallel threads and 100kb, 1mb and 10mb file sizes. #### Preparation commands for running test @@ -87,29 +87,29 @@ Multibucket test is in [RandomActionsOnMultiBucketTest](datasafe-business-tests- Example of raw test results: ```text -07:57:55.523 [main] INFO de.adorsys.datasafe.business.impl.e2e.randomactions.RandomActionsOnDatasafeTest - ==== Statistics for AMAZON with 2 threads and 100 Kb filesize: ==== -07:57:55.532 [main] INFO de.adorsys.datasafe.business.impl.e2e.randomactions.RandomActionsOnDatasafeTest - WRITE : StatisticService.Percentiles(stat={50=35.0, 99=113.73, 90=79.0, 75=57.0, 95=87.65}, throughputPerThread=21.199480270806266) -07:57:55.532 [main] INFO de.adorsys.datasafe.business.impl.e2e.randomactions.RandomActionsOnDatasafeTest - SHARE : StatisticService.Percentiles(stat={50=210.0, 99=537.75, 90=354.5, 75=299.5, 95=440.25}, throughputPerThread=4.598540145985401) -07:57:55.532 [main] INFO de.adorsys.datasafe.business.impl.e2e.randomactions.RandomActionsOnDatasafeTest - LIST : StatisticService.Percentiles(stat={50=18.0, 99=45.39, 90=25.0, 75=21.0, 95=29.95}, throughputPerThread=53.27014218009479) -07:57:55.532 [main] INFO de.adorsys.datasafe.business.impl.e2e.randomactions.RandomActionsOnDatasafeTest - DELETE : StatisticService.Percentiles(stat={50=17.0, 99=47.73, 90=26.0, 75=19.0, 95=35.65}, throughputPerThread=51.12889738382511) -07:57:55.532 [main] INFO de.adorsys.datasafe.business.impl.e2e.randomactions.RandomActionsOnDatasafeTest - CREATE_USER : StatisticService.Percentiles(stat={50=397.0, 99=1020.61, 90=639.1, 75=552.0, 95=851.05}, throughputPerThread=2.0807324178110695) -07:57:55.533 [main] INFO de.adorsys.datasafe.business.impl.e2e.randomactions.RandomActionsOnDatasafeTest - READ : StatisticService.Percentiles(stat={50=16.0, 99=51.09, 90=18.0, 75=17.0, 95=21.0}, throughputPerThread=59.33647388994688) - -07:59:13.117 [main] INFO de.adorsys.datasafe.business.impl.e2e.randomactions.RandomActionsOnDatasafeTest - ==== Statistics for AMAZON with 2 threads and 1024 Kb filesize: ==== -07:59:13.117 [main] INFO de.adorsys.datasafe.business.impl.e2e.randomactions.RandomActionsOnDatasafeTest - WRITE : StatisticService.Percentiles(stat={50=106.0, 99=168.82, 90=132.0, 75=116.0, 95=146.0}, throughputPerThread=9.077864651966383) -07:59:13.117 [main] INFO de.adorsys.datasafe.business.impl.e2e.randomactions.RandomActionsOnDatasafeTest - SHARE : StatisticService.Percentiles(stat={50=470.5, 99=855.25, 90=747.5, 75=670.25, 95=783.25}, throughputPerThread=2.120855074903215) -07:59:13.117 [main] INFO de.adorsys.datasafe.business.impl.e2e.randomactions.RandomActionsOnDatasafeTest - LIST : StatisticService.Percentiles(stat={50=16.0, 99=53.39, 90=23.0, 75=19.0, 95=25.0}, throughputPerThread=55.22256067603419) -07:59:13.118 [main] INFO de.adorsys.datasafe.business.impl.e2e.randomactions.RandomActionsOnDatasafeTest - DELETE : StatisticService.Percentiles(stat={50=17.0, 99=61.46, 90=30.0, 75=20.0, 95=45.0}, throughputPerThread=49.51411383618695) -07:59:13.118 [main] INFO de.adorsys.datasafe.business.impl.e2e.randomactions.RandomActionsOnDatasafeTest - CREATE_USER : StatisticService.Percentiles(stat={50=359.0, 99=552.8199999999999, 90=470.2, 75=421.75, 95=516.1}, throughputPerThread=2.632271650434325) -07:59:13.118 [main] INFO de.adorsys.datasafe.business.impl.e2e.randomactions.RandomActionsOnDatasafeTest - READ : StatisticService.Percentiles(stat={50=45.0, 99=79.09, 90=50.0, 75=47.0, 95=57.0}, throughputPerThread=21.367984118390183) - -08:04:13.146 [main] INFO de.adorsys.datasafe.business.impl.e2e.randomactions.RandomActionsOnDatasafeTest - ==== Statistics for AMAZON with 2 threads and 10240 Kb filesize: ==== -08:04:13.147 [main] INFO de.adorsys.datasafe.business.impl.e2e.randomactions.RandomActionsOnDatasafeTest - WRITE : StatisticService.Percentiles(stat={50=511.0, 99=1052.67, 90=617.0, 75=540.75, 95=682.0}, throughputPerThread=1.7302486534758463) -08:04:13.147 [main] INFO de.adorsys.datasafe.business.impl.e2e.randomactions.RandomActionsOnDatasafeTest - SHARE : StatisticService.Percentiles(stat={50=1503.5, 99=2321.5, 90=2135.5, 75=1822.0, 95=2188.5}, throughputPerThread=0.7149220110869652) -08:04:13.147 [main] INFO de.adorsys.datasafe.business.impl.e2e.randomactions.RandomActionsOnDatasafeTest - LIST : StatisticService.Percentiles(stat={50=15.0, 99=51.39, 90=23.0, 75=18.0, 95=30.9}, throughputPerThread=57.84273363524084) -08:04:13.147 [main] INFO de.adorsys.datasafe.business.impl.e2e.randomactions.RandomActionsOnDatasafeTest - DELETE : StatisticService.Percentiles(stat={50=21.0, 99=64.0, 90=36.3, 75=23.0, 95=48.65}, throughputPerThread=39.00483003736444) -08:04:13.147 [main] INFO de.adorsys.datasafe.business.impl.e2e.randomactions.RandomActionsOnDatasafeTest - CREATE_USER : StatisticService.Percentiles(stat={50=414.0, 99=584.28, 90=496.8, 75=469.75, 95=545.4}, throughputPerThread=2.3832221163012393) -08:04:13.147 [main] INFO de.adorsys.datasafe.business.impl.e2e.randomactions.RandomActionsOnDatasafeTest - READ : StatisticService.Percentiles(stat={50=319.0, 99=458.53, 90=362.0, 75=334.0, 95=390.45}, throughputPerThread=3.051153201906971) +07:57:55.523 [main] INFO de.adorsys.datasafe.business.impl.e2e.randomactions.RandomActionsOnDatasafeIT - ==== Statistics for AMAZON with 2 threads and 100 Kb filesize: ==== +07:57:55.532 [main] INFO de.adorsys.datasafe.business.impl.e2e.randomactions.RandomActionsOnDatasafeIT - WRITE : StatisticService.Percentiles(stat={50=35.0, 99=113.73, 90=79.0, 75=57.0, 95=87.65}, throughputPerThread=21.199480270806266) +07:57:55.532 [main] INFO de.adorsys.datasafe.business.impl.e2e.randomactions.RandomActionsOnDatasafeIT - SHARE : StatisticService.Percentiles(stat={50=210.0, 99=537.75, 90=354.5, 75=299.5, 95=440.25}, throughputPerThread=4.598540145985401) +07:57:55.532 [main] INFO de.adorsys.datasafe.business.impl.e2e.randomactions.RandomActionsOnDatasafeIT - LIST : StatisticService.Percentiles(stat={50=18.0, 99=45.39, 90=25.0, 75=21.0, 95=29.95}, throughputPerThread=53.27014218009479) +07:57:55.532 [main] INFO de.adorsys.datasafe.business.impl.e2e.randomactions.RandomActionsOnDatasafeIT - DELETE : StatisticService.Percentiles(stat={50=17.0, 99=47.73, 90=26.0, 75=19.0, 95=35.65}, throughputPerThread=51.12889738382511) +07:57:55.532 [main] INFO de.adorsys.datasafe.business.impl.e2e.randomactions.RandomActionsOnDatasafeIT - CREATE_USER : StatisticService.Percentiles(stat={50=397.0, 99=1020.61, 90=639.1, 75=552.0, 95=851.05}, throughputPerThread=2.0807324178110695) +07:57:55.533 [main] INFO de.adorsys.datasafe.business.impl.e2e.randomactions.RandomActionsOnDatasafeIT - READ : StatisticService.Percentiles(stat={50=16.0, 99=51.09, 90=18.0, 75=17.0, 95=21.0}, throughputPerThread=59.33647388994688) + +07:59:13.117 [main] INFO de.adorsys.datasafe.business.impl.e2e.randomactions.RandomActionsOnDatasafeIT - ==== Statistics for AMAZON with 2 threads and 1024 Kb filesize: ==== +07:59:13.117 [main] INFO de.adorsys.datasafe.business.impl.e2e.randomactions.RandomActionsOnDatasafeIT - WRITE : StatisticService.Percentiles(stat={50=106.0, 99=168.82, 90=132.0, 75=116.0, 95=146.0}, throughputPerThread=9.077864651966383) +07:59:13.117 [main] INFO de.adorsys.datasafe.business.impl.e2e.randomactions.RandomActionsOnDatasafeIT - SHARE : StatisticService.Percentiles(stat={50=470.5, 99=855.25, 90=747.5, 75=670.25, 95=783.25}, throughputPerThread=2.120855074903215) +07:59:13.117 [main] INFO de.adorsys.datasafe.business.impl.e2e.randomactions.RandomActionsOnDatasafeIT - LIST : StatisticService.Percentiles(stat={50=16.0, 99=53.39, 90=23.0, 75=19.0, 95=25.0}, throughputPerThread=55.22256067603419) +07:59:13.118 [main] INFO de.adorsys.datasafe.business.impl.e2e.randomactions.RandomActionsOnDatasafeIT - DELETE : StatisticService.Percentiles(stat={50=17.0, 99=61.46, 90=30.0, 75=20.0, 95=45.0}, throughputPerThread=49.51411383618695) +07:59:13.118 [main] INFO de.adorsys.datasafe.business.impl.e2e.randomactions.RandomActionsOnDatasafeIT - CREATE_USER : StatisticService.Percentiles(stat={50=359.0, 99=552.8199999999999, 90=470.2, 75=421.75, 95=516.1}, throughputPerThread=2.632271650434325) +07:59:13.118 [main] INFO de.adorsys.datasafe.business.impl.e2e.randomactions.RandomActionsOnDatasafeIT - READ : StatisticService.Percentiles(stat={50=45.0, 99=79.09, 90=50.0, 75=47.0, 95=57.0}, throughputPerThread=21.367984118390183) + +08:04:13.146 [main] INFO de.adorsys.datasafe.business.impl.e2e.randomactions.RandomActionsOnDatasafeIT - ==== Statistics for AMAZON with 2 threads and 10240 Kb filesize: ==== +08:04:13.147 [main] INFO de.adorsys.datasafe.business.impl.e2e.randomactions.RandomActionsOnDatasafeIT - WRITE : StatisticService.Percentiles(stat={50=511.0, 99=1052.67, 90=617.0, 75=540.75, 95=682.0}, throughputPerThread=1.7302486534758463) +08:04:13.147 [main] INFO de.adorsys.datasafe.business.impl.e2e.randomactions.RandomActionsOnDatasafeIT - SHARE : StatisticService.Percentiles(stat={50=1503.5, 99=2321.5, 90=2135.5, 75=1822.0, 95=2188.5}, throughputPerThread=0.7149220110869652) +08:04:13.147 [main] INFO de.adorsys.datasafe.business.impl.e2e.randomactions.RandomActionsOnDatasafeIT - LIST : StatisticService.Percentiles(stat={50=15.0, 99=51.39, 90=23.0, 75=18.0, 95=30.9}, throughputPerThread=57.84273363524084) +08:04:13.147 [main] INFO de.adorsys.datasafe.business.impl.e2e.randomactions.RandomActionsOnDatasafeIT - DELETE : StatisticService.Percentiles(stat={50=21.0, 99=64.0, 90=36.3, 75=23.0, 95=48.65}, throughputPerThread=39.00483003736444) +08:04:13.147 [main] INFO de.adorsys.datasafe.business.impl.e2e.randomactions.RandomActionsOnDatasafeIT - CREATE_USER : StatisticService.Percentiles(stat={50=414.0, 99=584.28, 90=496.8, 75=469.75, 95=545.4}, throughputPerThread=2.3832221163012393) +08:04:13.147 [main] INFO de.adorsys.datasafe.business.impl.e2e.randomactions.RandomActionsOnDatasafeIT - READ : StatisticService.Percentiles(stat={50=319.0, 99=458.53, 90=362.0, 75=334.0, 95=390.45}, throughputPerThread=3.051153201906971) ``` Then results was parsed and transformed with help of [parse_script.groovy](datasafe-business-tests-random-actions/parse_script.groovy) to suitable for charts builder view. diff --git a/datasafe-long-run-tests/datasafe-business-tests-random-actions/README.md b/datasafe-long-run-tests/datasafe-business-tests-random-actions/README.md index ca214bd03..03da14106 100644 --- a/datasafe-long-run-tests/datasafe-business-tests-random-actions/README.md +++ b/datasafe-long-run-tests/datasafe-business-tests-random-actions/README.md @@ -8,7 +8,7 @@ Tests can be disabled using (for performance reasons): `DISABLE_RANDOM_ACTIONS_TEST` system property equal to `true` Tests for Datasafe: - - [RandomActionsOnDatasafeTest](src/test/java/de/adorsys/datasafe/business/impl/e2e/randomactions/RandomActionsOnDatasafeTest.java) + - [RandomActionsOnDatasafeIT](src/test/java/de/adorsys/datasafe/business/impl/e2e/randomactions/RandomActionsOnDatasafeIT.java) Tests for Datasafe-wrapper: - [RandomActionsOnSimpleDatasafeAdapterTest](src/test/java/de/adorsys/datasafe/business/impl/e2e/randomactions/RandomActionsOnSimpleDatasafeAdapterTest.java) @@ -47,13 +47,13 @@ This way, we achieve parallel execution of random actions and can calculate perf These tests run on test plan matrix of (Content-size x Thread-count). As the result they produce following output in logs: ```text -12:51:36.383 [main] INFO de.adorsys.datasafe.business.impl.e2e.randomactions.RandomActionsOnDatasafeTest - ==== Statistics for FILESYSTEM with 11 threads and 3 Mb filesize: ==== -12:51:36.383 [main] INFO de.adorsys.datasafe.business.impl.e2e.randomactions.RandomActionsOnDatasafeTest - WRITE : StatisticService.Percentiles(stat={50=398.0, 99=629.78, 90=493.8, 75=436.0, 95=515.9}, throughputPerThread=2.4650780608052587) -12:51:36.383 [main] INFO de.adorsys.datasafe.business.impl.e2e.randomactions.RandomActionsOnDatasafeTest - LIST : StatisticService.Percentiles(stat={50=2.0, 99=12.0, 90=7.0, 75=4.0, 95=8.0}, throughputPerThread=389.06752411575565) -12:51:36.383 [main] INFO de.adorsys.datasafe.business.impl.e2e.randomactions.RandomActionsOnDatasafeTest - SHARE : StatisticService.Percentiles(stat={50=1987.5, 99=4022.18, 90=3323.7, 75=2448.0, 95=3456.65}, throughputPerThread=0.5068871369708885) -12:51:36.383 [main] INFO de.adorsys.datasafe.business.impl.e2e.randomactions.RandomActionsOnDatasafeTest - CREATE_USER : StatisticService.Percentiles(stat={50=461.0, 99=830.83, 90=658.3, 75=544.0, 95=754.15}, throughputPerThread=2.048340843916428) -12:51:36.383 [main] INFO de.adorsys.datasafe.business.impl.e2e.randomactions.RandomActionsOnDatasafeTest - READ : StatisticService.Percentiles(stat={50=511.0, 99=690.92, 90=602.6, 75=551.0, 95=646.0}, throughputPerThread=1.9656450727288677) -12:51:36.383 [main] INFO de.adorsys.datasafe.business.impl.e2e.randomactions.RandomActionsOnDatasafeTest - DELETE : StatisticService.Percentiles(stat={50=3.0, 99=8.05, 90=4.0, 75=4.0, 95=5.0}, throughputPerThread=397.5903614457831) +12:51:36.383 [main] INFO de.adorsys.datasafe.business.impl.e2e.randomactions.RandomActionsOnDatasafeIT - ==== Statistics for FILESYSTEM with 11 threads and 3 Mb filesize: ==== +12:51:36.383 [main] INFO de.adorsys.datasafe.business.impl.e2e.randomactions.RandomActionsOnDatasafeIT - WRITE : StatisticService.Percentiles(stat={50=398.0, 99=629.78, 90=493.8, 75=436.0, 95=515.9}, throughputPerThread=2.4650780608052587) +12:51:36.383 [main] INFO de.adorsys.datasafe.business.impl.e2e.randomactions.RandomActionsOnDatasafeIT - LIST : StatisticService.Percentiles(stat={50=2.0, 99=12.0, 90=7.0, 75=4.0, 95=8.0}, throughputPerThread=389.06752411575565) +12:51:36.383 [main] INFO de.adorsys.datasafe.business.impl.e2e.randomactions.RandomActionsOnDatasafeIT - SHARE : StatisticService.Percentiles(stat={50=1987.5, 99=4022.18, 90=3323.7, 75=2448.0, 95=3456.65}, throughputPerThread=0.5068871369708885) +12:51:36.383 [main] INFO de.adorsys.datasafe.business.impl.e2e.randomactions.RandomActionsOnDatasafeIT - CREATE_USER : StatisticService.Percentiles(stat={50=461.0, 99=830.83, 90=658.3, 75=544.0, 95=754.15}, throughputPerThread=2.048340843916428) +12:51:36.383 [main] INFO de.adorsys.datasafe.business.impl.e2e.randomactions.RandomActionsOnDatasafeIT - READ : StatisticService.Percentiles(stat={50=511.0, 99=690.92, 90=602.6, 75=551.0, 95=646.0}, throughputPerThread=1.9656450727288677) +12:51:36.383 [main] INFO de.adorsys.datasafe.business.impl.e2e.randomactions.RandomActionsOnDatasafeIT - DELETE : StatisticService.Percentiles(stat={50=3.0, 99=8.05, 90=4.0, 75=4.0, 95=5.0}, throughputPerThread=397.5903614457831) ``` Where, ```text diff --git a/datasafe-long-run-tests/datasafe-business-tests-random-actions/src/test/java/de/adorsys/datasafe/business/impl/e2e/randomactions/RandomActionsOnDatasafeTest.java b/datasafe-long-run-tests/datasafe-business-tests-random-actions/src/test/java/de/adorsys/datasafe/business/impl/e2e/randomactions/RandomActionsOnDatasafeIT.java similarity index 97% rename from datasafe-long-run-tests/datasafe-business-tests-random-actions/src/test/java/de/adorsys/datasafe/business/impl/e2e/randomactions/RandomActionsOnDatasafeTest.java rename to datasafe-long-run-tests/datasafe-business-tests-random-actions/src/test/java/de/adorsys/datasafe/business/impl/e2e/randomactions/RandomActionsOnDatasafeIT.java index 494329efe..c4f3a1575 100644 --- a/datasafe-long-run-tests/datasafe-business-tests-random-actions/src/test/java/de/adorsys/datasafe/business/impl/e2e/randomactions/RandomActionsOnDatasafeTest.java +++ b/datasafe-long-run-tests/datasafe-business-tests-random-actions/src/test/java/de/adorsys/datasafe/business/impl/e2e/randomactions/RandomActionsOnDatasafeIT.java @@ -23,7 +23,7 @@ */ @Slf4j @DisabledIfSystemProperty(named = DISABLE_RANDOM_ACTIONS_TEST, matches = "true") -class RandomActionsOnDatasafeTest extends BaseRandomActions { +class RandomActionsOnDatasafeIT extends BaseRandomActions { @ParameterizedTest @MethodSource("actionsOnStoragesAndThreadsAndFilesizes") diff --git a/datasafe-long-run-tests/datasafe-business-tests-random-actions/src/test/java/de/adorsys/datasafe/business/impl/e2e/randomactions/RandomActionsOnMultiBucketTest.java b/datasafe-long-run-tests/datasafe-business-tests-random-actions/src/test/java/de/adorsys/datasafe/business/impl/e2e/randomactions/RandomActionsOnMultiBucketIT.java similarity index 97% rename from datasafe-long-run-tests/datasafe-business-tests-random-actions/src/test/java/de/adorsys/datasafe/business/impl/e2e/randomactions/RandomActionsOnMultiBucketTest.java rename to datasafe-long-run-tests/datasafe-business-tests-random-actions/src/test/java/de/adorsys/datasafe/business/impl/e2e/randomactions/RandomActionsOnMultiBucketIT.java index 940634947..d72ae3662 100644 --- a/datasafe-long-run-tests/datasafe-business-tests-random-actions/src/test/java/de/adorsys/datasafe/business/impl/e2e/randomactions/RandomActionsOnMultiBucketTest.java +++ b/datasafe-long-run-tests/datasafe-business-tests-random-actions/src/test/java/de/adorsys/datasafe/business/impl/e2e/randomactions/RandomActionsOnMultiBucketIT.java @@ -16,7 +16,7 @@ @Slf4j @EnabledIfSystemProperty(named = ENABLE_MULTI_BUCKET_TEST, matches = "true") -class RandomActionsOnMultiBucketTest extends BaseRandomActions { +class RandomActionsOnMultiBucketIT extends BaseRandomActions { @ParameterizedTest @MethodSource("actionsOnStoragesAndThreadsAndFilesizes") From 801e2da0b80495d204bbea3645a52bd46236d8ae Mon Sep 17 00:00:00 2001 From: Elwizzy12 Date: Thu, 11 Apr 2024 18:06:42 +0100 Subject: [PATCH 23/28] integration-test-files-for-clear-separation --- .../business/impl/e2e/{BaseE2ETest.java => BaseE2EIT.java} | 0 ...feVersionTest.java => ProfileContainsDatasafeVersion2EIT.java} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/{BaseE2ETest.java => BaseE2EIT.java} (100%) rename datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/{ProfileContainsDatasafeVersionTest.java => ProfileContainsDatasafeVersion2EIT.java} (100%) diff --git a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BaseE2ETest.java b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BaseE2EIT.java similarity index 100% rename from datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BaseE2ETest.java rename to datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BaseE2EIT.java diff --git a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/ProfileContainsDatasafeVersionTest.java b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/ProfileContainsDatasafeVersion2EIT.java similarity index 100% rename from datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/ProfileContainsDatasafeVersionTest.java rename to datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/ProfileContainsDatasafeVersion2EIT.java From 0c3af1cf06c370f0c1f798d5e6b7a1526311a08a Mon Sep 17 00:00:00 2001 From: Elwizzy12 Date: Thu, 11 Apr 2024 18:18:47 +0100 Subject: [PATCH 24/28] integration-test-files-for-clear-separation --- .../e2e/{BaseE2EIT.java => BaseE2ETest.java} | 0 ...> ProfileContainsDatasafeVersionTest.java} | 0 .../impl/e2e/SchemaDelegationTest.java | 128 +++++++++++++++ .../business/impl/e2e/SchemeDelegationIT.java | 152 ------------------ 4 files changed, 128 insertions(+), 152 deletions(-) rename datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/{BaseE2EIT.java => BaseE2ETest.java} (100%) rename datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/{ProfileContainsDatasafeVersion2EIT.java => ProfileContainsDatasafeVersionTest.java} (100%) create mode 100644 datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/SchemaDelegationTest.java delete mode 100644 datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/SchemeDelegationIT.java diff --git a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BaseE2EIT.java b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BaseE2ETest.java similarity index 100% rename from datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BaseE2EIT.java rename to datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BaseE2ETest.java diff --git a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/ProfileContainsDatasafeVersion2EIT.java b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/ProfileContainsDatasafeVersionTest.java similarity index 100% rename from datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/ProfileContainsDatasafeVersion2EIT.java rename to datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/ProfileContainsDatasafeVersionTest.java diff --git a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/SchemaDelegationTest.java b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/SchemaDelegationTest.java new file mode 100644 index 000000000..1ea5f453c --- /dev/null +++ b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/SchemaDelegationTest.java @@ -0,0 +1,128 @@ +package de.adorsys.datasafe.business.impl.e2e; + +import de.adorsys.datasafe.business.impl.service.DaggerDefaultDatasafeServices; +import de.adorsys.datasafe.business.impl.service.DefaultDatasafeServices; +import de.adorsys.datasafe.directory.impl.profile.config.DefaultDFSConfig; +import de.adorsys.datasafe.encrypiton.api.types.UserID; +import de.adorsys.datasafe.encrypiton.api.types.UserIDAuth; +import de.adorsys.datasafe.storage.api.SchemeDelegatingStorage; +import de.adorsys.datasafe.storage.api.StorageService; +import de.adorsys.datasafe.storage.impl.fs.FileSystemStorageService; +import de.adorsys.datasafe.teststorage.WithStorageProvider; +import de.adorsys.datasafe.types.api.actions.WriteRequest; +import de.adorsys.datasafe.types.api.resource.AbsoluteLocation; +import de.adorsys.datasafe.types.api.resource.BasePrivateResource; +import de.adorsys.datasafe.types.api.resource.ResolvedResource; +import de.adorsys.datasafe.types.api.resource.Uri; +import de.adorsys.datasafe.types.api.types.ReadStorePassword; +import de.adorsys.datasafe.types.api.utils.ReadKeyPasswordTestFactory; +import lombok.SneakyThrows; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.io.TempDir; +import org.testcontainers.shaded.com.google.common.collect.ImmutableMap; + +import java.io.IOException; +import java.io.OutputStream; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.List; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import static org.assertj.core.api.Assertions.assertThat; + +class SchemeDelegationTest extends WithStorageProvider { + + private Path fsPath; + private Uri minioPath; + private StorageService minio; + private StorageService filesystem; + private DefaultDatasafeServices datasafeServices; + + @BeforeEach + void initialize(@TempDir Path tempDir) { + WithStorageProvider.StorageDescriptor minioDescriptor = minio(); + this.fsPath = tempDir; + this.minio = minioDescriptor.getStorageService().get(); + this.filesystem = new FileSystemStorageService(tempDir); + this.minioPath = minioDescriptor.getLocation(); + StorageService multiDfs = new SchemeDelegatingStorage( + ImmutableMap.of( + "s3", minio, + "file", filesystem + ) + ); + + this.datasafeServices = DaggerDefaultDatasafeServices + .builder() + .config(new ProfilesOnFsDataOnMinio(minioPath, tempDir)) + .storage(multiDfs) + .build(); + } + + @Test + @SneakyThrows + void testProfileOnFsDataOnMinioWorks() { + UserIDAuth userJohn = new UserIDAuth("john", ReadKeyPasswordTestFactory.getForString("doe")); + + // John's profile will be saved to filesystem + datasafeServices.userProfile().registerUsingDefaults(userJohn); + + // But this data - it will be saved to minio + try (OutputStream os = + datasafeServices.privateService().write(WriteRequest.forDefaultPrivate(userJohn, "file.txt"))) { + os.write("Hello".getBytes()); + } + + // Profiles are on FS + assertThat(listFs()) + .extracting(it -> fsPath.relativize(it)) + .extracting(Path::toString) + .containsExactlyInAnyOrder("", "public-john", "private-john"); + // File and keystore/pub keys are on minio + assertThat(listMinio()) + .extracting(it -> minioPath.relativize(it.location())) + .extracting(it -> it.asURI().toString()) + .contains("users/john/private/keystore", "users/john/public/pubkeys") + .anyMatch(it -> it.startsWith("users/john/private/files/")) + .hasSize(3); + } + + private List> listMinio() { + try (Stream> ls = + minio.list(new AbsoluteLocation<>(BasePrivateResource.forPrivate(minioPath.resolve(""))))) { + return ls.collect(Collectors.toList()); + } + } + + private List listFs() throws IOException { + try (Stream ls = Files.walk(fsPath)) { + return ls.collect(Collectors.toList()); + } + } + + static class ProfilesOnFsDataOnMinio extends DefaultDFSConfig { + + private final Path profilesPath; + + ProfilesOnFsDataOnMinio(Uri minioBucketPath, Path profilesPath) { + super(minioBucketPath, new ReadStorePassword("PAZZWORT")); + this.profilesPath = profilesPath; + } + + @Override + public AbsoluteLocation publicProfile(UserID forUser) { + return new AbsoluteLocation<>( + BasePrivateResource.forPrivate(profilesPath.resolve("public-" + forUser.getValue()).toUri()) + ); + } + + @Override + public AbsoluteLocation privateProfile(UserID forUser) { + return new AbsoluteLocation<>( + BasePrivateResource.forPrivate(profilesPath.resolve("private-" + forUser.getValue()).toUri()) + ); + } + } +} \ No newline at end of file diff --git a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/SchemeDelegationIT.java b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/SchemeDelegationIT.java deleted file mode 100644 index 846c11ea1..000000000 --- a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/SchemeDelegationIT.java +++ /dev/null @@ -1,152 +0,0 @@ -package de.adorsys.datasafe.business.impl.e2e; - -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.ImmutableSet; -import de.adorsys.datasafe.business.impl.service.DaggerDefaultDatasafeServices; -import de.adorsys.datasafe.business.impl.service.DefaultDatasafeServices; -import de.adorsys.datasafe.directory.impl.profile.config.DefaultDFSConfig; -import de.adorsys.datasafe.encrypiton.api.types.UserID; -import de.adorsys.datasafe.encrypiton.api.types.UserIDAuth; -import de.adorsys.datasafe.storage.api.SchemeDelegatingStorage; -import de.adorsys.datasafe.storage.api.StorageService; -import de.adorsys.datasafe.storage.impl.db.DatabaseConnectionRegistry; -import de.adorsys.datasafe.storage.impl.db.DatabaseCredentials; -import de.adorsys.datasafe.storage.impl.db.DatabaseStorageService; -import de.adorsys.datasafe.storage.impl.fs.FileSystemStorageService; -import de.adorsys.datasafe.teststorage.WithStorageProvider; -import de.adorsys.datasafe.types.api.actions.WriteRequest; -import de.adorsys.datasafe.types.api.resource.AbsoluteLocation; -import de.adorsys.datasafe.types.api.resource.BasePrivateResource; -import de.adorsys.datasafe.types.api.resource.ResolvedResource; -import de.adorsys.datasafe.types.api.resource.Uri; -import de.adorsys.datasafe.types.api.types.ReadStorePassword; -import de.adorsys.datasafe.types.api.utils.ReadKeyPasswordTestFactory; -import lombok.SneakyThrows; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.io.TempDir; - -import java.io.OutputStream; -import java.net.URI; -import java.nio.file.Files; -import java.nio.file.Path; -import java.util.List; -import java.util.Set; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -import static de.adorsys.datasafe.types.api.global.PathEncryptionId.AES_SIV; -import static org.assertj.core.api.Assertions.assertThat; - -class SchemeDelegationWithDbTest extends WithStorageProvider { - - private static final Set ALLOWED_TABLES = ImmutableSet.of("users", "private_profiles", "public_profiles"); - - private Path fsPath; - private StorageService db; - private DefaultDatasafeServices datasafeServices; - - @BeforeEach - void initialize(@TempDir Path tempDir) { - this.fsPath = tempDir; - StorageService filesystem = new FileSystemStorageService(tempDir); - this.db = new DatabaseStorageService(ALLOWED_TABLES, new DatabaseConnectionRegistry( - uri -> uri.location().getWrapped().getScheme() + ":" + uri.location().getPath().split("/")[1], - ImmutableMap.of("jdbc://localhost:9999", new DatabaseCredentials("sa", "sa"))) - ); - - StorageService multiDfs = new SchemeDelegatingStorage( - ImmutableMap.of( - "file", filesystem, - "jdbc", db - ) - ); - - this.datasafeServices = DaggerDefaultDatasafeServices - .builder() - .config(new ProfilesOnDbDataOnFs(tempDir.toUri(), URI.create("jdbc://localhost:9999/h2:mem:test/"))) - .storage(multiDfs) - .build(); - } - - @Test - @SneakyThrows - void testProfileOnDbDataOnFsWorks() { - UserIDAuth userJohn = new UserIDAuth("john", ReadKeyPasswordTestFactory.getForString("doe")); - - // John's profile will be saved to Database - datasafeServices.userProfile().registerUsingDefaults(userJohn); - - // But this data - it will be saved to FS - try (OutputStream os = - datasafeServices.privateService().write(WriteRequest.forDefaultPrivate(userJohn, "file.txt"))) { - os.write("Hello".getBytes()); - } - - // Profiles are on DB - assertThat(listDb("jdbc://localhost:9999/h2:mem:test/private_profiles/")) - .containsExactly("jdbc://localhost:9999/h2:mem:test/private_profiles/john"); - assertThat(listDb("jdbc://localhost:9999/h2:mem:test/public_profiles/")) - .containsExactly("jdbc://localhost:9999/h2:mem:test/public_profiles/john"); - - Path path = fsPath.resolve(new Uri("users/john/private/files/").resolve(AES_SIV.asUriRoot()).asString()); - Path encryptedFile = walk(path).get(1); - // File and keystore/pub keys are on FS - assertThat(walk(fsPath)) - .extracting(it -> fsPath.toUri().relativize(it.toUri())) - .extracting(URI::toString) - .containsExactlyInAnyOrder( - "", - "users/", - "users/john/", - "users/john/public/", - "users/john/public/pubkeys", - "users/john/private/", - "users/john/private/keystore", - "users/john/private/files/", - "users/john/private/files/SIV/", - fsPath.toUri().relativize(encryptedFile.toUri()).toString() - ); - } - - @SneakyThrows - private List walk(Path at) { - try (Stream ls = Files.walk(at)) { - return ls.collect(Collectors.toList()); - } - } - - private List listDb(String path) { - try (Stream> stream = db.list(BasePrivateResource.forAbsolutePrivate(URI.create(path)))){ - return stream.map(it -> it.location().asURI().toString()).collect(Collectors.toList()); - } - } - - static class ProfilesOnDbDataOnFs extends DefaultDFSConfig { - - private final Uri profilesPath; - - ProfilesOnDbDataOnFs(URI fsPath, URI profilesPath) { - super(fsPath, new ReadStorePassword("PAZZWORT")); - this.profilesPath = new Uri(profilesPath); - } - - @Override - public AbsoluteLocation publicProfile(UserID forUser) { - return new AbsoluteLocation<>( - BasePrivateResource.forPrivate( - profilesPath.resolve("public_profiles/").resolve(forUser.getValue()) - ) - ); - } - - @Override - public AbsoluteLocation privateProfile(UserID forUser) { - return new AbsoluteLocation<>( - BasePrivateResource.forPrivate( - profilesPath.resolve("private_profiles/").resolve(forUser.getValue()) - ) - ); - } - } -} \ No newline at end of file From 04602eafb9947dad1a734deb86bc2cdaff2d1688 Mon Sep 17 00:00:00 2001 From: Elwizzy12 Date: Fri, 12 Apr 2024 11:06:03 +0100 Subject: [PATCH 25/28] changed integration test with suffix IT --- .../business/impl/e2e/{BaseE2ETest.java => BaseE2EIT.java} | 2 +- .../datasafe/business/impl/e2e/BasicFunctionalityIT.java | 2 +- .../datasafe/business/impl/e2e/BasicFunctionalityUtf8IT.java | 2 +- .../business/impl/e2e/BasicFunctionalityWithConcurrencyIT.java | 2 +- .../impl/e2e/BasicFunctionalityWithPasswordChangeIT.java | 2 +- .../datasafe/business/impl/e2e/DataTamperingResistanceIT.java | 2 +- .../datasafe/business/impl/e2e/KeyStoreTypeCompareIT.java | 2 +- ...ersionTest.java => ProfileContainsDatasafeVersion2EIT.java} | 2 +- .../e2e/{SchemaDelegationTest.java => SchemeDelegationIT.java} | 3 +-- .../datasafe/business/impl/e2e/StorageBasedVersioningIT.java | 2 +- .../de/adorsys/datasafe/business/impl/e2e/VersionedDataIT.java | 2 +- 11 files changed, 11 insertions(+), 12 deletions(-) rename datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/{BaseE2ETest.java => BaseE2EIT.java} (99%) rename datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/{ProfileContainsDatasafeVersionTest.java => ProfileContainsDatasafeVersion2EIT.java} (94%) rename datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/{SchemaDelegationTest.java => SchemeDelegationIT.java} (98%) diff --git a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BaseE2ETest.java b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BaseE2EIT.java similarity index 99% rename from datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BaseE2ETest.java rename to datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BaseE2EIT.java index d544e2842..9cf4118e6 100644 --- a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BaseE2ETest.java +++ b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BaseE2EIT.java @@ -52,7 +52,7 @@ @Slf4j @RequiredArgsConstructor -public abstract class BaseE2ETest extends WithStorageProvider { +public abstract class BaseE2EIT extends WithStorageProvider { protected static final String PRIVATE_COMPONENT = "private"; protected static final String PRIVATE_FILES_COMPONENT = PRIVATE_COMPONENT + "/files"; diff --git a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BasicFunctionalityIT.java b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BasicFunctionalityIT.java index 4139e2a73..ce249ce74 100644 --- a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BasicFunctionalityIT.java +++ b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BasicFunctionalityIT.java @@ -47,7 +47,7 @@ * Tests that validates basic functionality - storing data to inbox, privatespace, listing files, etc. */ @Slf4j -class BasicFunctionalityIT extends BaseE2ETest { +class BasicFunctionalityIT extends BaseE2EIT { private static final int LARGE_SIZE = 10 * 1024 * 1024 + 100; diff --git a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BasicFunctionalityUtf8IT.java b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BasicFunctionalityUtf8IT.java index 5b2697852..344099e55 100644 --- a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BasicFunctionalityUtf8IT.java +++ b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BasicFunctionalityUtf8IT.java @@ -15,7 +15,7 @@ * Tests that validates basic functionality - storing data to inbox, privatespace, listing files, etc. using UTF-8 paths. */ @Slf4j -class BasicFunctionalityUtf8IT extends BaseE2ETest { +class BasicFunctionalityUtf8IT extends BaseE2EIT { private static final String MESSAGE_ONE = "Hello here 1"; private static final String FOLDER = "folder1"; diff --git a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BasicFunctionalityWithConcurrencyIT.java b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BasicFunctionalityWithConcurrencyIT.java index 238fff129..665666f61 100644 --- a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BasicFunctionalityWithConcurrencyIT.java +++ b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BasicFunctionalityWithConcurrencyIT.java @@ -56,7 +56,7 @@ * Multithreaded test of basic operations. */ @Slf4j -class BasicFunctionalityWithConcurrencyIT extends BaseE2ETest { +class BasicFunctionalityWithConcurrencyIT extends BaseE2EIT { private static final int TIMEOUT_S = 30; diff --git a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BasicFunctionalityWithPasswordChangeIT.java b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BasicFunctionalityWithPasswordChangeIT.java index ad5f3c320..714696659 100644 --- a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BasicFunctionalityWithPasswordChangeIT.java +++ b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/BasicFunctionalityWithPasswordChangeIT.java @@ -28,7 +28,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertThrows; -class BasicFunctionalityWithPasswordChangeIT extends BaseE2ETest { +class BasicFunctionalityWithPasswordChangeIT extends BaseE2EIT { @SneakyThrows @ParameterizedTest diff --git a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/DataTamperingResistanceIT.java b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/DataTamperingResistanceIT.java index 202f3ef83..9d2a623fb 100644 --- a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/DataTamperingResistanceIT.java +++ b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/DataTamperingResistanceIT.java @@ -38,7 +38,7 @@ * attacker is unable to modify encrypted text without being detected. */ @Slf4j -class DataTamperingResistanceIT extends BaseE2ETest { +class DataTamperingResistanceIT extends BaseE2EIT { private static final Set NOT_TO_REPLACE_IN_PATH = ImmutableSet.of('=', '/'); diff --git a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/KeyStoreTypeCompareIT.java b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/KeyStoreTypeCompareIT.java index 24672c5ba..d07bd839a 100644 --- a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/KeyStoreTypeCompareIT.java +++ b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/KeyStoreTypeCompareIT.java @@ -24,7 +24,7 @@ import static org.assertj.core.api.Assertions.assertThat; @Slf4j -public class KeyStoreTypeCompareIT extends BaseE2ETest { +public class KeyStoreTypeCompareIT extends BaseE2EIT { private final static int NUMBER_WRITES = 100; private final static int NUMBER_READS = 100; diff --git a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/ProfileContainsDatasafeVersionTest.java b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/ProfileContainsDatasafeVersion2EIT.java similarity index 94% rename from datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/ProfileContainsDatasafeVersionTest.java rename to datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/ProfileContainsDatasafeVersion2EIT.java index cf7afb707..7f12fdcf2 100644 --- a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/ProfileContainsDatasafeVersionTest.java +++ b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/ProfileContainsDatasafeVersion2EIT.java @@ -8,7 +8,7 @@ import static org.assertj.core.api.Assertions.assertThat; -class ProfileContainsDatasafeVersionTest extends BaseE2ETest { +class ProfileContainsDatasafeVersion2EIT extends BaseE2EIT { @Test @SneakyThrows diff --git a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/SchemaDelegationTest.java b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/SchemeDelegationIT.java similarity index 98% rename from datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/SchemaDelegationTest.java rename to datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/SchemeDelegationIT.java index 1ea5f453c..0035db8c2 100644 --- a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/SchemaDelegationTest.java +++ b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/SchemeDelegationIT.java @@ -1,5 +1,4 @@ package de.adorsys.datasafe.business.impl.e2e; - import de.adorsys.datasafe.business.impl.service.DaggerDefaultDatasafeServices; import de.adorsys.datasafe.business.impl.service.DefaultDatasafeServices; import de.adorsys.datasafe.directory.impl.profile.config.DefaultDFSConfig; @@ -32,7 +31,7 @@ import static org.assertj.core.api.Assertions.assertThat; -class SchemeDelegationTest extends WithStorageProvider { +class SchemeDelegationIT extends WithStorageProvider { private Path fsPath; private Uri minioPath; diff --git a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/StorageBasedVersioningIT.java b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/StorageBasedVersioningIT.java index 4da2b6b51..5445cbaf3 100644 --- a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/StorageBasedVersioningIT.java +++ b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/StorageBasedVersioningIT.java @@ -25,7 +25,7 @@ import static org.junit.jupiter.api.Assertions.assertThrows; @DisabledIfSystemProperty(named = WithStorageProvider.SKIP_CEPH, matches = "true") -class StorageBasedVersioningIT extends BaseE2ETest { +class StorageBasedVersioningIT extends BaseE2EIT { private static final String FILE = "file.txt"; diff --git a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/VersionedDataIT.java b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/VersionedDataIT.java index f791a6c87..a4a583237 100644 --- a/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/VersionedDataIT.java +++ b/datasafe-business/src/test/java/de/adorsys/datasafe/business/impl/e2e/VersionedDataIT.java @@ -36,7 +36,7 @@ * Validates software versioned operations. */ @Slf4j -public class VersionedDataIT extends BaseE2ETest { +public class VersionedDataIT extends BaseE2EIT { private static final String MESSAGE_ONE = "Hello here 1"; private static final String MESSAGE_TWO = "Hello here 2"; From 09b5d14c496f162d6bc02cdb9f3e678c6a83a229 Mon Sep 17 00:00:00 2001 From: AssahBismarkabah Date: Fri, 12 Apr 2024 13:12:35 +0100 Subject: [PATCH 26/28] fix: updated Datasafe-long-run-tests TestFiles --- ...terTest.java => RandomActionsOnSimpleDatasafeAdapterIT.java} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename datasafe-long-run-tests/datasafe-business-tests-random-actions/src/test/java/de/adorsys/datasafe/business/impl/e2e/randomactions/{RandomActionsOnSimpleDatasafeAdapterTest.java => RandomActionsOnSimpleDatasafeAdapterIT.java} (99%) diff --git a/datasafe-long-run-tests/datasafe-business-tests-random-actions/src/test/java/de/adorsys/datasafe/business/impl/e2e/randomactions/RandomActionsOnSimpleDatasafeAdapterTest.java b/datasafe-long-run-tests/datasafe-business-tests-random-actions/src/test/java/de/adorsys/datasafe/business/impl/e2e/randomactions/RandomActionsOnSimpleDatasafeAdapterIT.java similarity index 99% rename from datasafe-long-run-tests/datasafe-business-tests-random-actions/src/test/java/de/adorsys/datasafe/business/impl/e2e/randomactions/RandomActionsOnSimpleDatasafeAdapterTest.java rename to datasafe-long-run-tests/datasafe-business-tests-random-actions/src/test/java/de/adorsys/datasafe/business/impl/e2e/randomactions/RandomActionsOnSimpleDatasafeAdapterIT.java index 3cc92af44..4e782034a 100644 --- a/datasafe-long-run-tests/datasafe-business-tests-random-actions/src/test/java/de/adorsys/datasafe/business/impl/e2e/randomactions/RandomActionsOnSimpleDatasafeAdapterTest.java +++ b/datasafe-long-run-tests/datasafe-business-tests-random-actions/src/test/java/de/adorsys/datasafe/business/impl/e2e/randomactions/RandomActionsOnSimpleDatasafeAdapterIT.java @@ -68,7 +68,7 @@ * Imitates close-to-production SimpleDatasafeAdapter deployment. */ @DisabledIfSystemProperty(named = DISABLE_RANDOM_ACTIONS_TEST, matches = "true") -class RandomActionsOnSimpleDatasafeAdapterTest extends BaseRandomActions { +class RandomActionsOnSimpleDatasafeAdapterIT extends BaseRandomActions { @ParameterizedTest @MethodSource("actionsOnStoragesAndThreadsAndFilesizes") From ebdb09ef36e181d11a3222f94130a06a901a3720 Mon Sep 17 00:00:00 2001 From: Maxim Grischenko Date: Mon, 29 Jan 2024 19:06:11 +0100 Subject: [PATCH 27/28] Add mvn IT profile on github build --- .github/workflows/pull-request.yml | 2 +- .github/workflows/push-develop.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 988ae1ee7..b0d6e2f9e 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -25,7 +25,7 @@ jobs: key: docker-${{ runner.os }} - name: Step 4 - Build & Test - run: mvn clean verify -ntp + run: mvn clean verify -ntp -PIT - name: Step 5 - Upload coverage unittests reports to Codecov uses: codecov/codecov-action@v3 diff --git a/.github/workflows/push-develop.yml b/.github/workflows/push-develop.yml index 14dc23fc3..cebd686b3 100644 --- a/.github/workflows/push-develop.yml +++ b/.github/workflows/push-develop.yml @@ -24,7 +24,7 @@ jobs: key: docker-${{ runner.os }} - name: Step 4 - Build & Test - run: mvn clean verify -ntp + run: mvn clean verify -ntp -PIT - name: Step 5 - Deploy Snapshot run: ./scripts/mvn_deploy.sh From 8c36cb86edd678ad91aa952c0c9d8d3de154d2dc Mon Sep 17 00:00:00 2001 From: Maxim Grischenko Date: Thu, 18 Apr 2024 10:26:51 +0200 Subject: [PATCH 28/28] frontend fixes --- README.md | 3 +- .../datasafe.postman_collection.json | 1689 +++++++++++------ .../rest/impl/security/SecurityConfig.java | 34 +- frontend/README.md | 2 + frontend/datasafe-ui/angular.json | 15 +- frontend/datasafe-ui/main.js | 2 +- frontend/datasafe-ui/main.js.map | 1 - frontend/datasafe-ui/package.json | 6 +- frontend/datasafe-ui/src/app/app.component.ts | 2 +- .../component/filetree/filetree.component.ts | 9 +- .../app/component/login/login.component.ts | 2 +- .../component/register/register.component.ts | 36 +- frontend/datasafe-ui/src/app/polyfills.ts | 3 +- pom.xml | 16 +- 14 files changed, 1158 insertions(+), 662 deletions(-) delete mode 100644 frontend/datasafe-ui/main.js.map diff --git a/README.md b/README.md index 6a867c696..f160362dd 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,5 @@ -[![Build Status](https://travis-ci.com/adorsys/datasafe.svg?branch=develop)](https://travis-ci.com/adorsys/datasafe) [![codecov](https://codecov.io/gh/adorsys/datasafe/branch/develop/graph/badge.svg)](https://codecov.io/gh/adorsys/datasafe) -[![Maintainability](https://api.codeclimate.com/v1/badges/06ae7d4cafc3012cee85/maintainability)](https://codeclimate.com/github/adorsys/datasafe/maintainability) +[![Maintainability](https://codeclimate.com/github/adorsys/datasafe.png)](https://codeclimate.com/github/adorsys/datasafe/maintainability) # Secure, Encrypted and Versioned Data Storage Library diff --git a/datasafe-rest-impl/datasafe.postman_collection.json b/datasafe-rest-impl/datasafe.postman_collection.json index 524b1dcfb..e17f46f1d 100644 --- a/datasafe-rest-impl/datasafe.postman_collection.json +++ b/datasafe-rest-impl/datasafe.postman_collection.json @@ -1,232 +1,432 @@ { "info": { - "_postman_id": "54d63510-b402-4a2c-b518-50e79a04d569", + "_postman_id": "db124a60-8dee-44e6-9bf0-97d18e0a9c14", "name": "Datasafe", - "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "18419826" }, "item": [ { - "name": "authenticate", - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "name": "Content-Type", - "value": "application/json", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\"userName\":\"username\",\"password\":\"password\"}" - }, - "url": { - "raw": "{{host}}/api/authenticate", - "host": [ - "{{host}}" + "name": "user", + "item": [ + { + "name": "authenticate", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test('Success', function() {", + " pm.response.to.have.status(200)", + "})", + "", + "pm.collectionVariables.set(\"token\", pm.response.headers.get('token'))", + "" + ], + "type": "text/javascript" + } + } ], - "path": [ - "api", - "authenticate" - ] - } - }, - "response": [] - }, - { - "name": "create user", - "request": { - "method": "PUT", - "header": [ - { - "key": "Content-Type", - "name": "Content-Type", - "value": "application/json", - "type": "text" + "request": { + "auth": { + "type": "noauth" + }, + "method": "POST", + "header": [ + { + "key": "Content-Type", + "name": "Content-Type", + "value": "application/json", + "type": "text", + "disabled": true + }, + { + "key": "Origin", + "value": "http://localhost:8080", + "type": "text", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "{\"userName\":\"username\",\"password\":\"password\"}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{host}}/api/authenticate", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "authenticate" + ] + } }, - { - "key": "token", - "value": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJpc3MiOiJzZWN1cmUtYXBpIiwiYXVkIjoic2VjdXJlLWFwcCIsInN1YiI6InVzZXJuYW1lIiwiZXhwIjoxNTYxMzA0MTA4LCJyb2wiOlsiUk9MRV9VU0VSIl19.Ungu5hob8mbwb7GfWfvqj1VsrNNv1pN6UEMJYJHSAHBicRlsYVbRAE7Ju_N1nnjdoZ6TSs4hireff92SkXvesQ", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"userName\":\"ver\",\n\t\"password\":\"ver\"\n}" + "response": [] }, - "url": { - "raw": "{{host}}/user", - "host": [ - "{{host}}" + { + "name": "delete user Alice", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test('Success', function() {", + " pm.response.to.have.status(200)", + "})", + "" + ], + "type": "text/javascript" + } + } ], - "path": [ - "user" - ] - } - }, - "response": [] - }, - { - "name": "delete user", - "request": { - "method": "DELETE", - "header": [ - { - "key": "Content-Type", - "name": "Content-Type", - "value": "application/json", - "type": "text" - }, - { - "key": "user", - "value": "Max", - "type": "text" - }, - { - "key": "password", - "value": "123", - "type": "text" + "request": { + "method": "DELETE", + "header": [ + { + "key": "Content-Type", + "name": "Content-Type", + "value": "application/json", + "type": "text" + }, + { + "key": "user", + "value": "Alice", + "type": "text" + }, + { + "key": "password", + "value": "123", + "type": "text" + }, + { + "key": "token", + "value": "{{token}}", + "type": "text" + } + ], + "url": { + "raw": "{{host}}/user", + "host": [ + "{{host}}" + ], + "path": [ + "user" + ] + } }, - { - "key": "token", - "value": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJpc3MiOiJzZWN1cmUtYXBpIiwiYXVkIjoic2VjdXJlLWFwcCIsInN1YiI6InVzZXJuYW1lIiwiZXhwIjoxNTYxMzA0MTA4LCJyb2wiOlsiUk9MRV9VU0VSIl19.Ungu5hob8mbwb7GfWfvqj1VsrNNv1pN6UEMJYJHSAHBicRlsYVbRAE7Ju_N1nnjdoZ6TSs4hireff92SkXvesQ", - "type": "text" - } - ], - "url": { - "raw": "{{host}}/user/", - "host": [ - "{{host}}" + "response": [] + }, + { + "name": "delete user Bob", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test('Success', function() {", + " pm.response.to.have.status(200)", + "})", + "" + ], + "type": "text/javascript" + } + } ], - "path": [ - "user", - "" - ] - } - }, - "response": [] - }, - { - "name": "store document", - "request": { - "method": "PUT", - "header": [ - { - "key": "Content-Type", - "value": "application/octet-stream", - "type": "text" - }, - { - "key": "user", - "value": "ver", - "type": "text" - }, - { - "key": "password", - "value": "ver", - "type": "text" + "request": { + "method": "DELETE", + "header": [ + { + "key": "Content-Type", + "name": "Content-Type", + "value": "application/json", + "type": "text" + }, + { + "key": "user", + "value": "Bob", + "type": "text" + }, + { + "key": "password", + "value": "123", + "type": "text" + }, + { + "key": "token", + "value": "{{token}}", + "type": "text" + } + ], + "url": { + "raw": "{{host}}/user", + "host": [ + "{{host}}" + ], + "path": [ + "user" + ] + } }, - { - "key": "token", - "value": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJpc3MiOiJzZWN1cmUtYXBpIiwiYXVkIjoic2VjdXJlLWFwcCIsInN1YiI6InVzZXJuYW1lIiwiZXhwIjoxNTYxMzA0MTA4LCJyb2wiOlsiUk9MRV9VU0VSIl19.Ungu5hob8mbwb7GfWfvqj1VsrNNv1pN6UEMJYJHSAHBicRlsYVbRAE7Ju_N1nnjdoZ6TSs4hireff92SkXvesQ", - "type": "text" - } - ], - "body": { - "mode": "file", - "file": { - "src": "/Users/maxim/tx/store/a.txt" - } + "response": [] }, - "url": { - "raw": "{{host}}/document/test11.txt", - "host": [ - "{{host}}" + { + "name": "create user Alice", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "pm.test('Success', function() {", + " pm.response.to.have.status(200)", + "})" + ], + "type": "text/javascript" + } + } ], - "path": [ - "document", - "test11.txt" - ] - } - }, - "response": [] - }, - { - "name": "list documents", - "request": { - "method": "GET", - "header": [ - { - "key": "user", - "value": "vvv", - "type": "text" - }, - { - "key": "password", - "value": "vvv", - "type": "text" + "request": { + "method": "PUT", + "header": [ + { + "key": "Content-Type", + "name": "Content-Type", + "value": "application/json", + "type": "text" + }, + { + "key": "token", + "value": "{{token}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"userName\":\"Alice\",\n\t\"password\":\"123\"\n}" + }, + "url": { + "raw": "{{host}}/user", + "host": [ + "{{host}}" + ], + "path": [ + "user" + ] + } }, - { - "key": "token", - "value": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJpc3MiOiJzZWN1cmUtYXBpIiwiYXVkIjoic2VjdXJlLWFwcCIsInN1YiI6InVzZXJuYW1lIiwiZXhwIjoxNTYxMzA0MTA4LCJyb2wiOlsiUk9MRV9VU0VSIl19.Ungu5hob8mbwb7GfWfvqj1VsrNNv1pN6UEMJYJHSAHBicRlsYVbRAE7Ju_N1nnjdoZ6TSs4hireff92SkXvesQ", - "type": "text" - } - ], - "url": { - "raw": "{{host}}/documents/", - "host": [ - "{{host}}" + "response": [] + }, + { + "name": "create user Bob", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "pm.test('Success', function() {", + " pm.response.to.have.status(200)", + "})" + ], + "type": "text/javascript" + } + } ], - "path": [ - "documents", - "" - ] + "request": { + "method": "PUT", + "header": [ + { + "key": "Content-Type", + "name": "Content-Type", + "value": "application/json", + "type": "text" + }, + { + "key": "token", + "value": "{{token}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"userName\":\"Bob\",\n\t\"password\":\"123\"\n}" + }, + "url": { + "raw": "{{host}}/user", + "host": [ + "{{host}}" + ], + "path": [ + "user" + ] + } + }, + "response": [] } - }, - "response": [] + ] }, { - "name": "read document", - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "value": "application/octet-stream", - "type": "text" - }, - { - "key": "user", - "value": "ver", - "type": "text" - }, - { - "key": "password", - "value": "ver", - "type": "text" + "name": "private", + "item": [ + { + "name": "store document", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test('Success', function() {", + " pm.response.to.have.status(200)", + "})" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "Content-Type", + "value": "multipart/form-data", + "type": "text" + }, + { + "key": "user", + "value": "Alice", + "type": "text" + }, + { + "key": "password", + "value": "123", + "type": "text" + }, + { + "key": "token", + "value": "{{token}}", + "type": "text" + } + ], + "body": { + "mode": "formdata", + "formdata": [ + { + "key": "file", + "type": "file", + "src": "postman-cloud:///1eeb44d1-546d-4870-ae7e-c2f44aeee23e" + } + ] + }, + "url": { + "raw": "{{host}}/document/test.txt", + "host": [ + "{{host}}" + ], + "path": [ + "document", + "test.txt" + ] + } }, - { - "key": "token", - "value": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJpc3MiOiJzZWN1cmUtYXBpIiwiYXVkIjoic2VjdXJlLWFwcCIsInN1YiI6InVzZXJuYW1lIiwiZXhwIjoxNTYxMzA0MTA4LCJyb2wiOlsiUk9MRV9VU0VSIl19.Ungu5hob8mbwb7GfWfvqj1VsrNNv1pN6UEMJYJHSAHBicRlsYVbRAE7Ju_N1nnjdoZ6TSs4hireff92SkXvesQ", - "type": "text" - } - ], - "url": { - "raw": "{{host}}/document/test11.txt", - "host": [ - "{{host}}" + "response": [] + }, + { + "name": "list documents", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test('Success', function() {", + " pm.response.to.have.status(200)", + "})", + "", + "var rb = JSON.parse(responseBody);", + "", + "pm.test(\"response contains one file\", () => {", + " pm.expect(rb.length).to.eql(1);", + "})" + ], + "type": "text/javascript" + } + } ], - "path": [ - "document", - "test11.txt" - ] - } - }, - "response": [ + "request": { + "auth": { + "type": "noauth" + }, + "method": "GET", + "header": [ + { + "key": "user", + "value": "Alice", + "type": "text" + }, + { + "key": "password", + "value": "123", + "type": "text" + }, + { + "key": "token", + "value": "{{token}}", + "type": "text" + } + ], + "url": { + "raw": "{{host}}/documents", + "host": [ + "{{host}}" + ], + "path": [ + "documents" + ] + } + }, + "response": [] + }, { "name": "read document", - "originalRequest": { + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test('Success', function() {", + " pm.response.to.have.status(200)", + "})", + "", + "pm.test(\"file content is read\", () => {", + " pm.expect(responseBody).to.eql(\"hello world!\");", + "})" + ], + "type": "text/javascript" + } + } + ], + "request": { "method": "GET", "header": [ { @@ -236,455 +436,730 @@ }, { "key": "user", - "value": "ddd", + "value": "Alice", "type": "text" }, { "key": "password", - "value": "ddd", + "value": "123", + "type": "text" + }, + { + "key": "token", + "value": "{{token}}", "type": "text" } ], "url": { - "raw": "{{host}}/document/deep/path/test.txt", + "raw": "{{host}}/document/test.txt", "host": [ "{{host}}" ], "path": [ "document", - "deep", - "path", "test.txt" ] } }, - "status": "OK", - "code": 200, - "_postman_previewlanguage": "plain", - "header": [ - { - "key": "Transfer-Encoding", - "value": "chunked" - }, + "response": [] + }, + { + "name": "delete document", + "event": [ { - "key": "Date", - "value": "Fri, 24 May 2019 11:50:22 GMT" + "listen": "test", + "script": { + "exec": [ + "pm.test('Success', function() {", + " pm.response.to.have.status(200)", + "})" + ], + "type": "text/javascript" + } } ], - "cookie": [], - "body": "test" - } - ] - }, - { - "name": "delete document", - "request": { - "method": "DELETE", - "header": [ - { - "key": "user", - "value": "iii", - "type": "text" - }, - { - "key": "password", - "value": "iii", - "type": "text" + "request": { + "method": "DELETE", + "header": [ + { + "key": "user", + "value": "Alice", + "type": "text" + }, + { + "key": "password", + "value": "123", + "type": "text" + }, + { + "key": "token", + "value": "{{token}}", + "type": "text" + } + ], + "url": { + "raw": "{{host}}/document/test.txt", + "host": [ + "{{host}}" + ], + "path": [ + "document", + "test.txt" + ] + } }, - { - "key": "token", - "value": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJpc3MiOiJzZWN1cmUtYXBpIiwiYXVkIjoic2VjdXJlLWFwcCIsInN1YiI6InVzZXJuYW1lIiwiZXhwIjoxNTYxMzA0MTA4LCJyb2wiOlsiUk9MRV9VU0VSIl19.Ungu5hob8mbwb7GfWfvqj1VsrNNv1pN6UEMJYJHSAHBicRlsYVbRAE7Ju_N1nnjdoZ6TSs4hireff92SkXvesQ", - "type": "text" - } - ], - "url": { - "raw": "{{host}}/document/deep/path/test2.txt", - "host": [ - "{{host}}" - ], - "path": [ - "document", - "deep", - "path", - "test2.txt" - ] + "response": [] } - }, - "response": [] + ] }, { - "name": "send to inbox", - "request": { - "method": "PUT", - "header": [ - { - "key": "Content-Type", - "value": "application/octet-stream", - "type": "text" - }, - { - "key": "user", - "value": "ver", - "type": "text" - }, - { - "key": "token", - "value": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJpc3MiOiJzZWN1cmUtYXBpIiwiYXVkIjoic2VjdXJlLWFwcCIsInN1YiI6InVzZXJuYW1lIiwiZXhwIjoxNTYxMzA0MTA4LCJyb2wiOlsiUk9MRV9VU0VSIl19.Ungu5hob8mbwb7GfWfvqj1VsrNNv1pN6UEMJYJHSAHBicRlsYVbRAE7Ju_N1nnjdoZ6TSs4hireff92SkXvesQ", - "type": "text" - } - ], - "body": { - "mode": "file", - "file": { - "src": "/Users/maxim/test.txt" - } - }, - "url": { - "raw": "{{host}}/inbox/test2.txt", - "host": [ - "{{host}}" + "name": "versioned", + "item": [ + { + "name": "versioned write", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test('Success', function() {", + " pm.response.to.have.status(200)", + "})" + ], + "type": "text/javascript" + } + } ], - "path": [ - "inbox", - "test2.txt" - ] - } - }, - "response": [] - }, - { - "name": "inbox read", - "request": { - "method": "GET", - "header": [ - { - "key": "user", - "value": "ver", - "type": "text" - }, - { - "key": "password", - "value": "ver", - "type": "text" - }, - { - "key": "Accept", - "value": "application/octet-stream", - "type": "text" + "request": { + "method": "PUT", + "header": [ + { + "key": "Content-Type", + "value": "multipart/form-data", + "type": "text" + }, + { + "key": "user", + "value": "Alice", + "type": "text" + }, + { + "key": "password", + "value": "123", + "type": "text" + }, + { + "key": "token", + "value": "{{token}}", + "type": "text" + } + ], + "body": { + "mode": "formdata", + "formdata": [ + { + "key": "file", + "type": "file", + "src": "postman-cloud:///1eeb44d1-546d-4870-ae7e-c2f44aeee23e" + } + ] + }, + "url": { + "raw": "{{host}}/versioned/test.txt", + "host": [ + "{{host}}" + ], + "path": [ + "versioned", + "test.txt" + ] + } }, - { - "key": "token", - "value": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJpc3MiOiJzZWN1cmUtYXBpIiwiYXVkIjoic2VjdXJlLWFwcCIsInN1YiI6InVzZXJuYW1lIiwiZXhwIjoxNTYxMzA0MTA4LCJyb2wiOlsiUk9MRV9VU0VSIl19.Ungu5hob8mbwb7GfWfvqj1VsrNNv1pN6UEMJYJHSAHBicRlsYVbRAE7Ju_N1nnjdoZ6TSs4hireff92SkXvesQ", - "type": "text" - } - ], - "url": { - "raw": "{{host}}/inbox/test2.txt", - "host": [ - "{{host}}" + "response": [] + }, + { + "name": "versioned write 2", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test('Success', function() {", + " pm.response.to.have.status(200)", + "})" + ], + "type": "text/javascript" + } + } ], - "path": [ - "inbox", - "test2.txt" - ] - } - }, - "response": [] - }, - { - "name": "inbox delete", - "request": { - "method": "DELETE", - "header": [ - { - "key": "user", - "value": "iii", - "type": "text" - }, - { - "key": "password", - "value": "iii", - "type": "text" + "request": { + "method": "PUT", + "header": [ + { + "key": "Content-Type", + "value": "multipart/form-data", + "type": "text" + }, + { + "key": "user", + "value": "Alice", + "type": "text" + }, + { + "key": "password", + "value": "123", + "type": "text" + }, + { + "key": "token", + "value": "{{token}}", + "type": "text" + } + ], + "body": { + "mode": "formdata", + "formdata": [ + { + "key": "file", + "type": "file", + "src": "postman-cloud:///1eeb4517-de20-4860-b895-814e47ad657f" + } + ] + }, + "url": { + "raw": "{{host}}/versioned/test.txt", + "host": [ + "{{host}}" + ], + "path": [ + "versioned", + "test.txt" + ] + } }, - { - "key": "token", - "value": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJpc3MiOiJzZWN1cmUtYXBpIiwiYXVkIjoic2VjdXJlLWFwcCIsInN1YiI6InVzZXJuYW1lIiwiZXhwIjoxNTYxMzA0MTA4LCJyb2wiOlsiUk9MRV9VU0VSIl19.Ungu5hob8mbwb7GfWfvqj1VsrNNv1pN6UEMJYJHSAHBicRlsYVbRAE7Ju_N1nnjdoZ6TSs4hireff92SkXvesQ", - "type": "text" - } - ], - "url": { - "raw": "{{host}}/inbox/test2.txt", - "host": [ - "{{host}}" + "response": [] + }, + { + "name": "versioned list (last version)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test('Success', function() {", + " pm.response.to.have.status(200)", + "})", + "", + "var rb = JSON.parse(responseBody);", + "", + "pm.test(\"response contains one file\", () => {", + " pm.expect(rb.length).to.eql(1);", + "})" + ], + "type": "text/javascript" + } + } ], - "path": [ - "inbox", - "test2.txt" - ] - } - }, - "response": [] - }, - { - "name": "inbox list", - "request": { - "method": "GET", - "header": [ - { - "key": "user", - "value": "ver", - "type": "text" - }, - { - "key": "password", - "value": "ver", - "type": "text" - }, - { - "key": "Accept", - "value": "application/json", - "type": "text" + "request": { + "method": "GET", + "header": [ + { + "key": "user", + "value": "Alice", + "type": "text" + }, + { + "key": "password", + "value": "123", + "type": "text" + }, + { + "key": "token", + "value": "{{token}}", + "type": "text" + }, + { + "key": "Accept", + "value": "application/json", + "type": "text" + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + } + ], + "url": { + "raw": "{{host}}/versioned/test.txt", + "host": [ + "{{host}}" + ], + "path": [ + "versioned", + "test.txt" + ] + } }, - { - "key": "token", - "value": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJpc3MiOiJzZWN1cmUtYXBpIiwiYXVkIjoic2VjdXJlLWFwcCIsInN1YiI6InVzZXJuYW1lIiwiZXhwIjoxNTYxMzA0MTA4LCJyb2wiOlsiUk9MRV9VU0VSIl19.Ungu5hob8mbwb7GfWfvqj1VsrNNv1pN6UEMJYJHSAHBicRlsYVbRAE7Ju_N1nnjdoZ6TSs4hireff92SkXvesQ", - "type": "text" - } - ], - "url": { - "raw": "{{host}}/inbox/", - "host": [ - "{{host}}" + "response": [] + }, + { + "name": "versions list", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test('Success', function() {", + " pm.response.to.have.status(200)", + "})", + "", + "var rb = JSON.parse(responseBody);", + "", + "pm.test(\"response contains one file\", () => {", + " pm.expect(rb.length).to.eql(2);", + "})" + ], + "type": "text/javascript" + } + } ], - "path": [ - "inbox", - "" - ] - } - }, - "response": [] - }, - { - "name": "version list", - "request": { - "method": "GET", - "header": [ - { - "key": "user", - "type": "text", - "value": "ver" - }, - { - "key": "password", - "type": "text", - "value": "ver" - }, - { - "key": "token", - "value": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJpc3MiOiJzZWN1cmUtYXBpIiwiYXVkIjoic2VjdXJlLWFwcCIsInN1YiI6InVzZXJuYW1lIiwiZXhwIjoxNTYxMzA0MTA4LCJyb2wiOlsiUk9MRV9VU0VSIl19.Ungu5hob8mbwb7GfWfvqj1VsrNNv1pN6UEMJYJHSAHBicRlsYVbRAE7Ju_N1nnjdoZ6TSs4hireff92SkXvesQ", - "type": "text" - }, - { - "key": "Accept", - "value": "application/json", - "type": "text" + "request": { + "method": "GET", + "header": [ + { + "key": "user", + "type": "text", + "value": "Alice" + }, + { + "key": "password", + "type": "text", + "value": "123" + }, + { + "key": "token", + "value": "{{token}}", + "type": "text" + }, + { + "key": "Accept", + "value": "application/json", + "type": "text" + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + } + ], + "url": { + "raw": "{{host}}/versions/list/test.txt", + "host": [ + "{{host}}" + ], + "path": [ + "versions", + "list", + "test.txt" + ] + } }, - { - "key": "Content-Type", - "value": "application/json", - "type": "text" - } - ], - "url": { - "raw": "{{host}}/versions/list/", - "host": [ - "{{host}}" + "response": [] + }, + { + "name": "versioned read (last version)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test('Success', function() {", + " pm.response.to.have.status(200)", + "})", + "", + "pm.test(\"file content is read\", () => {", + " pm.expect(responseBody).to.eql(\"yet another file\");", + "})" + ], + "type": "text/javascript" + } + } ], - "path": [ - "versions", - "list", - "" - ] - } - }, - "response": [] - }, - { - "name": "versioned read", - "request": { - "method": "GET", - "header": [ - { - "key": "user", - "value": "ver", - "type": "text" - }, - { - "key": "password", - "value": "ver", - "type": "text" - }, - { - "key": "token", - "value": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJpc3MiOiJzZWN1cmUtYXBpIiwiYXVkIjoic2VjdXJlLWFwcCIsInN1YiI6InVzZXJuYW1lIiwiZXhwIjoxNTYxMzA0MTA4LCJyb2wiOlsiUk9MRV9VU0VSIl19.Ungu5hob8mbwb7GfWfvqj1VsrNNv1pN6UEMJYJHSAHBicRlsYVbRAE7Ju_N1nnjdoZ6TSs4hireff92SkXvesQ", - "type": "text" - }, - { - "key": "Accept", - "value": "application/octet-stream", - "type": "text" + "request": { + "method": "GET", + "header": [ + { + "key": "user", + "value": "Alice", + "type": "text" + }, + { + "key": "password", + "value": "123", + "type": "text" + }, + { + "key": "token", + "value": "{{token}}", + "type": "text" + }, + { + "key": "Accept", + "value": "application/octet-stream", + "type": "text" + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + } + ], + "url": { + "raw": "{{host}}/versioned/test.txt", + "host": [ + "{{host}}" + ], + "path": [ + "versioned", + "test.txt" + ] + } }, - { - "key": "Content-Type", - "value": "application/json", - "type": "text" - } - ], - "url": { - "raw": "{{host}}/versioned/test10.txt", - "host": [ - "{{host}}" + "response": [] + }, + { + "name": "versioned delete", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test('Success', function() {", + " pm.response.to.have.status(200)", + "})", + "" + ], + "type": "text/javascript" + } + } ], - "path": [ - "versioned", - "test10.txt" - ] - } - }, - "response": [] - }, - { - "name": "versioned delete", - "request": { - "method": "DELETE", - "header": [ - { - "key": "user", - "value": "ver", - "type": "text" - }, - { - "key": "password", - "value": "ver", - "type": "text" - }, - { - "key": "token", - "value": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJpc3MiOiJzZWN1cmUtYXBpIiwiYXVkIjoic2VjdXJlLWFwcCIsInN1YiI6InVzZXJuYW1lIiwiZXhwIjoxNTYxMzA0MTA4LCJyb2wiOlsiUk9MRV9VU0VSIl19.Ungu5hob8mbwb7GfWfvqj1VsrNNv1pN6UEMJYJHSAHBicRlsYVbRAE7Ju_N1nnjdoZ6TSs4hireff92SkXvesQ", - "type": "text" - }, - { - "key": "Accept", - "value": "application/json", - "type": "text" + "request": { + "method": "DELETE", + "header": [ + { + "key": "user", + "value": "Alice", + "type": "text" + }, + { + "key": "password", + "value": "123", + "type": "text" + }, + { + "key": "token", + "value": "{{token}}", + "type": "text" + }, + { + "key": "Accept", + "value": "application/json", + "type": "text" + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + } + ], + "url": { + "raw": "{{host}}/versioned/test.txt", + "host": [ + "{{host}}" + ], + "path": [ + "versioned", + "test.txt" + ] + } }, - { - "key": "Content-Type", - "value": "application/json", - "type": "text" - } - ], - "url": { - "raw": "{{host}}/versioned/test4.txt", - "host": [ - "{{host}}" - ], - "path": [ - "versioned", - "test4.txt" - ] + "response": [] } - }, - "response": [] + ] }, { - "name": "versioned write", - "request": { - "method": "PUT", - "header": [ - { - "key": "Content-Type", - "value": "application/octet-stream", - "type": "text" + "name": "inbox", + "item": [ + { + "name": "send to inbox", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test('Success', function() {", + " pm.response.to.have.status(200)", + "})", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "user", + "value": "Alice", + "type": "text" + }, + { + "key": "password", + "value": "123", + "type": "text" + }, + { + "key": "token", + "value": "{{token}}", + "type": "text" + }, + { + "key": "recipients", + "value": "Bob", + "type": "text" + } + ], + "body": { + "mode": "formdata", + "formdata": [ + { + "key": "file", + "type": "file", + "src": "postman-cloud:///1eeb44d1-546d-4870-ae7e-c2f44aeee23e" + } + ] + }, + "url": { + "raw": "{{host}}/inbox/document/test.txt", + "host": [ + "{{host}}" + ], + "path": [ + "inbox", + "document", + "test.txt" + ] + } }, - { - "key": "user", - "value": "ver", - "type": "text" + "response": [] + }, + { + "name": "inbox list", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test('Success', function() {", + " pm.response.to.have.status(200)", + "})", + "", + "var rb = JSON.parse(responseBody);", + "", + "pm.test(\"response contains one file\", () => {", + " pm.expect(rb.length).to.eql(1);", + "})" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "user", + "value": "Bob", + "type": "text" + }, + { + "key": "password", + "value": "123", + "type": "text" + }, + { + "key": "Accept", + "value": "application/json", + "type": "text" + }, + { + "key": "token", + "value": "{{token}}", + "type": "text" + } + ], + "url": { + "raw": "{{host}}/inbox/documents", + "host": [ + "{{host}}" + ], + "path": [ + "inbox", + "documents" + ] + } }, - { - "key": "password", - "value": "ver", - "type": "text" + "response": [] + }, + { + "name": "inbox read", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test('Success', function() {", + " pm.response.to.have.status(200)", + "})", + "", + "pm.test(\"file content is read\", () => {", + " pm.expect(responseBody).to.eql(\"hello world!\");", + "})" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "user", + "value": "Bob", + "type": "text" + }, + { + "key": "password", + "value": "123", + "type": "text" + }, + { + "key": "Accept", + "value": "application/octet-stream", + "type": "text" + }, + { + "key": "token", + "value": "{{token}}", + "type": "text" + } + ], + "url": { + "raw": "{{host}}/inbox/document/test.txt", + "host": [ + "{{host}}" + ], + "path": [ + "inbox", + "document", + "test.txt" + ] + } }, - { - "key": "token", - "value": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJpc3MiOiJzZWN1cmUtYXBpIiwiYXVkIjoic2VjdXJlLWFwcCIsInN1YiI6InVzZXJuYW1lIiwiZXhwIjoxNTYxMzA0MTA4LCJyb2wiOlsiUk9MRV9VU0VSIl19.Ungu5hob8mbwb7GfWfvqj1VsrNNv1pN6UEMJYJHSAHBicRlsYVbRAE7Ju_N1nnjdoZ6TSs4hireff92SkXvesQ", - "type": "text" - } - ], - "body": { - "mode": "file", - "file": { - "src": "/Users/maxim/parallel_transactions_merge_logic_fix.patch" - } + "response": [] }, - "url": { - "raw": "{{host}}/versioned/test10.txt", - "host": [ - "{{host}}" + { + "name": "inbox delete", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test('Success', function() {", + " pm.response.to.have.status(200)", + "})", + "" + ], + "type": "text/javascript" + } + } ], - "path": [ - "versioned", - "test10.txt" - ] + "request": { + "method": "DELETE", + "header": [ + { + "key": "user", + "value": "Bob", + "type": "text" + }, + { + "key": "password", + "value": "123", + "type": "text" + }, + { + "key": "token", + "value": "{{token}}", + "type": "text" + } + ], + "url": { + "raw": "{{host}}/inbox/document/test.txt", + "host": [ + "{{host}}" + ], + "path": [ + "inbox", + "document", + "test.txt" + ] + } + }, + "response": [] } - }, - "response": [] + ] + } + ], + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } }, { - "name": "versioned list", - "request": { - "method": "GET", - "header": [ - { - "key": "user", - "value": "ver", - "type": "text" - }, - { - "key": "password", - "value": "ver", - "type": "text" - }, - { - "key": "token", - "value": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJpc3MiOiJzZWN1cmUtYXBpIiwiYXVkIjoic2VjdXJlLWFwcCIsInN1YiI6InVzZXJuYW1lIiwiZXhwIjoxNTYxMzA0MTA4LCJyb2wiOlsiUk9MRV9VU0VSIl19.Ungu5hob8mbwb7GfWfvqj1VsrNNv1pN6UEMJYJHSAHBicRlsYVbRAE7Ju_N1nnjdoZ6TSs4hireff92SkXvesQ", - "type": "text" - }, - { - "key": "Accept", - "value": "application/json", - "type": "text" - }, - { - "key": "Content-Type", - "value": "application/json", - "type": "text" - } - ], - "url": { - "raw": "{{host}}/versioned/", - "host": [ - "{{host}}" - ], - "path": [ - "versioned", - "" - ] - } - }, - "response": [] + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "host", + "value": "http://localhost:8080", + "type": "string" + }, + { + "key": "token", + "value": "" } ] } \ No newline at end of file diff --git a/datasafe-rest-impl/src/main/java/de/adorsys/datasafe/rest/impl/security/SecurityConfig.java b/datasafe-rest-impl/src/main/java/de/adorsys/datasafe/rest/impl/security/SecurityConfig.java index ed5677088..dab705ac1 100644 --- a/datasafe-rest-impl/src/main/java/de/adorsys/datasafe/rest/impl/security/SecurityConfig.java +++ b/datasafe-rest-impl/src/main/java/de/adorsys/datasafe/rest/impl/security/SecurityConfig.java @@ -26,10 +26,13 @@ import org.springframework.web.cors.UrlBasedCorsConfigurationSource; import org.springframework.web.servlet.handler.HandlerMappingIntrospector; +import java.util.Arrays; import java.util.HashMap; +import java.util.List; import java.util.Map; import static de.adorsys.datasafe.rest.impl.security.SecurityConstants.TOKEN_HEADER; +import static org.springframework.security.config.Customizer.withDefaults; @Configuration @EnableWebSecurity @@ -44,7 +47,7 @@ public class SecurityConfig { @Bean public SecurityFilterChain filterChain(HttpSecurity http, MvcRequestMatcher.Builder mvc, AuthenticationManager authenticationManager) throws Exception { - MvcRequestMatcher[] SWAGGER_RESOURCES = { + MvcRequestMatcher[] swaggerResources = { mvc.pattern("/v2/api-docs"), mvc.pattern("/configuration/ui"), mvc.pattern("/swagger-resources"), @@ -54,11 +57,10 @@ public SecurityFilterChain filterChain(HttpSecurity http, MvcRequestMatcher.Buil mvc.pattern("/swagger-resources/configuration/ui"), mvc.pattern("/swagger-ui.html") }; - - http.cors(AbstractHttpConfigurer::disable) + http.cors(withDefaults()) .csrf(AbstractHttpConfigurer::disable) .authorizeHttpRequests(authz -> authz - .requestMatchers(SWAGGER_RESOURCES).permitAll() + .requestMatchers(swaggerResources).permitAll() .requestMatchers(mvc.pattern("/static/**")).permitAll() .requestMatchers(mvc.pattern(SecurityConstants.AUTH_LOGIN_URL)).permitAll() .requestMatchers(mvc.pattern(HttpMethod.OPTIONS, "/**")).permitAll() @@ -77,8 +79,8 @@ MvcRequestMatcher.Builder mvc(HandlerMappingIntrospector introspector) { } @Bean - public InMemoryUserDetailsManager userDetailsService(PasswordEncoder passwordEncoder) { - UserDetails user = User.withDefaultPasswordEncoder() + public InMemoryUserDetailsManager userDetailsService(PasswordEncoder encoder) { + UserDetails user = User.builder().passwordEncoder(encoder::encode) .username(securityProperties.getDefaultUser()) .password(securityProperties.getDefaultPassword()) .authorities("ROLE_USER") @@ -101,19 +103,15 @@ public PasswordEncoder passwordEncoder() { } @Bean - public CorsConfigurationSource corsConfigurationSource() { + CorsConfigurationSource corsConfigurationSource() { + CorsConfiguration configuration = new CorsConfiguration(); + configuration.setAllowedOrigins(List.of("http://localhost:4200")); + configuration.setAllowedMethods(Arrays.asList("GET", "POST", "PUT", "DELETE")); + configuration.setAllowedHeaders(List.of("*")); + configuration.setAllowCredentials(true); + configuration.addExposedHeader(TOKEN_HEADER); UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); - - CorsConfiguration authConfig = new CorsConfiguration().applyPermitDefaultValues(); - authConfig.addExposedHeader(TOKEN_HEADER); - source.registerCorsConfiguration(SecurityConstants.AUTH_LOGIN_URL, authConfig); - - CorsConfiguration globalConfig = new CorsConfiguration().applyPermitDefaultValues(); - globalConfig.addAllowedMethod(HttpMethod.OPTIONS); - globalConfig.addAllowedMethod(HttpMethod.PUT); - globalConfig.addAllowedMethod(HttpMethod.DELETE); - source.registerCorsConfiguration("/**", globalConfig); - + source.registerCorsConfiguration("/**", configuration); return source; } diff --git a/frontend/README.md b/frontend/README.md index ca8275e3a..174a51035 100644 --- a/frontend/README.md +++ b/frontend/README.md @@ -3,6 +3,8 @@ Use `npm run-script ng:serve:web` for local development Use `npm run-script start` for electron development +Use `ng serve -c dev` if you need to debug + ### Notes - API url and credentials are provided by env.js file (API_URL, API_USERNAME, API_PASSWORD). Credentials (API_USERNAME, API_PASSWORD) are intended for local use only. diff --git a/frontend/datasafe-ui/angular.json b/frontend/datasafe-ui/angular.json index 544edcee8..bb53be0a1 100755 --- a/frontend/datasafe-ui/angular.json +++ b/frontend/datasafe-ui/angular.json @@ -40,7 +40,6 @@ "optimization": true, "outputHashing": "all", "sourceMap": false, - "extractCss": true, "namedChunks": false, "aot": true, "extractLicenses": true, @@ -53,6 +52,17 @@ "maximumError": "5mb" } ] + }, + "dev": { + "fileReplacements": [ + { + "replace": "src/environments/environment.ts", + "with": "src/environments/environment.dev.ts" + } + ], + "optimization": false, + "extractLicenses": false, + "sourceMap": true } } }, @@ -64,6 +74,9 @@ "configurations": { "production": { "browserTarget": "my-app:build:production" + }, + "dev": { + "browserTarget": "my-app:build:dev" } } }, diff --git a/frontend/datasafe-ui/main.js b/frontend/datasafe-ui/main.js index 49966638b..c6746dce1 100644 --- a/frontend/datasafe-ui/main.js +++ b/frontend/datasafe-ui/main.js @@ -21,7 +21,7 @@ function createWindow() { }); if (serve) { require('electron-reload')(__dirname, { - electron: require(__dirname + "/node_modules/electron") + electron: require("".concat(__dirname, "/node_modules/electron")) }); win.loadURL('http://localhost:4200'); } diff --git a/frontend/datasafe-ui/main.js.map b/frontend/datasafe-ui/main.js.map deleted file mode 100644 index f967e92ff..000000000 --- a/frontend/datasafe-ui/main.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"main.js","sourceRoot":"","sources":["main.ts"],"names":[],"mappings":";;AAAA,qCAAsD;AACtD,2BAA6B;AAC7B,yBAA2B;AAE3B,IAAI,GAAG,EAAE,KAAK,CAAC;AACf,IAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACnC,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,UAAA,GAAG,IAAI,OAAA,GAAG,KAAK,SAAS,EAAjB,CAAiB,CAAC,CAAC;AAE5C,SAAS,YAAY;IAEnB,IAAM,cAAc,GAAG,iBAAM,CAAC;IAC9B,IAAM,IAAI,GAAG,cAAc,CAAC,iBAAiB,EAAE,CAAC,YAAY,CAAC;IAE7D,6BAA6B;IAC7B,GAAG,GAAG,IAAI,wBAAa,CAAC;QACtB,CAAC,EAAE,CAAC;QACJ,CAAC,EAAE,CAAC;QACJ,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,MAAM,EAAE,IAAI,CAAC,MAAM;QACnB,cAAc,EAAE;YACd,eAAe,EAAE,IAAI;SACtB;KACF,CAAC,CAAC;IAEH,IAAI,KAAK,EAAE;QACT,OAAO,CAAC,iBAAiB,CAAC,CAAC,SAAS,EAAE;YACpC,QAAQ,EAAE,OAAO,CAAI,SAAS,2BAAwB,CAAC;SACxD,CAAC,CAAC;QACH,GAAG,CAAC,OAAO,CAAC,uBAAuB,CAAC,CAAC;KACtC;SAAM;QACL,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC;YACrB,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,iBAAiB,CAAC;YACjD,QAAQ,EAAE,OAAO;YACjB,OAAO,EAAE,IAAI;SACd,CAAC,CAAC,CAAC;KACL;IAED,IAAI,KAAK,EAAE;QACT,GAAG,CAAC,WAAW,CAAC,YAAY,EAAE,CAAC;KAChC;IAED,qCAAqC;IACrC,GAAG,CAAC,EAAE,CAAC,QAAQ,EAAE;QACf,gEAAgE;QAChE,mEAAmE;QACnE,oDAAoD;QACpD,GAAG,GAAG,IAAI,CAAC;IACb,CAAC,CAAC,CAAC;AAEL,CAAC;AAED,IAAI;IAEF,wDAAwD;IACxD,yDAAyD;IACzD,sDAAsD;IACtD,cAAG,CAAC,EAAE,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;IAE9B,oCAAoC;IACpC,cAAG,CAAC,EAAE,CAAC,mBAAmB,EAAE;QAC1B,2DAA2D;QAC3D,8DAA8D;QAC9D,IAAI,OAAO,CAAC,QAAQ,KAAK,QAAQ,EAAE;YACjC,cAAG,CAAC,IAAI,EAAE,CAAC;SACZ;IACH,CAAC,CAAC,CAAC;IAEH,cAAG,CAAC,EAAE,CAAC,UAAU,EAAE;QACjB,gEAAgE;QAChE,4DAA4D;QAC5D,IAAI,GAAG,KAAK,IAAI,EAAE;YAChB,YAAY,EAAE,CAAC;SAChB;IACH,CAAC,CAAC,CAAC;CAEJ;AAAC,OAAO,CAAC,EAAE;IACV,cAAc;IACd,WAAW;CACZ"} \ No newline at end of file diff --git a/frontend/datasafe-ui/package.json b/frontend/datasafe-ui/package.json index 3195a72de..7994278ae 100644 --- a/frontend/datasafe-ui/package.json +++ b/frontend/datasafe-ui/package.json @@ -4,7 +4,7 @@ "description": "datasafe-ui with web and electron interface", "keywords": [ "angular", - "angular 8", + "angular 15", "electron", "typescript", "sass" @@ -53,7 +53,7 @@ "@types/node": "20.8.0", "codelyzer": "6.0.2", "core-js": "3.33.0", - "electron": "26.2.4", + "electron": "^26.2.4", "electron-builder": "24.7.0", "electron-reload": "1.5.0", "hammerjs": "2.0.8", @@ -75,7 +75,7 @@ "wait-on": "7.0.1", "web-animations-js": "2.3.2", "webdriver-manager": "13.0.2", - "zone.js": "0.14.0" + "zone.js": "0.13.0" }, "engines": { "node": ">=18.10.0" diff --git a/frontend/datasafe-ui/src/app/app.component.ts b/frontend/datasafe-ui/src/app/app.component.ts index 788f93502..852e4d829 100644 --- a/frontend/datasafe-ui/src/app/app.component.ts +++ b/frontend/datasafe-ui/src/app/app.component.ts @@ -1,5 +1,5 @@ import {Component, OnInit} from '@angular/core'; -import {ErrorStateMatcher} from "@angular/material"; +import {ErrorStateMatcher} from "@angular/material/core"; import {FormControl, FormGroupDirective, NgForm} from "@angular/forms"; export class Env { diff --git a/frontend/datasafe-ui/src/app/component/filetree/filetree.component.ts b/frontend/datasafe-ui/src/app/component/filetree/filetree.component.ts index 57aee9256..9269168d4 100644 --- a/frontend/datasafe-ui/src/app/component/filetree/filetree.component.ts +++ b/frontend/datasafe-ui/src/app/component/filetree/filetree.component.ts @@ -7,7 +7,7 @@ import {ApiService} from "../../service/api/api.service"; import {CredentialsService} from "../../service/credentials/credentials.service"; import {Router} from "@angular/router"; import {ErrorMessageUtil} from "../../app.component"; -import {MAT_DIALOG_DATA, MatDialog, MatDialogRef} from "@angular/material"; +import {MAT_DIALOG_DATA, MatDialog, MatDialogRef} from "@angular/material/dialog"; class UserFileSystem { @@ -39,6 +39,7 @@ class UserFileSystem { var fullPath = ""; var folder = ""; + path = (path.startsWith('/')) ? path.substring(1) : path; path.split("/").forEach(segment => { fullPath += segment; fullPath += (fullPath === path ? "" : "/"); @@ -302,7 +303,7 @@ export class FiletreeComponent { this.error = ''; this.removePathFromUiCreatedFolders(path); this.api.deleteDocument(path, this.creds.getCredentialsForApi()) - .then(res => this.loadTree()) + .then(_ => this.loadTree()) .catch(err => this.error = 'Delete failed: ' + ErrorMessageUtil.extract(err)); } @@ -316,7 +317,7 @@ export class FiletreeComponent { uploadFile(event) { this.error = ''; this.api.uploadDocument(event.target.files[0], event.target.files[0].name, this.creds.getCredentialsForApi()) - .then(res => this.loadTree()) + .then(_ => this.loadTree()) .catch(err => { this.error = 'Upload failed: ' + ErrorMessageUtil.extract(err); }); @@ -328,7 +329,7 @@ export class FiletreeComponent { event.currentTarget.files[0], event.currentTarget.name + event.currentTarget.files[0].name, this.creds.getCredentialsForApi()) - .then(res => this.loadTree()) + .then(_ => this.loadTree()) .catch(err => { this.error = 'Upload failed: ' + ErrorMessageUtil.extract(err); }); diff --git a/frontend/datasafe-ui/src/app/component/login/login.component.ts b/frontend/datasafe-ui/src/app/component/login/login.component.ts index f943deeff..b2c947f34 100644 --- a/frontend/datasafe-ui/src/app/component/login/login.component.ts +++ b/frontend/datasafe-ui/src/app/component/login/login.component.ts @@ -3,7 +3,7 @@ import {Router} from '@angular/router'; import {FormBuilder, FormControl, Validators} from '@angular/forms'; import {CredentialsService} from '../../service/credentials/credentials.service'; import {Env, FieldErrorStateMatcher} from '../../app.component'; -import {MAT_DIALOG_DATA, MatDialog, MatDialogRef} from '@angular/material'; +import {MAT_DIALOG_DATA, MatDialog, MatDialogRef} from '@angular/material/dialog'; export interface ApiConfigData { apiUrl: string; diff --git a/frontend/datasafe-ui/src/app/component/register/register.component.ts b/frontend/datasafe-ui/src/app/component/register/register.component.ts index 4aff54c12..4c5542fe3 100644 --- a/frontend/datasafe-ui/src/app/component/register/register.component.ts +++ b/frontend/datasafe-ui/src/app/component/register/register.component.ts @@ -1,14 +1,14 @@ import {Component, OnInit} from '@angular/core'; -import {FormBuilder, FormControl, FormGroup, Validators} from "@angular/forms"; -import {Router} from "@angular/router"; -import {ApiService} from "../../service/api/api.service"; -import {CredentialsService} from "../../service/credentials/credentials.service"; -import {ErrorMessageUtil, FieldErrorStateMatcher, ParentOrFieldErrorStateMatcher} from "../../app.component"; +import {FormBuilder, FormControl, FormGroup, Validators} from '@angular/forms'; +import {Router} from '@angular/router'; +import {ApiService} from '../../service/api/api.service'; +import {CredentialsService} from '../../service/credentials/credentials.service'; +import {ErrorMessageUtil, FieldErrorStateMatcher, ParentOrFieldErrorStateMatcher} from '../../app.component'; class PasswordsMatchControl extends FormControl { constructor(private hidden: boolean) { - super('', []) + super('', []); } get Hidden(): boolean { @@ -31,6 +31,10 @@ class PasswordsMatchControl extends FormControl { }) export class RegisterComponent implements OnInit { + constructor(public router: Router, private api: ApiService, private fb: FormBuilder, + private creds: CredentialsService) { + } + userNameControl = new FormControl('', [ Validators.required, Validators.minLength(3) @@ -53,8 +57,12 @@ export class RegisterComponent implements OnInit { fieldMatcher = new FieldErrorStateMatcher(); parentOrFieldMatcher = new ParentOrFieldErrorStateMatcher(); - constructor(public router: Router, private api: ApiService, private fb: FormBuilder, - private creds: CredentialsService) { + private static checkPasswords(group: FormGroup) { // here we have the 'passwords' group + const matchControl = group.controls.matchPasswords; + const pass = group.controls.passwords.value; + const confirmPass = matchControl.value; + + return (matchControl.Hidden || pass === confirmPass) ? null : {notSame: true} } ngOnInit() { @@ -62,22 +70,14 @@ export class RegisterComponent implements OnInit { public handleCreateUserClick() { if (!this.registerForm.valid) { - return + return; } this.api.createUser(this.userNameControl.value, this.passwordControl.value) .then(res => { this.creds.setCredentials(this.userNameControl.value, this.passwordControl.value); - this.router.navigate(['/user']) + this.router.navigate(['/user']); }) .catch(error => this.registerForm.setErrors({'createFailed': ErrorMessageUtil.extract(error)})); } - - private static checkPasswords(group: FormGroup) { // here we have the 'passwords' group - let matchControl = group.controls.matchPasswords; - let pass = group.controls.passwords.value; - let confirmPass = matchControl.value; - - return (matchControl.Hidden || pass === confirmPass) ? null : {notSame: true} - } } diff --git a/frontend/datasafe-ui/src/app/polyfills.ts b/frontend/datasafe-ui/src/app/polyfills.ts index 5134b24e9..203549750 100755 --- a/frontend/datasafe-ui/src/app/polyfills.ts +++ b/frontend/datasafe-ui/src/app/polyfills.ts @@ -1,5 +1,4 @@ -import 'core-js/es6/reflect'; -import 'core-js/es7/reflect'; +import 'core-js/features/reflect'; import 'zone.js/dist/zone'; import 'hammerjs'; import 'web-animations-js'; \ No newline at end of file diff --git a/pom.xml b/pom.xml index b15b12999..16be9735c 100644 --- a/pom.xml +++ b/pom.xml @@ -74,13 +74,13 @@ src/main/java src/test/java 19.2.0 - 3.11.0 + 3.12.1 17 17 3.6.1 1.18.30 2.8.9 - 2.46.1 + 2.50 32.1.1-jre 4.0.3 5.10.0 @@ -113,7 +113,7 @@ 3.1.2 1.4.4 2.16.1 - 0.0.9 + 0.0.11-SNAPSHOT 2.1.1 2.3.1 2.8.1 @@ -741,6 +741,16 @@ + + + sonatype + https://oss.sonatype.org/content/repositories/snapshots + + true + + + + sonatype