diff --git a/.gitattributes b/.gitattributes index dfe07704..9c74e428 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,2 +1,9 @@ # Auto detect text files and perform LF normalization * text=auto + +# Force sh files to have LF +*.sh text eol=lf + +# Force MVN Wrapper Linux files LF +mvnw text eol=lf +.mvn/wrapper/maven-wrapper.properties text eol=lf diff --git a/.github/dependabot.yml b/.github/dependabot.yml deleted file mode 100644 index 28d6d7b3..00000000 --- a/.github/dependabot.yml +++ /dev/null @@ -1,22 +0,0 @@ -version: 2 -updates: -- package-ecosystem: github-actions - directory: "/" - schedule: - interval: daily - # Run it at a specific time so that we don't get emails all day long - time: "00:00" - open-pull-requests-limit: 10 - ignore: - - dependency-name: "*" - # GitHub actions are using git tags (v1 = v1.2 = v1.2.3) which should be compatible until a major change is performed - update-types: - - "version-update:semver-minor" - - "version-update:semver-patch" -- package-ecosystem: maven - directory: "/" - schedule: - interval: daily - # Run it at a specific time so that we don't get emails all day long - time: "00:00" - open-pull-requests-limit: 10 diff --git a/.github/workflows/antora-build.yml b/.github/workflows/antora-build.yml new file mode 100644 index 00000000..a7b47f5b --- /dev/null +++ b/.github/workflows/antora-build.yml @@ -0,0 +1,51 @@ +name: Antora Documentation Build + +on: + workflow_dispatch: + +env: + ACTIONS_STEP_DEBUG : true + +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages +permissions: + contents: read # Read permission for repository contents + pages: write # Write permission for GitHub Pages + id-token: write # Write permission for ID token + +jobs: + build: + runs-on: ubuntu-latest + + environment: + name: github-pages + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Install Node.js + uses: actions/setup-node@v4 + with: + node-version: 18 + + - name: Install Antora and the Antora Lunr Extension + run: npm i antora @antora/lunr-extension + + - name: Generate Site + run: npx antora docs/antora-playbook.yml + + - name: Setup Pages + uses: actions/configure-pages@v5 + + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + name: site + path: docs/site + + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 + with: + token: ${{ secrets.GITHUB_TOKEN }} + artifact_name: site diff --git a/.github/workflows/checkBuild.yml b/.github/workflows/checkBuild.yml index 5f2678b6..a1fc53b5 100644 --- a/.github/workflows/checkBuild.yml +++ b/.github/workflows/checkBuild.yml @@ -29,7 +29,7 @@ jobs: strategy: matrix: - java: [17, 21.0.1] + java: [17, 21] distribution: [temurin] steps: @@ -43,7 +43,7 @@ jobs: cache: 'maven' - name: Build with Maven - run: mvn -B clean package + run: ./mvnw -B clean package - name: Check for uncommited changes run: | @@ -59,7 +59,7 @@ jobs: echo ---------------------------------------- echo Troubleshooting echo ---------------------------------------- - echo "::error::Unstaged changes detected. Locally try running: git clean -ffdx && mvn -B clean package" + echo "::error::Unstaged changes detected. Locally try running: git clean -ffdx && ./mvnw -B clean package" exit 1 fi @@ -72,6 +72,7 @@ jobs: code-style: runs-on: ubuntu-latest + if: ${{ github.event_name != 'pull_request' || !startsWith(github.head_ref, 'renovate/') }} strategy: matrix: @@ -89,4 +90,21 @@ jobs: cache: 'maven' - name: Run Checkstyle - run: mvn -B checkstyle:check -P checkstyle -T2C + run: ./mvnw -B checkstyle:check -P checkstyle -T2C + + docs: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Install Node.js + uses: actions/setup-node@v4 + with: + node-version: 18 + + - name: Install Antora and the Antora Lunr Extension + run: npm i antora @antora/lunr-extension + + - name: Generate Site + run: npx antora docs/antora-playbook.yml \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 534759b2..4ad042f4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -25,7 +25,7 @@ jobs: cache: 'maven' - name: Build with Maven - run: mvn -B clean package + run: ./mvnw -B clean package - name: Check for uncommited changes run: | @@ -41,7 +41,7 @@ jobs: echo ---------------------------------------- echo Troubleshooting echo ---------------------------------------- - echo "::error::Unstaged changes detected. Locally try running: git clean -ffdx && mvn -B clean package" + echo "::error::Unstaged changes detected. Locally try running: git clean -ffdx && ./mvnw -B clean package" exit 1 fi @@ -60,18 +60,19 @@ jobs: - name: Un-SNAP run: | + mvnwPath=$(readlink -f ./mvnw) modules=("") # root modules+=($(grep -ozP '(?<=module>)[^<]+' 'pom.xml' | tr -d '\0')) for i in "${modules[@]}" do echo "Processing $i/pom.xml" - (cd "$i" && mvn -B versions:set -DremoveSnapshot -DgenerateBackupPoms=false) + (cd "$i" && $mvnwPath -B versions:set -DremoveSnapshot -DgenerateBackupPoms=false) done - name: Get version id: version run: | - version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) + version=$(../mvnw help:evaluate -Dexpression=project.version -q -DforceStdout) echo "release=$version" >> $GITHUB_OUTPUT echo "releasenumber=${version//[!0-9]/}" >> $GITHUB_OUTPUT working-directory: ${{ env.PRIMARY_MAVEN_MODULE }} @@ -129,7 +130,7 @@ jobs: gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} - name: Publish to Apache Maven Central - run: mvn -B deploy -Possrh + run: ../mvnw -B deploy -Possrh env: MAVEN_CENTRAL_USERNAME: ${{ secrets.S01_OSS_SONATYPE_MAVEN_USERNAME }} MAVEN_CENTRAL_TOKEN: ${{ secrets.S01_OSS_SONATYPE_MAVEN_TOKEN }} @@ -137,7 +138,6 @@ jobs: working-directory: ${{ env.PRIMARY_MAVEN_MODULE }} publish-pages: - name: Publish dependencies and licenses to github pages runs-on: ubuntu-latest needs: [prepare_release] steps: @@ -156,40 +156,15 @@ jobs: distribution: 'temurin' cache: 'maven' - - name: Build dependencies/licenses files - run: mvn -B project-info-reports:dependencies + - name: Build site + run: ../mvnw -B site working-directory: ${{ env.PRIMARY_MAVEN_MODULE }} - - name: Upload licenses - Upload Artifact - uses: actions/upload-artifact@v4 - with: - name: dependencies-licenses - path: ${{ env.PRIMARY_MAVEN_MODULE }}/target/site - - - name: Generate docs/dependencies dir - run: mkdir -p docs/dependencies - - - name: Move built files into docs/dependencies - run: mv ${{ env.PRIMARY_MAVEN_MODULE }}/target/site/* docs/dependencies - - - name: Rename dependencies.html to index.html - working-directory: docs/dependencies - run: mv dependencies.html index.html - - - name: Copy Readme into docs (as index.md) - run: cp README.md docs/index.md - - - name: Configure Pages - working-directory: docs - run: |- - echo "theme: jekyll-theme-tactile" > _config.yml - - name: Deploy to Github pages - uses: peaceiris/actions-gh-pages@v3 + uses: peaceiris/actions-gh-pages@v4 with: github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./docs - enable_jekyll: true + publish_dir: ./${{ env.PRIMARY_MAVEN_MODULE }}/target/site after_release: runs-on: ubuntu-latest @@ -205,12 +180,13 @@ jobs: - name: Inc Version and SNAP run: | + mvnwPath=$(readlink -f ./mvnw) modules=("") # root modules+=($(grep -ozP '(?<=module>)[^<]+' 'pom.xml' | tr -d '\0')) for i in "${modules[@]}" do echo "Processing $i/pom.xml" - (cd "$i" && mvn -B build-helper:parse-version versions:set -DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.minorVersion}.\${parsedVersion.nextIncrementalVersion} -DgenerateBackupPoms=false -DnextSnapshot=true) + (cd "$i" && $mvnwPath -B build-helper:parse-version versions:set -DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.minorVersion}.\${parsedVersion.nextIncrementalVersion} -DgenerateBackupPoms=false -DnextSnapshot=true) done - name: Git Commit and Push diff --git a/.github/workflows/sonar.yml b/.github/workflows/sonar.yml index 39335e05..1c9b0f8d 100644 --- a/.github/workflows/sonar.yml +++ b/.github/workflows/sonar.yml @@ -27,8 +27,7 @@ jobs: sonar: name: SonarCloud Scan runs-on: ubuntu-latest - # Dependabot PRs have no access to secrets (SONAR_TOKEN) -> Ignore them - if: ${{ github.event_name != 'pull_request' || !startsWith(github.head_ref, 'dependabot/') }} + if: ${{ github.event_name != 'pull_request' || !startsWith(github.head_ref, 'renovate/') }} steps: - uses: actions/checkout@v4 with: @@ -56,7 +55,7 @@ jobs: - name: Build with Maven run: | - mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar \ + ./mvnw -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar \ -DskipTests \ -Dsonar.projectKey=${{ env.SONARCLOUD_ORG }}_${{ github.event.repository.name }} \ -Dsonar.organization=${{ env.SONARCLOUD_ORG }} \ diff --git a/.github/workflows/test-deploy.yml b/.github/workflows/test-deploy.yml index 4e883f82..cdd96cc1 100644 --- a/.github/workflows/test-deploy.yml +++ b/.github/workflows/test-deploy.yml @@ -24,7 +24,7 @@ jobs: gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} - name: Publish to OSSRH - run: mvn -B deploy -Possrh + run: ../mvnw -B deploy -Possrh working-directory: ${{ env.PRIMARY_MAVEN_MODULE }} env: MAVEN_CENTRAL_USERNAME: ${{ secrets.S01_OSS_SONATYPE_MAVEN_USERNAME }} diff --git a/.gitignore b/.gitignore index a6d5c6d3..fb4acbe5 100644 --- a/.gitignore +++ b/.gitignore @@ -68,6 +68,8 @@ target/ # EclipseStore storage +storage-person +storage-invoice storage-jpa # == IntelliJ == diff --git a/.idea/checkstyle-idea.xml b/.idea/checkstyle-idea.xml index 9a5d4ffe..eb3fcd83 100644 --- a/.idea/checkstyle-idea.xml +++ b/.idea/checkstyle-idea.xml @@ -1,7 +1,7 @@ - 10.12.5 + 10.15.0 JavaOnlyWithTests true true @@ -17,4 +17,4 @@ - + \ No newline at end of file diff --git a/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 00000000..7f156212 --- /dev/null +++ b/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1,17 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.6/apache-maven-3.9.6-bin.zip diff --git a/.run/Run Dual Storage Demo.run.xml b/.run/Run Dual Storage Demo.run.xml new file mode 100644 index 00000000..65f11f49 --- /dev/null +++ b/.run/Run Dual Storage Demo.run.xml @@ -0,0 +1,17 @@ + + + + \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index faad4e2e..a11d28d0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +# 1.0.4 + +* Added possibility to use multiple storages +* Added Lazy support + # 1.0.3 * Added the EclipseStoreDataImporter to import data from JPA repositories. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0a21eee9..641e8533 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -20,7 +20,7 @@ We also encourage you to read the [contribution instructions by GitHub](https:// You should have the following things installed: * Git * Java 21 - should be as unmodified as possible (Recommended: [Eclipse Adoptium](https://adoptium.net/temurin/releases/)) -* Maven +* Maven (Note that the [Maven Wrapper](https://maven.apache.org/wrapper/) is shipped with the repo) ### Recommended setup * Install ``IntelliJ`` (Community Edition is sufficient) diff --git a/LICENSE b/LICENSE index 864bb41e..ccaa2b3a 100644 --- a/LICENSE +++ b/LICENSE @@ -186,7 +186,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2024 XDEV Software + Copyright 2024 XDEV Software Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/README.md b/README.md index 40cf0f50..2468c459 100644 --- a/README.md +++ b/README.md @@ -19,8 +19,9 @@ The library provides following features: * Enforces the **[Spring data repository concept](https://docs.spring.io/spring-data/jpa/reference/repositories/core-concepts.html)** - for EclipseStore by using [working copies](#working-copies) -* **[Drop in compatible](#usage)** for your existing Spring application + for EclipseStore by + using [working copies](https://xdev-software.github.io/spring-data-eclipse-store/working-copies.html) +* **[Drop in compatible](https://xdev-software.github.io/spring-data-eclipse-store/installation.html#drop-in-compatible)** for your existing Spring application * Utilizes **ultra-fast EclipseStore serializing and storing** * Enables your application to **select any [EclipseStore target](https://docs.eclipsestore.io/manual/storage/storage-targets/index.html)** (e.g. @@ -37,41 +38,30 @@ GB of data are stored. ([IBM Cloud Pricing](https://cloud.ibm.com/estimator/esti AWS. ([AWS Pricing Calculator](https://calculator.aws/#/estimate?id=ab85cddf77f0d1aa0457111ed82785dfb836b1d8), as of 08.01.2024) -### Working copies +## Installation & Usage -If you use EclipseStore without our library, EclipseStore loads the data from the datastore directly into memory. You make your changes on these loaded Java objects and by calling ``store`` EclipseStore writes it directly from memory to the datastore. +[**Installation +guide** for the latest release](https://github.com/xdev-software/spring-data-eclipse-store/releases/latest#Installation) -![Native behavior of EclipseStore](assets/WorkingCopy_1.svg) - -If you e.g. change the address of a person, the changed address is already in your data model, **even before storing** this person. -This is very different from the behavior a Spring user expects. - -With *Spring-Data-Eclipse-Store* every time an object is loaded from the datastore, a working copy of that object (or rather the object tree) is created and returned to the user. Therefore, the user can make the changes on the working copy without any changes to the actual data model. The changes are only persisted after calling ``save`` on a repository. - -![Behavior of EclipseStore with Spring-Data-Eclipse-Store](assets/WorkingCopy_2.svg) - -## Installation -[Installation guide for the latest release](https://github.com/xdev-software/spring-data-eclipse-store/releases/latest#Installation) +[**Detailed +instructions** are in the documentation](https://xdev-software.github.io/spring-data-eclipse-store/installation.html) ### Supported versions | Spring-Data-Eclipse-Store | Java | Spring Data | EclipseStore | |---------------------------|--------|-------------|--------------| | ``<= 1.0.2`` | ``17`` | ``3.2.2`` | ``1.1.0`` | -| ``1.0.3`` | ``17`` | ``3.2.3`` | ``1.2.0`` | - -### Usage - -After adding the library in your dependencies, using it is as easy as adding the ``@EnableEclipseStoreRepositories`` annotation to your ``@SpringBootApplication`` annotation. +| ``>= 1.0.3`` | ``17`` | ``3.2.3`` | ``1.2.0`` | ## Demo -To see how easy it is to implement EclipseStore in your Spring project, take a look at the three -[demos](./spring-data-eclipse-store-demo):
-A [simple](./spring-data-eclipse-store-demo/src/main/java/software/xdev/spring/data/eclipse/store/demo/simple), a -more [complex demo](./spring-data-eclipse-store-demo/src/main/java/software/xdev/spring/data/eclipse/store/demo/complex) -and -a [demo with coexisting JPA](./spring-data-eclipse-store-jpa/src/main/java/software/xdev/spring/data/eclipse/store/jpa). +To see how easy it is to implement EclipseStore in your Spring project, take a look at +the [demos](./spring-data-eclipse-store-demo): + +* [Simple demo](https://github.com/xdev-software/spring-data-eclipse-store/tree/develop/spring-data-eclipse-store-demo/src/main/java/software/xdev/spring/data/eclipse/store/demo/simple) +* [Complex demo](https://github.com/xdev-software/spring-data-eclipse-store/tree/develop/spring-data-eclipse-store-demo/src/main/java/software/xdev/spring/data/eclipse/store/demo/complex) +* [Demo with coexisting JPA](https://github.com/xdev-software/spring-data-eclipse-store/tree/develop/spring-data-eclipse-store-jpa/src/main/java/software/xdev/spring/data/eclipse/store/jpa) +* [Dual storage demo](https://github.com/xdev-software/spring-data-eclipse-store/tree/develop/spring-data-eclipse-store-demo/src/main/java/software/xdev/spring/data/eclipse/store/demo/dual/storage) > [!NOTE] > Since the library is using reflection to copy data, the following JVM-Arguments may have to be set: @@ -82,7 +72,6 @@ a [demo with coexisting JPA](./spring-data-eclipse-store-jpa/src/main/java/softw > --add-opens=java.base/java.time=ALL-UNNAMED > ``` - ## Support If you need support as soon as possible, and you can't wait for any pull request, feel free to @@ -92,4 +81,4 @@ use [our support](https://xdev.software/en/services/support). See the [contributing guide](./CONTRIBUTING.md) for detailed instructions on how to get started with our project. ## Dependencies and Licenses -View the [license of the current project](LICENSE) or the [summary including all dependencies](https://xdev-software.github.io/spring-data-eclipse-store/dependencies/) +View the [license of the current project](LICENSE) or the [summary including all dependencies](https://xdev-software.github.io/spring-data-eclipse-store/dependencies) diff --git a/docs/antora-playbook.yml b/docs/antora-playbook.yml new file mode 100644 index 00000000..15845af5 --- /dev/null +++ b/docs/antora-playbook.yml @@ -0,0 +1,36 @@ +site: + title: Spring-Data-Eclipse-Store + url: https://spring-eclipsestore.xdev.software/ + robots: allow + +# see https://docs.antora.org/antora/2.3/playbook/configure-runtime/ +runtime: + cache_dir: ./.cache/antora + log: + # use pretty even on CI + format: pretty + # set to info to get details from the Antora extensions + level: info + # Antora exits with a non-zero exit code if an error is logged -> https://docs.antora.org/antora/latest/playbook/runtime-log-failure-level + failure_level: error + +content: + sources: + # url of the repo + - url: https://github.com/xdev-software/spring-data-eclipse-store + start_path: docs + branches: + - "develop" + +ui: + bundle: + url: https://gitlab.com/antora/antora-ui-default/-/jobs/artifacts/master/raw/build/ui-bundle.zip?job=bundle-stable + snapshot: true + supplemental_files: ./supplemental-ui + +output: + dir: ./site + +antora: + extensions: + - require: '@antora/lunr-extension' diff --git a/docs/antora.yml b/docs/antora.yml new file mode 100644 index 00000000..c7ed9c14 --- /dev/null +++ b/docs/antora.yml @@ -0,0 +1,14 @@ +name: ROOT +title: Spring-Data-Eclipse-Store +version: master +display_version: '1.0.3' +start_page: index.adoc +nav: + - modules/ROOT/nav.adoc +asciidoc: + attributes: + product-name: 'Spring-Data-Eclipse-Store' + display-version: '1.0.3' + maven-version: '1.0.3' + page-editable: false + page-out-of-support: false diff --git a/docs/modules/ROOT/assets/images/Logo.svg b/docs/modules/ROOT/assets/images/Logo.svg new file mode 100644 index 00000000..79b8e3ec --- /dev/null +++ b/docs/modules/ROOT/assets/images/Logo.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/WorkingCopy_1.svg b/docs/modules/ROOT/assets/images/WorkingCopy_1.svg similarity index 100% rename from assets/WorkingCopy_1.svg rename to docs/modules/ROOT/assets/images/WorkingCopy_1.svg diff --git a/assets/WorkingCopy_2.svg b/docs/modules/ROOT/assets/images/WorkingCopy_2.svg similarity index 100% rename from assets/WorkingCopy_2.svg rename to docs/modules/ROOT/assets/images/WorkingCopy_2.svg diff --git a/docs/modules/ROOT/nav.adoc b/docs/modules/ROOT/nav.adoc new file mode 100644 index 00000000..20b43255 --- /dev/null +++ b/docs/modules/ROOT/nav.adoc @@ -0,0 +1,7 @@ +* xref:index.adoc[Home] +* xref:installation.adoc[Installation] +* xref:configuration.adoc[Configuration] +* xref:working-copies.adoc[Working Copies] +* xref:lazies.adoc[Lazy References] +* xref:migration.adoc[Migration] +* xref:known-issues.adoc[Known issues] diff --git a/docs/modules/ROOT/pages/configuration.adoc b/docs/modules/ROOT/pages/configuration.adoc new file mode 100644 index 00000000..57659125 --- /dev/null +++ b/docs/modules/ROOT/pages/configuration.adoc @@ -0,0 +1,30 @@ += Configuration + +== EclipseStore Spring-Boot Configuration + +The simplest way to configure your storage is by using the key/value pairs in a configuration file as described in the https://docs.eclipsestore.io/manual/misc/integrations/spring-boot.html[EclipseStore documentation]. + +== Detailed Configuration + +If you need more control or want to configure your storage in code, we provide a simple Configuration class which can be used as follows: + +[source,java,title="Demo configuration"] +---- +import org.eclipse.store.storage.embedded.types.EmbeddedStorage; +import org.eclipse.store.storage.embedded.types.EmbeddedStorageFoundation; +import org.eclipse.store.storage.types.Storage; +... +@Configuration +@EnableEclipseStoreRepositories(clientConfigurationClass = DemoConfiguration.class) +public class DemoConfiguration extends EclipseStoreClientConfiguration +{ + @Override + public EmbeddedStorageFoundation createEmbeddedStorageFoundation() + { + return EmbeddedStorage.Foundation(Storage.Configuration(Storage.FileProvider(Path.of("demo-storage")))); + } +} +---- +The method ``createEmbeddedStorageFoundation`` could return a much more complicated ``EmbeddedStorageFoundation`` as described here in the https://docs.eclipsestore.io/manual/storage/configuration/index.html[EclipseStore documentation about configuration and foundations]. + +This also enables you to use multiple EclipseStore-Storages in one project. See the https://github.com/xdev-software/spring-data-eclipse-store/tree/develop/spring-data-eclipse-store-demo/src/main/java/software/xdev/spring/data/eclipse/store/demo/dual/storage[Dual storages demo]. diff --git a/docs/modules/ROOT/pages/index.adoc b/docs/modules/ROOT/pages/index.adoc new file mode 100644 index 00000000..dcab5756 --- /dev/null +++ b/docs/modules/ROOT/pages/index.adoc @@ -0,0 +1,26 @@ += {product-name} + +image::Logo.svg[Logo XDEV Spring-Data-Eclipse-Store,200] + +== About + +A Open-Source library to simplify using https://eclipsestore.io/[EclipseStore] in a https://spring.io/projects/spring-data/[Spring environment]. + +What makes this library special is, that it creates a xref:working-copies.adoc[working copy] of the data. +This way EclipseStore behaves almost exactly like relational database from a coding perspective. + +== Features + +The library provides following features: + +* Enforces the +https://docs.spring.io/spring-data/jpa/reference/repositories/core-concepts.html[Spring data repository concept] +for EclipseStore by using xref:working-copies.adoc[working copies]. +* xref:installation.adoc#drop-in-compatible[Drop in compatible] for your existing Spring application +* Utilizes *ultra-fast EclipseStore serializing and storing* +* Enables your application to select any https://docs.eclipsestore.io/manual/storage/storage-targets/index.html[EclipseStore target] (e.g. +https://docs.eclipsestore.io/manual/storage/storage-targets/sql-databases/postgresql.html[PostgreSQL], +https://docs.eclipsestore.io/manual/storage/storage-targets/blob-stores/aws-s3.html[AWS S3] or +https://github.com/xdev-software/eclipse-store-afs-ibm-cos[IBM COS]) +* Can save up to *99%footnote:[If the COS Connector is used in the IBM Cloud instead of a PostgreSQL and approx. 10,000 entries with a total size of 1 GB of data are stored. (https://cloud.ibm.com/estimator/estimates[IBM Cloud Pricing], as of 08.01.2024)] of monthly costs* in the IBM Cloud and up to 82%footnote:[If the S3 connector is used instead of DynamoDB under the same conditions at AWS. +(https://calculator.aws/#/estimate?id=ab85cddf77f0d1aa0457111ed82785dfb836b1d8[AWS Pricing Calculator], as of 08.01.2024)] in the AWS Cloud diff --git a/docs/modules/ROOT/pages/installation.adoc b/docs/modules/ROOT/pages/installation.adoc new file mode 100644 index 00000000..f37272e9 --- /dev/null +++ b/docs/modules/ROOT/pages/installation.adoc @@ -0,0 +1,51 @@ += Installation + +== Build Configuration + +You can find the {product-name} libraries in the Maven Central repository. + +Simply add the following dependency to your maven project + +[source,xml,subs=attributes+,title="Maven [pom.xml]"] +---- + + + software.xdev + spring-data-eclipse-store + {maven-version} + + +---- + +Also see the https://github.com/xdev-software/spring-data-eclipse-store/releases/latest#Installation[installation guide for the latest release]. + +== Configuration + +After adding the library in your dependencies, using it is as easy as adding the ``@EnableEclipseStoreRepositories`` annotation to your ``@SpringBootApplication`` annotation. + +[NOTE] +==== +Since the library is using reflection to copy data, the following JVM-Arguments may have to be set. + +[source,title="JVM Arguments"] +---- +--add-opens=java.base/java.util=ALL-UNNAMED +--add-exports java.base/jdk.internal.misc=ALL-UNNAMED +--add-opens=java.base/java.lang=ALL-UNNAMED +--add-opens=java.base/java.time=ALL-UNNAMED +---- +==== + +== Demo + +To see how easy it is to implement EclipseStore in your Spring project, take a look at the https://github.com/xdev-software/spring-data-eclipse-store/tree/develop/spring-data-eclipse-store-demo[demos]: + +* https://github.com/xdev-software/spring-data-eclipse-store/tree/develop/spring-data-eclipse-store-demo/src/main/java/software/xdev/spring/data/eclipse/store/demo/simple[Simple demo] +* https://github.com/xdev-software/spring-data-eclipse-store/tree/develop/spring-data-eclipse-store-demo/src/main/java/software/xdev/spring/data/eclipse/store/demo/complex[Complex demo] +* https://github.com/xdev-software/spring-data-eclipse-store/tree/develop/spring-data-eclipse-store-jpa/src/main/java/software/xdev/spring/data/eclipse/store/jpa[Demo with coexisting JPA] +* https://github.com/xdev-software/spring-data-eclipse-store/tree/develop/spring-data-eclipse-store-demo/src/main/java/software/xdev/spring/data/eclipse/store/demo/dual/storage[Dual storage demo] + +== Drop in compatible [[drop-in-compatible]] + +After adding the dependency and the annotation you are ready to go. +This makes this library drop in compatible for Spring-Data projects. diff --git a/docs/modules/ROOT/pages/known-issues.adoc b/docs/modules/ROOT/pages/known-issues.adoc new file mode 100644 index 00000000..6c1c9489 --- /dev/null +++ b/docs/modules/ROOT/pages/known-issues.adoc @@ -0,0 +1,31 @@ += Known issues + +== Query annotations + +In Spring-Data-JPA you can write a Query over methods of repositories like this: + +[source,java,title="From https://github.com/spring-projects/spring-petclinic/blob/main/src/main/java/org/springframework/samples/petclinic/owner/OwnerRepository.java[spring-petclinic]"] +---- +@Query("SELECT ptype FROM PetType ptype ORDER BY ptype.name") +List findPetTypes(); +---- + +We created https://github.com/xdev-software/spring-data-eclipse-store/issues/32[an issue] for that but right now we *do not support Query annotations*. + +== Data changes + +There are two basic ways to keep your data up to date. + +=== Structural + +As with most projects, data that needs persisting changes over time. +In EclipseStore that's handled through https://docs.eclipsestore.io/manual/storage/legacy-type-mapping/index.html[Legacy Type Mapping]. + +That consists of https://docs.eclipsestore.io/manual/storage/legacy-type-mapping/index.html#_automatic_mapping[Automatic Mapping] through EclipseStores internal heuristic and https://docs.eclipsestore.io/manual/storage/legacy-type-mapping/index.html#explicit-mapping[Explicit Mapping] by the user. + +=== Values + +There is a library to version your data in the store called https://github.com/xdev-software/micro-migration[XDEV MicroMigration]. +This helps you keep your data up to date regardless of the current version. + +We created https://github.com/xdev-software/spring-data-eclipse-store/issues/33[an issue] for that but right now we *do not support XDEVs MicroMigration*. diff --git a/docs/modules/ROOT/pages/lazies.adoc b/docs/modules/ROOT/pages/lazies.adoc new file mode 100644 index 00000000..55f93cbc --- /dev/null +++ b/docs/modules/ROOT/pages/lazies.adoc @@ -0,0 +1,40 @@ += Lazy References + +Lazy Loading is an essential part of EclipseStore. +The basic mechanism is best explained in the https://docs.eclipsestore.io/manual/storage/loading-data/lazy-loading/index.html[EclipseStore-Docs]. + +In essence java objects which are wrapped in a *Lazy-Reference are not loaded with the startup of the EclipseStore-Storage but only if ``get()`` is called* on them. + +Lazy References are essential for big data sets that can't get loaded into memory. +Since {product-name} operates with xref:working-copies.adoc[working copies] using the EclipseStore-Lazy-References is not possible. + +If you are using the EclipseStore-Lazy-References, all references would be resolved and loaded into memory as soon as a working copy is created, because the ``get()``-Method is called to create a full working copy. + +That's why we implemented ``SpringDataEclipseStoreLazy``. + +The usage is the same as with the EclipseStore-Lazies, but they are handled very differently. + +Simply wrap any kind of java object in the SpringDataEclipseStoreLazy-Wrapper and the wrapped object has a lazy loading behaviour. + +CAUTION: Lazy-References are not only loaded when needed, but also https://docs.eclipsestore.io/manual/storage/loading-data/lazy-loading/clearing-lazy-references.html#automatically[*cleared when they are no longer needed*]! + +Example: ``SpringDataEclipseStoreLazy.build(new HashMap())`` + +[source,java,title="https://github.com/xdev-software/spring-data-eclipse-store/tree/develop/spring-data-eclipse-store-demo/src/main/java/software/xdev/spring/data/eclipse/store/demo/complex/owner/Owner.java[Example from complex demo]"] +---- +package software.xdev.spring.data.eclipse.store.demo.complex.owner; +//... +import software.xdev.spring.data.eclipse.store.repository.lazy.SpringDataEclipseStoreLazy; + +public class Owner extends Person +{ + private String address; + + private Lazy> pets = SpringDataEclipseStoreLazy.build(new ArrayList<>()); + //... +---- + +== Internas + +SpringDataEclipseStoreLazies work as a proxy for the EclipseStore-Lazies. +As far as EclipseStore is concerned, a SpringDataEclipseStoreLazy-Object is a normal Java object that contains a Lazy-Reference. + +But when {product-name} creates the working copy, *the SpringDataEclipseStoreLazy-Reference is not resolved* but instead only a reference to the original Lazy-Object in EclipseStore is loaded. +As soon as ``get()`` is called on the SpringDataEclipseStoreLazy, a *new working copy of the lazy object* is created. diff --git a/docs/modules/ROOT/pages/migration.adoc b/docs/modules/ROOT/pages/migration.adoc new file mode 100644 index 00000000..24148348 --- /dev/null +++ b/docs/modules/ROOT/pages/migration.adoc @@ -0,0 +1,36 @@ += Migration + +Migrating from Spring Data JPA is very easy. +We implemented a https://github.com/xdev-software/spring-data-eclipse-store-migration[OpenRewrite recipe] for that. +It can be executed with a simple Maven command: + +[source,title="Maven"] +---- +mvn org.openrewrite.maven:rewrite-maven-plugin:run \ +-Drewrite.recipeArtifactCoordinates=software.xdev:spring-data-eclipse-store-migration \ +-Drewrite.activeRecipes=software.xdev.spring.data.eclipse.store.JpaMigration +---- + +[CAUTION] +==== +Since {product-name} can't handle ``@Query``-Annotations, these annotations are getting removed by the Rewrite-Recipe. +==== + +== Data + +To import data from different data sources like JPA, you can simply let the ``EclipseStoreDataImporterComponent`` get injected and then call ``importData()``. +This reads all instances of ``EntityManagerFactory``, creates EclipseStoreRepositories for it and then imports that data. +This can take quite some time if you have a lot of data. + +[source,java] +---- +@Autowired +private EclipseStoreDataImporterComponent eclipseStoreDataImporter; + +void importDataFromJpaToEclipseStore() +{ + final List> repositories = this.eclipseStoreDataImporter.importData(); +} +---- + +After that you can change your JpaRepositories to EclipseStoreRepositories and you're done. diff --git a/docs/modules/ROOT/pages/working-copies.adoc b/docs/modules/ROOT/pages/working-copies.adoc new file mode 100644 index 00000000..b4a0f3b7 --- /dev/null +++ b/docs/modules/ROOT/pages/working-copies.adoc @@ -0,0 +1,15 @@ += Working copies + +If you use EclipseStore without our library, EclipseStore loads the data from the datastore directly into memory. You make your changes on these loaded Java objects and by calling ``store`` EclipseStore writes it directly from memory to the datastore. + +image::WorkingCopy_1.svg[Native behavior of EclipseStore] + +If you e.g. change the address of a person, the changed address is already in your data model, *even before storing* this person. +This is very different from the behavior a Spring user expects. + +image::WorkingCopy_2.svg[Behavior of EclipseStore with Spring-Data-Eclipse-Store] + +With {product-name} every time an object is loaded from the datastore, a working copy of that object (or rather the object tree) is created and returned to the user. +Therefore, the user can make the changes on the working copy without any changes to the actual data model. +The changes are only persisted after calling ``save`` on a repository. + diff --git a/docs/package.json b/docs/package.json new file mode 100644 index 00000000..86a7578d --- /dev/null +++ b/docs/package.json @@ -0,0 +1,9 @@ +{ + "dependencies": { + "@antora/lunr-extension": "^1.0.0-alpha.8" + }, + "devDependencies": { + "@antora/cli": "3.1.7", + "@antora/site-generator": "3.1.7" + } +} \ No newline at end of file diff --git a/docs/supplemental-ui/css/site-extra.css b/docs/supplemental-ui/css/site-extra.css new file mode 100644 index 00000000..f4e4f1f0 --- /dev/null +++ b/docs/supplemental-ui/css/site-extra.css @@ -0,0 +1,47 @@ +body { + font-family: sans-serif; +} + +.navbar { + background-color: #fff; +} + +footer.footer { + color: #fff; + background-color: #333333; +} + +footer.footer a, +footer.footer .link-separator +{ + color: #c02222; +} + +.navbar-item { + padding: 0px 8px; +} + +.navbar-brand .navbar-item.logo { + align-self: center; + padding: 0; +} + +.navbar-brand .navbar-item.logo img { + width: inherit; +} + +.navbar-brand .navbar-item.title { + align-self: center; + color: var(--navbar-font-color); + font-size: 1rem; + line-height: 1; + position: relative; + top: 0.06em; /* compensate for built-in line height in font */ + letter-spacing: -0.02em; + padding: 0; + margin: 0 1rem; +} + +.doc h1 { + color: #333333; +} diff --git a/docs/supplemental-ui/img/Favicon_16x16.png b/docs/supplemental-ui/img/Favicon_16x16.png new file mode 100644 index 00000000..47845d38 Binary files /dev/null and b/docs/supplemental-ui/img/Favicon_16x16.png differ diff --git a/docs/supplemental-ui/img/Favicon_32x32.png b/docs/supplemental-ui/img/Favicon_32x32.png new file mode 100644 index 00000000..d061272e Binary files /dev/null and b/docs/supplemental-ui/img/Favicon_32x32.png differ diff --git a/docs/supplemental-ui/img/Header_logo.svg b/docs/supplemental-ui/img/Header_logo.svg new file mode 100644 index 00000000..10286feb --- /dev/null +++ b/docs/supplemental-ui/img/Header_logo.svg @@ -0,0 +1,210 @@ + + + + diff --git a/docs/supplemental-ui/partials/footer-content.hbs b/docs/supplemental-ui/partials/footer-content.hbs new file mode 100644 index 00000000..7b55a4b0 --- /dev/null +++ b/docs/supplemental-ui/partials/footer-content.hbs @@ -0,0 +1,2 @@ +
+
diff --git a/docs/supplemental-ui/partials/head-meta.hbs b/docs/supplemental-ui/partials/head-meta.hbs new file mode 100644 index 00000000..69dbe3b1 --- /dev/null +++ b/docs/supplemental-ui/partials/head-meta.hbs @@ -0,0 +1,3 @@ + + + diff --git a/docs/supplemental-ui/partials/header-content.hbs b/docs/supplemental-ui/partials/header-content.hbs new file mode 100644 index 00000000..3f4a88c6 --- /dev/null +++ b/docs/supplemental-ui/partials/header-content.hbs @@ -0,0 +1,203 @@ +
+ +
diff --git a/mvnw b/mvnw new file mode 100755 index 00000000..08303327 --- /dev/null +++ b/mvnw @@ -0,0 +1,250 @@ +#!/bin/sh +# ---------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Apache Maven Wrapper startup batch script, version 3.3.0 +# +# Optional ENV vars +# ----------------- +# JAVA_HOME - location of a JDK home dir, required when download maven via java source +# MVNW_REPOURL - repo url base for downloading maven distribution +# MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven +# MVNW_VERBOSE - true: enable verbose log; debug: trace the mvnw script; others: silence the output +# ---------------------------------------------------------------------------- + +set -euf +[ "${MVNW_VERBOSE-}" != debug ] || set -x + +# OS specific support. +native_path() { printf %s\\n "$1"; } +case "$(uname)" in +CYGWIN* | MINGW*) + [ -z "${JAVA_HOME-}" ] || JAVA_HOME="$(cygpath --unix "$JAVA_HOME")" + native_path() { cygpath --path --windows "$1"; } + ;; +esac + +# set JAVACMD and JAVACCMD +set_java_home() { + # For Cygwin and MinGW, ensure paths are in Unix format before anything is touched + if [ -n "${JAVA_HOME-}" ]; then + if [ -x "$JAVA_HOME/jre/sh/java" ]; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACCMD="$JAVA_HOME/jre/sh/javac" + else + JAVACMD="$JAVA_HOME/bin/java" + JAVACCMD="$JAVA_HOME/bin/javac" + + if [ ! -x "$JAVACMD" ] || [ ! -x "$JAVACCMD" ]; then + echo "The JAVA_HOME environment variable is not defined correctly, so mvnw cannot run." >&2 + echo "JAVA_HOME is set to \"$JAVA_HOME\", but \"\$JAVA_HOME/bin/java\" or \"\$JAVA_HOME/bin/javac\" does not exist." >&2 + return 1 + fi + fi + else + JAVACMD="$( + 'set' +e + 'unset' -f command 2>/dev/null + 'command' -v java + )" || : + JAVACCMD="$( + 'set' +e + 'unset' -f command 2>/dev/null + 'command' -v javac + )" || : + + if [ ! -x "${JAVACMD-}" ] || [ ! -x "${JAVACCMD-}" ]; then + echo "The java/javac command does not exist in PATH nor is JAVA_HOME set, so mvnw cannot run." >&2 + return 1 + fi + fi +} + +# hash string like Java String::hashCode +hash_string() { + str="${1:-}" h=0 + while [ -n "$str" ]; do + char="${str%"${str#?}"}" + h=$(((h * 31 + $(LC_CTYPE=C printf %d "'$char")) % 4294967296)) + str="${str#?}" + done + printf %x\\n $h +} + +verbose() { :; } +[ "${MVNW_VERBOSE-}" != true ] || verbose() { printf %s\\n "${1-}"; } + +die() { + printf %s\\n "$1" >&2 + exit 1 +} + +# parse distributionUrl and optional distributionSha256Sum, requires .mvn/wrapper/maven-wrapper.properties +while IFS="=" read -r key value; do + case "${key-}" in + distributionUrl) distributionUrl="${value-}" ;; + distributionSha256Sum) distributionSha256Sum="${value-}" ;; + esac +done <"${0%/*}/.mvn/wrapper/maven-wrapper.properties" +[ -n "${distributionUrl-}" ] || die "cannot read distributionUrl property in ${0%/*}/.mvn/wrapper/maven-wrapper.properties" + +case "${distributionUrl##*/}" in +maven-mvnd-*bin.*) + MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ + case "${PROCESSOR_ARCHITECTURE-}${PROCESSOR_ARCHITEW6432-}:$(uname -a)" in + *AMD64:CYGWIN* | *AMD64:MINGW*) distributionPlatform=windows-amd64 ;; + :Darwin*x86_64) distributionPlatform=darwin-amd64 ;; + :Darwin*arm64) distributionPlatform=darwin-aarch64 ;; + :Linux*x86_64*) distributionPlatform=linux-amd64 ;; + *) + echo "Cannot detect native platform for mvnd on $(uname)-$(uname -m), use pure java version" >&2 + distributionPlatform=linux-amd64 + ;; + esac + distributionUrl="${distributionUrl%-bin.*}-$distributionPlatform.zip" + ;; +maven-mvnd-*) MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ ;; +*) MVN_CMD="mvn${0##*/mvnw}" _MVNW_REPO_PATTERN=/org/apache/maven/ ;; +esac + +# apply MVNW_REPOURL and calculate MAVEN_HOME +# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-,maven-mvnd--}/ +[ -z "${MVNW_REPOURL-}" ] || distributionUrl="$MVNW_REPOURL$_MVNW_REPO_PATTERN${distributionUrl#*"$_MVNW_REPO_PATTERN"}" +distributionUrlName="${distributionUrl##*/}" +distributionUrlNameMain="${distributionUrlName%.*}" +distributionUrlNameMain="${distributionUrlNameMain%-bin}" +MAVEN_HOME="$HOME/.m2/wrapper/dists/${distributionUrlNameMain-}/$(hash_string "$distributionUrl")" + +exec_maven() { + unset MVNW_VERBOSE MVNW_USERNAME MVNW_PASSWORD MVNW_REPOURL || : + exec "$MAVEN_HOME/bin/$MVN_CMD" "$@" || die "cannot exec $MAVEN_HOME/bin/$MVN_CMD" +} + +if [ -d "$MAVEN_HOME" ]; then + verbose "found existing MAVEN_HOME at $MAVEN_HOME" + exec_maven "$@" +fi + +case "${distributionUrl-}" in +*?-bin.zip | *?maven-mvnd-?*-?*.zip) ;; +*) die "distributionUrl is not valid, must match *-bin.zip or maven-mvnd-*.zip, but found '${distributionUrl-}'" ;; +esac + +# prepare tmp dir +if TMP_DOWNLOAD_DIR="$(mktemp -d)" && [ -d "$TMP_DOWNLOAD_DIR" ]; then + clean() { rm -rf -- "$TMP_DOWNLOAD_DIR"; } + trap clean HUP INT TERM EXIT +else + die "cannot create temp dir" +fi + +mkdir -p -- "${MAVEN_HOME%/*}" + +# Download and Install Apache Maven +verbose "Couldn't find MAVEN_HOME, downloading and installing it ..." +verbose "Downloading from: $distributionUrl" +verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName" + +# select .zip or .tar.gz +if ! command -v unzip >/dev/null; then + distributionUrl="${distributionUrl%.zip}.tar.gz" + distributionUrlName="${distributionUrl##*/}" +fi + +# verbose opt +__MVNW_QUIET_WGET=--quiet __MVNW_QUIET_CURL=--silent __MVNW_QUIET_UNZIP=-q __MVNW_QUIET_TAR='' +[ "${MVNW_VERBOSE-}" != true ] || __MVNW_QUIET_WGET='' __MVNW_QUIET_CURL='' __MVNW_QUIET_UNZIP='' __MVNW_QUIET_TAR=v + +# normalize http auth +case "${MVNW_PASSWORD:+has-password}" in +'') MVNW_USERNAME='' MVNW_PASSWORD='' ;; +has-password) [ -n "${MVNW_USERNAME-}" ] || MVNW_USERNAME='' MVNW_PASSWORD='' ;; +esac + +if [ -z "${MVNW_USERNAME-}" ] && command -v wget >/dev/null; then + verbose "Found wget ... using wget" + wget ${__MVNW_QUIET_WGET:+"$__MVNW_QUIET_WGET"} "$distributionUrl" -O "$TMP_DOWNLOAD_DIR/$distributionUrlName" || die "wget: Failed to fetch $distributionUrl" +elif [ -z "${MVNW_USERNAME-}" ] && command -v curl >/dev/null; then + verbose "Found curl ... using curl" + curl ${__MVNW_QUIET_CURL:+"$__MVNW_QUIET_CURL"} -f -L -o "$TMP_DOWNLOAD_DIR/$distributionUrlName" "$distributionUrl" || die "curl: Failed to fetch $distributionUrl" +elif set_java_home; then + verbose "Falling back to use Java to download" + javaSource="$TMP_DOWNLOAD_DIR/Downloader.java" + targetZip="$TMP_DOWNLOAD_DIR/$distributionUrlName" + cat >"$javaSource" <<-END + public class Downloader extends java.net.Authenticator + { + protected java.net.PasswordAuthentication getPasswordAuthentication() + { + return new java.net.PasswordAuthentication( System.getenv( "MVNW_USERNAME" ), System.getenv( "MVNW_PASSWORD" ).toCharArray() ); + } + public static void main( String[] args ) throws Exception + { + setDefault( new Downloader() ); + java.nio.file.Files.copy( new java.net.URL( args[0] ).openStream(), java.nio.file.Paths.get( args[1] ).toAbsolutePath().normalize() ); + } + } + END + # For Cygwin/MinGW, switch paths to Windows format before running javac and java + verbose " - Compiling Downloader.java ..." + "$(native_path "$JAVACCMD")" "$(native_path "$javaSource")" || die "Failed to compile Downloader.java" + verbose " - Running Downloader.java ..." + "$(native_path "$JAVACMD")" -cp "$(native_path "$TMP_DOWNLOAD_DIR")" Downloader "$distributionUrl" "$(native_path "$targetZip")" +fi + +# If specified, validate the SHA-256 sum of the Maven distribution zip file +if [ -n "${distributionSha256Sum-}" ]; then + distributionSha256Result=false + if [ "$MVN_CMD" = mvnd.sh ]; then + echo "Checksum validation is not supported for maven-mvnd." >&2 + echo "Please disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2 + exit 1 + elif command -v sha256sum >/dev/null; then + if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | sha256sum -c >/dev/null 2>&1; then + distributionSha256Result=true + fi + elif command -v shasum >/dev/null; then + if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | shasum -a 256 -c >/dev/null 2>&1; then + distributionSha256Result=true + fi + else + echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available." >&2 + echo "Please install either command, or disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2 + exit 1 + fi + if [ $distributionSha256Result = false ]; then + echo "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised." >&2 + echo "If you updated your Maven version, you need to update the specified distributionSha256Sum property." >&2 + exit 1 + fi +fi + +# unzip and move +if command -v unzip >/dev/null; then + unzip ${__MVNW_QUIET_UNZIP:+"$__MVNW_QUIET_UNZIP"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -d "$TMP_DOWNLOAD_DIR" || die "failed to unzip" +else + tar xzf${__MVNW_QUIET_TAR:+"$__MVNW_QUIET_TAR"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -C "$TMP_DOWNLOAD_DIR" || die "failed to untar" +fi +printf %s\\n "$distributionUrl" >"$TMP_DOWNLOAD_DIR/$distributionUrlNameMain/mvnw.url" +mv -- "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" "$MAVEN_HOME" || [ -d "$MAVEN_HOME" ] || die "fail to move MAVEN_HOME" + +clean || : +exec_maven "$@" diff --git a/mvnw.cmd b/mvnw.cmd new file mode 100644 index 00000000..136e686a --- /dev/null +++ b/mvnw.cmd @@ -0,0 +1,146 @@ +<# : batch portion +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Apache Maven Wrapper startup batch script, version 3.3.0 +@REM +@REM Optional ENV vars +@REM MVNW_REPOURL - repo url base for downloading maven distribution +@REM MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven +@REM MVNW_VERBOSE - true: enable verbose log; others: silence the output +@REM ---------------------------------------------------------------------------- + +@IF "%__MVNW_ARG0_NAME__%"=="" (SET __MVNW_ARG0_NAME__=%~nx0) +@SET __MVNW_CMD__= +@SET __MVNW_ERROR__= +@SET __MVNW_PSMODULEP_SAVE=%PSModulePath% +@SET PSModulePath= +@FOR /F "usebackq tokens=1* delims==" %%A IN (`powershell -noprofile "& {$scriptDir='%~dp0'; $script='%__MVNW_ARG0_NAME__%'; icm -ScriptBlock ([Scriptblock]::Create((Get-Content -Raw '%~f0'))) -NoNewScope}"`) DO @( + IF "%%A"=="MVN_CMD" (set __MVNW_CMD__=%%B) ELSE IF "%%B"=="" (echo %%A) ELSE (echo %%A=%%B) +) +@SET PSModulePath=%__MVNW_PSMODULEP_SAVE% +@SET __MVNW_PSMODULEP_SAVE= +@SET __MVNW_ARG0_NAME__= +@SET MVNW_USERNAME= +@SET MVNW_PASSWORD= +@IF NOT "%__MVNW_CMD__%"=="" (%__MVNW_CMD__% %*) +@echo Cannot start maven from wrapper >&2 && exit /b 1 +@GOTO :EOF +: end batch / begin powershell #> + +$ErrorActionPreference = "Stop" +if ($env:MVNW_VERBOSE -eq "true") { + $VerbosePreference = "Continue" +} + +# calculate distributionUrl, requires .mvn/wrapper/maven-wrapper.properties +$distributionUrl = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionUrl +if (!$distributionUrl) { + Write-Error "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties" +} + +switch -wildcard -casesensitive ( $($distributionUrl -replace '^.*/','') ) { + "maven-mvnd-*" { + $USE_MVND = $true + $distributionUrl = $distributionUrl -replace '-bin\.[^.]*$',"-windows-amd64.zip" + $MVN_CMD = "mvnd.cmd" + break + } + default { + $USE_MVND = $false + $MVN_CMD = $script -replace '^mvnw','mvn' + break + } +} + +# apply MVNW_REPOURL and calculate MAVEN_HOME +# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-,maven-mvnd--}/ +if ($env:MVNW_REPOURL) { + $MVNW_REPO_PATTERN = if ($USE_MVND) { "/org/apache/maven/" } else { "/maven/mvnd/" } + $distributionUrl = "$env:MVNW_REPOURL$MVNW_REPO_PATTERN$($distributionUrl -replace '^.*'+$MVNW_REPO_PATTERN,'')" +} +$distributionUrlName = $distributionUrl -replace '^.*/','' +$distributionUrlNameMain = $distributionUrlName -replace '\.[^.]*$','' -replace '-bin$','' +$MAVEN_HOME_PARENT = "$HOME/.m2/wrapper/dists/$distributionUrlNameMain" +$MAVEN_HOME_NAME = ([System.Security.Cryptography.MD5]::Create().ComputeHash([byte[]][char[]]$distributionUrl) | ForEach-Object {$_.ToString("x2")}) -join '' +$MAVEN_HOME = "$MAVEN_HOME_PARENT/$MAVEN_HOME_NAME" + +if (Test-Path -Path "$MAVEN_HOME" -PathType Container) { + Write-Verbose "found existing MAVEN_HOME at $MAVEN_HOME" + Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD" + exit $? +} + +if (! $distributionUrlNameMain -or ($distributionUrlName -eq $distributionUrlNameMain)) { + Write-Error "distributionUrl is not valid, must end with *-bin.zip, but found $distributionUrl" +} + +# prepare tmp dir +$TMP_DOWNLOAD_DIR_HOLDER = New-TemporaryFile +$TMP_DOWNLOAD_DIR = New-Item -Itemtype Directory -Path "$TMP_DOWNLOAD_DIR_HOLDER.dir" +$TMP_DOWNLOAD_DIR_HOLDER.Delete() | Out-Null +trap { + if ($TMP_DOWNLOAD_DIR.Exists) { + try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null } + catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" } + } +} + +New-Item -Itemtype Directory -Path "$MAVEN_HOME_PARENT" -Force | Out-Null + +# Download and Install Apache Maven +Write-Verbose "Couldn't find MAVEN_HOME, downloading and installing it ..." +Write-Verbose "Downloading from: $distributionUrl" +Write-Verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName" + +$webclient = New-Object System.Net.WebClient +if ($env:MVNW_USERNAME -and $env:MVNW_PASSWORD) { + $webclient.Credentials = New-Object System.Net.NetworkCredential($env:MVNW_USERNAME, $env:MVNW_PASSWORD) +} +[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 +$webclient.DownloadFile($distributionUrl, "$TMP_DOWNLOAD_DIR/$distributionUrlName") | Out-Null + +# If specified, validate the SHA-256 sum of the Maven distribution zip file +$distributionSha256Sum = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionSha256Sum +if ($distributionSha256Sum) { + if ($USE_MVND) { + Write-Error "Checksum validation is not supported for maven-mvnd. `nPlease disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." + } + Import-Module $PSHOME\Modules\Microsoft.PowerShell.Utility -Function Get-FileHash + if ((Get-FileHash "$TMP_DOWNLOAD_DIR/$distributionUrlName" -Algorithm SHA256).Hash.ToLower() -ne $distributionSha256Sum) { + Write-Error "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised. If you updated your Maven version, you need to update the specified distributionSha256Sum property." + } +} + +# unzip and move +Expand-Archive "$TMP_DOWNLOAD_DIR/$distributionUrlName" -DestinationPath "$TMP_DOWNLOAD_DIR" | Out-Null +Rename-Item -Path "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" -NewName $MAVEN_HOME_NAME | Out-Null +try { + Move-Item -Path "$TMP_DOWNLOAD_DIR/$MAVEN_HOME_NAME" -Destination $MAVEN_HOME_PARENT | Out-Null +} catch { + if (! (Test-Path -Path "$MAVEN_HOME" -PathType Container)) { + Write-Error "fail to move MAVEN_HOME" + } +} finally { + try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null } + catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" } +} + +Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD" diff --git a/pom.xml b/pom.xml index 8d2e0206..18253e0f 100644 --- a/pom.xml +++ b/pom.xml @@ -14,6 +14,11 @@ https://xdev.software + + 17 + ${javaVersion} + + spring-data-eclipse-store spring-data-eclipse-store-demo diff --git a/renovate.json5 b/renovate.json5 new file mode 100644 index 00000000..11a77b2a --- /dev/null +++ b/renovate.json5 @@ -0,0 +1,4 @@ +{ + "$schema": "https://docs.renovatebot.com/renovate-schema.json", + "rebaseWhen": "behind-base-branch" +} diff --git a/spring-data-eclipse-store-benchmark/pom.xml b/spring-data-eclipse-store-benchmark/pom.xml index e2f3612f..17814b6d 100644 --- a/spring-data-eclipse-store-benchmark/pom.xml +++ b/spring-data-eclipse-store-benchmark/pom.xml @@ -69,7 +69,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.12.1 + 3.13.0 ${maven.compiler.release} @@ -96,7 +96,7 @@ com.puppycrawl.tools checkstyle - 10.14.0 + 10.16.0 diff --git a/spring-data-eclipse-store-demo/pom.xml b/spring-data-eclipse-store-demo/pom.xml index 29d21bef..606b12a8 100644 --- a/spring-data-eclipse-store-demo/pom.xml +++ b/spring-data-eclipse-store-demo/pom.xml @@ -9,8 +9,6 @@ 1.0.4-SNAPSHOT jar - 2023 - XDEV Software https://xdev.software @@ -68,7 +66,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.12.1 + 3.13.0 ${maven.compiler.release} @@ -103,7 +101,7 @@ com.puppycrawl.tools checkstyle - 10.14.0 + 10.16.0 diff --git a/spring-data-eclipse-store-demo/src/main/java/software/xdev/spring/data/eclipse/store/demo/complex/ComplexDemoApplication.java b/spring-data-eclipse-store-demo/src/main/java/software/xdev/spring/data/eclipse/store/demo/complex/ComplexDemoApplication.java index c7e2c7dd..33758888 100644 --- a/spring-data-eclipse-store-demo/src/main/java/software/xdev/spring/data/eclipse/store/demo/complex/ComplexDemoApplication.java +++ b/spring-data-eclipse-store-demo/src/main/java/software/xdev/spring/data/eclipse/store/demo/complex/ComplexDemoApplication.java @@ -103,6 +103,17 @@ public void run(final String... args) ); } ); + + LOG.info("----Owner-Lazy Pet loading----"); + this.ownerRepository.findAll().forEach( + o -> o.getPets().forEach( + pet -> LOG.info(String.format( + "Pet %s has owner %s %s", + pet.getName(), + o.getFirstName(), + o.getLastName())) + ) + ); } private static Visit createVisit() diff --git a/spring-data-eclipse-store-demo/src/main/java/software/xdev/spring/data/eclipse/store/demo/complex/owner/Owner.java b/spring-data-eclipse-store-demo/src/main/java/software/xdev/spring/data/eclipse/store/demo/complex/owner/Owner.java index 1cf16094..e9c0467c 100644 --- a/spring-data-eclipse-store-demo/src/main/java/software/xdev/spring/data/eclipse/store/demo/complex/owner/Owner.java +++ b/spring-data-eclipse-store-demo/src/main/java/software/xdev/spring/data/eclipse/store/demo/complex/owner/Owner.java @@ -19,10 +19,12 @@ import java.util.List; import java.util.Optional; +import org.eclipse.serializer.reference.Lazy; import org.springframework.core.style.ToStringCreator; import org.springframework.util.Assert; import software.xdev.spring.data.eclipse.store.demo.complex.model.Person; +import software.xdev.spring.data.eclipse.store.repository.lazy.SpringDataEclipseStoreLazy; public class Owner extends Person @@ -33,7 +35,7 @@ public class Owner extends Person private String telephone; - private final List pets = new ArrayList<>(); + private Lazy> pets = SpringDataEclipseStoreLazy.build(new ArrayList<>()); public String getAddress() { @@ -52,7 +54,12 @@ public String getTelephone() public List getPets() { - return this.pets; + return this.pets.get(); + } + + public void setPets(final List pets) + { + this.pets = SpringDataEclipseStoreLazy.build(pets); } public void addPet(final Pet pet) diff --git a/spring-data-eclipse-store-demo/src/main/java/software/xdev/spring/data/eclipse/store/demo/complex/owner/OwnerRepository.java b/spring-data-eclipse-store-demo/src/main/java/software/xdev/spring/data/eclipse/store/demo/complex/owner/OwnerRepository.java index 03b735b1..1c2b3e93 100644 --- a/spring-data-eclipse-store-demo/src/main/java/software/xdev/spring/data/eclipse/store/demo/complex/owner/OwnerRepository.java +++ b/spring-data-eclipse-store-demo/src/main/java/software/xdev/spring/data/eclipse/store/demo/complex/owner/OwnerRepository.java @@ -15,6 +15,8 @@ */ package software.xdev.spring.data.eclipse.store.demo.complex.owner; +import java.util.List; + import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.data.repository.Repository; @@ -28,5 +30,7 @@ public interface OwnerRepository extends Repository Page findAll(Pageable pageable); + List findAll(); + void deleteAll(); } diff --git a/spring-data-eclipse-store-demo/src/main/java/software/xdev/spring/data/eclipse/store/demo/dual/storage/DualStorageDemoApplication.java b/spring-data-eclipse-store-demo/src/main/java/software/xdev/spring/data/eclipse/store/demo/dual/storage/DualStorageDemoApplication.java new file mode 100644 index 00000000..92c1faec --- /dev/null +++ b/spring-data-eclipse-store-demo/src/main/java/software/xdev/spring/data/eclipse/store/demo/dual/storage/DualStorageDemoApplication.java @@ -0,0 +1,58 @@ +package software.xdev.spring.data.eclipse.store.demo.dual.storage; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.boot.CommandLineRunner; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.ConfigurableApplicationContext; + +import software.xdev.spring.data.eclipse.store.demo.dual.storage.invoice.Invoice; +import software.xdev.spring.data.eclipse.store.demo.dual.storage.invoice.InvoiceRepository; +import software.xdev.spring.data.eclipse.store.demo.dual.storage.person.Person; +import software.xdev.spring.data.eclipse.store.demo.dual.storage.person.PersonRepository; + + +@SpringBootApplication +public class DualStorageDemoApplication implements CommandLineRunner +{ + private static final Logger LOG = LoggerFactory.getLogger(DualStorageDemoApplication.class); + private final InvoiceRepository invoiceRepository; + private final PersonRepository personRepository; + + public DualStorageDemoApplication( + final InvoiceRepository invoiceRepository, + final PersonRepository personRepository) + { + this.invoiceRepository = invoiceRepository; + this.personRepository = personRepository; + } + + public static void main(final String[] args) + { + final ConfigurableApplicationContext run = SpringApplication.run(DualStorageDemoApplication.class, args); + run.close(); + } + + @Override + public void run(final String... args) + { + LOG.info("----Invoices-BeforeDeleteAll----"); + this.invoiceRepository.findAll().forEach(i -> LOG.info(i.toString())); + this.invoiceRepository.deleteAll(); + + LOG.info("----Invoices-AfterDeleteAll----"); + this.invoiceRepository.findAll().forEach(i -> LOG.info(i.toString())); + + this.invoiceRepository.save(new Invoice("N1", 100.0)); + + LOG.info("----Persons-BeforeDeleteAll----"); + this.personRepository.findAll().forEach(i -> LOG.info(i.toString())); + this.personRepository.deleteAll(); + + LOG.info("----Persons-AfterDeleteAll----"); + this.personRepository.findAll().forEach(i -> LOG.info(i.toString())); + + this.personRepository.save(new Person("Stevie", "Nicks")); + } +} diff --git a/spring-data-eclipse-store-demo/src/main/java/software/xdev/spring/data/eclipse/store/demo/dual/storage/invoice/Invoice.java b/spring-data-eclipse-store-demo/src/main/java/software/xdev/spring/data/eclipse/store/demo/dual/storage/invoice/Invoice.java new file mode 100644 index 00000000..1bf25541 --- /dev/null +++ b/spring-data-eclipse-store-demo/src/main/java/software/xdev/spring/data/eclipse/store/demo/dual/storage/invoice/Invoice.java @@ -0,0 +1,5 @@ +package software.xdev.spring.data.eclipse.store.demo.dual.storage.invoice; + +public record Invoice(String id, double sum) +{ +} diff --git a/spring-data-eclipse-store-demo/src/main/java/software/xdev/spring/data/eclipse/store/demo/dual/storage/invoice/InvoiceRepository.java b/spring-data-eclipse-store-demo/src/main/java/software/xdev/spring/data/eclipse/store/demo/dual/storage/invoice/InvoiceRepository.java new file mode 100644 index 00000000..639b3304 --- /dev/null +++ b/spring-data-eclipse-store-demo/src/main/java/software/xdev/spring/data/eclipse/store/demo/dual/storage/invoice/InvoiceRepository.java @@ -0,0 +1,8 @@ +package software.xdev.spring.data.eclipse.store.demo.dual.storage.invoice; + +import org.springframework.data.repository.CrudRepository; + + +public interface InvoiceRepository extends CrudRepository +{ +} diff --git a/spring-data-eclipse-store-demo/src/main/java/software/xdev/spring/data/eclipse/store/demo/dual/storage/invoice/PersistenceInvoiceConfiguration.java b/spring-data-eclipse-store-demo/src/main/java/software/xdev/spring/data/eclipse/store/demo/dual/storage/invoice/PersistenceInvoiceConfiguration.java new file mode 100644 index 00000000..81a1c2f2 --- /dev/null +++ b/spring-data-eclipse-store-demo/src/main/java/software/xdev/spring/data/eclipse/store/demo/dual/storage/invoice/PersistenceInvoiceConfiguration.java @@ -0,0 +1,26 @@ +package software.xdev.spring.data.eclipse.store.demo.dual.storage.invoice; + +import java.nio.file.Path; + +import org.eclipse.store.storage.embedded.types.EmbeddedStorage; +import org.eclipse.store.storage.embedded.types.EmbeddedStorageFoundation; +import org.eclipse.store.storage.types.Storage; +import org.springframework.context.annotation.Configuration; + +import software.xdev.spring.data.eclipse.store.repository.config.EclipseStoreClientConfiguration; +import software.xdev.spring.data.eclipse.store.repository.config.EnableEclipseStoreRepositories; + + +@Configuration +@EnableEclipseStoreRepositories( + value = "software.xdev.spring.data.eclipse.store.demo.dual.storage.invoice", + clientConfiguration = "persistenceInvoiceConfiguration" +) +public class PersistenceInvoiceConfiguration extends EclipseStoreClientConfiguration +{ + @Override + public EmbeddedStorageFoundation createEmbeddedStorageFoundation() + { + return EmbeddedStorage.Foundation(Storage.Configuration(Storage.FileProvider(Path.of("storage-invoice")))); + } +} diff --git a/spring-data-eclipse-store-demo/src/main/java/software/xdev/spring/data/eclipse/store/demo/dual/storage/person/PersistencePersonConfiguration.java b/spring-data-eclipse-store-demo/src/main/java/software/xdev/spring/data/eclipse/store/demo/dual/storage/person/PersistencePersonConfiguration.java new file mode 100644 index 00000000..5beffdf0 --- /dev/null +++ b/spring-data-eclipse-store-demo/src/main/java/software/xdev/spring/data/eclipse/store/demo/dual/storage/person/PersistencePersonConfiguration.java @@ -0,0 +1,27 @@ +package software.xdev.spring.data.eclipse.store.demo.dual.storage.person; + +import static org.eclipse.store.storage.embedded.types.EmbeddedStorage.Foundation; + +import java.nio.file.Path; + +import org.eclipse.store.storage.embedded.types.EmbeddedStorageFoundation; +import org.eclipse.store.storage.types.Storage; +import org.springframework.context.annotation.Configuration; + +import software.xdev.spring.data.eclipse.store.repository.config.EclipseStoreClientConfiguration; +import software.xdev.spring.data.eclipse.store.repository.config.EnableEclipseStoreRepositories; + + +@Configuration +@EnableEclipseStoreRepositories( + value = "software.xdev.spring.data.eclipse.store.demo.dual.storage.person", + clientConfigurationClass = PersistencePersonConfiguration.class +) +public class PersistencePersonConfiguration extends EclipseStoreClientConfiguration +{ + @Override + public EmbeddedStorageFoundation createEmbeddedStorageFoundation() + { + return Foundation(Storage.Configuration(Storage.FileProvider(Path.of("storage-person")))); + } +} diff --git a/spring-data-eclipse-store-demo/src/main/java/software/xdev/spring/data/eclipse/store/demo/dual/storage/person/Person.java b/spring-data-eclipse-store-demo/src/main/java/software/xdev/spring/data/eclipse/store/demo/dual/storage/person/Person.java new file mode 100644 index 00000000..d53cfdb3 --- /dev/null +++ b/spring-data-eclipse-store-demo/src/main/java/software/xdev/spring/data/eclipse/store/demo/dual/storage/person/Person.java @@ -0,0 +1,5 @@ +package software.xdev.spring.data.eclipse.store.demo.dual.storage.person; + +public record Person(String firstName, String lastName) +{ +} diff --git a/spring-data-eclipse-store-demo/src/main/java/software/xdev/spring/data/eclipse/store/demo/dual/storage/person/PersonRepository.java b/spring-data-eclipse-store-demo/src/main/java/software/xdev/spring/data/eclipse/store/demo/dual/storage/person/PersonRepository.java new file mode 100644 index 00000000..2ad7bdcc --- /dev/null +++ b/spring-data-eclipse-store-demo/src/main/java/software/xdev/spring/data/eclipse/store/demo/dual/storage/person/PersonRepository.java @@ -0,0 +1,8 @@ +package software.xdev.spring.data.eclipse.store.demo.dual.storage.person; + +import org.springframework.data.repository.CrudRepository; + + +public interface PersonRepository extends CrudRepository +{ +} diff --git a/spring-data-eclipse-store-jpa/pom.xml b/spring-data-eclipse-store-jpa/pom.xml index 8af9104d..3d90278d 100644 --- a/spring-data-eclipse-store-jpa/pom.xml +++ b/spring-data-eclipse-store-jpa/pom.xml @@ -88,7 +88,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.12.1 + 3.13.0 ${maven.compiler.release} @@ -123,7 +123,7 @@ com.puppycrawl.tools checkstyle - 10.14.0 + 10.16.0 diff --git a/spring-data-eclipse-store-jpa/src/test/java/software/xdev/spring/data/eclipse/store/jpa/integration/IntegrationTest.java b/spring-data-eclipse-store-jpa/src/test/java/software/xdev/spring/data/eclipse/store/jpa/integration/IntegrationTest.java index 3a8f91d0..3eef8849 100644 --- a/spring-data-eclipse-store-jpa/src/test/java/software/xdev/spring/data/eclipse/store/jpa/integration/IntegrationTest.java +++ b/spring-data-eclipse-store-jpa/src/test/java/software/xdev/spring/data/eclipse/store/jpa/integration/IntegrationTest.java @@ -27,7 +27,7 @@ import software.xdev.spring.data.eclipse.store.jpa.integration.repository.PersonToTestInEclipseStoreRepository; import software.xdev.spring.data.eclipse.store.jpa.integration.repository.PersonToTestInJpa; import software.xdev.spring.data.eclipse.store.jpa.integration.repository.PersonToTestInJpaRepository; -import software.xdev.spring.data.eclipse.store.repository.EclipseStoreStorage; +import software.xdev.spring.data.eclipse.store.repository.config.EclipseStoreClientConfiguration; import software.xdev.spring.data.eclipse.store.repository.support.SimpleEclipseStoreRepository; @@ -44,7 +44,7 @@ class IntegrationTest private EclipseStoreDataImporterComponent eclipseStoreDataImporter; @Autowired - private EclipseStoreStorage eclipseStoreStorage; + private EclipseStoreClientConfiguration configuration; /** * Super simple test if there are any start-up errors when running parallel to a JPA configuration @@ -72,10 +72,10 @@ void testEclipseStoreImport() final List allEntities = simpleEclipseStoreRepositories.get(0).findAll(); Assertions.assertEquals(1, allEntities.size()); - this.eclipseStoreStorage.stop(); + this.configuration.getStorageInstance().stop(); Assertions.assertEquals( 1, - this.eclipseStoreStorage.getEntityCount(PersonToTestInJpa.class), + this.configuration.getStorageInstance().getEntityCount(PersonToTestInJpa.class), "After restart the imported entities are not there anymore."); } diff --git a/spring-data-eclipse-store-jpa/src/test/java/software/xdev/spring/data/eclipse/store/jpa/integration/TestConfiguration.java b/spring-data-eclipse-store-jpa/src/test/java/software/xdev/spring/data/eclipse/store/jpa/integration/TestConfiguration.java index bb73884f..157a276c 100644 --- a/spring-data-eclipse-store-jpa/src/test/java/software/xdev/spring/data/eclipse/store/jpa/integration/TestConfiguration.java +++ b/spring-data-eclipse-store-jpa/src/test/java/software/xdev/spring/data/eclipse/store/jpa/integration/TestConfiguration.java @@ -28,7 +28,7 @@ import org.springframework.context.event.EventListener; import org.springframework.util.FileSystemUtils; -import software.xdev.spring.data.eclipse.store.repository.EclipseStoreStorage; +import software.xdev.spring.data.eclipse.store.repository.config.EclipseStoreClientConfiguration; import software.xdev.spring.data.eclipse.store.repository.config.EnableEclipseStoreRepositories; @@ -40,7 +40,7 @@ public class TestConfiguration implements DisposableBean { @Autowired - EclipseStoreStorage storage; + EclipseStoreClientConfiguration configuration; @Value("${org.eclipse.store.storage-directory}") private String storageDirectory; @@ -49,15 +49,15 @@ public class TestConfiguration implements DisposableBean public void handleContextRefresh(final ContextRefreshedEvent event) { // Init with empty root object - this.storage.clearData(); + this.configuration.getStorageInstance().clearData(); } @Override public void destroy() throws Exception { // End with empty root object - this.storage.clearData(); - this.storage.stop(); + this.configuration.getStorageInstance().clearData(); + this.configuration.getStorageInstance().stop(); FileSystemUtils.deleteRecursively(Path.of(this.storageDirectory)); } } diff --git a/spring-data-eclipse-store-jpa/src/test/java/software/xdev/spring/data/eclipse/store/jpa/integration/repository/PersonToTestInEclipseStoreRepository.java b/spring-data-eclipse-store-jpa/src/test/java/software/xdev/spring/data/eclipse/store/jpa/integration/repository/PersonToTestInEclipseStoreRepository.java index 1f2b5418..a5be72f5 100644 --- a/spring-data-eclipse-store-jpa/src/test/java/software/xdev/spring/data/eclipse/store/jpa/integration/repository/PersonToTestInEclipseStoreRepository.java +++ b/spring-data-eclipse-store-jpa/src/test/java/software/xdev/spring/data/eclipse/store/jpa/integration/repository/PersonToTestInEclipseStoreRepository.java @@ -3,6 +3,7 @@ import software.xdev.spring.data.eclipse.store.repository.interfaces.EclipseStoreListCrudRepository; -public interface PersonToTestInEclipseStoreRepository extends EclipseStoreListCrudRepository +public interface PersonToTestInEclipseStoreRepository + extends EclipseStoreListCrudRepository { } diff --git a/spring-data-eclipse-store/pom.xml b/spring-data-eclipse-store/pom.xml index 6e5cf6e6..1b476725 100644 --- a/spring-data-eclipse-store/pom.xml +++ b/spring-data-eclipse-store/pom.xml @@ -15,7 +15,7 @@ https://github.com/xdev-software/spring-data-eclipse-store - https://github.com/xdev-software/spring-data-eclipse-store.git + scm:git:https://github.com/xdev-software/spring-data-eclipse-store.git 2023 @@ -192,6 +192,20 @@ + + + + org.apache.maven.plugins + maven-site-plugin + 4.0.0-M13 + + + org.apache.maven.plugins + maven-project-info-reports-plugin + 3.5.0 + + + com.mycila @@ -200,6 +214,7 @@ ${project.organization.url} + 2024 @@ -225,7 +240,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.12.1 + 3.13.0 ${maven.compiler.release} @@ -270,7 +285,7 @@ org.apache.maven.plugins maven-source-plugin - 3.3.0 + 3.3.1 attach-sources @@ -291,7 +306,7 @@ org.apache.maven.plugins maven-gpg-plugin - 3.1.0 + 3.2.4 sign-artifacts @@ -339,7 +354,7 @@ com.puppycrawl.tools checkstyle - 10.14.0 + 10.16.0 diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/aot/EclipseStoreRuntimeHints.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/aot/EclipseStoreRuntimeHints.java index 20352c97..8055cdae 100644 --- a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/aot/EclipseStoreRuntimeHints.java +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/aot/EclipseStoreRuntimeHints.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/core/IdentitySet.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/core/IdentitySet.java index d5af7575..2545c21c 100644 --- a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/core/IdentitySet.java +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/core/IdentitySet.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/exceptions/AlreadyRegisteredException.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/exceptions/AlreadyRegisteredException.java index a0ba3bf7..83b59d8c 100644 --- a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/exceptions/AlreadyRegisteredException.java +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/exceptions/AlreadyRegisteredException.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/exceptions/DataTypeNotSupportedException.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/exceptions/DataTypeNotSupportedException.java index c6184649..8f0b3579 100644 --- a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/exceptions/DataTypeNotSupportedException.java +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/exceptions/DataTypeNotSupportedException.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/exceptions/DifferentClassesException.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/exceptions/DifferentClassesException.java index 9eee8d81..ebe9a16b 100644 --- a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/exceptions/DifferentClassesException.java +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/exceptions/DifferentClassesException.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/exceptions/FieldAccessReflectionException.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/exceptions/FieldAccessReflectionException.java index a5c854c7..d64206ef 100644 --- a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/exceptions/FieldAccessReflectionException.java +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/exceptions/FieldAccessReflectionException.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/exceptions/IdFieldFinalException.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/exceptions/IdFieldFinalException.java index 2abfa3e2..144e2c55 100644 --- a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/exceptions/IdFieldFinalException.java +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/exceptions/IdFieldFinalException.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/exceptions/IdGeneratorNotSupportedException.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/exceptions/IdGeneratorNotSupportedException.java index 808049b7..98f221fc 100644 --- a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/exceptions/IdGeneratorNotSupportedException.java +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/exceptions/IdGeneratorNotSupportedException.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/exceptions/LazyNotUnlinkableException.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/exceptions/LazyNotUnlinkableException.java new file mode 100644 index 00000000..4bb9978f --- /dev/null +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/exceptions/LazyNotUnlinkableException.java @@ -0,0 +1,31 @@ +/* + * Copyright © 2024 XDEV Software (https://xdev.software) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package software.xdev.spring.data.eclipse.store.exceptions; + +/** + * Is used when a {@link software.xdev.spring.data.eclipse.store.repository.lazy.SpringDataEclipseStoreLazy} is not able + * to get unlinked from the object tree. + *

+ * This exception should not be created by the user, but only within the Spring-Data-Eclipse-Store-Library. + *

+ */ +public class LazyNotUnlinkableException extends RuntimeException +{ + public LazyNotUnlinkableException(final String message, final Throwable e) + { + super(message, e); + } +} diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/exceptions/MergeFailedException.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/exceptions/MergeFailedException.java index 0ce35b02..0a602b3c 100644 --- a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/exceptions/MergeFailedException.java +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/exceptions/MergeFailedException.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/exceptions/NoIdFieldFoundException.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/exceptions/NoIdFieldFoundException.java index cd9c6f7f..2f612539 100644 --- a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/exceptions/NoIdFieldFoundException.java +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/exceptions/NoIdFieldFoundException.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/exceptions/NoPageableObjectFoundException.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/exceptions/NoPageableObjectFoundException.java index c49733a4..3c71f94d 100644 --- a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/exceptions/NoPageableObjectFoundException.java +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/exceptions/NoPageableObjectFoundException.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/exceptions/NotComparableException.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/exceptions/NotComparableException.java index 115e2b8f..b5fe9aa1 100644 --- a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/exceptions/NotComparableException.java +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/exceptions/NotComparableException.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/exceptions/StringBlankException.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/exceptions/StringBlankException.java index 78d203f2..0546e418 100644 --- a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/exceptions/StringBlankException.java +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/exceptions/StringBlankException.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/importer/EclipseStoreDataImporter.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/importer/EclipseStoreDataImporter.java index d5256f34..c6109fa7 100644 --- a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/importer/EclipseStoreDataImporter.java +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/importer/EclipseStoreDataImporter.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,6 +31,7 @@ import software.xdev.spring.data.eclipse.store.repository.EclipseStoreStorage; import software.xdev.spring.data.eclipse.store.repository.SupportedChecker; +import software.xdev.spring.data.eclipse.store.repository.config.EclipseStoreClientConfiguration; import software.xdev.spring.data.eclipse.store.repository.support.SimpleEclipseStoreRepository; import software.xdev.spring.data.eclipse.store.repository.support.copier.working.RecursiveWorkingCopier; @@ -41,11 +42,11 @@ public class EclipseStoreDataImporter { private static final Logger LOG = LoggerFactory.getLogger(EclipseStoreDataImporter.class); - private final EclipseStoreStorage eclipseStoreStorage; + private final EclipseStoreClientConfiguration configuration; - public EclipseStoreDataImporter(final EclipseStoreStorage eclipseStoreStorage) + public EclipseStoreDataImporter(final EclipseStoreClientConfiguration configuration) { - this.eclipseStoreStorage = eclipseStoreStorage; + this.configuration = configuration; } /** @@ -196,15 +197,19 @@ private void createRepositoryForType( private SimpleEclipseStoreRepository createEclipseStoreRepo(final Class domainClass) { + final EclipseStoreStorage storageInstance = this.configuration.getStorageInstance(); return new SimpleEclipseStoreRepository<>( - this.eclipseStoreStorage, + storageInstance, new RecursiveWorkingCopier<>( domainClass, - this.eclipseStoreStorage.getRegistry(), - this.eclipseStoreStorage, - this.eclipseStoreStorage, - new SupportedChecker.Implementation()), - domainClass); + storageInstance.getRegistry(), + storageInstance, + storageInstance, + new SupportedChecker.Implementation(), + storageInstance + ), + domainClass + ); } private record EntityManagerFactoryRepositoryListPair( diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/importer/EclipseStoreDataImporterComponent.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/importer/EclipseStoreDataImporterComponent.java index adf1b878..ddeb3add 100644 --- a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/importer/EclipseStoreDataImporterComponent.java +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/importer/EclipseStoreDataImporterComponent.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,7 +23,7 @@ import org.springframework.context.ApplicationContext; import org.springframework.stereotype.Component; -import software.xdev.spring.data.eclipse.store.repository.EclipseStoreStorage; +import software.xdev.spring.data.eclipse.store.repository.config.EclipseStoreClientConfiguration; import software.xdev.spring.data.eclipse.store.repository.support.SimpleEclipseStoreRepository; @@ -37,10 +37,10 @@ public class EclipseStoreDataImporterComponent private final ApplicationContext applicationContext; public EclipseStoreDataImporterComponent( - final EclipseStoreStorage eclipseStoreStorage, + final EclipseStoreClientConfiguration configuration, final ApplicationContext applicationContext) { - this.importer = new EclipseStoreDataImporter(eclipseStoreStorage); + this.importer = new EclipseStoreDataImporter(configuration); this.applicationContext = applicationContext; } @@ -56,6 +56,7 @@ public EclipseStoreDataImporterComponent( * * @return all the newly created {@link SimpleEclipseStoreRepository} for the specific entities. */ + @SuppressWarnings("java:S1452") public List> importData() { final Map beansOfEms = diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/EclipseStoreStorage.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/EclipseStoreStorage.java index da2c3312..65d3ac00 100644 --- a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/EclipseStoreStorage.java +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/EclipseStoreStorage.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,32 +26,29 @@ import org.eclipse.serializer.persistence.binary.jdk17.java.util.BinaryHandlerImmutableCollectionsList12; import org.eclipse.serializer.persistence.binary.jdk17.java.util.BinaryHandlerImmutableCollectionsSet12; import org.eclipse.serializer.persistence.types.Storer; -import org.eclipse.store.integrations.spring.boot.types.EclipseStoreProvider; -import org.eclipse.store.integrations.spring.boot.types.configuration.EclipseStoreProperties; +import org.eclipse.serializer.reference.ObjectSwizzling; import org.eclipse.store.storage.embedded.types.EmbeddedStorageFoundation; import org.eclipse.store.storage.types.StorageManager; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Component; import software.xdev.spring.data.eclipse.store.core.IdentitySet; import software.xdev.spring.data.eclipse.store.exceptions.AlreadyRegisteredException; +import software.xdev.spring.data.eclipse.store.repository.config.EclipseStoreClientConfiguration; +import software.xdev.spring.data.eclipse.store.repository.config.EclipseStoreStorageFoundationProvider; import software.xdev.spring.data.eclipse.store.repository.support.copier.id.IdSetter; import software.xdev.spring.data.eclipse.store.repository.support.reposyncer.RepositorySynchronizer; import software.xdev.spring.data.eclipse.store.repository.support.reposyncer.SimpleRepositorySynchronizer; - -@Component public class EclipseStoreStorage - implements EntityListProvider, IdSetterProvider, PersistableChecker + implements EntityListProvider, IdSetterProvider, PersistableChecker, ObjectSwizzling { private static final Logger LOG = LoggerFactory.getLogger(EclipseStoreStorage.class); private final Map, String> entityClassToRepositoryName = new HashMap<>(); private final Map, IdSetter> entityClassToIdSetter = new HashMap<>(); private EntitySetCollector entitySetCollector; private PersistableChecker persistenceChecker; - private final EclipseStoreProperties storeConfiguration; - private final EclipseStoreProvider storeProvider; + private final EclipseStoreStorageFoundationProvider foundationProvider; private StorageManager storageManager; private Root root; @@ -59,12 +56,9 @@ public class EclipseStoreStorage private final WorkingCopyRegistry registry = new WorkingCopyRegistry(); private RepositorySynchronizer repositorySynchronizer; - public EclipseStoreStorage( - final EclipseStoreProperties storeConfiguration, - final EclipseStoreProvider storeProvider) + public EclipseStoreStorage(final EclipseStoreClientConfiguration storeConfiguration) { - this.storeConfiguration = storeConfiguration; - this.storeProvider = storeProvider; + this.foundationProvider = storeConfiguration; } private synchronized StorageManager getInstanceOfStorageManager() @@ -85,7 +79,7 @@ private synchronized void ensureEntitiesInRoot() LOG.info("Starting storage..."); this.root = new Root(); final EmbeddedStorageFoundation embeddedStorageFoundation = - this.storeProvider.createStorageFoundation(this.storeConfiguration); + this.foundationProvider.createEmbeddedStorageFoundation(); embeddedStorageFoundation.registerTypeHandler(BinaryHandlerImmutableCollectionsSet12.New()); embeddedStorageFoundation.registerTypeHandler(BinaryHandlerImmutableCollectionsList12.New()); this.storageManager = embeddedStorageFoundation.start(this.root); @@ -268,6 +262,17 @@ public synchronized void clearData() } } + /** + * Starts the storage. + */ + public synchronized void start() + { + this.ensureEntitiesInRoot(); + } + + /** + * Stops the storage. + */ public synchronized void stop() { LOG.info("Stopping storage..."); @@ -318,4 +323,11 @@ public boolean isPersistable(final Class clazz) this.ensureEntitiesInRoot(); return this.persistenceChecker.isPersistable(clazz); } + + @Override + public Object getObject(final long objectId) + { + this.ensureEntitiesInRoot(); + return this.storageManager.getObject(objectId); + } } diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/EntityListProvider.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/EntityListProvider.java index 1be8b552..e69c5f7b 100644 --- a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/EntityListProvider.java +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/EntityListProvider.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/EntitySetCollector.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/EntitySetCollector.java index d25edbfc..6d5b6936 100644 --- a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/EntitySetCollector.java +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/EntitySetCollector.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/IdSetterProvider.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/IdSetterProvider.java index 1e2e7133..08b9536c 100644 --- a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/IdSetterProvider.java +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/IdSetterProvider.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/PersistableChecker.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/PersistableChecker.java index b342a204..7a70c405 100644 --- a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/PersistableChecker.java +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/PersistableChecker.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/Query.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/Query.java index f56ba3f1..9099f492 100644 --- a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/Query.java +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/Query.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/RelayedPersistenceChecker.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/RelayedPersistenceChecker.java index ab89f64a..0f82d03a 100644 --- a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/RelayedPersistenceChecker.java +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/RelayedPersistenceChecker.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/Root.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/Root.java index ad078410..7ccbbc7f 100644 --- a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/Root.java +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/Root.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/SupportedChecker.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/SupportedChecker.java index 9d9cfc7b..c09d5180 100644 --- a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/SupportedChecker.java +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/SupportedChecker.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,6 +20,9 @@ import java.util.List; import java.util.WeakHashMap; +import org.eclipse.serializer.collections.lazy.LazyArrayList; +import org.eclipse.serializer.collections.lazy.LazyHashMap; +import org.eclipse.serializer.collections.lazy.LazyHashSet; import org.eclipse.serializer.reference.Lazy; @@ -41,29 +44,26 @@ public interface SupportedChecker *

* Some classes are not supported, because Eclipse Store doesn't support them. *

- *

- * {@link Lazy} is not supported, because a lot of hidden stuff must be done to keep Lazy-References really Lazy - * when creating a working copy. - *

*/ boolean isSupported(Class clazz); class Implementation implements SupportedChecker { private static final List> UNSUPPORTED_DATA_TYPES = List.of( - // Is difficult to handle when creating working copies - Lazy.class, // Here EclipseStore has problems: https://github.com/microstream-one/microstream/issues/173 Calendar.class, WeakHashMap.class, // Here EclipseStore has problems too: https://github.com/microstream-one/microstream/issues/204 - EnumMap.class + EnumMap.class, + LazyHashMap.class, + LazyArrayList.class, + LazyHashSet.class ); @Override public boolean isSupported(final Class clazz) { - return !UNSUPPORTED_DATA_TYPES.stream().anyMatch( + return UNSUPPORTED_DATA_TYPES.stream().noneMatch( unsupportedClazz -> unsupportedClazz.isAssignableFrom(clazz) ); } diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/WorkingCopyRegistry.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/WorkingCopyRegistry.java index 6f2b0b56..59d1422a 100644 --- a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/WorkingCopyRegistry.java +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/WorkingCopyRegistry.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,6 +27,9 @@ public class WorkingCopyRegistry { private static final Logger LOG = LoggerFactory.getLogger(WorkingCopyRegistry.class); + /** + * Map with Working Copies (key) with the corresponding original object (value). + */ private Map currentWorkingCopies = new IdentityHashMap<>(); /** diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/access/AccessHelper.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/access/AccessHelper.java index 29039059..06649b8a 100644 --- a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/access/AccessHelper.java +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/access/AccessHelper.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -99,7 +99,7 @@ public static Field getInheritedPrivateField(final Class clazz, final String */ public static Object readFieldVariable(final Field field, final T sourceObject) { - try(final FieldAccessModifier fieldAccessModifier = FieldAccessModifier.makeFieldReadable( + try(final FieldAccessModifier fieldAccessModifier = FieldAccessModifier.prepareForField( Objects.requireNonNull(field), Objects.requireNonNull(sourceObject))) { diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/access/modifier/FieldAccessModifier.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/access/modifier/FieldAccessModifier.java index f6a9b382..cee4cae2 100644 --- a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/access/modifier/FieldAccessModifier.java +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/access/modifier/FieldAccessModifier.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,7 +24,7 @@ */ public interface FieldAccessModifier extends AutoCloseable { - static FieldAccessModifier makeFieldReadable(final Field field, final T sourceObject) + static FieldAccessModifier prepareForField(final Field field, final T sourceObject) { return new FieldAccessibleMaker<>(Objects.requireNonNull(field), Objects.requireNonNull(sourceObject)); } diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/access/modifier/FieldAccessibleMaker.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/access/modifier/FieldAccessibleMaker.java index 5c0633d8..4381aff5 100644 --- a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/access/modifier/FieldAccessibleMaker.java +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/access/modifier/FieldAccessibleMaker.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/config/DefaultEclipseStoreClientConfiguration.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/config/DefaultEclipseStoreClientConfiguration.java new file mode 100644 index 00000000..d9659623 --- /dev/null +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/config/DefaultEclipseStoreClientConfiguration.java @@ -0,0 +1,29 @@ +/* + * Copyright © 2024 XDEV Software (https://xdev.software) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package software.xdev.spring.data.eclipse.store.repository.config; + +import org.springframework.context.annotation.Configuration; + + +/** + * Provides the Default implementation of an {@link EclipseStoreClientConfiguration}. The class can't be final because + * of the {@link Configuration}-Annotation. It's mostly used to check if the user wants the default implementation or if + * he created a different {@link EclipseStoreClientConfiguration}. + */ +@Configuration(proxyBeanMethods = false) +public class DefaultEclipseStoreClientConfiguration extends EclipseStoreClientConfiguration +{ +} diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/config/EclipseStoreClientConfiguration.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/config/EclipseStoreClientConfiguration.java new file mode 100644 index 00000000..05f04c80 --- /dev/null +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/config/EclipseStoreClientConfiguration.java @@ -0,0 +1,85 @@ +/* + * Copyright © 2024 XDEV Software (https://xdev.software) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package software.xdev.spring.data.eclipse.store.repository.config; + +import org.eclipse.store.integrations.spring.boot.types.EclipseStoreProvider; +import org.eclipse.store.integrations.spring.boot.types.EclipseStoreProviderImpl; +import org.eclipse.store.integrations.spring.boot.types.configuration.EclipseStoreProperties; +import org.eclipse.store.storage.embedded.types.EmbeddedStorageFoundation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import software.xdev.spring.data.eclipse.store.repository.EclipseStoreStorage; + + +/** + * Defines the configuration of a single EclipseStore-Storage. + *

+ * Configuration is possible through default EclipseStore-Behavior.
See EclipseStore documentation + *

+ *

+ * It's also possible to inherit this configuration and override {@link #createEmbeddedStorageFoundation()} + *

+ *

+ * Also creates a singleton reference to a {@link EclipseStoreStorage}. This is to only create one EclipseStore-Storage + * for one configuration. + *

+ */ +@Configuration(proxyBeanMethods = false) +public abstract class EclipseStoreClientConfiguration implements EclipseStoreStorageFoundationProvider +{ + @Autowired + @Qualifier("eclipseStoreProperties") + private EclipseStoreProperties defaultEclipseStoreProperties; + + @Autowired + private EclipseStoreProviderImpl defaultEclipseStoreProvider; + + private EclipseStoreStorage storageInstance; + + public EclipseStoreProperties getStoreConfiguration() + { + return this.defaultEclipseStoreProperties; + } + + public EclipseStoreProvider getStoreProvider() + { + return this.defaultEclipseStoreProvider; + } + + /** + * Creates a {@link EmbeddedStorageFoundation} out of the two other provided functions {@link #getStoreProvider()} + * and {@link #getStoreConfiguration()}. + */ + @Override + public EmbeddedStorageFoundation createEmbeddedStorageFoundation() + { + return this.getStoreProvider().createStorageFoundation(this.getStoreConfiguration()); + } + + @Bean + public EclipseStoreStorage getStorageInstance() + { + if(this.storageInstance == null) + { + this.storageInstance = new EclipseStoreStorage(this); + } + return this.storageInstance; + } +} diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/config/EclipseStoreRepositoriesRegistrar.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/config/EclipseStoreRepositoriesRegistrar.java index 5caeb6b7..c6fc042f 100644 --- a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/config/EclipseStoreRepositoriesRegistrar.java +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/config/EclipseStoreRepositoriesRegistrar.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/config/EclipseStoreRepositoryConfigNamespaceHandler.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/config/EclipseStoreRepositoryConfigNamespaceHandler.java index 61f3f770..a8d49b08 100644 --- a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/config/EclipseStoreRepositoryConfigNamespaceHandler.java +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/config/EclipseStoreRepositoryConfigNamespaceHandler.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/config/EclipseStoreRepositoryConfigurationExtension.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/config/EclipseStoreRepositoryConfigurationExtension.java index ee36979c..28fcd20f 100644 --- a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/config/EclipseStoreRepositoryConfigurationExtension.java +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/config/EclipseStoreRepositoryConfigurationExtension.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,6 +15,9 @@ */ package software.xdev.spring.data.eclipse.store.repository.config; +import static software.xdev.spring.data.eclipse.store.repository.config.EnableEclipseStoreRepositories.CLIENT_CONFIGURATION_ANNOTATION_VALUE; +import static software.xdev.spring.data.eclipse.store.repository.config.EnableEclipseStoreRepositories.CLIENT_CONFIGURATION_CLASS_ANNOTATION_VALUE; + import java.lang.annotation.Annotation; import java.util.Collection; import java.util.Collections; @@ -22,8 +25,12 @@ import jakarta.annotation.Nonnull; +import org.springframework.beans.factory.support.BeanDefinitionBuilder; +import org.springframework.core.annotation.AnnotationAttributes; +import org.springframework.data.repository.config.AnnotationRepositoryConfigurationSource; import org.springframework.data.repository.config.RepositoryConfigurationExtension; import org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport; +import org.springframework.util.ClassUtils; import software.xdev.spring.data.eclipse.store.repository.interfaces.EclipseStoreCrudRepository; import software.xdev.spring.data.eclipse.store.repository.interfaces.EclipseStoreCustomRepository; @@ -63,6 +70,25 @@ public String getRepositoryFactoryBeanClassName() return EclipseStoreRepositoryFactoryBean.class.getName(); } + /** + * This method puts the {@link EclipseStoreRepositoryFactoryBean#configuration} in the created + * {@link EclipseStoreRepositoryFactoryBean}. This is important to link + * {@link EnableEclipseStoreRepositories#clientConfiguration()} with the actual + * {@link software.xdev.spring.data.eclipse.store.repository.EclipseStoreStorage}. + */ + @Override + public void postProcess(final BeanDefinitionBuilder builder, final AnnotationRepositoryConfigurationSource config) + { + final AnnotationAttributes attributes = config.getAttributes(); + final Class configurationClass = attributes.getClass(CLIENT_CONFIGURATION_CLASS_ANNOTATION_VALUE); + String configurationString = attributes.getString(CLIENT_CONFIGURATION_ANNOTATION_VALUE); + if(!configurationClass.equals(DefaultEclipseStoreClientConfiguration.class)) + { + configurationString = ClassUtils.getShortNameAsProperty(configurationClass); + } + builder.addPropertyReference("configuration", configurationString); + } + @Override @Nonnull public String getModuleIdentifier() diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/config/EclipseStoreStorageFoundationProvider.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/config/EclipseStoreStorageFoundationProvider.java new file mode 100644 index 00000000..f01dfd08 --- /dev/null +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/config/EclipseStoreStorageFoundationProvider.java @@ -0,0 +1,29 @@ +/* + * Copyright © 2024 XDEV Software (https://xdev.software) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package software.xdev.spring.data.eclipse.store.repository.config; + +import org.eclipse.store.storage.embedded.types.EmbeddedStorageFoundation; + + +/** + * Wraps access to a {@link EmbeddedStorageFoundation} into a single interface to have looser coupling towards + * EclipseStore. + */ +public interface EclipseStoreStorageFoundationProvider +{ + @SuppressWarnings("java:S1452") + EmbeddedStorageFoundation createEmbeddedStorageFoundation(); +} diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/config/EnableEclipseStoreRepositories.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/config/EnableEclipseStoreRepositories.java index c200a994..442e6be8 100644 --- a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/config/EnableEclipseStoreRepositories.java +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/config/EnableEclipseStoreRepositories.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -45,7 +45,8 @@ @ComponentScan({ "software.xdev.spring.data.eclipse.store.importer", "software.xdev.spring.data.eclipse.store.repository", - "org.eclipse.store.integrations.spring.boot.types"}) + "org.eclipse.store.integrations.spring.boot.types", + "org.eclipse.store.integrations.spring.boot.types.converter"}) public @interface EnableEclipseStoreRepositories { @@ -81,6 +82,23 @@ */ Filter[] excludeFilters() default {}; + String CLIENT_CONFIGURATION_ANNOTATION_VALUE = "clientConfiguration"; + + /** + * @return the name of a {@link EclipseStoreClientConfiguration} to use. + * {@link DefaultEclipseStoreClientConfiguration} is used if not defined. + */ + String clientConfiguration() default "defaultEclipseStoreClientConfiguration"; + + String CLIENT_CONFIGURATION_CLASS_ANNOTATION_VALUE = "clientConfigurationClass"; + + /** + * @return the class of a {@link EclipseStoreClientConfiguration} to use. + * {@link DefaultEclipseStoreClientConfiguration} is used if not defined. + */ + Class clientConfigurationClass() + default DefaultEclipseStoreClientConfiguration.class; + /** * Returns the postfix to be used when looking up custom repository implementations. Defaults to {@literal Impl} . * So for a repository named {@code PersonRepository} the corresponding implementation class will be looked up diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/interfaces/EclipseStoreCrudRepository.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/interfaces/EclipseStoreCrudRepository.java index f9336ec4..325610c4 100644 --- a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/interfaces/EclipseStoreCrudRepository.java +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/interfaces/EclipseStoreCrudRepository.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/interfaces/EclipseStoreCustomRepository.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/interfaces/EclipseStoreCustomRepository.java index f8883714..97c7b09e 100644 --- a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/interfaces/EclipseStoreCustomRepository.java +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/interfaces/EclipseStoreCustomRepository.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/interfaces/EclipseStoreListCrudRepository.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/interfaces/EclipseStoreListCrudRepository.java index 700559fb..ac91ce71 100644 --- a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/interfaces/EclipseStoreListCrudRepository.java +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/interfaces/EclipseStoreListCrudRepository.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/interfaces/EclipseStoreListPagingAndSortingRepositoryRepository.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/interfaces/EclipseStoreListPagingAndSortingRepositoryRepository.java index 1323550a..34a774fb 100644 --- a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/interfaces/EclipseStoreListPagingAndSortingRepositoryRepository.java +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/interfaces/EclipseStoreListPagingAndSortingRepositoryRepository.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/interfaces/EclipseStorePagingAndSortingRepositoryRepository.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/interfaces/EclipseStorePagingAndSortingRepositoryRepository.java index c79b7238..33e65618 100644 --- a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/interfaces/EclipseStorePagingAndSortingRepositoryRepository.java +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/interfaces/EclipseStorePagingAndSortingRepositoryRepository.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/interfaces/EclipseStoreRepository.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/interfaces/EclipseStoreRepository.java index 6ba02530..f70c739c 100644 --- a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/interfaces/EclipseStoreRepository.java +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/interfaces/EclipseStoreRepository.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/lazy/SpringDataEclipseStoreLazy.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/lazy/SpringDataEclipseStoreLazy.java new file mode 100644 index 00000000..b659de3a --- /dev/null +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/lazy/SpringDataEclipseStoreLazy.java @@ -0,0 +1,257 @@ +/* + * Copyright © 2024 XDEV Software (https://xdev.software) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package software.xdev.spring.data.eclipse.store.repository.lazy; + +import java.lang.reflect.Field; +import java.util.Objects; + +import org.eclipse.serializer.reference.Lazy; +import org.eclipse.serializer.reference.ObjectSwizzling; +import org.eclipse.serializer.reference.Swizzling; + +import software.xdev.spring.data.eclipse.store.exceptions.LazyNotUnlinkableException; +import software.xdev.spring.data.eclipse.store.repository.access.modifier.FieldAccessModifier; +import software.xdev.spring.data.eclipse.store.repository.support.copier.working.WorkingCopier; + + +/** + * This is the Lazy-Wrapper a user of the Spring-Data-Eclipse-Store-Library should use. Please do not use the + * {@link Lazy}-Wrapper! Because SDES is making working copies of the stored data, the {@link Lazy} does not work as + * expected. Instead, use this Wrapper. It brings the same functionality as the native {@link Lazy}-Wrapper but works + * with working copies. + * + * @param the type of the lazily referenced element + */ +public interface SpringDataEclipseStoreLazy extends Lazy +{ + static SpringDataEclipseStoreLazy.Default build(final T objectToWrapInLazy) + { + return new Default<>(objectToWrapInLazy); + } + + SpringDataEclipseStoreLazy copyWithReference(); + + void unlink(); + + long objectId(); + + boolean isOriginalObject(); + + interface Internals + { + static SpringDataEclipseStoreLazy.Default buildWithLazy(final Lazy lazySubject) + { + return new Default<>(lazySubject); + } + } + + /** + * This class is very complex and its various member variables all have their reason to exist. This code is very + * difficult to read due to its the functionality explained in the {@link SpringDataEclipseStoreLazyBinaryHandler}. + * + * @param the type of the lazily referenced element + */ + @SuppressWarnings({"java:S2065", "checkstyle:FinalClass"}) + class Default implements SpringDataEclipseStoreLazy + { + private T objectToBeWrapped; + private Lazy wrappedLazy; + private long objectId = Swizzling.notFoundId(); + private transient ObjectSwizzling loader; + private transient WorkingCopier copier; + private transient boolean isStored; + + private Default(final Lazy lazySubject) + { + this.setWrappedLazy(lazySubject); + } + + private Default(final T objectToBeWrapped) + { + this.objectToBeWrapped = objectToBeWrapped; + } + + private Default(final long objectId, final ObjectSwizzling loader, final WorkingCopier copier) + { + this.objectId = objectId; + this.loader = loader; + this.copier = copier; + // This object is already stored in the real storage. So it can get cleared. + this.setStored(); + } + + private Lazy ensureLazy() + { + if(this.wrappedLazy == null || !this.wrappedLazy.isLoaded()) + { + this.wrappedLazy = this.createNewDefaultLazyWithClearableReference(); + } + return this.wrappedLazy; + } + + @SuppressWarnings("unchecked") + private Lazy createNewDefaultLazyWithClearableReference() + { + Objects.requireNonNull(this.loader); + Objects.requireNonNull(this.copier); + + final T originalInstance = (T)this.loader.getObject(this.objectId); + final T copiedInstance = this.copier.onlyCreateCopy(originalInstance, false); + + return Lazy.New( + copiedInstance, + Swizzling.nullId(), + this.loader + ); + } + + @Override + public T get() + { + if(this.objectToBeWrapped != null) + { + return this.objectToBeWrapped; + } + return this.ensureLazy().get(); + } + + @Override + public T peek() + { + return this.ensureLazy().peek(); + } + + @Override + public T clear() + { + if(!this.isStored()) + { + throw new IllegalStateException("Cannot clear an unstored lazy reference."); + } + // Make sure to save the correct objectId. + this.objectId = this.objectId(); + this.wrappedLazy = null; + return null; + } + + @Override + public boolean isStored() + { + return this.isStored; + } + + void setStored() + { + this.isStored = true; + } + + @Override + public boolean isLoaded() + { + if(this.objectToBeWrapped != null) + { + return true; + } + if(this.wrappedLazy == null) + { + return false; + } + return this.wrappedLazy.isLoaded(); + } + + @Override + public long lastTouched() + { + return this.ensureLazy().lastTouched(); + } + + @Override + public boolean clear(final ClearingEvaluator clearingEvaluator) + { + if(this.wrappedLazy != null) + { + return this.wrappedLazy.clear(clearingEvaluator); + } + return true; + } + + @Override + public long objectId() + { + if(this.wrappedLazy != null && this.wrappedLazy instanceof final Lazy.Default wrappedTypedLazy) + { + return wrappedTypedLazy.objectId(); + } + return this.objectId; + } + + void setWrappedLazy(final Lazy wrappedLazy) + { + this.wrappedLazy = wrappedLazy; + // This object is already stored in the real storage. So it can get cleared. + this.setStored(); + } + + public T getObjectToBeWrapped() + { + return this.objectToBeWrapped; + } + + @Override + public SpringDataEclipseStoreLazy copyWithReference() + { + final SpringDataEclipseStoreLazy.Default newLazy = new SpringDataEclipseStoreLazy.Default<>( + this.objectId(), + this.loader, + this.copier + ); + newLazy.wrappedLazy = this.wrappedLazy; + return newLazy; + } + + @Override + public void unlink() + { + try + { + if(this.wrappedLazy != null) + { + final Lazy.Default wrappedDefaultLazy = (Lazy.Default)this.wrappedLazy; + wrappedDefaultLazy.$unlink(); + final Field objectIdField = Lazy.Default.class.getDeclaredField("objectId"); + try(final FieldAccessModifier> fam = FieldAccessModifier.prepareForField( + objectIdField, + wrappedDefaultLazy)) + { + // The lazy object should be seen as "stored" by the LazyManager. + // Therefore, we must set the objectId to Swizzling.nullId(). + fam.writeValueOfField(wrappedDefaultLazy, Swizzling.nullId(), true); + } + } + } + catch(final Exception e) + { + throw new LazyNotUnlinkableException("Could not unlink lazy " + this.wrappedLazy, e); + } + } + + @Override + public boolean isOriginalObject() + { + return this.objectToBeWrapped != null; + } + } +} diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/lazy/SpringDataEclipseStoreLazyBinaryHandler.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/lazy/SpringDataEclipseStoreLazyBinaryHandler.java new file mode 100644 index 00000000..a6223a84 --- /dev/null +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/lazy/SpringDataEclipseStoreLazyBinaryHandler.java @@ -0,0 +1,197 @@ +/* + * Copyright © 2024 XDEV Software (https://xdev.software) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package software.xdev.spring.data.eclipse.store.repository.lazy; + +import java.lang.reflect.Constructor; +import java.util.Objects; + +import org.eclipse.serializer.memory.XMemory; +import org.eclipse.serializer.persistence.binary.types.AbstractBinaryHandlerCustom; +import org.eclipse.serializer.persistence.binary.types.Binary; +import org.eclipse.serializer.persistence.binary.types.BinaryTypeHandler; +import org.eclipse.serializer.persistence.types.PersistenceLoadHandler; +import org.eclipse.serializer.persistence.types.PersistenceReferenceLoader; +import org.eclipse.serializer.persistence.types.PersistenceStoreHandler; +import org.eclipse.serializer.reference.Lazy; +import org.eclipse.serializer.reference.ObjectSwizzling; +import org.eclipse.serializer.reflect.XReflect; + +import software.xdev.spring.data.eclipse.store.repository.support.copier.working.WorkingCopier; + + +/** + * This is a complicated one. First off: this handler should only be used for WorkingCopies (see + * {@link + * software.xdev.spring.data.eclipse.store.repository.support.copier.registering.EclipseSerializerRegisteringCopier})! + *

+ * First case:
+ * The user creates a {@link SpringDataEclipseStoreLazy} and puts a object in it. + * This object is stored as with a default {@link BinaryTypeHandler}. But when it gets loaded, + * it does not load as the stored object, but it gets wrapped in a {@link Lazy#Reference(Object)}. + *

+ *

+ * Second case:
+ * The actual lazy object gets loaded from the actual storage. In this case the {@link ObjectSwizzling} is + * important! It's the actual {@link ObjectSwizzling} from the storage (not from the + * {@link + * software.xdev.spring.data.eclipse.store.repository.support.copier.registering.EclipseSerializerRegisteringCopier}). + * This means, the {@link SpringDataEclipseStoreLazy} holds the objectId of the original lazy in the original + * storage. + * Therefore if {@link SpringDataEclipseStoreLazy#get()} is called a new working copy of the lazy from the + * storage is loaded. + *

+ */ +public final class SpringDataEclipseStoreLazyBinaryHandler + extends AbstractBinaryHandlerCustom> +{ + @SuppressWarnings("rawtypes") + static final Constructor CONSTRUCTOR_SURROGATE_LAZY = XReflect.setAccessible( + XReflect.getDeclaredConstructor( + SpringDataEclipseStoreLazy.Default.class, + long.class, + ObjectSwizzling.class, + WorkingCopier.class + ) + ); + + private static final int OFFSET_UNWRAPPED_OBJECT = 8; + private static final int OFFSET_LAZY = 0; + + private final ObjectSwizzling originalStoreLoader; + private final WorkingCopier copier; + + public SpringDataEclipseStoreLazyBinaryHandler( + final ObjectSwizzling originalStoreLoader, + final WorkingCopier copier) + { + super( + // Cast is necessary for the compiler + (Class)SpringDataEclipseStoreLazy.Default.class, + CustomFields( + CustomField(Object.class, "lazySubject"), + CustomField(Object.class, "unwrappedSubject") + ) + ); + this.originalStoreLoader = Objects.requireNonNull(originalStoreLoader); + this.copier = Objects.requireNonNull(copier); + } + + @Override + public void store( + final Binary data, + final SpringDataEclipseStoreLazy.Default instance, + final long objectId, + final PersistenceStoreHandler handler + ) + { + data.storeEntityHeader(Binary.referenceBinaryLength(2), this.typeId(), objectId); + if(instance.isOriginalObject()) + { + // Store unwrapped Object + data.store_long(OFFSET_UNWRAPPED_OBJECT, handler.applyEager(instance.getObjectToBeWrapped())); + } + else + { + // Store only reference to lazy + data.store_long(OFFSET_LAZY, instance.objectId()); + } + instance.setStored(); + } + + @SuppressWarnings("unchecked") + @Override + public SpringDataEclipseStoreLazy.Default create(final Binary data, final PersistenceLoadHandler handler) + { + final long objectIdOfLazy = data.read_long(OFFSET_LAZY); + final long objectIdOfUnwrappedObject = data.read_long(OFFSET_UNWRAPPED_OBJECT); + + if(objectIdOfUnwrappedObject == 0) + { + return Lazy.register( + XReflect.invoke(CONSTRUCTOR_SURROGATE_LAZY, objectIdOfLazy, this.originalStoreLoader, this.copier) + ); + } + return XMemory.instantiateBlank(SpringDataEclipseStoreLazy.Default.class); + } + + @Override + public void updateState( + final Binary data, + final SpringDataEclipseStoreLazy.Default instance, + final PersistenceLoadHandler handler + ) + { + this.updateStateT(data, instance, handler); + } + + private void updateStateT( + final Binary data, + final SpringDataEclipseStoreLazy.Default instance, + final PersistenceLoadHandler handler + ) + { + final long objectIdOfUnwrappedObject = data.read_long(OFFSET_UNWRAPPED_OBJECT); + + if(objectIdOfUnwrappedObject != 0) + { + instance.setWrappedLazy(Lazy.Reference((T)handler.lookupObject(objectIdOfUnwrappedObject))); + // Is already stored in the main storage. + instance.setStored(); + } + } + + @Override + public final void complete( + final Binary data, + final SpringDataEclipseStoreLazy.Default instance, + final PersistenceLoadHandler handler + ) + { + // no-op for normal implementation (see non-reference-hashing collections for other examples) + } + + @Override + public final boolean hasPersistedReferences() + { + return true; + } + + @Override + public final boolean hasPersistedVariableLength() + { + return false; + } + + @Override + public final boolean hasVaryingPersistedLengthInstances() + { + return false; + } + + @Override + public final void iterateLoadableReferences( + final Binary data, + final PersistenceReferenceLoader iterator + ) + { + final long objectIdOfUnwrappedObject = data.read_long(OFFSET_UNWRAPPED_OBJECT); + + if(objectIdOfUnwrappedObject != 0) + { + iterator.acceptObjectId(objectIdOfUnwrappedObject); + } + } +} diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/query/EclipseStoreQueryCreator.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/query/EclipseStoreQueryCreator.java index fb685694..6bed9ef5 100644 --- a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/query/EclipseStoreQueryCreator.java +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/query/EclipseStoreQueryCreator.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/query/FindAllEclipseStoreQueryProvider.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/query/FindAllEclipseStoreQueryProvider.java index 77e2de71..175e47b6 100644 --- a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/query/FindAllEclipseStoreQueryProvider.java +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/query/FindAllEclipseStoreQueryProvider.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/query/ReflectedField.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/query/ReflectedField.java index f3ece752..2fb19a78 100644 --- a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/query/ReflectedField.java +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/query/ReflectedField.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/query/StringBasedEclipseStoreQueryProvider.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/query/StringBasedEclipseStoreQueryProvider.java index 9fdfd8ca..957e958b 100644 --- a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/query/StringBasedEclipseStoreQueryProvider.java +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/query/StringBasedEclipseStoreQueryProvider.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/query/criteria/AbstractCriteriaNode.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/query/criteria/AbstractCriteriaNode.java index 876e3e42..fc62538a 100644 --- a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/query/criteria/AbstractCriteriaNode.java +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/query/criteria/AbstractCriteriaNode.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/query/criteria/Criteria.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/query/criteria/Criteria.java index 1ea456cd..7a211d7c 100644 --- a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/query/criteria/Criteria.java +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/query/criteria/Criteria.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/query/criteria/CriteriaAndNode.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/query/criteria/CriteriaAndNode.java index adcf44b4..0c683857 100644 --- a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/query/criteria/CriteriaAndNode.java +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/query/criteria/CriteriaAndNode.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/query/criteria/CriteriaOrNode.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/query/criteria/CriteriaOrNode.java index d7e84dd9..4e22b1b3 100644 --- a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/query/criteria/CriteriaOrNode.java +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/query/criteria/CriteriaOrNode.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/query/criteria/CriteriaSingleNode.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/query/criteria/CriteriaSingleNode.java index e6eddeeb..a0237d39 100644 --- a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/query/criteria/CriteriaSingleNode.java +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/query/criteria/CriteriaSingleNode.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/query/executors/EntitySorter.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/query/executors/EntitySorter.java index b34e1efb..48d7e5d9 100644 --- a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/query/executors/EntitySorter.java +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/query/executors/EntitySorter.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/query/executors/ListQueryExecutor.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/query/executors/ListQueryExecutor.java index 3a9d13e8..535036a2 100644 --- a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/query/executors/ListQueryExecutor.java +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/query/executors/ListQueryExecutor.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/query/executors/PageableQueryExecutor.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/query/executors/PageableQueryExecutor.java index cb4fe7ce..c21ffe16 100644 --- a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/query/executors/PageableQueryExecutor.java +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/query/executors/PageableQueryExecutor.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/query/executors/PageableSortableCollectionQuerier.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/query/executors/PageableSortableCollectionQuerier.java index 25dc3923..13901115 100644 --- a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/query/executors/PageableSortableCollectionQuerier.java +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/query/executors/PageableSortableCollectionQuerier.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/query/executors/QueryExecutor.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/query/executors/QueryExecutor.java index ebe92070..c2b312af 100644 --- a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/query/executors/QueryExecutor.java +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/query/executors/QueryExecutor.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/query/executors/QueryExecutorCreator.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/query/executors/QueryExecutorCreator.java index c5027e90..f802a9a8 100644 --- a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/query/executors/QueryExecutorCreator.java +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/query/executors/QueryExecutorCreator.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/query/executors/SingleOptionalQueryExecutor.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/query/executors/SingleOptionalQueryExecutor.java index eb06865b..ef0a98fa 100644 --- a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/query/executors/SingleOptionalQueryExecutor.java +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/query/executors/SingleOptionalQueryExecutor.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/query/executors/SingleQueryExecutor.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/query/executors/SingleQueryExecutor.java index 620cfd9f..d5f1c95f 100644 --- a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/query/executors/SingleQueryExecutor.java +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/query/executors/SingleQueryExecutor.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/EclipseStoreQueryLookupStrategy.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/EclipseStoreQueryLookupStrategy.java index 3f0bf32b..06ca3f2b 100644 --- a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/EclipseStoreQueryLookupStrategy.java +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/EclipseStoreQueryLookupStrategy.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/EclipseStoreRepositoryFactory.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/EclipseStoreRepositoryFactory.java index 2f42894f..f5ab612c 100644 --- a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/EclipseStoreRepositoryFactory.java +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/EclipseStoreRepositoryFactory.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -86,7 +86,8 @@ private WorkingCopier createWorkingCopier( storage.getRegistry(), storage, storage, - new SupportedChecker.Implementation() + new SupportedChecker.Implementation(), + storage ); } diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/EclipseStoreRepositoryFactoryBean.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/EclipseStoreRepositoryFactoryBean.java index 4c54c4b9..fb859e62 100644 --- a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/EclipseStoreRepositoryFactoryBean.java +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/EclipseStoreRepositoryFactoryBean.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,7 +25,7 @@ import org.springframework.data.repository.core.support.RepositoryFactorySupport; import org.springframework.stereotype.Component; -import software.xdev.spring.data.eclipse.store.repository.EclipseStoreStorage; +import software.xdev.spring.data.eclipse.store.repository.config.EclipseStoreClientConfiguration; @ComponentScan({ @@ -35,20 +35,22 @@ public class EclipseStoreRepositoryFactoryBean, S, ID extends Serializable> extends RepositoryFactoryBeanSupport { - private final EclipseStoreStorage storage; + private EclipseStoreClientConfiguration configuration; - public EclipseStoreRepositoryFactoryBean( - final Class repositoryInterface, - final EclipseStoreStorage storage) + public EclipseStoreRepositoryFactoryBean(final Class repositoryInterface) { super(repositoryInterface); - this.storage = storage; + } + + public void setConfiguration(final EclipseStoreClientConfiguration configuration) + { + this.configuration = configuration; } @Override @Nonnull protected RepositoryFactorySupport createRepositoryFactory() { - return new EclipseStoreRepositoryFactory(this.storage); + return new EclipseStoreRepositoryFactory(this.configuration.getStorageInstance()); } } diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/IdFieldFinder.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/IdFieldFinder.java index c956cf6a..2e0a31e5 100644 --- a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/IdFieldFinder.java +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/IdFieldFinder.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/SimpleEclipseStoreRepository.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/SimpleEclipseStoreRepository.java index b366c873..8e5ef8cc 100644 --- a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/SimpleEclipseStoreRepository.java +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/SimpleEclipseStoreRepository.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -151,7 +151,7 @@ public Optional findById(@Nonnull final ID id) { for(final T entity : this.storage.getEntityList(this.domainClass)) { - try(final FieldAccessModifier fam = FieldAccessModifier.makeFieldReadable(this.getIdField(), entity)) + try(final FieldAccessModifier fam = FieldAccessModifier.prepareForField(this.getIdField(), entity)) { if(id.equals(fam.getValueOfField(entity))) { @@ -173,7 +173,7 @@ public boolean existsById(@Nonnull final ID id) { for(final T entity : this.storage.getEntityList(this.domainClass)) { - try(final FieldAccessModifier fam = FieldAccessModifier.makeFieldReadable(this.getIdField(), entity)) + try(final FieldAccessModifier fam = FieldAccessModifier.prepareForField(this.getIdField(), entity)) { if(id.equals(fam.getValueOfField(entity))) { @@ -204,7 +204,7 @@ public List findAllById(@Nonnull final Iterable ids) final List foundEntities = new ArrayList<>(); for(final T entity : this.storage.getEntityList(this.domainClass)) { - try(final FieldAccessModifier fam = FieldAccessModifier.makeFieldReadable(this.getIdField(), entity)) + try(final FieldAccessModifier fam = FieldAccessModifier.prepareForField(this.getIdField(), entity)) { for(final ID id : ids) { diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/copier/DataTypeUtil.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/copier/DataTypeUtil.java index 0e6fc2de..7101400d 100644 --- a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/copier/DataTypeUtil.java +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/copier/DataTypeUtil.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,6 +20,8 @@ import jakarta.annotation.Nonnull; +import software.xdev.spring.data.eclipse.store.repository.lazy.SpringDataEclipseStoreLazy; + public final class DataTypeUtil { @@ -45,6 +47,11 @@ public static boolean isObjectArray(final Object obj) return obj instanceof Object[]; } + public static boolean isSpringDataEclipseStoreLazy(final Object obj) + { + return obj instanceof SpringDataEclipseStoreLazy; + } + public static boolean isPrimitiveArray(final Object obj) { return obj instanceof boolean[] diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/copier/id/IdSetter.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/copier/id/IdSetter.java index f3a08497..9a2f1da0 100644 --- a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/copier/id/IdSetter.java +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/copier/id/IdSetter.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/copier/id/NotSettingIdSetter.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/copier/id/NotSettingIdSetter.java index 4177bf27..c299b55d 100644 --- a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/copier/id/NotSettingIdSetter.java +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/copier/id/NotSettingIdSetter.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/copier/id/SimpleIdSetter.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/copier/id/SimpleIdSetter.java index 5c7a5975..e59bc75f 100644 --- a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/copier/id/SimpleIdSetter.java +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/copier/id/SimpleIdSetter.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -53,7 +53,7 @@ private void checkIfIdFieldIsFinal() @Override public void ensureId(final T objectToSetIdIn) { - try(final FieldAccessModifier fam = FieldAccessModifier.makeFieldReadable( + try(final FieldAccessModifier fam = FieldAccessModifier.prepareForField( this.idField, objectToSetIdIn)) { diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/copier/id/strategy/IdFinder.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/copier/id/strategy/IdFinder.java index b26de773..2618fa2b 100644 --- a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/copier/id/strategy/IdFinder.java +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/copier/id/strategy/IdFinder.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/copier/id/strategy/auto/AbstractAutoIdFinder.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/copier/id/strategy/auto/AbstractAutoIdFinder.java index ac603696..beb768f2 100644 --- a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/copier/id/strategy/auto/AbstractAutoIdFinder.java +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/copier/id/strategy/auto/AbstractAutoIdFinder.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/copier/id/strategy/auto/AutoIntegerIdFinder.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/copier/id/strategy/auto/AutoIntegerIdFinder.java index 39602d50..0f4b4535 100644 --- a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/copier/id/strategy/auto/AutoIntegerIdFinder.java +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/copier/id/strategy/auto/AutoIntegerIdFinder.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/copier/id/strategy/auto/AutoLongIdFinder.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/copier/id/strategy/auto/AutoLongIdFinder.java index db1e5ea9..b3b41e56 100644 --- a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/copier/id/strategy/auto/AutoLongIdFinder.java +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/copier/id/strategy/auto/AutoLongIdFinder.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/copier/id/strategy/auto/AutoStringIdFinder.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/copier/id/strategy/auto/AutoStringIdFinder.java index c4e835eb..afc2cbca 100644 --- a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/copier/id/strategy/auto/AutoStringIdFinder.java +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/copier/id/strategy/auto/AutoStringIdFinder.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/copier/registering/AbstractRegisteringCopier.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/copier/registering/AbstractRegisteringCopier.java new file mode 100644 index 00000000..d5bc900d --- /dev/null +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/copier/registering/AbstractRegisteringCopier.java @@ -0,0 +1,97 @@ +/* + * Copyright © 2024 XDEV Software (https://xdev.software) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package software.xdev.spring.data.eclipse.store.repository.support.copier.registering; + +import org.eclipse.serializer.Serializer; +import org.eclipse.serializer.SerializerFoundation; +import org.eclipse.serializer.persistence.binary.jdk17.java.util.BinaryHandlerImmutableCollectionsList12; +import org.eclipse.serializer.persistence.binary.jdk17.java.util.BinaryHandlerImmutableCollectionsSet12; +import org.eclipse.serializer.persistence.binary.types.Binary; +import org.eclipse.serializer.persistence.types.PersistenceManager; +import org.eclipse.serializer.reference.ObjectSwizzling; +import org.eclipse.serializer.reference.Reference; +import org.eclipse.serializer.util.X; + +import software.xdev.spring.data.eclipse.store.repository.SupportedChecker; +import software.xdev.spring.data.eclipse.store.repository.lazy.SpringDataEclipseStoreLazyBinaryHandler; +import software.xdev.spring.data.eclipse.store.repository.support.copier.working.WorkingCopier; + + +/** + * This class registers storage instances and copy them for working copies. Utilizes + * {@link EclipseSerializerRegisteringCopier}. + */ +public abstract class AbstractRegisteringCopier implements RegisteringObjectCopier +{ + private final EclipseSerializerRegisteringCopier actualCopier; + + protected AbstractRegisteringCopier( + final SupportedChecker supportedChecker, + final RegisteringWorkingCopyAndOriginal register, + final ObjectSwizzling objectSwizzling, + final WorkingCopier copier) + { + this.actualCopier = new EclipseSerializerRegisteringCopier( + supportedChecker, + register, + this.createPersistenceManager( + this.createSerializerFoundation(), + objectSwizzling, + copier + ) + ); + } + + private PersistenceManager createPersistenceManager( + final SerializerFoundation serializerFoundation, + final ObjectSwizzling objectSwizzling, + final WorkingCopier copier) + { + return serializerFoundation + .registerCustomTypeHandler(BinaryHandlerImmutableCollectionsSet12.New()) + .registerCustomTypeHandler(BinaryHandlerImmutableCollectionsList12.New()) + .registerCustomTypeHandlers(new SpringDataEclipseStoreLazyBinaryHandler(objectSwizzling, copier)) + .createPersistenceManager(); + } + + @SuppressWarnings("java:S1452") + protected SerializerFoundation createSerializerFoundation() + { + final Reference buffer = X.Reference(null); + final Serializer.Source source = () -> X.Constant(buffer.get()); + final Serializer.Target target = buffer::set; + + return SerializerFoundation.New() + .setPersistenceSource(source) + .setPersistenceTarget(target) + // Make every type persistable. + // This is quite dangerous! + // But if this is not set we get problems e.g. with HashMap$Node + .setTypeEvaluatorPersistable(a -> true); + } + + @Override + public synchronized T copy(final T source) + { + return this.actualCopier.copy(source); + } + + @Override + public synchronized void close() + { + this.actualCopier.close(); + } +} diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/copier/object/EclipseSerializerRegisteringCopier.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/copier/registering/EclipseSerializerRegisteringCopier.java similarity index 65% rename from spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/copier/object/EclipseSerializerRegisteringCopier.java rename to spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/copier/registering/EclipseSerializerRegisteringCopier.java index 00f6f8e5..5ec09598 100644 --- a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/copier/object/EclipseSerializerRegisteringCopier.java +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/copier/registering/EclipseSerializerRegisteringCopier.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,28 +13,21 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package software.xdev.spring.data.eclipse.store.repository.support.copier.object; +package software.xdev.spring.data.eclipse.store.repository.support.copier.registering; import java.util.HashMap; import java.util.Map; -import org.eclipse.serializer.Serializer; -import org.eclipse.serializer.SerializerFoundation; -import org.eclipse.serializer.persistence.binary.jdk17.java.util.BinaryHandlerImmutableCollectionsList12; -import org.eclipse.serializer.persistence.binary.jdk17.java.util.BinaryHandlerImmutableCollectionsSet12; import org.eclipse.serializer.persistence.binary.types.Binary; import org.eclipse.serializer.persistence.binary.types.BinaryStorer; import org.eclipse.serializer.persistence.types.PersistenceLoader; import org.eclipse.serializer.persistence.types.PersistenceManager; import org.eclipse.serializer.persistence.types.PersistenceStorer; -import org.eclipse.serializer.reference.Reference; -import org.eclipse.serializer.util.X; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import software.xdev.spring.data.eclipse.store.exceptions.DataTypeNotSupportedException; import software.xdev.spring.data.eclipse.store.repository.SupportedChecker; -import software.xdev.spring.data.eclipse.store.repository.WorkingCopyRegistry; import software.xdev.spring.data.eclipse.store.repository.support.copier.DataTypeUtil; @@ -42,32 +35,23 @@ * This class utilizes EclipseStore-Serialization and copies objects by serializing and deserializing objects in * memory. */ -public class EclipseSerializerRegisteringCopier implements RegisteringObjectCopier +public class EclipseSerializerRegisteringCopier implements AutoCloseable { private static final Logger LOG = LoggerFactory.getLogger(EclipseSerializerRegisteringCopier.class); - private final SerializerFoundation foundation; private PersistenceManager persistenceManager; private final SupportedChecker supportedChecker; - - private final WorkingCopyRegistry registry; + private final RegisteringWorkingCopyAndOriginal register; public EclipseSerializerRegisteringCopier( - final WorkingCopyRegistry registry, - final SupportedChecker supportedChecker) + final SupportedChecker supportedChecker, + final RegisteringWorkingCopyAndOriginal register, + final PersistenceManager persistenceManager) { - final SerializerFoundation newFoundation = SerializerFoundation.New(); - newFoundation.registerCustomTypeHandler(BinaryHandlerImmutableCollectionsSet12.New()); - newFoundation.registerCustomTypeHandler(BinaryHandlerImmutableCollectionsList12.New()); - this.foundation = newFoundation; - this.registry = registry; this.supportedChecker = supportedChecker; + this.register = register; + this.persistenceManager = persistenceManager; } - - @Override - public synchronized T copy(final T source) - { - return this.copy(source, false); - } + @Override public synchronized void close() @@ -80,28 +64,6 @@ public synchronized void close() } } - private void lazyInit() - { - if(this.persistenceManager == null) - { - final Reference buffer = X.Reference(null); - final Serializer.Source source = () -> X.Constant(buffer.get()); - final Serializer.Target target = buffer::set; - this.persistenceManager = - (((SerializerFoundation)this.foundation.setPersistenceSource(source)) - .setPersistenceTarget(target)) - // Make every type persistable. - // This is quite dangerous! - // But if this is not set we get problems e.g. with HashMap$Node - .setTypeEvaluatorPersistable(a -> true) - .createPersistenceManager(); - } - else - { - this.persistenceManager.objectRegistry().truncateAll(); - } - } - /** * Here lies a lot of knowledge about EclipseStore internals. *

@@ -116,11 +78,9 @@ private void lazyInit() * EclipseStore-ObjectId. *

*/ - @SuppressWarnings("unchecked") - @Override - public synchronized T copy(final T source, final boolean invertRegistering) + public synchronized T copy(final T source) { - this.lazyInit(); + this.persistenceManager.objectRegistry().truncateAll(); final BinaryStorer.Default storer = (BinaryStorer.Default)this.persistenceManager.createStorer(); // Loader erstellen final PersistenceLoader loader = this.persistenceManager.createLoader(); @@ -153,14 +113,7 @@ public synchronized T copy(final T source, final boolean invertRegistering) if(originalObject != null) { summarizer.incrementRegisteredObjectsCount(); - if(invertRegistering) - { - this.registry.invertRegister(copiedObject, originalObject); - } - else - { - this.registry.register(copiedObject, originalObject); - } + this.register.register(copiedObject, originalObject); } } ); diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/copier/object/RegisteringObjectCopier.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/copier/registering/RegisteringObjectCopier.java similarity index 73% rename from spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/copier/object/RegisteringObjectCopier.java rename to spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/copier/registering/RegisteringObjectCopier.java index 4e659c08..146cd700 100644 --- a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/copier/object/RegisteringObjectCopier.java +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/copier/registering/RegisteringObjectCopier.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,12 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package software.xdev.spring.data.eclipse.store.repository.support.copier.object; +package software.xdev.spring.data.eclipse.store.repository.support.copier.registering; -import org.eclipse.serializer.ObjectCopier; - - -public interface RegisteringObjectCopier extends ObjectCopier +public interface RegisteringObjectCopier extends AutoCloseable { - T copy(T t, boolean invertRegistering); + T copy(T t); } diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/copier/registering/RegisteringStorageToWorkingCopyCopier.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/copier/registering/RegisteringStorageToWorkingCopyCopier.java new file mode 100644 index 00000000..df11886e --- /dev/null +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/copier/registering/RegisteringStorageToWorkingCopyCopier.java @@ -0,0 +1,44 @@ +/* + * Copyright © 2024 XDEV Software (https://xdev.software) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package software.xdev.spring.data.eclipse.store.repository.support.copier.registering; + +import org.eclipse.serializer.reference.ObjectSwizzling; + +import software.xdev.spring.data.eclipse.store.repository.SupportedChecker; +import software.xdev.spring.data.eclipse.store.repository.WorkingCopyRegistry; +import software.xdev.spring.data.eclipse.store.repository.support.copier.working.WorkingCopier; + + +/** + * This class registers storage instances and copy them for working copies. Utilizes + * {@link EclipseSerializerRegisteringCopier}. + */ +public class RegisteringStorageToWorkingCopyCopier extends AbstractRegisteringCopier +{ + public RegisteringStorageToWorkingCopyCopier( + final WorkingCopyRegistry registry, + final SupportedChecker supportedChecker, + final ObjectSwizzling objectSwizzling, + final WorkingCopier copier) + { + super( + supportedChecker, + registry::register, + objectSwizzling, + copier + ); + } +} diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/copier/registering/RegisteringWorkingCopyAndOriginal.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/copier/registering/RegisteringWorkingCopyAndOriginal.java new file mode 100644 index 00000000..3a9ca24d --- /dev/null +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/copier/registering/RegisteringWorkingCopyAndOriginal.java @@ -0,0 +1,22 @@ +/* + * Copyright © 2024 XDEV Software (https://xdev.software) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package software.xdev.spring.data.eclipse.store.repository.support.copier.registering; + +@FunctionalInterface +public interface RegisteringWorkingCopyAndOriginal +{ + boolean register(final Object workingCopy, final Object objectToStore); +} diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/copier/registering/RegisteringWorkingCopyToStorageCopier.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/copier/registering/RegisteringWorkingCopyToStorageCopier.java new file mode 100644 index 00000000..9fdc45f7 --- /dev/null +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/copier/registering/RegisteringWorkingCopyToStorageCopier.java @@ -0,0 +1,45 @@ +/* + * Copyright © 2024 XDEV Software (https://xdev.software) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package software.xdev.spring.data.eclipse.store.repository.support.copier.registering; + +import org.eclipse.serializer.reference.ObjectSwizzling; + +import software.xdev.spring.data.eclipse.store.repository.SupportedChecker; +import software.xdev.spring.data.eclipse.store.repository.WorkingCopyRegistry; +import software.xdev.spring.data.eclipse.store.repository.support.copier.working.WorkingCopier; + + +/** + * This class registers working copy instances and copy them for the storage. Utilizes + * {@link EclipseSerializerRegisteringCopier}. + */ +public class RegisteringWorkingCopyToStorageCopier extends AbstractRegisteringCopier +{ + + public RegisteringWorkingCopyToStorageCopier( + final WorkingCopyRegistry registry, + final SupportedChecker supportedChecker, + final ObjectSwizzling objectSwizzling, + final WorkingCopier copier) + { + super( + supportedChecker, + registry::invertRegister, + objectSwizzling, + copier + ); + } +} diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/copier/working/ChangedObjectCollector.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/copier/working/ChangedObjectCollector.java index d1cd9f5b..c3461f20 100644 --- a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/copier/working/ChangedObjectCollector.java +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/copier/working/ChangedObjectCollector.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/copier/working/HashSetChangedObjectCollector.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/copier/working/HashSetChangedObjectCollector.java index dc9fad70..fd3f31b1 100644 --- a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/copier/working/HashSetChangedObjectCollector.java +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/copier/working/HashSetChangedObjectCollector.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/copier/working/HashSetMergedTargetsCollector.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/copier/working/HashSetMergedTargetsCollector.java index 4e1c7cbc..3569e548 100644 --- a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/copier/working/HashSetMergedTargetsCollector.java +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/copier/working/HashSetMergedTargetsCollector.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/copier/working/MergedTargetsCollector.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/copier/working/MergedTargetsCollector.java index 86112646..4efaa8ad 100644 --- a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/copier/working/MergedTargetsCollector.java +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/copier/working/MergedTargetsCollector.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/copier/working/RecursiveWorkingCopier.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/copier/working/RecursiveWorkingCopier.java index a781da27..c03949fa 100644 --- a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/copier/working/RecursiveWorkingCopier.java +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/copier/working/RecursiveWorkingCopier.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,6 +27,8 @@ import java.util.TreeMap; import java.util.TreeSet; +import org.eclipse.serializer.reference.Lazy; +import org.eclipse.serializer.reference.ObjectSwizzling; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -37,9 +39,11 @@ import software.xdev.spring.data.eclipse.store.repository.WorkingCopyRegistry; import software.xdev.spring.data.eclipse.store.repository.access.AccessHelper; import software.xdev.spring.data.eclipse.store.repository.access.modifier.FieldAccessModifier; +import software.xdev.spring.data.eclipse.store.repository.lazy.SpringDataEclipseStoreLazy; import software.xdev.spring.data.eclipse.store.repository.support.copier.DataTypeUtil; -import software.xdev.spring.data.eclipse.store.repository.support.copier.object.EclipseSerializerRegisteringCopier; -import software.xdev.spring.data.eclipse.store.repository.support.copier.object.RegisteringObjectCopier; +import software.xdev.spring.data.eclipse.store.repository.support.copier.registering.RegisteringObjectCopier; +import software.xdev.spring.data.eclipse.store.repository.support.copier.registering.RegisteringStorageToWorkingCopyCopier; +import software.xdev.spring.data.eclipse.store.repository.support.copier.registering.RegisteringWorkingCopyToStorageCopier; /** @@ -48,7 +52,8 @@ public class RecursiveWorkingCopier implements WorkingCopier { private static final Logger LOG = LoggerFactory.getLogger(RecursiveWorkingCopier.class); - private final RegisteringObjectCopier objectCopier; + private final RegisteringObjectCopier workingCopyToStorageCopier; + private final RegisteringObjectCopier storageToWorkingCopyCopier; private final WorkingCopyRegistry registry; private final IdSetterProvider idSetterProvider; private final Class domainClass; @@ -59,11 +64,15 @@ public RecursiveWorkingCopier( final WorkingCopyRegistry registry, final IdSetterProvider idSetterProvider, final PersistableChecker persistableChecker, - final SupportedChecker supportedChecker) + final SupportedChecker supportedChecker, + final ObjectSwizzling objectSwizzling) { this.domainClass = domainClass; this.registry = registry; - this.objectCopier = new EclipseSerializerRegisteringCopier(registry, supportedChecker); + this.workingCopyToStorageCopier = + new RegisteringWorkingCopyToStorageCopier(registry, supportedChecker, objectSwizzling, this); + this.storageToWorkingCopyCopier = + new RegisteringStorageToWorkingCopyCopier(registry, supportedChecker, objectSwizzling, this); this.idSetterProvider = idSetterProvider; this.persistableChecker = persistableChecker; } @@ -144,7 +153,7 @@ public E getOrCreateObjectForDatastore( // The object to merge back is not a working copy, but a originalObject. // Therefore, we create a copy to persist this in the storage. final E objectForDatastore = this.genericCopy(workingCopy, true); - // "Why merging values of an identical object?" you might ask. + // "Why merge values of an identical object?" you might ask. // Well, because some sub-objects might already be in the datastore. this.mergeValues(workingCopy, objectForDatastore, alreadyMergedTargets, changedCollector); changedCollector.collectChangedObject(objectForDatastore); @@ -161,7 +170,8 @@ private void mergeValues( final E sourceObject, final E targetObject, final MergedTargetsCollector alreadyMergedTargets, - final ChangedObjectCollector changedCollector) + final ChangedObjectCollector changedCollector + ) { if(sourceObject == targetObject || alreadyMergedTargets.isAlreadyMerged(targetObject) || targetObject == null) { @@ -172,14 +182,21 @@ private void mergeValues( { alreadyMergedTargets.collectMergedTarget(targetObject); - if(sourceObject instanceof String) + if(sourceObject instanceof String || sourceObject instanceof SpringDataEclipseStoreLazy) { // no merge needed and no merge possible return; } - AccessHelper.getInheritedPrivateFieldsByName(sourceObject.getClass()).values().forEach( + final Collection valuesToMerge = + AccessHelper.getInheritedPrivateFieldsByName(sourceObject.getClass()).values(); + valuesToMerge.forEach( field -> - this.mergeValueOfField(sourceObject, targetObject, field, alreadyMergedTargets, changedCollector) + this.mergeValueOfField( + sourceObject, + targetObject, + field, + alreadyMergedTargets, + changedCollector) ); } catch(final Exception e) @@ -203,7 +220,7 @@ private void mergeValueOfField( return; } - try(final FieldAccessModifier fam = FieldAccessModifier.makeFieldReadable( + try(final FieldAccessModifier fam = FieldAccessModifier.prepareForField( field, sourceObject)) { @@ -243,41 +260,28 @@ else if(DataTypeUtil.isObjectArray(valueOfSourceObject)) ); fam.writeValueOfField(targetObject, newArray, !targetObjectIsPartOfJavaPackage); } + else if(DataTypeUtil.isSpringDataEclipseStoreLazy(valueOfSourceObject)) + { + final SpringDataEclipseStoreLazy newLazy = + this.createNewLazy( + (SpringDataEclipseStoreLazy)valueOfSourceObject, + (SpringDataEclipseStoreLazy)valueOfTargetObject, + alreadyMergedTargets, + changedCollector); + fam.writeValueOfField(targetObject, newLazy, true); + } else { // "Simple" object // get original value object - final Object originalValueObjectOfSource = - this.getOrCreateObjectForDatastore( - valueOfSourceObject, - false, - alreadyMergedTargets, - changedCollector); - if(valueOfTargetObject != originalValueObjectOfSource) - { - // If the reference is new, it must be set - fam.writeValueOfField( - targetObject, - originalValueObjectOfSource, - !targetObjectIsPartOfJavaPackage); - } - - if(this.isSpecialCaseWhereOnlyAFullCopyWorks(valueOfSourceObject)) - { - fam.writeValueOfField( - targetObject, - this.onlyCreateCopy(valueOfSourceObject, true), - !targetObjectIsPartOfJavaPackage); - } - else - { - // Merge after setting reference to avoid endless loops - this.mergeValues( - valueOfSourceObject, - originalValueObjectOfSource, - alreadyMergedTargets, - changedCollector); - } + this.mergeSimpleObjectValue( + targetObject, + alreadyMergedTargets, + changedCollector, + valueOfSourceObject, + valueOfTargetObject, + fam, + targetObjectIsPartOfJavaPackage); } } } @@ -288,6 +292,99 @@ else if(DataTypeUtil.isObjectArray(valueOfSourceObject)) } } + private void mergeSimpleObjectValue( + final E targetObject, + final MergedTargetsCollector alreadyMergedTargets, + final ChangedObjectCollector changedCollector, + final Object valueOfSourceObject, + final Object valueOfTargetObject, + final FieldAccessModifier fam, + final boolean targetObjectIsPartOfJavaPackage) throws IllegalAccessException + { + final Object originalValueObjectOfSource = + this.getOrCreateObjectForDatastore( + valueOfSourceObject, + false, + alreadyMergedTargets, + changedCollector); + if(valueOfTargetObject != originalValueObjectOfSource) + { + // If the reference is new, it must be set + fam.writeValueOfField( + targetObject, + originalValueObjectOfSource, + !targetObjectIsPartOfJavaPackage); + } + + if(this.isSpecialCaseWhereOnlyAFullCopyWorks(valueOfSourceObject)) + { + fam.writeValueOfField( + targetObject, + this.onlyCreateCopy(valueOfSourceObject, true), + !targetObjectIsPartOfJavaPackage); + } + else + { + // Merge after setting reference to avoid endless loops + this.mergeValues( + valueOfSourceObject, + originalValueObjectOfSource, + alreadyMergedTargets, + changedCollector); + } + } + + private SpringDataEclipseStoreLazy createNewLazy( + final SpringDataEclipseStoreLazy oldLazy, + final SpringDataEclipseStoreLazy newLazy, + final MergedTargetsCollector alreadyMergedTargets, + final ChangedObjectCollector changedCollector + ) + { + if(oldLazy.isLoaded()) + { + if(oldLazy.isOriginalObject()) + { + // This object is new and in this case it is merged into the storage. + if(!newLazy.isStored()) + { + // The EclipseSerializerRegisteringCopier already creates the perfect lazy object. + // No change necessary. + return (SpringDataEclipseStoreLazy)newLazy; + } + else + { + // This object is already stored but the new version must get overwritten. + // The oldLazy Object can contain all kinds of objects (including more lazies) + final E copyOfWrappedObject = this.getOrCreateObjectForDatastore( + oldLazy.get(), + true, + alreadyMergedTargets, + changedCollector); + oldLazy.unlink(); + newLazy.unlink(); + + return SpringDataEclipseStoreLazy.Internals.buildWithLazy(Lazy.Reference(copyOfWrappedObject)); + } + } + final E copyOfWrappedObject = this.getOrCreateObjectForDatastore( + oldLazy.get(), + true, + alreadyMergedTargets, + changedCollector); + oldLazy.unlink(); + newLazy.unlink(); + return SpringDataEclipseStoreLazy.build(copyOfWrappedObject); + } + else + { + oldLazy.unlink(); + // This lazy should never be used again! + // It is though of as a temporary copy to merge back into the original-storage-data. + return (SpringDataEclipseStoreLazy)newLazy.copyWithReference(); + } + } + /** * Super special case for HashMap or similar java-classes which can't be merged nicely. Thus, we make a simple copy * of the whole object. @@ -326,9 +423,14 @@ private E[] createGenericObjectArray( return newArray; } - private E onlyCreateCopy(final E objectToCopy, final boolean invertRegistry) + @Override + public E onlyCreateCopy(final E objectToCopy, final boolean invertRegistry) { - return this.objectCopier.copy(objectToCopy, invertRegistry); + if(invertRegistry) + { + return this.workingCopyToStorageCopier.copy(objectToCopy); + } + return this.storageToWorkingCopyCopier.copy(objectToCopy); } @Override diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/copier/working/WorkingCopier.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/copier/working/WorkingCopier.java index c2c60f23..fdf84e73 100644 --- a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/copier/working/WorkingCopier.java +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/copier/working/WorkingCopier.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -50,6 +50,8 @@ public interface WorkingCopier */ WorkingCopierResult mergeBack(T workingCopy); + E onlyCreateCopy(final E objectToCopy, final boolean invertRegistry); + /** * @return the original entity that corresponds to the given working copy object. */ diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/copier/working/WorkingCopierCreator.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/copier/working/WorkingCopierCreator.java index e5415938..4f0a50a8 100644 --- a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/copier/working/WorkingCopierCreator.java +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/copier/working/WorkingCopierCreator.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/copier/working/WorkingCopierResult.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/copier/working/WorkingCopierResult.java index b780b2da..c88bc711 100644 --- a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/copier/working/WorkingCopierResult.java +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/copier/working/WorkingCopierResult.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/reposyncer/RepositorySynchronizer.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/reposyncer/RepositorySynchronizer.java index b071aae5..399552a2 100644 --- a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/reposyncer/RepositorySynchronizer.java +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/reposyncer/RepositorySynchronizer.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/reposyncer/SimpleRepositorySynchronizer.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/reposyncer/SimpleRepositorySynchronizer.java index 644b4fa8..5b812d77 100644 --- a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/reposyncer/SimpleRepositorySynchronizer.java +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/reposyncer/SimpleRepositorySynchronizer.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/util/GenericObjectComparer.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/util/GenericObjectComparer.java index 22bf49b3..633f6544 100644 --- a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/util/GenericObjectComparer.java +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/util/GenericObjectComparer.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/util/StringUtil.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/util/StringUtil.java index bcf1a600..8bea8d55 100644 --- a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/util/StringUtil.java +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/util/StringUtil.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/helper/DummyWorkingCopier.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/helper/DummyWorkingCopier.java index e92deeb6..d07d0627 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/helper/DummyWorkingCopier.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/helper/DummyWorkingCopier.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -41,6 +41,12 @@ public WorkingCopierResult mergeBack(final T workingCopy) return null; } + @Override + public E onlyCreateCopy(final E objectToCopy, final boolean invertRegistry) + { + return objectToCopy; + } + @Override public T getOriginal(final T workingCopy) { diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/helper/StorageDirectoryNameProvider.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/helper/StorageDirectoryNameProvider.java new file mode 100644 index 00000000..2813f208 --- /dev/null +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/helper/StorageDirectoryNameProvider.java @@ -0,0 +1,33 @@ +/* + * Copyright © 2024 XDEV Software (https://xdev.software) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package software.xdev.spring.data.eclipse.store.helper; + +import java.util.concurrent.atomic.AtomicInteger; + + +public final class StorageDirectoryNameProvider +{ + private static final AtomicInteger SEQ_NUMBER = new AtomicInteger(1); + + private StorageDirectoryNameProvider() + { + } + + public static String getNewStorageDirectoryPath() + { + return String.format("./target/tempstorage-%05d", SEQ_NUMBER.getAndIncrement()); + } +} diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/helper/TestData.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/helper/TestData.java index e5482b6d..683d5e69 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/helper/TestData.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/helper/TestData.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,6 +22,9 @@ public final class TestData public static final String LAST_NAME_ALTERNATIVE = "Nicks"; public static final String FIRST_NAME_ALTERNATIVE = "Stevie"; + public static final String DUMMY_STRING = "-- skldfoöüä+#+!(/%&/%($§\"=)()nxjkß? _:.. ,-.;"; + public static final String DUMMY_STRING_ALTERNATIVE = " abc "; + private TestData() { } diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/helper/TestUtil.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/helper/TestUtil.java index 98cb7550..dcfc4e77 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/helper/TestUtil.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/helper/TestUtil.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,7 +20,7 @@ import org.opentest4j.AssertionFailedError; -import software.xdev.spring.data.eclipse.store.repository.EclipseStoreStorage; +import software.xdev.spring.data.eclipse.store.repository.config.EclipseStoreClientConfiguration; public final class TestUtil @@ -32,14 +32,14 @@ public static List iterableToList(final Iterable iterable) return list; } - public static void restartDatastore(final EclipseStoreStorage storage) + public static void restartDatastore(final EclipseStoreClientConfiguration configuration) { - storage.stop(); + configuration.getStorageInstance().stop(); // Storage starts automatically again, if the repo is accessed } public static void doBeforeAndAfterRestartOfDatastore( - final EclipseStoreStorage storage, + final EclipseStoreClientConfiguration configuration, final Runnable thingToDoBeforeAndAfterRestart) { try @@ -50,7 +50,7 @@ public static void doBeforeAndAfterRestartOfDatastore( { throw new AssertionFailedError("Error before restart of storage", error); } - restartDatastore(storage); + restartDatastore(configuration); try { thingToDoBeforeAndAfterRestart.run(); diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/TestConfiguration.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/TestConfiguration.java index 5c0ea1fa..3f6557fd 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/TestConfiguration.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/TestConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,43 +15,47 @@ */ package software.xdev.spring.data.eclipse.store.integration; +import static org.eclipse.store.storage.embedded.types.EmbeddedStorage.Foundation; + +import java.io.IOException; import java.nio.file.Path; -import org.springframework.beans.factory.DisposableBean; -import org.springframework.beans.factory.annotation.Value; +import org.eclipse.store.storage.embedded.types.EmbeddedStorageFoundation; +import org.eclipse.store.storage.types.Storage; import org.springframework.context.annotation.Configuration; +import org.springframework.context.event.ContextClosedEvent; import org.springframework.context.event.ContextRefreshedEvent; import org.springframework.context.event.EventListener; import org.springframework.util.FileSystemUtils; -import org.springframework.beans.factory.annotation.Autowired; -import software.xdev.spring.data.eclipse.store.repository.EclipseStoreStorage; -import software.xdev.spring.data.eclipse.store.repository.config.EnableEclipseStoreRepositories; +import software.xdev.spring.data.eclipse.store.helper.StorageDirectoryNameProvider; +import software.xdev.spring.data.eclipse.store.repository.config.EclipseStoreClientConfiguration; @Configuration -@EnableEclipseStoreRepositories -public class TestConfiguration implements DisposableBean +public class TestConfiguration extends EclipseStoreClientConfiguration { - @Autowired - EclipseStoreStorage storage; + private final String storageDirectory = StorageDirectoryNameProvider.getNewStorageDirectoryPath(); - @Value("${org.eclipse.store.storage-directory}") - private String storageDirectory; + @Override + public EmbeddedStorageFoundation createEmbeddedStorageFoundation() + { + return Foundation(Storage.Configuration(Storage.FileProvider(Path.of(this.storageDirectory)))); + } @EventListener public void handleContextRefresh(final ContextRefreshedEvent event) { // Init with empty root object - this.storage.clearData(); + this.getStorageInstance().clearData(); } - @Override - public void destroy() throws Exception + @EventListener + public void handleContextClosed(final ContextClosedEvent event) throws IOException { // End with empty root object - this.storage.clearData(); - this.storage.stop(); + this.getStorageInstance().clearData(); + this.getStorageInstance().stop(); FileSystemUtils.deleteRecursively(Path.of(this.storageDirectory)); } } diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/IsolatedTestAnnotations.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/IsolatedTestAnnotations.java similarity index 86% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/IsolatedTestAnnotations.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/IsolatedTestAnnotations.java index 61d27ef1..164c75e1 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/IsolatedTestAnnotations.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/IsolatedTestAnnotations.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package software.xdev.spring.data.eclipse.store.integration.isolated.tests; +package software.xdev.spring.data.eclipse.store.integration.isolated; import static org.springframework.test.annotation.DirtiesContext.ClassMode.BEFORE_EACH_TEST_METHOD; @@ -24,14 +24,12 @@ import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.test.annotation.DirtiesContext; -import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit.jupiter.SpringExtension; @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE) @ExtendWith(SpringExtension.class) -@ContextConfiguration(classes = {IsolatedTestConfiguration.class}) @DirtiesContext(classMode = BEFORE_EACH_TEST_METHOD) public @interface IsolatedTestAnnotations { diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/package-info.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/package-info.java new file mode 100644 index 00000000..917d49c7 --- /dev/null +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/package-info.java @@ -0,0 +1,21 @@ +/* + * Copyright © 2024 XDEV Software (https://xdev.software) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * The repositories of these tests are seperated from each other. That means that e.g. the + * {@link software.xdev.spring.data.eclipse.store.integration.isolated.tests.special.types.TypesTest} can't access the + * {@link software.xdev.spring.data.eclipse.store.integration.isolated.tests.keywords.MinimalRepository}. + */ +package software.xdev.spring.data.eclipse.store.integration.isolated; diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/IsolatedTestConfiguration.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/IsolatedTestConfiguration.java deleted file mode 100644 index a5be2ce0..00000000 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/IsolatedTestConfiguration.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright © 2023 XDEV Software (https://xdev.software) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package software.xdev.spring.data.eclipse.store.integration.isolated.tests; - -import java.nio.file.Path; - -import org.springframework.beans.factory.DisposableBean; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.event.ContextRefreshedEvent; -import org.springframework.context.event.EventListener; -import org.springframework.util.FileSystemUtils; - -import software.xdev.spring.data.eclipse.store.repository.EclipseStoreStorage; -import software.xdev.spring.data.eclipse.store.repository.config.EnableEclipseStoreRepositories; - - -@Configuration -@EnableEclipseStoreRepositories -public class IsolatedTestConfiguration implements DisposableBean -{ - @Autowired - EclipseStoreStorage storage; - - @Value("${org.eclipse.store.storage-directory}") - private String storageDirectory; - - @EventListener - public void handleContextRefresh(final ContextRefreshedEvent event) - { - // Init with empty root object - this.storage.clearData(); - } - - @Override - public void destroy() throws Exception - { - // End with empty root object - this.storage.clearData(); - this.storage.stop(); - FileSystemUtils.deleteRecursively(Path.of(this.storageDirectory)); - } -} diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/deletion/DeletionTest.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/deletion/DeletionTest.java new file mode 100644 index 00000000..da5a3827 --- /dev/null +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/deletion/DeletionTest.java @@ -0,0 +1,87 @@ +/* + * Copyright © 2024 XDEV Software (https://xdev.software) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package software.xdev.spring.data.eclipse.store.integration.isolated.tests.deletion; + +import java.util.List; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.context.ContextConfiguration; + +import software.xdev.spring.data.eclipse.store.helper.TestUtil; +import software.xdev.spring.data.eclipse.store.integration.isolated.IsolatedTestAnnotations; + + +/** + * These tests should show that all or most of the following keywords are available in this library: Repository query + * keywords + */ +@IsolatedTestAnnotations +@ContextConfiguration(classes = {DeletionTestConfiguration.class}) +class DeletionTest +{ + @Autowired + private DeletionTestConfiguration configuration; + + @Test + void deleteReferencedObject( + @Autowired final ReferencedRepository referencedRepository, + @Autowired final ReferencingRepository referencingRepository) + { + final ReferencedDaoObject referencedObject = new ReferencedDaoObject("someValue"); + final ReferencingDaoObject referencingDaoObject = new ReferencingDaoObject(referencedObject); + referencingRepository.save(referencingDaoObject); + + Assertions.assertEquals(1, TestUtil.iterableToList(referencingRepository.findAll()).size()); + Assertions.assertEquals(1, TestUtil.iterableToList(referencedRepository.findAll()).size()); + + referencedRepository.delete(referencedObject); + + TestUtil.doBeforeAndAfterRestartOfDatastore( + this.configuration, + () -> { + Assertions.assertTrue(TestUtil.iterableToList(referencedRepository.findAll()).isEmpty()); + final List referencingDaoObjects = + TestUtil.iterableToList(referencingRepository.findAll()); + Assertions.assertEquals(1, referencingDaoObjects.size()); + Assertions.assertNotNull(referencingDaoObjects.get(0).getValue()); + } + ); + } + + @Test + void restoreDeletedReferencedObject( + @Autowired final ReferencedRepository referencedRepository, + @Autowired final ReferencingRepository referencingRepository) + { + final ReferencedDaoObject referencedObject = new ReferencedDaoObject("someValue"); + final ReferencingDaoObject referencingDaoObject = new ReferencingDaoObject(referencedObject); + + referencingRepository.save(referencingDaoObject); + referencedRepository.delete(referencedObject); + referencingRepository.save(referencingDaoObject); + + TestUtil.doBeforeAndAfterRestartOfDatastore( + this.configuration, + () -> { + Assertions.assertEquals(1, TestUtil.iterableToList(referencingRepository.findAll()).size()); + Assertions.assertEquals(1, TestUtil.iterableToList(referencedRepository.findAll()).size()); + } + ); + } +} diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/deletion/DeletionTestConfiguration.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/deletion/DeletionTestConfiguration.java new file mode 100644 index 00000000..0db7c903 --- /dev/null +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/deletion/DeletionTestConfiguration.java @@ -0,0 +1,28 @@ +/* + * Copyright © 2024 XDEV Software (https://xdev.software) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package software.xdev.spring.data.eclipse.store.integration.isolated.tests.deletion; + +import org.springframework.context.annotation.Configuration; + +import software.xdev.spring.data.eclipse.store.integration.TestConfiguration; +import software.xdev.spring.data.eclipse.store.repository.config.EnableEclipseStoreRepositories; + + +@Configuration +@EnableEclipseStoreRepositories(clientConfigurationClass = DeletionTestConfiguration.class) +public class DeletionTestConfiguration extends TestConfiguration +{ +} diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/deletion/ReferencedDaoObject.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/deletion/ReferencedDaoObject.java new file mode 100644 index 00000000..94577218 --- /dev/null +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/deletion/ReferencedDaoObject.java @@ -0,0 +1,36 @@ +/* + * Copyright © 2024 XDEV Software (https://xdev.software) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package software.xdev.spring.data.eclipse.store.integration.isolated.tests.deletion; + +public class ReferencedDaoObject +{ + private String value; + + public ReferencedDaoObject(final String value) + { + this.value = value; + } + + public String getValue() + { + return this.value; + } + + public void setValue(final String value) + { + this.value = value; + } +} diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/deletion/ReferencedRepository.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/deletion/ReferencedRepository.java new file mode 100644 index 00000000..7cc76772 --- /dev/null +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/deletion/ReferencedRepository.java @@ -0,0 +1,23 @@ +/* + * Copyright © 2024 XDEV Software (https://xdev.software) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package software.xdev.spring.data.eclipse.store.integration.isolated.tests.deletion; + +import org.springframework.data.repository.CrudRepository; + + +public interface ReferencedRepository extends CrudRepository +{ +} diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/deletion/ReferencingDaoObject.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/deletion/ReferencingDaoObject.java new file mode 100644 index 00000000..15d4cf5a --- /dev/null +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/deletion/ReferencingDaoObject.java @@ -0,0 +1,36 @@ +/* + * Copyright © 2024 XDEV Software (https://xdev.software) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package software.xdev.spring.data.eclipse.store.integration.isolated.tests.deletion; + +public class ReferencingDaoObject +{ + private ReferencedDaoObject value; + + public ReferencingDaoObject(final ReferencedDaoObject value) + { + this.value = value; + } + + public ReferencedDaoObject getValue() + { + return this.value; + } + + public void setValue(final ReferencedDaoObject value) + { + this.value = value; + } +} diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/deletion/ReferencingRepository.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/deletion/ReferencingRepository.java new file mode 100644 index 00000000..f89a1885 --- /dev/null +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/deletion/ReferencingRepository.java @@ -0,0 +1,23 @@ +/* + * Copyright © 2024 XDEV Software (https://xdev.software) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package software.xdev.spring.data.eclipse.store.integration.isolated.tests.deletion; + +import org.springframework.data.repository.CrudRepository; + + +public interface ReferencingRepository extends CrudRepository +{ +} diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/keywords/KeywordsTest.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/keywords/KeywordsTest.java index 61c012ca..e4e09179 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/keywords/KeywordsTest.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/keywords/KeywordsTest.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,11 +19,10 @@ import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.context.TestPropertySource; +import org.springframework.test.context.ContextConfiguration; import software.xdev.spring.data.eclipse.store.helper.TestUtil; -import software.xdev.spring.data.eclipse.store.integration.isolated.tests.IsolatedTestAnnotations; -import software.xdev.spring.data.eclipse.store.repository.EclipseStoreStorage; +import software.xdev.spring.data.eclipse.store.integration.isolated.IsolatedTestAnnotations; /** @@ -32,14 +31,11 @@ * keywords */ @IsolatedTestAnnotations -@TestPropertySource( - properties = - "org.eclipse.store.storage-directory=./target/keywords-tests-storage" -) +@ContextConfiguration(classes = {KeywordsTestConfiguration.class}) class KeywordsTest { @Autowired - private EclipseStoreStorage storage; + private KeywordsTestConfiguration configuration; @Test @Disabled("For now we don't need 'existsBy'") @@ -48,7 +44,7 @@ void simpleStoreAndRead(final MinimalRepository repository) repository.save(new MinimalDaoObject("1")); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { Assertions.assertTrue(repository.existsByValue("1")); Assertions.assertFalse(repository.existsByValue("2")); diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/keywords/KeywordsTestConfiguration.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/keywords/KeywordsTestConfiguration.java new file mode 100644 index 00000000..6c3d3a65 --- /dev/null +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/keywords/KeywordsTestConfiguration.java @@ -0,0 +1,28 @@ +/* + * Copyright © 2024 XDEV Software (https://xdev.software) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package software.xdev.spring.data.eclipse.store.integration.isolated.tests.keywords; + +import org.springframework.context.annotation.Configuration; + +import software.xdev.spring.data.eclipse.store.integration.TestConfiguration; +import software.xdev.spring.data.eclipse.store.repository.config.EnableEclipseStoreRepositories; + + +@Configuration +@EnableEclipseStoreRepositories(clientConfigurationClass = KeywordsTestConfiguration.class) +public class KeywordsTestConfiguration extends TestConfiguration +{ +} diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/keywords/MinimalDaoObject.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/keywords/MinimalDaoObject.java index f306c867..c7c52c70 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/keywords/MinimalDaoObject.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/keywords/MinimalDaoObject.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/keywords/MinimalRepository.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/keywords/MinimalRepository.java index c1db0a3f..534c042b 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/keywords/MinimalRepository.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/keywords/MinimalRepository.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/lazy/ComplexLazyObject.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/lazy/ComplexLazyObject.java new file mode 100644 index 00000000..02413a96 --- /dev/null +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/lazy/ComplexLazyObject.java @@ -0,0 +1,55 @@ +/* + * Copyright © 2024 XDEV Software (https://xdev.software) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package software.xdev.spring.data.eclipse.store.integration.isolated.tests.lazy; + +import java.util.List; + +import org.eclipse.serializer.reference.Lazy; + + +public class ComplexLazyObject +{ + private Lazy simpleObject; + private List>> listOfLazyListOfString; + + public ComplexLazyObject( + final Lazy simpleObject, + final List>> listOfLazyListOfString) + { + this.simpleObject = simpleObject; + this.listOfLazyListOfString = listOfLazyListOfString; + } + + public Lazy getSimpleObject() + { + return this.simpleObject; + } + + public void setSimpleObject(final Lazy simpleObject) + { + this.simpleObject = simpleObject; + } + + public List>> getListOfLazyListOfString() + { + return this.listOfLazyListOfString; + } + + public void setListOfLazyListOfString(final List>> listOfLazyListOfString) + { + this.listOfLazyListOfString = listOfLazyListOfString; + } +} diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/lazy/LazyTest.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/lazy/LazyTest.java new file mode 100644 index 00000000..b51c683e --- /dev/null +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/lazy/LazyTest.java @@ -0,0 +1,468 @@ +/* + * Copyright © 2024 XDEV Software (https://xdev.software) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package software.xdev.spring.data.eclipse.store.integration.isolated.tests.lazy; + +import static software.xdev.spring.data.eclipse.store.helper.TestUtil.restartDatastore; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import org.eclipse.serializer.collections.lazy.LazyArrayList; +import org.eclipse.serializer.collections.lazy.LazyList; +import org.eclipse.serializer.reference.Lazy; +import org.eclipse.serializer.reference.LazyReferenceManager; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.context.ContextConfiguration; + +import software.xdev.spring.data.eclipse.store.helper.TestData; +import software.xdev.spring.data.eclipse.store.helper.TestUtil; +import software.xdev.spring.data.eclipse.store.integration.isolated.IsolatedTestAnnotations; +import software.xdev.spring.data.eclipse.store.repository.lazy.SpringDataEclipseStoreLazy; + + +@IsolatedTestAnnotations +@ContextConfiguration(classes = {LazyTestConfiguration.class}) +class LazyTest +{ + @Autowired + private LazyTestConfiguration configuration; + + @Test + @Disabled("This should work at some point. At least a warning should be displayed.") + void lazyListStore(@Autowired final ObjectWithLazyListRepository repository) + { + final ObjectWithLazyList newList = new ObjectWithLazyList(); + final SimpleObject objectToStore = new SimpleObject(TestData.DUMMY_STRING); + final LazyArrayList lazyArrayList = new LazyArrayList<>(); + lazyArrayList.add(objectToStore); + newList.setLazyList(lazyArrayList); + repository.save(newList); + + TestUtil.doBeforeAndAfterRestartOfDatastore( + this.configuration, + () -> { + Assertions.assertEquals(1, repository.findAll().size()); + final LazyList loadedLazyList = repository.findAll().get(0).getLazyList(); + Assertions.assertEquals(1, loadedLazyList.size()); + Assertions.assertEquals(objectToStore, loadedLazyList.get(0)); + } + ); + } + + @Test + void lazyStore(@Autowired final ObjectWithLazyRepository repository) + { + final ObjectWithLazy newLazy = new ObjectWithLazy<>(); + final SimpleObject objectToStore = new SimpleObject(TestData.DUMMY_STRING); + newLazy.setLazy(SpringDataEclipseStoreLazy.build(objectToStore)); + repository.save(newLazy); + + TestUtil.doBeforeAndAfterRestartOfDatastore( + this.configuration, + () -> { + Assertions.assertEquals(1, repository.findAll().size()); + final Lazy lazy = repository.findAll().get(0).getLazy(); + Assertions.assertEquals(objectToStore, lazy.get()); + } + ); + } + + @Test + void lazyGetsCleared(@Autowired final ObjectWithLazyRepository repository) + { + final ObjectWithLazy newLazy = new ObjectWithLazy<>(); + final SimpleObject objectToStore = new SimpleObject(TestData.DUMMY_STRING); + newLazy.setLazy(SpringDataEclipseStoreLazy.build(objectToStore)); + repository.save(newLazy); + + restartDatastore(this.configuration); + + final List> loadedObjects = repository.findAll(); + Assertions.assertEquals(1, loadedObjects.size()); + Assertions.assertFalse(loadedObjects.get(0).getLazy().isLoaded()); + Assertions.assertNotNull(loadedObjects.get(0).getLazy().get()); + Assertions.assertTrue(loadedObjects.get(0).getLazy().isLoaded()); + + LazyReferenceManager.get().clear(); + Assertions.assertFalse(repository.findAll().get(0).getLazy().isLoaded()); + } + + @Test + void lazyWorkingCopyIsCreated(@Autowired final ObjectWithLazyRepository repository) + { + final ObjectWithLazy newLazy = new ObjectWithLazy<>(); + final SimpleObject objectToStore = new SimpleObject(TestData.DUMMY_STRING); + newLazy.setLazy(SpringDataEclipseStoreLazy.build(objectToStore)); + repository.save(newLazy); + + TestUtil.doBeforeAndAfterRestartOfDatastore( + this.configuration, + () -> { + final SimpleObject storedObject = newLazy.getLazy().get(); + final SimpleObject loadedObject = repository.findAll().get(0).getLazy().get(); + Assertions.assertNotSame(storedObject, loadedObject); + Assertions.assertEquals(storedObject, loadedObject); + } + ); + } + + @Test + void lazyDifferentWorkingCopiesAreCreated(@Autowired final ObjectWithLazyRepository repository) + { + final ObjectWithLazy newLazy = new ObjectWithLazy<>(); + final SimpleObject objectToStore = new SimpleObject(TestData.DUMMY_STRING); + newLazy.setLazy(SpringDataEclipseStoreLazy.build(objectToStore)); + repository.save(newLazy); + + TestUtil.doBeforeAndAfterRestartOfDatastore( + this.configuration, + () -> { + final ObjectWithLazy workingCopy1 = repository.findAll().get(0); + final ObjectWithLazy workingCopy2 = repository.findAll().get(0); + Assertions.assertNotSame(workingCopy1.getLazy(), workingCopy2.getLazy()); + Assertions.assertNotSame(workingCopy1.getLazy().get(), workingCopy2.getLazy().get()); + Assertions.assertEquals(workingCopy1.getLazy().get(), workingCopy2.getLazy().get()); + } + ); + } + + @Test + void lazyWorkingCopyChange(@Autowired final ObjectWithLazyRepository repository) + { + final ObjectWithLazy newLazy = new ObjectWithLazy<>(); + final SimpleObject objectToStore = new SimpleObject(TestData.DUMMY_STRING); + newLazy.setLazy(SpringDataEclipseStoreLazy.build(objectToStore)); + repository.save(newLazy); + + final SimpleObject changedObjectToStore = new SimpleObject(TestData.DUMMY_STRING_ALTERNATIVE); + newLazy.setLazy(SpringDataEclipseStoreLazy.build(changedObjectToStore)); + + TestUtil.doBeforeAndAfterRestartOfDatastore( + this.configuration, + () -> { + Assertions.assertNotEquals(newLazy.getLazy().get(), repository.findAll().get(0).getLazy().get()); + } + ); + } + + @Test + void lazyWorkingCopyChangeAfterRestart(@Autowired final ObjectWithLazyRepository repository) + { + final ObjectWithLazy newLazy = new ObjectWithLazy<>(); + final SimpleObject objectToStore = new SimpleObject(TestData.DUMMY_STRING); + newLazy.setLazy(SpringDataEclipseStoreLazy.build(objectToStore)); + repository.save(newLazy); + + restartDatastore(this.configuration); + + final SimpleObject changedObjectToStore = new SimpleObject(TestData.DUMMY_STRING_ALTERNATIVE); + final ObjectWithLazy objectToChange = repository.findAll().get(0); + objectToChange.setLazy(SpringDataEclipseStoreLazy.build(changedObjectToStore)); + + Assertions.assertNotEquals(objectToChange.getLazy().get(), repository.findAll().get(0).getLazy().get()); + + repository.save(objectToChange); + + final ObjectWithLazy workingCopy1 = repository.findAll().get(0); + final ObjectWithLazy workingCopy2 = repository.findAll().get(0); + Assertions.assertEquals(workingCopy1.getLazy().get(), workingCopy2.getLazy().get()); + } + + @Test + void lazyStoreComplexObject(@Autowired final ObjectWithLazyRepository repository) + { + final ObjectWithLazy newLazy = new ObjectWithLazy<>(); + final ComplexLazyObject objectToStore = new ComplexLazyObject( + SpringDataEclipseStoreLazy.build(new SimpleObject(TestData.DUMMY_STRING)), + new ArrayList<>(Arrays.asList( + SpringDataEclipseStoreLazy.build(new ArrayList<>(Arrays.asList(TestData.DUMMY_STRING))), + SpringDataEclipseStoreLazy.build(new ArrayList<>(Arrays.asList(TestData.DUMMY_STRING_ALTERNATIVE))) + )) + ); + newLazy.setLazy(SpringDataEclipseStoreLazy.build(objectToStore)); + repository.save(newLazy); + + TestUtil.doBeforeAndAfterRestartOfDatastore( + this.configuration, + () -> { + Assertions.assertEquals(1, repository.findAll().size()); + final Lazy lazy = repository.findAll().get(0).getLazy(); + Assertions.assertNotNull(lazy.get()); + Assertions.assertEquals(objectToStore.getSimpleObject().get(), lazy.get().getSimpleObject().get()); + Assertions.assertEquals( + objectToStore.getListOfLazyListOfString().size(), + lazy.get().getListOfLazyListOfString().size()); + Assertions.assertEquals( + objectToStore.getListOfLazyListOfString().get(0).get(), + lazy.get().getListOfLazyListOfString().get(0).get()); + Assertions.assertEquals( + objectToStore.getListOfLazyListOfString().get(1).get(), + lazy.get().getListOfLazyListOfString().get(1).get()); + } + ); + } + + @Test + void lazyChangeComplexObject(@Autowired final ObjectWithLazyRepository repository) + { + final ObjectWithLazy newLazy = new ObjectWithLazy<>(); + final ComplexLazyObject objectToStore = new ComplexLazyObject( + SpringDataEclipseStoreLazy.build(new SimpleObject(TestData.DUMMY_STRING)), + new ArrayList<>(Arrays.asList( + SpringDataEclipseStoreLazy.build(new ArrayList<>(Arrays.asList(TestData.DUMMY_STRING))), + SpringDataEclipseStoreLazy.build(new ArrayList<>(Arrays.asList(TestData.DUMMY_STRING_ALTERNATIVE))) + )) + ); + newLazy.setLazy(SpringDataEclipseStoreLazy.build(objectToStore)); + repository.save(newLazy); + + restartDatastore(this.configuration); + + final ObjectWithLazy loadedObjectToChange = repository.findAll().get(0); + loadedObjectToChange + .getLazy() + .get() + .getListOfLazyListOfString() + .add(SpringDataEclipseStoreLazy.build(List.of(TestData.DUMMY_STRING_ALTERNATIVE))); + repository.save(loadedObjectToChange); + + TestUtil.doBeforeAndAfterRestartOfDatastore( + this.configuration, + () -> { + final ObjectWithLazy loadedObject = repository.findAll().get(0); + Assertions.assertNotSame(loadedObjectToChange, loadedObject); + Assertions.assertNotSame( + loadedObjectToChange.getLazy().get(), + loadedObject.getLazy().get() + ); + Assertions.assertEquals( + loadedObjectToChange.getLazy().get().getListOfLazyListOfString().size(), + loadedObject.getLazy().get().getListOfLazyListOfString().size() + ); + Assertions.assertEquals( + loadedObjectToChange.getLazy().get().getListOfLazyListOfString().get(0).get().size(), + loadedObject.getLazy().get().getListOfLazyListOfString().get(0).get().size() + ); + Assertions.assertEquals( + loadedObjectToChange.getLazy().get().getListOfLazyListOfString().get(0).get().get(0), + loadedObject.getLazy().get().getListOfLazyListOfString().get(0).get().get(0) + ); + } + ); + } + + @Test + void lazyReloadAndRestoreComplexObject(@Autowired final ObjectWithLazyRepository repository) + { + final ObjectWithLazy newLazy = new ObjectWithLazy<>(); + final ComplexLazyObject objectToStore = new ComplexLazyObject( + SpringDataEclipseStoreLazy.build(new SimpleObject(TestData.DUMMY_STRING)), + new ArrayList<>(Arrays.asList( + SpringDataEclipseStoreLazy.build(new ArrayList<>(Arrays.asList(TestData.DUMMY_STRING))), + SpringDataEclipseStoreLazy.build(new ArrayList<>(Arrays.asList(TestData.DUMMY_STRING_ALTERNATIVE))) + )) + ); + newLazy.setLazy(SpringDataEclipseStoreLazy.build(objectToStore)); + repository.save(newLazy); + + restartDatastore(this.configuration); + + final ObjectWithLazy loadedObjectToChange = repository.findAll().get(0); + repository.save(loadedObjectToChange); + + TestUtil.doBeforeAndAfterRestartOfDatastore( + this.configuration, + () -> { + final ObjectWithLazy loadedObject = repository.findAll().get(0); + Assertions.assertNotSame(loadedObjectToChange, loadedObject); + Assertions.assertNotSame( + loadedObjectToChange.getLazy().get(), + loadedObject.getLazy().get() + ); + Assertions.assertEquals( + loadedObjectToChange.getLazy().get().getListOfLazyListOfString().size(), + loadedObject.getLazy().get().getListOfLazyListOfString().size() + ); + Assertions.assertEquals( + loadedObjectToChange.getLazy().get().getListOfLazyListOfString().get(0).get().size(), + loadedObject.getLazy().get().getListOfLazyListOfString().get(0).get().size() + ); + Assertions.assertEquals( + loadedObjectToChange.getLazy().get().getListOfLazyListOfString().get(0).get().get(0), + loadedObject.getLazy().get().getListOfLazyListOfString().get(0).get().get(0) + ); + } + ); + } + + @Test + void lazyClearBeforeSave() + { + final ObjectWithLazy newLazy = new ObjectWithLazy<>(); + final SimpleObject objectToStore = new SimpleObject(TestData.DUMMY_STRING); + newLazy.setLazy(SpringDataEclipseStoreLazy.build(objectToStore)); + final Lazy lazy = newLazy.getLazy(); + Assertions.assertThrows(IllegalStateException.class, () -> lazy.clear()); + } + + @Test + @Disabled("This should work at some point. At least a warning should be displayed.") + void lazyUseEclipseStoreLazy(@Autowired final ObjectWithLazyRepository repository) + { + final ObjectWithLazy newLazy = new ObjectWithLazy<>(); + final SimpleObject objectToStore = new SimpleObject(TestData.DUMMY_STRING); + newLazy.setLazy(Lazy.Reference(objectToStore)); + Assertions.assertThrows(Exception.class, () -> repository.save(newLazy)); + } + + @Test + void lazyClearAfterSave(@Autowired final ObjectWithLazyRepository repository) + { + final ObjectWithLazy newLazy = new ObjectWithLazy<>(); + final SimpleObject objectToStore = new SimpleObject(TestData.DUMMY_STRING); + newLazy.setLazy(SpringDataEclipseStoreLazy.build(objectToStore)); + + Assertions.assertTrue(newLazy.getLazy().isLoaded()); + Assertions.assertFalse(newLazy.getLazy().isStored()); + + repository.save(newLazy); + + Assertions.assertTrue(newLazy.getLazy().isLoaded()); + Assertions.assertTrue(newLazy.getLazy().isStored()); + + newLazy.getLazy().clear(); + + TestUtil.doBeforeAndAfterRestartOfDatastore( + this.configuration, + () -> { + Assertions.assertEquals(1, repository.findAll().size()); + final Lazy lazy = repository.findAll().get(0).getLazy(); + Assertions.assertFalse(lazy.isLoaded()); + Assertions.assertEquals(objectToStore, lazy.get()); + Assertions.assertTrue(lazy.isLoaded()); + } + ); + } + + @Test + void lazyClearThroughLazyManagerAfterSave(@Autowired final ObjectWithLazyRepository repository) + { + final ObjectWithLazy newLazy = new ObjectWithLazy<>(); + final SimpleObject objectToStore = new SimpleObject(TestData.DUMMY_STRING); + newLazy.setLazy(SpringDataEclipseStoreLazy.build(objectToStore)); + repository.save(newLazy); + LazyReferenceManager.get().cleanUp(); + + TestUtil.doBeforeAndAfterRestartOfDatastore( + this.configuration, + () -> { + Assertions.assertEquals(1, repository.findAll().size()); + final Lazy lazy = repository.findAll().get(0).getLazy(); + Assertions.assertFalse(lazy.isLoaded()); + Assertions.assertEquals(objectToStore, lazy.get()); + Assertions.assertTrue(lazy.isLoaded()); + } + ); + } + + @Test + void lazyClearAfterRestart(@Autowired final ObjectWithLazyRepository repository) + { + final ObjectWithLazy newLazy = new ObjectWithLazy<>(); + final SimpleObject objectToStore = new SimpleObject(TestData.DUMMY_STRING); + newLazy.setLazy(SpringDataEclipseStoreLazy.build(objectToStore)); + repository.save(newLazy); + + restartDatastore(this.configuration); + + Assertions.assertDoesNotThrow(() -> newLazy.getLazy().clear()); + } + + @Test + void lazyChangeAfterSave(@Autowired final ObjectWithLazyRepository repository) + { + final ObjectWithLazy newLazy = new ObjectWithLazy<>(); + final SimpleObject objectToStore = new SimpleObject(TestData.DUMMY_STRING); + newLazy.setLazy(SpringDataEclipseStoreLazy.build(objectToStore)); + repository.save(newLazy); + + final SimpleObject objectToStore2 = new SimpleObject(TestData.DUMMY_STRING_ALTERNATIVE); + newLazy.setLazy(SpringDataEclipseStoreLazy.build(objectToStore2)); + repository.save(newLazy); + + TestUtil.doBeforeAndAfterRestartOfDatastore( + this.configuration, + () -> { + Assertions.assertEquals(1, repository.findAll().size()); + final Lazy lazy = repository.findAll().get(0).getLazy(); + Assertions.assertEquals(objectToStore2, lazy.get()); + } + ); + } + + @Test + void lazyChangeBeforeSave(@Autowired final ObjectWithLazyRepository repository) + { + final ObjectWithLazy newLazy = new ObjectWithLazy<>(); + final SimpleObject objectToStore = new SimpleObject(TestData.DUMMY_STRING); + newLazy.setLazy(SpringDataEclipseStoreLazy.build(objectToStore)); + + final SimpleObject objectToStore2 = new SimpleObject(TestData.DUMMY_STRING_ALTERNATIVE); + newLazy.setLazy(SpringDataEclipseStoreLazy.build(objectToStore2)); + repository.save(newLazy); + + TestUtil.doBeforeAndAfterRestartOfDatastore( + this.configuration, + () -> { + Assertions.assertEquals(1, repository.findAll().size()); + final Lazy lazy = repository.findAll().get(0).getLazy(); + Assertions.assertEquals(objectToStore2, lazy.get()); + } + ); + } + + @Test + void lazyChangeAfterRestart(@Autowired final ObjectWithLazyRepository repository) + { + final ObjectWithLazy newLazy = new ObjectWithLazy<>(); + final SimpleObject objectToStore = new SimpleObject(TestData.DUMMY_STRING); + newLazy.setLazy(SpringDataEclipseStoreLazy.build(objectToStore)); + repository.save(newLazy); + + restartDatastore(this.configuration); + + Assertions.assertEquals(1, repository.findAll().size()); + final ObjectWithLazy reloadedObjectWithLazy = repository.findAll().get(0); + Assertions.assertEquals(objectToStore, reloadedObjectWithLazy.getLazy().get()); + + final SimpleObject objectToStore2 = new SimpleObject(TestData.DUMMY_STRING_ALTERNATIVE); + reloadedObjectWithLazy.setLazy(SpringDataEclipseStoreLazy.build(objectToStore2)); + repository.save(reloadedObjectWithLazy); + + TestUtil.doBeforeAndAfterRestartOfDatastore( + this.configuration, + () -> { + Assertions.assertEquals(1, repository.findAll().size()); + final Lazy lazy = repository.findAll().get(0).getLazy(); + Assertions.assertEquals(objectToStore2, lazy.get()); + } + ); + } +} diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/lazy/LazyTestConfiguration.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/lazy/LazyTestConfiguration.java new file mode 100644 index 00000000..75dcafa4 --- /dev/null +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/lazy/LazyTestConfiguration.java @@ -0,0 +1,28 @@ +/* + * Copyright © 2024 XDEV Software (https://xdev.software) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package software.xdev.spring.data.eclipse.store.integration.isolated.tests.lazy; + +import org.springframework.context.annotation.Configuration; + +import software.xdev.spring.data.eclipse.store.integration.TestConfiguration; +import software.xdev.spring.data.eclipse.store.repository.config.EnableEclipseStoreRepositories; + + +@Configuration +@EnableEclipseStoreRepositories(clientConfigurationClass = LazyTestConfiguration.class) +public class LazyTestConfiguration extends TestConfiguration +{ +} diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/lazy/ObjectWithLazy.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/lazy/ObjectWithLazy.java new file mode 100644 index 00000000..f670d298 --- /dev/null +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/lazy/ObjectWithLazy.java @@ -0,0 +1,34 @@ +/* + * Copyright © 2024 XDEV Software (https://xdev.software) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package software.xdev.spring.data.eclipse.store.integration.isolated.tests.lazy; + +import org.eclipse.serializer.reference.Lazy; + + +public class ObjectWithLazy +{ + private Lazy lazy; + + public Lazy getLazy() + { + return this.lazy; + } + + public void setLazy(final Lazy lazy) + { + this.lazy = lazy; + } +} diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/lazy/ObjectWithLazyHashMap.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/lazy/ObjectWithLazyHashMap.java new file mode 100644 index 00000000..10b2f430 --- /dev/null +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/lazy/ObjectWithLazyHashMap.java @@ -0,0 +1,34 @@ +/* + * Copyright © 2024 XDEV Software (https://xdev.software) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package software.xdev.spring.data.eclipse.store.integration.isolated.tests.lazy; + +import org.eclipse.serializer.collections.lazy.LazyHashMap; + + +public class ObjectWithLazyHashMap +{ + private LazyHashMap lazyHashMap; + + public LazyHashMap getLazyHashMap() + { + return this.lazyHashMap; + } + + public void setLazyHashMap(final LazyHashMap lazyHashMap) + { + this.lazyHashMap = lazyHashMap; + } +} diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/lazy/ObjectWithLazyHashMapRepository.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/lazy/ObjectWithLazyHashMapRepository.java new file mode 100644 index 00000000..3a4f8857 --- /dev/null +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/lazy/ObjectWithLazyHashMapRepository.java @@ -0,0 +1,23 @@ +/* + * Copyright © 2024 XDEV Software (https://xdev.software) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package software.xdev.spring.data.eclipse.store.integration.isolated.tests.lazy; + +import org.springframework.data.repository.ListCrudRepository; + + +public interface ObjectWithLazyHashMapRepository extends ListCrudRepository +{ +} diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/lazy/ObjectWithLazyHashSet.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/lazy/ObjectWithLazyHashSet.java new file mode 100644 index 00000000..2f8b0cd4 --- /dev/null +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/lazy/ObjectWithLazyHashSet.java @@ -0,0 +1,34 @@ +/* + * Copyright © 2024 XDEV Software (https://xdev.software) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package software.xdev.spring.data.eclipse.store.integration.isolated.tests.lazy; + +import org.eclipse.serializer.collections.lazy.LazyHashSet; + + +public class ObjectWithLazyHashSet +{ + private LazyHashSet lazyHashSet; + + public LazyHashSet getLazyHashSet() + { + return this.lazyHashSet; + } + + public void setLazyHashSet(final LazyHashSet lazyHashSet) + { + this.lazyHashSet = lazyHashSet; + } +} diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/lazy/ObjectWithLazyHashSetRepository.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/lazy/ObjectWithLazyHashSetRepository.java new file mode 100644 index 00000000..070ff4b8 --- /dev/null +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/lazy/ObjectWithLazyHashSetRepository.java @@ -0,0 +1,23 @@ +/* + * Copyright © 2024 XDEV Software (https://xdev.software) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package software.xdev.spring.data.eclipse.store.integration.isolated.tests.lazy; + +import org.springframework.data.repository.ListCrudRepository; + + +public interface ObjectWithLazyHashSetRepository extends ListCrudRepository +{ +} diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/lazy/ObjectWithLazyList.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/lazy/ObjectWithLazyList.java new file mode 100644 index 00000000..e15783c0 --- /dev/null +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/lazy/ObjectWithLazyList.java @@ -0,0 +1,34 @@ +/* + * Copyright © 2024 XDEV Software (https://xdev.software) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package software.xdev.spring.data.eclipse.store.integration.isolated.tests.lazy; + +import org.eclipse.serializer.collections.lazy.LazyList; + + +public class ObjectWithLazyList +{ + private LazyList lazyList; + + public LazyList getLazyList() + { + return this.lazyList; + } + + public void setLazyList(final LazyList lazyList) + { + this.lazyList = lazyList; + } +} diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/lazy/ObjectWithLazyListRepository.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/lazy/ObjectWithLazyListRepository.java new file mode 100644 index 00000000..773e1d0d --- /dev/null +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/lazy/ObjectWithLazyListRepository.java @@ -0,0 +1,23 @@ +/* + * Copyright © 2024 XDEV Software (https://xdev.software) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package software.xdev.spring.data.eclipse.store.integration.isolated.tests.lazy; + +import org.springframework.data.repository.ListCrudRepository; + + +public interface ObjectWithLazyListRepository extends ListCrudRepository +{ +} diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/lazy/ObjectWithLazyRepository.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/lazy/ObjectWithLazyRepository.java new file mode 100644 index 00000000..a0e4164f --- /dev/null +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/lazy/ObjectWithLazyRepository.java @@ -0,0 +1,23 @@ +/* + * Copyright © 2024 XDEV Software (https://xdev.software) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package software.xdev.spring.data.eclipse.store.integration.isolated.tests.lazy; + +import org.springframework.data.repository.ListCrudRepository; + + +public interface ObjectWithLazyRepository extends ListCrudRepository, Integer> +{ +} diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/lazy/ObjectWithLazySimpleObject.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/lazy/ObjectWithLazySimpleObject.java new file mode 100644 index 00000000..75dbfb07 --- /dev/null +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/lazy/ObjectWithLazySimpleObject.java @@ -0,0 +1,31 @@ +/* + * Copyright © 2024 XDEV Software (https://xdev.software) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package software.xdev.spring.data.eclipse.store.integration.isolated.tests.lazy; + +public class ObjectWithLazySimpleObject +{ + private SimpleObject lazySimpleObject; + + public SimpleObject getLazySimpleObject() + { + return this.lazySimpleObject; + } + + public void setLazySimpleObject(final SimpleObject lazySimpleObject) + { + this.lazySimpleObject = lazySimpleObject; + } +} diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/lazy/ObjectWithLazySimpleObjectRepository.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/lazy/ObjectWithLazySimpleObjectRepository.java new file mode 100644 index 00000000..4bd550a6 --- /dev/null +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/lazy/ObjectWithLazySimpleObjectRepository.java @@ -0,0 +1,23 @@ +/* + * Copyright © 2024 XDEV Software (https://xdev.software) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package software.xdev.spring.data.eclipse.store.integration.isolated.tests.lazy; + +import org.springframework.data.repository.ListCrudRepository; + + +public interface ObjectWithLazySimpleObjectRepository extends ListCrudRepository +{ +} diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/lazy/SimpleObject.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/lazy/SimpleObject.java new file mode 100644 index 00000000..f09879e4 --- /dev/null +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/lazy/SimpleObject.java @@ -0,0 +1,20 @@ +/* + * Copyright © 2024 XDEV Software (https://xdev.software) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package software.xdev.spring.data.eclipse.store.integration.isolated.tests.lazy; + +public record SimpleObject(String value) +{ +} diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/BigDecimalDaoObject.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/BigDecimalDaoObject.java index 52c42c58..bbb331d6 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/BigDecimalDaoObject.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/BigDecimalDaoObject.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/BigDecimalRepository.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/BigDecimalRepository.java index f56eb4a8..44451dde 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/BigDecimalRepository.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/BigDecimalRepository.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/BigIntegerDaoObject.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/BigIntegerDaoObject.java index 90dc44f1..5dba8163 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/BigIntegerDaoObject.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/BigIntegerDaoObject.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/BigIntegerRepository.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/BigIntegerRepository.java index 74a8d364..7dcc0f5e 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/BigIntegerRepository.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/BigIntegerRepository.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/CalendarDaoObject.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/CalendarDaoObject.java index 3b835475..df30ccbc 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/CalendarDaoObject.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/CalendarDaoObject.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/CalendarRepository.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/CalendarRepository.java index 187d33fb..85451deb 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/CalendarRepository.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/CalendarRepository.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/ComplexObject.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/ComplexObject.java index 5561bb6c..6c5b61ab 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/ComplexObject.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/ComplexObject.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/DateDaoObject.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/DateDaoObject.java index f93dfa12..6a3b066f 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/DateDaoObject.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/DateDaoObject.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/DateRepository.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/DateRepository.java index f967c16f..b25a000d 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/DateRepository.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/DateRepository.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/EnumMapDaoObject.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/EnumMapDaoObject.java index cd81c07c..dfd07ec3 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/EnumMapDaoObject.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/EnumMapDaoObject.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/EnumMapRepository.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/EnumMapRepository.java index 4f49be48..77f5ce6e 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/EnumMapRepository.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/EnumMapRepository.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/EnumSetDaoObject.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/EnumSetDaoObject.java index 31acf389..01738257 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/EnumSetDaoObject.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/EnumSetDaoObject.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/EnumSetRepository.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/EnumSetRepository.java index f2f186b8..aea2509a 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/EnumSetRepository.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/EnumSetRepository.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/LazyDaoObject.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/LazyDaoObject.java index 41221a67..a58bf983 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/LazyDaoObject.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/LazyDaoObject.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,6 +15,8 @@ */ package software.xdev.spring.data.eclipse.store.integration.isolated.tests.special.types; +import java.util.Objects; + import org.eclipse.serializer.reference.Lazy; @@ -24,4 +26,29 @@ public LazyDaoObject(final Integer id, final Lazy value) { super(id, value); } + + @Override + public int hashCode() + { + return super.hashCode(); + } + + @Override + public boolean equals(final Object o) + { + if(this == o) + { + return true; + } + if(o == null || this.getClass() != o.getClass()) + { + return false; + } + final ComplexObject> that = (ComplexObject>)o; + return Objects.equals(this.getId(), that.getId()) + && (this.getValue() == null && that.getValue() == null) + || Objects.equals( + this.getValue().get(), + that.getValue().get()); + } } diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/LazyRepository.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/LazyRepository.java index a3cd5e37..812806ee 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/LazyRepository.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/LazyRepository.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/ListDaoObject.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/ListDaoObject.java index f4cb80e7..8d6b1154 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/ListDaoObject.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/ListDaoObject.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/ListRepository.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/ListRepository.java index b0351524..3aad2865 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/ListRepository.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/ListRepository.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/LocalDateDaoObject.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/LocalDateDaoObject.java index bf6cf781..c232caa1 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/LocalDateDaoObject.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/LocalDateDaoObject.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/LocalDateRepository.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/LocalDateRepository.java index 0aa50229..a44c110d 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/LocalDateRepository.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/LocalDateRepository.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/LocalDateTimeDaoObject.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/LocalDateTimeDaoObject.java index 169ea937..6a4e5ac9 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/LocalDateTimeDaoObject.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/LocalDateTimeDaoObject.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/LocalDateTimeRepository.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/LocalDateTimeRepository.java index 737c6ebf..c5d83582 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/LocalDateTimeRepository.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/LocalDateTimeRepository.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/LocalTimeDaoObject.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/LocalTimeDaoObject.java index 953aeab5..6ae4c6b1 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/LocalTimeDaoObject.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/LocalTimeDaoObject.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/LocalTimeRepository.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/LocalTimeRepository.java index db1cac67..046295b0 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/LocalTimeRepository.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/LocalTimeRepository.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/MapDaoObject.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/MapDaoObject.java index 372ec6b3..fc466f74 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/MapDaoObject.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/MapDaoObject.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/MapRepository.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/MapRepository.java index ebbb1d18..4e9e790d 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/MapRepository.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/MapRepository.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/OptionalDaoObject.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/OptionalDaoObject.java index 228abedc..6a50a276 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/OptionalDaoObject.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/OptionalDaoObject.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/OptionalRepository.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/OptionalRepository.java index 7868afc6..be0456d0 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/OptionalRepository.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/OptionalRepository.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/SetDaoObject.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/SetDaoObject.java index be214b09..07dcf5dc 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/SetDaoObject.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/SetDaoObject.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/SetRepository.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/SetRepository.java index e3ed468b..c75f089f 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/SetRepository.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/SetRepository.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/SpecialTypesTestConfiguration.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/SpecialTypesTestConfiguration.java new file mode 100644 index 00000000..54a8bc9a --- /dev/null +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/SpecialTypesTestConfiguration.java @@ -0,0 +1,28 @@ +/* + * Copyright © 2024 XDEV Software (https://xdev.software) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package software.xdev.spring.data.eclipse.store.integration.isolated.tests.special.types; + +import org.springframework.context.annotation.Configuration; + +import software.xdev.spring.data.eclipse.store.integration.TestConfiguration; +import software.xdev.spring.data.eclipse.store.repository.config.EnableEclipseStoreRepositories; + + +@Configuration +@EnableEclipseStoreRepositories(clientConfigurationClass = SpecialTypesTestConfiguration.class) +public class SpecialTypesTestConfiguration extends TestConfiguration +{ +} diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/TypesData.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/TypesData.java index 4429ddb6..0062d6de 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/TypesData.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/TypesData.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -44,14 +44,21 @@ import java.util.function.Function; import java.util.stream.Stream; -import org.eclipse.serializer.reference.Lazy; +import org.eclipse.serializer.collections.lazy.LazyArrayList; +import org.eclipse.serializer.collections.lazy.LazyHashMap; +import org.eclipse.serializer.collections.lazy.LazyHashSet; import org.junit.jupiter.params.provider.Arguments; import software.xdev.spring.data.eclipse.store.repository.interfaces.EclipseStoreRepository; +import software.xdev.spring.data.eclipse.store.repository.lazy.SpringDataEclipseStoreLazy; final class TypesData { + private TypesData() + { + } + public record ListOfTestArguments(List> testArguments) { public Stream toArguments() @@ -378,6 +385,11 @@ public static Stream generateData() OptionalRepository.class, id -> new OptionalDaoObject(id, null), set -> set.setValue(Optional.of("1")) + ), + new TestArguments<>( + LazyRepository.class, + id -> new LazyDaoObject(id, SpringDataEclipseStoreLazy.build("1")), + object -> object.setValue(SpringDataEclipseStoreLazy.build("2")) ) ) ).toArguments(); @@ -392,16 +404,6 @@ public static Stream generateNotWorkingData() { return new ListOfTestArguments( List.of( - new TestArguments<>( - LazyRepository.class, - id -> new LazyDaoObject(id, Lazy.Reference("1")), - object -> object.setValue(Lazy.Reference("2")) - ), - new TestArguments<>( - LazyRepository.class, - id -> new LazyDaoObject(id, Lazy.Reference("1")), - object -> object.getValue().clear() - ), new TestArguments<>( EnumMapRepository.class, id -> new EnumMapDaoObject(id, new EnumMap<>(EnumMapDaoObject.Album.class)), @@ -436,6 +438,82 @@ public static Stream generateNotWorkingData() CalendarRepository.class, id -> new CalendarDaoObject(id, Calendar.getInstance()), object -> object.getValue().add(Calendar.DAY_OF_MONTH, 1) + ), + new TestArguments<>( + MapRepository.class, + id -> { + final LazyHashMap lazyHashMap = new LazyHashMap<>(); + lazyHashMap.put("1", "1"); + return new MapDaoObject(id, lazyHashMap); + }, + set -> set.getValue().put("2", "2") + ), + new TestArguments<>( + MapRepository.class, + id -> { + final LazyHashMap lazyHashMap = new LazyHashMap<>(); + lazyHashMap.put("1", "1"); + lazyHashMap.put("2", "2"); + return new MapDaoObject(id, lazyHashMap); + }, + set -> set.getValue().put("3", "3") + ), + new TestArguments<>( + SetRepository.class, + id -> new SetDaoObject(id, new LazyHashSet<>()), + set -> set.getValue().add("1") + ), + new TestArguments<>( + SetRepository.class, + id -> + { + final LazyHashSet set = new LazyHashSet<>(); + set.add("1"); + return new SetDaoObject(id, set); + }, + set -> set.getValue().add("2") + ), + new TestArguments<>( + SetRepository.class, + id -> + { + final LazyHashSet set = new LazyHashSet<>(); + set.add("1"); + set.add("2"); + return new SetDaoObject(id, set); + }, + set -> set.getValue().add("3") + ), + new TestArguments<>( + ListRepository.class, + id -> new ListDaoObject(id, new LazyArrayList<>()), + object -> object.getValue().add("1") + ), + new TestArguments<>( + ListRepository.class, + id -> + { + final LazyArrayList list = new LazyArrayList<>(); + list.add("1"); + return new ListDaoObject(id, list); + }, + object -> object.getValue().add("2") + ), + new TestArguments<>( + ListRepository.class, + id -> + { + final LazyArrayList list = new LazyArrayList<>(); + list.add("1"); + list.add("2"); + return new ListDaoObject(id, list); + }, + object -> object.getValue().add("3") + ), + new TestArguments<>( + MapRepository.class, + id -> new MapDaoObject(id, new LazyHashMap<>()), + set -> set.getValue().put("1", "1") ) ) ).toArguments(); diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/TypesTest.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/TypesTest.java index 8c28d405..2cc4ac96 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/TypesTest.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/TypesTest.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,20 +26,16 @@ import org.junit.jupiter.params.provider.MethodSource; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationContext; -import org.springframework.test.context.TestPropertySource; +import org.springframework.test.context.ContextConfiguration; import software.xdev.spring.data.eclipse.store.exceptions.DataTypeNotSupportedException; import software.xdev.spring.data.eclipse.store.helper.TestUtil; -import software.xdev.spring.data.eclipse.store.integration.isolated.tests.IsolatedTestAnnotations; -import software.xdev.spring.data.eclipse.store.repository.EclipseStoreStorage; +import software.xdev.spring.data.eclipse.store.integration.isolated.IsolatedTestAnnotations; import software.xdev.spring.data.eclipse.store.repository.interfaces.EclipseStoreRepository; @IsolatedTestAnnotations -@TestPropertySource( - properties = - "org.eclipse.store.storage-directory=./target/isolated-tests-storage" -) +@ContextConfiguration(classes = {SpecialTypesTestConfiguration.class}) class TypesTest { public static final String TYPES_DATA_SOURCE = @@ -50,7 +46,7 @@ class TypesTest + ".TypesData#generateNotWorkingData"; @Autowired - private EclipseStoreStorage storage; + private SpecialTypesTestConfiguration configuration; @ParameterizedTest @MethodSource(TYPES_DATA_SOURCE) @@ -65,7 +61,7 @@ > void simpleStoreAndRead( repository.save(objectToStore); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> this.dynamicAssertEquals(1, repository, objectToStore) ); } @@ -113,7 +109,7 @@ > void simpleChangeAfterStore( repository.save(storedObject.get()); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> this.dynamicAssertEquals(1, repository, storedObject.get()) ); } @@ -134,7 +130,7 @@ > void doubleStoreSameEntityWithChange( repository.save(objectToStore); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> this.dynamicAssertEquals(1, repository, objectToStore) ); } @@ -153,7 +149,7 @@ > void simpleChangeBeforeStore( repository.save(objectToStore); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> this.dynamicAssertEquals(1, repository, objectToStore) ); } diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/DefaultTestAnnotations.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/DefaultTestAnnotations.java similarity index 81% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/DefaultTestAnnotations.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/DefaultTestAnnotations.java index 299800c4..84295620 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/DefaultTestAnnotations.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/DefaultTestAnnotations.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package software.xdev.spring.data.eclipse.store.integration; +package software.xdev.spring.data.eclipse.store.integration.shared; import static org.springframework.test.annotation.DirtiesContext.ClassMode.BEFORE_EACH_TEST_METHOD; @@ -25,16 +25,14 @@ import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.TestPropertySource; import org.springframework.test.context.junit.jupiter.SpringExtension; @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE) @ExtendWith(SpringExtension.class) -@ContextConfiguration(classes = {TestConfiguration.class}) +@ContextConfiguration(classes = {SharedTestConfiguration.class}) @DirtiesContext(classMode = BEFORE_EACH_TEST_METHOD) -@TestPropertySource("/application.properties") public @interface DefaultTestAnnotations { } diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/SharedTestConfiguration.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/SharedTestConfiguration.java new file mode 100644 index 00000000..565c2270 --- /dev/null +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/SharedTestConfiguration.java @@ -0,0 +1,30 @@ +/* + * Copyright © 2024 XDEV Software (https://xdev.software) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package software.xdev.spring.data.eclipse.store.integration.shared; + +import org.springframework.context.annotation.Configuration; + +import software.xdev.spring.data.eclipse.store.integration.TestConfiguration; +import software.xdev.spring.data.eclipse.store.repository.config.EnableEclipseStoreRepositories; + + +@Configuration +@EnableEclipseStoreRepositories( + value = "software.xdev.spring.data.eclipse.store.integration.shared", + clientConfigurationClass = SharedTestConfiguration.class) +public class SharedTestConfiguration extends TestConfiguration +{ +} diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/package-info.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/package-info.java new file mode 100644 index 00000000..0c47ebef --- /dev/null +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/package-info.java @@ -0,0 +1,19 @@ +/* + * Copyright © 2024 XDEV Software (https://xdev.software) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * These tests SHARE their repositories. That's not ideal and should be changed in the future. + */ +package software.xdev.spring.data.eclipse.store.integration.shared; diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/Child.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/Child.java similarity index 92% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/Child.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/Child.java index c0d24c1a..64521977 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/Child.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/Child.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package software.xdev.spring.data.eclipse.store.integration.repositories; +package software.xdev.spring.data.eclipse.store.integration.shared.repositories; import java.util.Objects; diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/ChildCustomer.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/ChildCustomer.java similarity index 87% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/ChildCustomer.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/ChildCustomer.java index 7af466b3..136fb6b1 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/ChildCustomer.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/ChildCustomer.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package software.xdev.spring.data.eclipse.store.integration.repositories; +package software.xdev.spring.data.eclipse.store.integration.shared.repositories; public class ChildCustomer extends ParentCustomer { diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/ChildCustomerRepository.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/ChildCustomerRepository.java similarity index 83% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/ChildCustomerRepository.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/ChildCustomerRepository.java index 46979d77..a45bed32 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/ChildCustomerRepository.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/ChildCustomerRepository.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package software.xdev.spring.data.eclipse.store.integration.repositories; +package software.xdev.spring.data.eclipse.store.integration.shared.repositories; import org.springframework.data.repository.CrudRepository; diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/Customer.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/Customer.java similarity index 93% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/Customer.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/Customer.java index 89e7d4f7..767ef6d9 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/Customer.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/Customer.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package software.xdev.spring.data.eclipse.store.integration.repositories; +package software.xdev.spring.data.eclipse.store.integration.shared.repositories; import java.util.List; import java.util.Objects; diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/CustomerAsRecord.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/CustomerAsRecord.java similarity index 87% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/CustomerAsRecord.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/CustomerAsRecord.java index 0e082bc9..ab242afa 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/CustomerAsRecord.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/CustomerAsRecord.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package software.xdev.spring.data.eclipse.store.integration.repositories; +package software.xdev.spring.data.eclipse.store.integration.shared.repositories; import java.util.List; diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/CustomerAsRecordRepository.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/CustomerAsRecordRepository.java similarity index 85% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/CustomerAsRecordRepository.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/CustomerAsRecordRepository.java index 0061c6de..8119fc23 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/CustomerAsRecordRepository.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/CustomerAsRecordRepository.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package software.xdev.spring.data.eclipse.store.integration.repositories; +package software.xdev.spring.data.eclipse.store.integration.shared.repositories; import java.util.Optional; diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/CustomerNotCrud.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/CustomerNotCrud.java similarity index 91% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/CustomerNotCrud.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/CustomerNotCrud.java index 99140aa9..00835cdc 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/CustomerNotCrud.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/CustomerNotCrud.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package software.xdev.spring.data.eclipse.store.integration.repositories; +package software.xdev.spring.data.eclipse.store.integration.shared.repositories; import java.util.Objects; diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/CustomerNotCrudRepository.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/CustomerNotCrudRepository.java similarity index 85% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/CustomerNotCrudRepository.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/CustomerNotCrudRepository.java index abf8c087..29e21eb9 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/CustomerNotCrudRepository.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/CustomerNotCrudRepository.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package software.xdev.spring.data.eclipse.store.integration.repositories; +package software.xdev.spring.data.eclipse.store.integration.shared.repositories; import java.util.List; diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/CustomerRepository.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/CustomerRepository.java similarity index 91% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/CustomerRepository.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/CustomerRepository.java index cd2a570b..ec3c5fa2 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/CustomerRepository.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/CustomerRepository.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package software.xdev.spring.data.eclipse.store.integration.repositories; +package software.xdev.spring.data.eclipse.store.integration.shared.repositories; import java.util.List; import java.util.Optional; diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/CustomerRepositoryWithHashSet.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/CustomerRepositoryWithHashSet.java similarity index 83% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/CustomerRepositoryWithHashSet.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/CustomerRepositoryWithHashSet.java index 045d6c17..8e51bc5f 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/CustomerRepositoryWithHashSet.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/CustomerRepositoryWithHashSet.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package software.xdev.spring.data.eclipse.store.integration.repositories; +package software.xdev.spring.data.eclipse.store.integration.shared.repositories; import org.springframework.data.repository.CrudRepository; diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/CustomerRepositoryWithNonFinalHashSet.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/CustomerRepositoryWithNonFinalHashSet.java similarity index 84% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/CustomerRepositoryWithNonFinalHashSet.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/CustomerRepositoryWithNonFinalHashSet.java index 3c729c1b..8cae4400 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/CustomerRepositoryWithNonFinalHashSet.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/CustomerRepositoryWithNonFinalHashSet.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package software.xdev.spring.data.eclipse.store.integration.repositories; +package software.xdev.spring.data.eclipse.store.integration.shared.repositories; import org.springframework.data.repository.CrudRepository; diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/CustomerRepositoryWithQuery.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/CustomerRepositoryWithQuery.java similarity index 88% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/CustomerRepositoryWithQuery.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/CustomerRepositoryWithQuery.java index 69baff3c..86d5b1d2 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/CustomerRepositoryWithQuery.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/CustomerRepositoryWithQuery.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package software.xdev.spring.data.eclipse.store.integration.repositories; +package software.xdev.spring.data.eclipse.store.integration.shared.repositories; import java.util.List; import java.util.Optional; diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/CustomerWithChild.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/CustomerWithChild.java similarity index 94% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/CustomerWithChild.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/CustomerWithChild.java index 668e67f2..07f1ca9d 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/CustomerWithChild.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/CustomerWithChild.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package software.xdev.spring.data.eclipse.store.integration.repositories; +package software.xdev.spring.data.eclipse.store.integration.shared.repositories; import java.util.List; import java.util.Objects; diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/CustomerWithChildRepository.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/CustomerWithChildRepository.java similarity index 85% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/CustomerWithChildRepository.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/CustomerWithChildRepository.java index 65a8cf5e..25e6e98d 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/CustomerWithChildRepository.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/CustomerWithChildRepository.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package software.xdev.spring.data.eclipse.store.integration.repositories; +package software.xdev.spring.data.eclipse.store.integration.shared.repositories; import java.util.Optional; diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/CustomerWithHashSet.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/CustomerWithHashSet.java similarity index 94% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/CustomerWithHashSet.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/CustomerWithHashSet.java index e6a2c95c..f5e6158f 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/CustomerWithHashSet.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/CustomerWithHashSet.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package software.xdev.spring.data.eclipse.store.integration.repositories; +package software.xdev.spring.data.eclipse.store.integration.shared.repositories; import java.util.HashSet; import java.util.List; diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/CustomerWithNonFinalHashSet.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/CustomerWithNonFinalHashSet.java similarity index 94% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/CustomerWithNonFinalHashSet.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/CustomerWithNonFinalHashSet.java index dc8bbefd..24cc8632 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/CustomerWithNonFinalHashSet.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/CustomerWithNonFinalHashSet.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package software.xdev.spring.data.eclipse.store.integration.repositories; +package software.xdev.spring.data.eclipse.store.integration.shared.repositories; import java.util.HashSet; import java.util.List; diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/CustomerWithQuery.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/CustomerWithQuery.java similarity index 91% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/CustomerWithQuery.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/CustomerWithQuery.java index a4ad8257..b917f505 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/CustomerWithQuery.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/CustomerWithQuery.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package software.xdev.spring.data.eclipse.store.integration.repositories; +package software.xdev.spring.data.eclipse.store.integration.shared.repositories; import java.util.Objects; diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/Node.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/Node.java similarity index 91% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/Node.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/Node.java index d359f8a4..44a933d2 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/Node.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/Node.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package software.xdev.spring.data.eclipse.store.integration.repositories; +package software.xdev.spring.data.eclipse.store.integration.shared.repositories; import java.util.ArrayList; import java.util.List; diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/NodeRepository.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/NodeRepository.java similarity index 83% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/NodeRepository.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/NodeRepository.java index 53555be9..43b0739f 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/NodeRepository.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/NodeRepository.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package software.xdev.spring.data.eclipse.store.integration.repositories; +package software.xdev.spring.data.eclipse.store.integration.shared.repositories; import org.springframework.data.repository.CrudRepository; diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/Owner.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/Owner.java similarity index 93% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/Owner.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/Owner.java index f49d78f4..43ac8d71 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/Owner.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/Owner.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package software.xdev.spring.data.eclipse.store.integration.repositories; +package software.xdev.spring.data.eclipse.store.integration.shared.repositories; import java.util.List; import java.util.Objects; diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/OwnerRepository.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/OwnerRepository.java similarity index 83% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/OwnerRepository.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/OwnerRepository.java index e3b5b5dc..72a47207 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/OwnerRepository.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/OwnerRepository.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package software.xdev.spring.data.eclipse.store.integration.repositories; +package software.xdev.spring.data.eclipse.store.integration.shared.repositories; import org.springframework.data.repository.CrudRepository; diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/ParentCustomer.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/ParentCustomer.java similarity index 93% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/ParentCustomer.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/ParentCustomer.java index c897bc62..bda9afb6 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/ParentCustomer.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/ParentCustomer.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package software.xdev.spring.data.eclipse.store.integration.repositories; +package software.xdev.spring.data.eclipse.store.integration.shared.repositories; import java.util.List; import java.util.Objects; diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/ParentCustomerRepository.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/ParentCustomerRepository.java similarity index 85% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/ParentCustomerRepository.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/ParentCustomerRepository.java index a76780b6..0758223a 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/ParentCustomerRepository.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/ParentCustomerRepository.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package software.xdev.spring.data.eclipse.store.integration.repositories; +package software.xdev.spring.data.eclipse.store.integration.shared.repositories; import org.springframework.data.repository.CrudRepository; import org.springframework.data.repository.PagingAndSortingRepository; diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/SubCustomer.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/SubCustomer.java similarity index 83% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/SubCustomer.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/SubCustomer.java index d7cd1a98..ccb5b68a 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/SubCustomer.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/SubCustomer.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package software.xdev.spring.data.eclipse.store.integration.repositories; +package software.xdev.spring.data.eclipse.store.integration.shared.repositories; public class SubCustomer extends Customer { diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/SubCustomerRepository.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/SubCustomerRepository.java similarity index 84% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/SubCustomerRepository.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/SubCustomerRepository.java index e95e3785..39188d6e 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/SubCustomerRepository.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/SubCustomerRepository.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package software.xdev.spring.data.eclipse.store.integration.repositories; +package software.xdev.spring.data.eclipse.store.integration.shared.repositories; import org.springframework.data.repository.CrudRepository; diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/id/CustomerWithIdInt.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/id/CustomerWithIdInt.java similarity index 93% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/id/CustomerWithIdInt.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/id/CustomerWithIdInt.java index ba16d8d4..30a8c9ca 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/id/CustomerWithIdInt.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/id/CustomerWithIdInt.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package software.xdev.spring.data.eclipse.store.integration.repositories.id; +package software.xdev.spring.data.eclipse.store.integration.shared.repositories.id; import java.util.List; import java.util.Objects; diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/id/CustomerWithIdIntRepository.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/id/CustomerWithIdIntRepository.java similarity index 83% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/id/CustomerWithIdIntRepository.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/id/CustomerWithIdIntRepository.java index b000d441..8e32578d 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/id/CustomerWithIdIntRepository.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/id/CustomerWithIdIntRepository.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package software.xdev.spring.data.eclipse.store.integration.repositories.id; +package software.xdev.spring.data.eclipse.store.integration.shared.repositories.id; import org.springframework.data.repository.CrudRepository; diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/id/CustomerWithIdInteger.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/id/CustomerWithIdInteger.java similarity index 93% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/id/CustomerWithIdInteger.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/id/CustomerWithIdInteger.java index 096d2466..81cd2f1f 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/id/CustomerWithIdInteger.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/id/CustomerWithIdInteger.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package software.xdev.spring.data.eclipse.store.integration.repositories.id; +package software.xdev.spring.data.eclipse.store.integration.shared.repositories.id; import java.util.List; import java.util.Objects; diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/id/CustomerWithIdIntegerNoAutoGenerate.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/id/CustomerWithIdIntegerNoAutoGenerate.java similarity index 93% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/id/CustomerWithIdIntegerNoAutoGenerate.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/id/CustomerWithIdIntegerNoAutoGenerate.java index 5fa96ed0..c3540763 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/id/CustomerWithIdIntegerNoAutoGenerate.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/id/CustomerWithIdIntegerNoAutoGenerate.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package software.xdev.spring.data.eclipse.store.integration.repositories.id; +package software.xdev.spring.data.eclipse.store.integration.shared.repositories.id; import java.util.List; import java.util.Objects; diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/id/CustomerWithIdIntegerNoAutoGenerateRepository.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/id/CustomerWithIdIntegerNoAutoGenerateRepository.java similarity index 84% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/id/CustomerWithIdIntegerNoAutoGenerateRepository.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/id/CustomerWithIdIntegerNoAutoGenerateRepository.java index c86528c3..55c15fe0 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/id/CustomerWithIdIntegerNoAutoGenerateRepository.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/id/CustomerWithIdIntegerNoAutoGenerateRepository.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package software.xdev.spring.data.eclipse.store.integration.repositories.id; +package software.xdev.spring.data.eclipse.store.integration.shared.repositories.id; import org.springframework.data.repository.CrudRepository; diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/id/CustomerWithIdIntegerRepository.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/id/CustomerWithIdIntegerRepository.java similarity index 83% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/id/CustomerWithIdIntegerRepository.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/id/CustomerWithIdIntegerRepository.java index 79a534da..8846c83a 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/id/CustomerWithIdIntegerRepository.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/id/CustomerWithIdIntegerRepository.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package software.xdev.spring.data.eclipse.store.integration.repositories.id; +package software.xdev.spring.data.eclipse.store.integration.shared.repositories.id; import org.springframework.data.repository.CrudRepository; diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/id/CustomerWithIdLong.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/id/CustomerWithIdLong.java similarity index 92% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/id/CustomerWithIdLong.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/id/CustomerWithIdLong.java index e2c003ce..1fa239b0 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/id/CustomerWithIdLong.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/id/CustomerWithIdLong.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package software.xdev.spring.data.eclipse.store.integration.repositories.id; +package software.xdev.spring.data.eclipse.store.integration.shared.repositories.id; import java.util.Objects; diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/id/CustomerWithIdLongRepository.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/id/CustomerWithIdLongRepository.java similarity index 83% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/id/CustomerWithIdLongRepository.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/id/CustomerWithIdLongRepository.java index 29f340f0..d70b9b76 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/id/CustomerWithIdLongRepository.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/id/CustomerWithIdLongRepository.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package software.xdev.spring.data.eclipse.store.integration.repositories.id; +package software.xdev.spring.data.eclipse.store.integration.shared.repositories.id; import org.springframework.data.repository.CrudRepository; diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/id/CustomerWithIdString.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/id/CustomerWithIdString.java similarity index 92% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/id/CustomerWithIdString.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/id/CustomerWithIdString.java index 43045152..4ff3e317 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/id/CustomerWithIdString.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/id/CustomerWithIdString.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package software.xdev.spring.data.eclipse.store.integration.repositories.id; +package software.xdev.spring.data.eclipse.store.integration.shared.repositories.id; import java.util.Objects; diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/id/CustomerWithIdStringRepository.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/id/CustomerWithIdStringRepository.java similarity index 83% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/id/CustomerWithIdStringRepository.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/id/CustomerWithIdStringRepository.java index 85e75ec9..7efb2535 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/id/CustomerWithIdStringRepository.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/id/CustomerWithIdStringRepository.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package software.xdev.spring.data.eclipse.store.integration.repositories.id; +package software.xdev.spring.data.eclipse.store.integration.shared.repositories.id; import org.springframework.data.repository.CrudRepository; diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/id/CustomerWithPurchase.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/id/CustomerWithPurchase.java similarity index 94% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/id/CustomerWithPurchase.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/id/CustomerWithPurchase.java index 69e1e80d..d55f7503 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/id/CustomerWithPurchase.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/id/CustomerWithPurchase.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package software.xdev.spring.data.eclipse.store.integration.repositories.id; +package software.xdev.spring.data.eclipse.store.integration.shared.repositories.id; import java.util.ArrayList; import java.util.List; diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/id/CustomerWithPurchaseRepository.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/id/CustomerWithPurchaseRepository.java similarity index 83% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/id/CustomerWithPurchaseRepository.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/id/CustomerWithPurchaseRepository.java index aa8264e3..9bc5eae8 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/id/CustomerWithPurchaseRepository.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/id/CustomerWithPurchaseRepository.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package software.xdev.spring.data.eclipse.store.integration.repositories.id; +package software.xdev.spring.data.eclipse.store.integration.shared.repositories.id; import org.springframework.data.repository.CrudRepository; diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/id/Purchase.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/id/Purchase.java similarity index 91% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/id/Purchase.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/id/Purchase.java index 69479540..2a3af61e 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/id/Purchase.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/id/Purchase.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package software.xdev.spring.data.eclipse.store.integration.repositories.id; +package software.xdev.spring.data.eclipse.store.integration.shared.repositories.id; import java.util.Objects; diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/immutables/CustomerWithFinal.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/immutables/CustomerWithFinal.java similarity index 92% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/immutables/CustomerWithFinal.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/immutables/CustomerWithFinal.java index 5eae308e..404bf5d9 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/immutables/CustomerWithFinal.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/immutables/CustomerWithFinal.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package software.xdev.spring.data.eclipse.store.integration.repositories.immutables; +package software.xdev.spring.data.eclipse.store.integration.shared.repositories.immutables; import java.util.List; import java.util.Objects; diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/immutables/CustomerWithFinalChild.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/immutables/CustomerWithFinalChild.java similarity index 89% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/immutables/CustomerWithFinalChild.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/immutables/CustomerWithFinalChild.java index f74c8326..359c8033 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/immutables/CustomerWithFinalChild.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/immutables/CustomerWithFinalChild.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,12 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package software.xdev.spring.data.eclipse.store.integration.repositories.immutables; +package software.xdev.spring.data.eclipse.store.integration.shared.repositories.immutables; import java.util.List; import java.util.Objects; -import software.xdev.spring.data.eclipse.store.integration.repositories.Child; +import software.xdev.spring.data.eclipse.store.integration.shared.repositories.Child; public class CustomerWithFinalChild diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/immutables/CustomerWithFinalChildRepository.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/immutables/CustomerWithFinalChildRepository.java similarity index 85% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/immutables/CustomerWithFinalChildRepository.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/immutables/CustomerWithFinalChildRepository.java index 0eb44e4a..59061f54 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/immutables/CustomerWithFinalChildRepository.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/immutables/CustomerWithFinalChildRepository.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package software.xdev.spring.data.eclipse.store.integration.repositories.immutables; +package software.xdev.spring.data.eclipse.store.integration.shared.repositories.immutables; import org.springframework.data.repository.CrudRepository; import org.springframework.data.repository.PagingAndSortingRepository; diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/immutables/CustomerWithFinalId.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/immutables/CustomerWithFinalId.java similarity index 93% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/immutables/CustomerWithFinalId.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/immutables/CustomerWithFinalId.java index f4cad237..4655a388 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/immutables/CustomerWithFinalId.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/immutables/CustomerWithFinalId.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package software.xdev.spring.data.eclipse.store.integration.repositories.immutables; +package software.xdev.spring.data.eclipse.store.integration.shared.repositories.immutables; import java.util.List; import java.util.Objects; diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/immutables/CustomerWithFinalIdRepository.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/immutables/CustomerWithFinalIdRepository.java similarity index 82% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/immutables/CustomerWithFinalIdRepository.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/immutables/CustomerWithFinalIdRepository.java index 7ce5b1fd..83957816 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/immutables/CustomerWithFinalIdRepository.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/immutables/CustomerWithFinalIdRepository.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package software.xdev.spring.data.eclipse.store.integration.repositories.immutables; +package software.xdev.spring.data.eclipse.store.integration.shared.repositories.immutables; import org.springframework.data.repository.CrudRepository; diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/immutables/CustomerWithFinalRepository.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/immutables/CustomerWithFinalRepository.java similarity index 84% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/immutables/CustomerWithFinalRepository.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/immutables/CustomerWithFinalRepository.java index 607c3bf3..2daf2ab1 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/immutables/CustomerWithFinalRepository.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/immutables/CustomerWithFinalRepository.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package software.xdev.spring.data.eclipse.store.integration.repositories.immutables; +package software.xdev.spring.data.eclipse.store.integration.shared.repositories.immutables; import org.springframework.data.repository.CrudRepository; import org.springframework.data.repository.PagingAndSortingRepository; diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/interfaces/CustomerCrud.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/interfaces/CustomerCrud.java similarity index 92% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/interfaces/CustomerCrud.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/interfaces/CustomerCrud.java index 9e7d49ce..d549f64e 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/interfaces/CustomerCrud.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/interfaces/CustomerCrud.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package software.xdev.spring.data.eclipse.store.integration.repositories.interfaces; +package software.xdev.spring.data.eclipse.store.integration.shared.repositories.interfaces; import java.util.List; import java.util.Objects; diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/interfaces/CustomerEclipseStoreCrudRepository.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/interfaces/CustomerEclipseStoreCrudRepository.java similarity index 83% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/interfaces/CustomerEclipseStoreCrudRepository.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/interfaces/CustomerEclipseStoreCrudRepository.java index 4c9bd223..5782778e 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/interfaces/CustomerEclipseStoreCrudRepository.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/interfaces/CustomerEclipseStoreCrudRepository.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package software.xdev.spring.data.eclipse.store.integration.repositories.interfaces; +package software.xdev.spring.data.eclipse.store.integration.shared.repositories.interfaces; import software.xdev.spring.data.eclipse.store.repository.interfaces.EclipseStoreCrudRepository; diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/interfaces/CustomerEclipseStoreListCrudRepository.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/interfaces/CustomerEclipseStoreListCrudRepository.java similarity index 84% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/interfaces/CustomerEclipseStoreListCrudRepository.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/interfaces/CustomerEclipseStoreListCrudRepository.java index cc4337fa..99fd8de1 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/interfaces/CustomerEclipseStoreListCrudRepository.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/interfaces/CustomerEclipseStoreListCrudRepository.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package software.xdev.spring.data.eclipse.store.integration.repositories.interfaces; +package software.xdev.spring.data.eclipse.store.integration.shared.repositories.interfaces; import software.xdev.spring.data.eclipse.store.repository.interfaces.EclipseStoreListCrudRepository; diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/interfaces/CustomerEclipseStoreListPagingAndSortingRepository.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/interfaces/CustomerEclipseStoreListPagingAndSortingRepository.java similarity index 85% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/interfaces/CustomerEclipseStoreListPagingAndSortingRepository.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/interfaces/CustomerEclipseStoreListPagingAndSortingRepository.java index 9fbfea7e..575042ad 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/interfaces/CustomerEclipseStoreListPagingAndSortingRepository.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/interfaces/CustomerEclipseStoreListPagingAndSortingRepository.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package software.xdev.spring.data.eclipse.store.integration.repositories.interfaces; +package software.xdev.spring.data.eclipse.store.integration.shared.repositories.interfaces; import software.xdev.spring.data.eclipse.store.repository.interfaces.EclipseStoreListPagingAndSortingRepositoryRepository; diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/interfaces/CustomerEclipseStorePagingAndSortingRepository.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/interfaces/CustomerEclipseStorePagingAndSortingRepository.java similarity index 84% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/interfaces/CustomerEclipseStorePagingAndSortingRepository.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/interfaces/CustomerEclipseStorePagingAndSortingRepository.java index 7d45e15a..53710546 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/interfaces/CustomerEclipseStorePagingAndSortingRepository.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/interfaces/CustomerEclipseStorePagingAndSortingRepository.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package software.xdev.spring.data.eclipse.store.integration.repositories.interfaces; +package software.xdev.spring.data.eclipse.store.integration.shared.repositories.interfaces; import software.xdev.spring.data.eclipse.store.repository.interfaces.EclipseStorePagingAndSortingRepositoryRepository; diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/interfaces/CustomerEclipseStoreRepository.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/interfaces/CustomerEclipseStoreRepository.java similarity index 83% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/interfaces/CustomerEclipseStoreRepository.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/interfaces/CustomerEclipseStoreRepository.java index b3feecb1..a86bc48a 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/interfaces/CustomerEclipseStoreRepository.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/interfaces/CustomerEclipseStoreRepository.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package software.xdev.spring.data.eclipse.store.integration.repositories.interfaces; +package software.xdev.spring.data.eclipse.store.integration.shared.repositories.interfaces; import software.xdev.spring.data.eclipse.store.repository.interfaces.EclipseStoreRepository; diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/interfaces/CustomerListCrud.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/interfaces/CustomerListCrud.java similarity index 93% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/interfaces/CustomerListCrud.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/interfaces/CustomerListCrud.java index 56e2087d..fedb81fb 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/interfaces/CustomerListCrud.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/interfaces/CustomerListCrud.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package software.xdev.spring.data.eclipse.store.integration.repositories.interfaces; +package software.xdev.spring.data.eclipse.store.integration.shared.repositories.interfaces; import java.util.List; import java.util.Objects; diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/interfaces/CustomerListPagingAndSorting.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/interfaces/CustomerListPagingAndSorting.java similarity index 93% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/interfaces/CustomerListPagingAndSorting.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/interfaces/CustomerListPagingAndSorting.java index 2e848482..e18ddffa 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/interfaces/CustomerListPagingAndSorting.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/interfaces/CustomerListPagingAndSorting.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package software.xdev.spring.data.eclipse.store.integration.repositories.interfaces; +package software.xdev.spring.data.eclipse.store.integration.shared.repositories.interfaces; import java.util.List; import java.util.Objects; diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/interfaces/CustomerPagingAndSorting.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/interfaces/CustomerPagingAndSorting.java similarity index 93% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/interfaces/CustomerPagingAndSorting.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/interfaces/CustomerPagingAndSorting.java index 06ba144f..65837819 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/interfaces/CustomerPagingAndSorting.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/interfaces/CustomerPagingAndSorting.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package software.xdev.spring.data.eclipse.store.integration.repositories.interfaces; +package software.xdev.spring.data.eclipse.store.integration.shared.repositories.interfaces; import java.util.List; import java.util.Objects; diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/interfaces/CustomerSimple.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/interfaces/CustomerSimple.java similarity index 93% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/interfaces/CustomerSimple.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/interfaces/CustomerSimple.java index 775f3198..23ff527d 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/interfaces/CustomerSimple.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/interfaces/CustomerSimple.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package software.xdev.spring.data.eclipse.store.integration.repositories.interfaces; +package software.xdev.spring.data.eclipse.store.integration.shared.repositories.interfaces; import java.util.List; import java.util.Objects; diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/real/life/example/Article.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/real/life/example/Article.java similarity index 89% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/real/life/example/Article.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/real/life/example/Article.java index dd418fcb..a9d5d997 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/real/life/example/Article.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/real/life/example/Article.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package software.xdev.spring.data.eclipse.store.integration.repositories.real.life.example; +package software.xdev.spring.data.eclipse.store.integration.shared.repositories.real.life.example; import java.util.ArrayList; import java.util.Collections; diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/real/life/example/ArticleGroup.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/real/life/example/ArticleGroup.java similarity index 82% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/real/life/example/ArticleGroup.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/real/life/example/ArticleGroup.java index fd6e4bac..dc73ba6d 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/real/life/example/ArticleGroup.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/real/life/example/ArticleGroup.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package software.xdev.spring.data.eclipse.store.integration.repositories.real.life.example; +package software.xdev.spring.data.eclipse.store.integration.shared.repositories.real.life.example; public class ArticleGroup { diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/real/life/example/Invoice.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/real/life/example/Invoice.java similarity index 85% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/real/life/example/Invoice.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/real/life/example/Invoice.java index 8af20a95..868061ee 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/real/life/example/Invoice.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/real/life/example/Invoice.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package software.xdev.spring.data.eclipse.store.integration.repositories.real.life.example; +package software.xdev.spring.data.eclipse.store.integration.shared.repositories.real.life.example; import java.util.List; diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/real/life/example/InvoiceRepository.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/real/life/example/InvoiceRepository.java similarity index 81% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/real/life/example/InvoiceRepository.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/real/life/example/InvoiceRepository.java index 93c9e286..baa35843 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/real/life/example/InvoiceRepository.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/real/life/example/InvoiceRepository.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package software.xdev.spring.data.eclipse.store.integration.repositories.real.life.example; +package software.xdev.spring.data.eclipse.store.integration.shared.repositories.real.life.example; import org.springframework.data.repository.CrudRepository; diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/real/life/example/Position.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/real/life/example/Position.java similarity index 89% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/real/life/example/Position.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/real/life/example/Position.java index 29b55bc6..b0894b12 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/real/life/example/Position.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/real/life/example/Position.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package software.xdev.spring.data.eclipse.store.integration.repositories.real.life.example; +package software.xdev.spring.data.eclipse.store.integration.shared.repositories.real.life.example; import java.util.List; import java.util.Optional; diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/real/life/example/PositionRepository.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/real/life/example/PositionRepository.java similarity index 81% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/real/life/example/PositionRepository.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/real/life/example/PositionRepository.java index d7e98068..c8656c26 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/real/life/example/PositionRepository.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/real/life/example/PositionRepository.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package software.xdev.spring.data.eclipse.store.integration.repositories.real.life.example; +package software.xdev.spring.data.eclipse.store.integration.shared.repositories.real.life.example; import org.springframework.data.repository.CrudRepository; diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/real/life/example/Warehouse.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/real/life/example/Warehouse.java similarity index 86% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/real/life/example/Warehouse.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/real/life/example/Warehouse.java index 9f7bd011..8d5b0663 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/repositories/real/life/example/Warehouse.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/repositories/real/life/example/Warehouse.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package software.xdev.spring.data.eclipse.store.integration.repositories.real.life.example; +package software.xdev.spring.data.eclipse.store.integration.shared.repositories.real.life.example; import java.util.HashSet; import java.util.Set; diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/tests/ChangeRootTests.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/tests/ChangeRootTests.java similarity index 85% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/tests/ChangeRootTests.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/tests/ChangeRootTests.java index 4ce74c8f..356f6c1a 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/tests/ChangeRootTests.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/tests/ChangeRootTests.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,19 +13,19 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package software.xdev.spring.data.eclipse.store.integration.tests; +package software.xdev.spring.data.eclipse.store.integration.shared.tests; import java.util.List; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; - import org.springframework.beans.factory.annotation.Autowired; + import software.xdev.spring.data.eclipse.store.helper.TestUtil; -import software.xdev.spring.data.eclipse.store.integration.DefaultTestAnnotations; -import software.xdev.spring.data.eclipse.store.integration.repositories.Node; -import software.xdev.spring.data.eclipse.store.integration.repositories.NodeRepository; -import software.xdev.spring.data.eclipse.store.repository.EclipseStoreStorage; +import software.xdev.spring.data.eclipse.store.integration.shared.DefaultTestAnnotations; +import software.xdev.spring.data.eclipse.store.integration.shared.SharedTestConfiguration; +import software.xdev.spring.data.eclipse.store.integration.shared.repositories.Node; +import software.xdev.spring.data.eclipse.store.integration.shared.repositories.NodeRepository; @DefaultTestAnnotations @@ -39,7 +39,7 @@ public class ChangeRootTests @Autowired private NodeRepository repository; @Autowired - private EclipseStoreStorage storage; + private SharedTestConfiguration configuration; //@formatter:off /** @@ -55,7 +55,7 @@ void testSaveParentAndFindAll() this.repository.save(parentNode); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { final List nodes = TestUtil.iterableToList(this.repository.findAll()); Assertions.assertEquals(3, nodes.size()); @@ -82,7 +82,7 @@ void testSaveRecursive() this.repository.save(parentNode1); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { final List nodes = TestUtil.iterableToList(this.repository.findAll()); Assertions.assertEquals(3, nodes.size()); @@ -110,7 +110,7 @@ void testSaveGraph() this.repository.save(parentNode); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { final List nodes = TestUtil.iterableToList(this.repository.findAll()); Assertions.assertEquals(3, nodes.size()); diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/tests/ConcurrencyTest.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/tests/ConcurrencyTest.java similarity index 90% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/tests/ConcurrencyTest.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/tests/ConcurrencyTest.java index cfe1039a..81a7b087 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/tests/ConcurrencyTest.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/tests/ConcurrencyTest.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package software.xdev.spring.data.eclipse.store.integration.tests; +package software.xdev.spring.data.eclipse.store.integration.shared.tests; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; @@ -29,13 +29,13 @@ import org.apache.logging.log4j.util.Strings; import org.junit.jupiter.api.Test; - import org.springframework.beans.factory.annotation.Autowired; + import software.xdev.spring.data.eclipse.store.helper.TestUtil; -import software.xdev.spring.data.eclipse.store.integration.DefaultTestAnnotations; -import software.xdev.spring.data.eclipse.store.integration.repositories.Customer; -import software.xdev.spring.data.eclipse.store.integration.repositories.CustomerRepository; -import software.xdev.spring.data.eclipse.store.repository.EclipseStoreStorage; +import software.xdev.spring.data.eclipse.store.integration.shared.DefaultTestAnnotations; +import software.xdev.spring.data.eclipse.store.integration.shared.SharedTestConfiguration; +import software.xdev.spring.data.eclipse.store.integration.shared.repositories.Customer; +import software.xdev.spring.data.eclipse.store.integration.shared.repositories.CustomerRepository; @SuppressWarnings("OptionalGetWithoutIsPresent") @@ -47,7 +47,7 @@ class ConcurrencyTest private CustomerRepository repository; @Autowired - private EclipseStoreStorage storage; + private SharedTestConfiguration configuration; private final List testCustomers = IntStream.range(1, 100).mapToObj((i) -> new Customer(CUSTOMER_NO + i, "")).toList(); @@ -72,7 +72,7 @@ void testSaveConcurrently() throws InterruptedException final List customers = TestUtil.iterableToList(this.repository.findAll()); assertEquals(this.testCustomers.size(), customers.size()); - restartDatastore(this.storage); + restartDatastore(this.configuration); final List customers2 = TestUtil.iterableToList(this.repository.findAll()); assertEquals(this.testCustomers.size(), customers2.size()); } @@ -98,7 +98,7 @@ void testDeleteConcurrently() throws InterruptedException final List customers2 = TestUtil.iterableToList(this.repository.findAll()); assertTrue(customers2.isEmpty()); - restartDatastore(this.storage); + restartDatastore(this.configuration); final List customers3 = TestUtil.iterableToList(this.repository.findAll()); assertTrue(customers3.isEmpty()); } diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/tests/FinalTest.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/tests/FinalTest.java similarity index 70% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/tests/FinalTest.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/tests/FinalTest.java index 77d4f989..00d99a0a 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/tests/FinalTest.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/tests/FinalTest.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package software.xdev.spring.data.eclipse.store.integration.tests; +package software.xdev.spring.data.eclipse.store.integration.shared.tests; import java.util.List; @@ -24,14 +24,14 @@ import software.xdev.spring.data.eclipse.store.exceptions.IdFieldFinalException; import software.xdev.spring.data.eclipse.store.helper.TestData; import software.xdev.spring.data.eclipse.store.helper.TestUtil; -import software.xdev.spring.data.eclipse.store.integration.DefaultTestAnnotations; -import software.xdev.spring.data.eclipse.store.integration.repositories.immutables.CustomerWithFinal; -import software.xdev.spring.data.eclipse.store.integration.repositories.immutables.CustomerWithFinalChild; -import software.xdev.spring.data.eclipse.store.integration.repositories.immutables.CustomerWithFinalChildRepository; -import software.xdev.spring.data.eclipse.store.integration.repositories.immutables.CustomerWithFinalId; -import software.xdev.spring.data.eclipse.store.integration.repositories.immutables.CustomerWithFinalIdRepository; -import software.xdev.spring.data.eclipse.store.integration.repositories.immutables.CustomerWithFinalRepository; -import software.xdev.spring.data.eclipse.store.repository.EclipseStoreStorage; +import software.xdev.spring.data.eclipse.store.integration.shared.DefaultTestAnnotations; +import software.xdev.spring.data.eclipse.store.integration.shared.SharedTestConfiguration; +import software.xdev.spring.data.eclipse.store.integration.shared.repositories.immutables.CustomerWithFinal; +import software.xdev.spring.data.eclipse.store.integration.shared.repositories.immutables.CustomerWithFinalChild; +import software.xdev.spring.data.eclipse.store.integration.shared.repositories.immutables.CustomerWithFinalChildRepository; +import software.xdev.spring.data.eclipse.store.integration.shared.repositories.immutables.CustomerWithFinalId; +import software.xdev.spring.data.eclipse.store.integration.shared.repositories.immutables.CustomerWithFinalIdRepository; +import software.xdev.spring.data.eclipse.store.integration.shared.repositories.immutables.CustomerWithFinalRepository; @DefaultTestAnnotations @@ -45,7 +45,7 @@ class FinalTest CustomerWithFinalIdRepository withFinalIdRepository; @Autowired - EclipseStoreStorage storage; + SharedTestConfiguration configuration; @Test void testSaveAndFindSingle() @@ -54,7 +54,7 @@ void testSaveAndFindSingle() this.repository.save(customer); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { final List customers = TestUtil.iterableToList(this.repository.findAll()); Assertions.assertEquals(1, customers.size()); @@ -71,7 +71,7 @@ void testSaveAndFindSingleWithChild() this.withChildRepository.save(originalCustomer); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { final List customers = TestUtil.iterableToList(this.withChildRepository.findAll()); diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/tests/HashSetTest.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/tests/HashSetTest.java similarity index 85% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/tests/HashSetTest.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/tests/HashSetTest.java index 3c4acc2a..62f494ee 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/tests/HashSetTest.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/tests/HashSetTest.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package software.xdev.spring.data.eclipse.store.integration.tests; +package software.xdev.spring.data.eclipse.store.integration.shared.tests; import java.util.List; import java.util.Set; @@ -24,12 +24,12 @@ import software.xdev.spring.data.eclipse.store.helper.TestData; import software.xdev.spring.data.eclipse.store.helper.TestUtil; -import software.xdev.spring.data.eclipse.store.integration.DefaultTestAnnotations; -import software.xdev.spring.data.eclipse.store.integration.repositories.CustomerRepositoryWithHashSet; -import software.xdev.spring.data.eclipse.store.integration.repositories.CustomerRepositoryWithNonFinalHashSet; -import software.xdev.spring.data.eclipse.store.integration.repositories.CustomerWithHashSet; -import software.xdev.spring.data.eclipse.store.integration.repositories.CustomerWithNonFinalHashSet; -import software.xdev.spring.data.eclipse.store.repository.EclipseStoreStorage; +import software.xdev.spring.data.eclipse.store.integration.shared.DefaultTestAnnotations; +import software.xdev.spring.data.eclipse.store.integration.shared.SharedTestConfiguration; +import software.xdev.spring.data.eclipse.store.integration.shared.repositories.CustomerRepositoryWithHashSet; +import software.xdev.spring.data.eclipse.store.integration.shared.repositories.CustomerRepositoryWithNonFinalHashSet; +import software.xdev.spring.data.eclipse.store.integration.shared.repositories.CustomerWithHashSet; +import software.xdev.spring.data.eclipse.store.integration.shared.repositories.CustomerWithNonFinalHashSet; @DefaultTestAnnotations @@ -41,7 +41,7 @@ class HashSetTest private CustomerRepositoryWithNonFinalHashSet nonFinalRepository; @Autowired - private EclipseStoreStorage storage; + private SharedTestConfiguration configuration; @Test void testSaveAndFindAll() @@ -51,7 +51,7 @@ void testSaveAndFindAll() this.repository.save(customer); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { final List customers = TestUtil.iterableToList(this.repository.findAll()); Assertions.assertEquals(1, customers.size()); @@ -73,7 +73,7 @@ void testSaveAndResaveFindAll() this.repository.save(customerWithHashSet); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { final List customers = TestUtil.iterableToList(this.repository.findAll()); Assertions.assertEquals(1, customers.size()); @@ -91,7 +91,7 @@ void testSaveAndFindAllNonFinal() this.nonFinalRepository.save(customer); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { final List customers = TestUtil.iterableToList(this.nonFinalRepository.findAll()); @@ -110,7 +110,7 @@ void testSaveAndSetAndFindAllNonFinal() this.nonFinalRepository.save(customer); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { final List customers = TestUtil.iterableToList(this.nonFinalRepository.findAll()); @@ -134,7 +134,7 @@ void testSaveAndResetAndFindAllNonFinal() this.nonFinalRepository.save(customerWithHashSet); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { final List customers = TestUtil.iterableToList(this.nonFinalRepository.findAll()); @@ -153,7 +153,7 @@ void testSaveAndSetNullAndFindAllNonFinal() this.nonFinalRepository.save(customer); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { final List customers = TestUtil.iterableToList(this.nonFinalRepository.findAll()); @@ -174,7 +174,7 @@ void testDoubleSaveWithNewInstanceAndFindAll() this.repository.save(reloadedCustomer); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { final List customers = TestUtil.iterableToList(this.repository.findAll()); Assertions.assertEquals(1, customers.size()); diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/tests/IdTest.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/tests/IdTest.java similarity index 86% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/tests/IdTest.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/tests/IdTest.java index 0557f6e1..cf6f91b9 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/tests/IdTest.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/tests/IdTest.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package software.xdev.spring.data.eclipse.store.integration.tests; +package software.xdev.spring.data.eclipse.store.integration.shared.tests; import static software.xdev.spring.data.eclipse.store.helper.TestUtil.restartDatastore; @@ -26,20 +26,21 @@ import software.xdev.spring.data.eclipse.store.helper.TestData; import software.xdev.spring.data.eclipse.store.helper.TestUtil; -import software.xdev.spring.data.eclipse.store.integration.DefaultTestAnnotations; -import software.xdev.spring.data.eclipse.store.integration.repositories.id.CustomerWithIdInt; -import software.xdev.spring.data.eclipse.store.integration.repositories.id.CustomerWithIdIntRepository; -import software.xdev.spring.data.eclipse.store.integration.repositories.id.CustomerWithIdInteger; -import software.xdev.spring.data.eclipse.store.integration.repositories.id.CustomerWithIdIntegerNoAutoGenerate; -import software.xdev.spring.data.eclipse.store.integration.repositories.id.CustomerWithIdIntegerNoAutoGenerateRepository; -import software.xdev.spring.data.eclipse.store.integration.repositories.id.CustomerWithIdIntegerRepository; -import software.xdev.spring.data.eclipse.store.integration.repositories.id.CustomerWithIdLong; -import software.xdev.spring.data.eclipse.store.integration.repositories.id.CustomerWithIdLongRepository; -import software.xdev.spring.data.eclipse.store.integration.repositories.id.CustomerWithIdString; -import software.xdev.spring.data.eclipse.store.integration.repositories.id.CustomerWithIdStringRepository; -import software.xdev.spring.data.eclipse.store.integration.repositories.id.CustomerWithPurchase; -import software.xdev.spring.data.eclipse.store.integration.repositories.id.CustomerWithPurchaseRepository; -import software.xdev.spring.data.eclipse.store.integration.repositories.id.Purchase; +import software.xdev.spring.data.eclipse.store.integration.shared.DefaultTestAnnotations; +import software.xdev.spring.data.eclipse.store.integration.shared.SharedTestConfiguration; +import software.xdev.spring.data.eclipse.store.integration.shared.repositories.id.CustomerWithIdInt; +import software.xdev.spring.data.eclipse.store.integration.shared.repositories.id.CustomerWithIdIntRepository; +import software.xdev.spring.data.eclipse.store.integration.shared.repositories.id.CustomerWithIdInteger; +import software.xdev.spring.data.eclipse.store.integration.shared.repositories.id.CustomerWithIdIntegerNoAutoGenerate; +import software.xdev.spring.data.eclipse.store.integration.shared.repositories.id.CustomerWithIdIntegerNoAutoGenerateRepository; +import software.xdev.spring.data.eclipse.store.integration.shared.repositories.id.CustomerWithIdIntegerRepository; +import software.xdev.spring.data.eclipse.store.integration.shared.repositories.id.CustomerWithIdLong; +import software.xdev.spring.data.eclipse.store.integration.shared.repositories.id.CustomerWithIdLongRepository; +import software.xdev.spring.data.eclipse.store.integration.shared.repositories.id.CustomerWithIdString; +import software.xdev.spring.data.eclipse.store.integration.shared.repositories.id.CustomerWithIdStringRepository; +import software.xdev.spring.data.eclipse.store.integration.shared.repositories.id.CustomerWithPurchase; +import software.xdev.spring.data.eclipse.store.integration.shared.repositories.id.CustomerWithPurchaseRepository; +import software.xdev.spring.data.eclipse.store.integration.shared.repositories.id.Purchase; import software.xdev.spring.data.eclipse.store.repository.EclipseStoreStorage; @@ -48,7 +49,7 @@ class IdTest { @Autowired - private EclipseStoreStorage storage; + private SharedTestConfiguration configuration; @Test void testCreateSingleWithAutoIdInteger(@Autowired final CustomerWithIdIntegerRepository customerRepository) @@ -57,7 +58,7 @@ void testCreateSingleWithAutoIdInteger(@Autowired final CustomerWithIdIntegerRep customerRepository.save(customer1); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { final Optional loadedCustomer = customerRepository.findById(0); Assertions.assertTrue(loadedCustomer.isPresent()); @@ -73,12 +74,12 @@ void testCreateSingleWithAutoIdInteger(@Autowired final CustomerWithIdIntegerRep @Test void testSaveSingleWithoutAnyPreviousCall(@Autowired final CustomerWithIdIntegerRepository customerRepository) { - restartDatastore(this.storage); + restartDatastore(this.configuration); final CustomerWithIdInteger customer1 = new CustomerWithIdInteger(TestData.FIRST_NAME, TestData.LAST_NAME); customerRepository.save(customer1); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { final Optional loadedCustomer = customerRepository.findById(0); Assertions.assertTrue(loadedCustomer.isPresent()); @@ -107,7 +108,7 @@ void testCreateMultipleWithAutoIdInteger(@Autowired final CustomerWithIdIntegerR customerRepository.save(customer2); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { final List loadedCustomers = TestUtil.iterableToList(customerRepository.findAllById(List.of(0, 1))); @@ -128,7 +129,7 @@ void testCreateMultipleWithAutoIdIntegerSingleFinds( customerRepository.save(customer2); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { final Optional loadedCustomer1 = customerRepository.findById(0); Assertions.assertEquals(customer1, loadedCustomer1.get()); @@ -145,7 +146,7 @@ void testCreateSingleWithAutoIdInt(@Autowired final CustomerWithIdIntRepository customerRepository.save(customer1); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { final Optional loadedCustomer = customerRepository.findById(0); Assertions.assertTrue(loadedCustomer.isPresent()); @@ -161,7 +162,7 @@ void testCreateSingleWithAutoIdString(@Autowired final CustomerWithIdStringRepos customerRepository.save(customer1); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { final Optional loadedCustomer = customerRepository.findById("0"); Assertions.assertTrue(loadedCustomer.isPresent()); @@ -180,7 +181,7 @@ void testCreateMultipleWithAutoIdString(@Autowired final CustomerWithIdStringRep customerRepository.save(customer2); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { final List loadedCustomers = TestUtil.iterableToList(customerRepository.findAllById(List.of("0", "1"))); @@ -197,7 +198,7 @@ void testCreateSingleWithAutoIdLong(@Autowired final CustomerWithIdLongRepositor customerRepository.save(customer1); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { final Optional loadedCustomer = customerRepository.findById(0L); Assertions.assertTrue(loadedCustomer.isPresent()); @@ -217,13 +218,13 @@ void testCreateMultipleWithAutoIdLong(@Autowired final CustomerWithIdLongReposit customerRepository.save(customer2); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { final List loadedCustomers = TestUtil.iterableToList(customerRepository.findAllById(List.of(0L, 1L))); Assertions.assertEquals(2, loadedCustomers.size()); Assertions.assertNotEquals(loadedCustomers.get(0), loadedCustomers.get(1)); - final List idList = loadedCustomers.stream().map(c -> c.getId()).toList(); + final List idList = loadedCustomers.stream().map(CustomerWithIdLong::getId).toList(); Assertions.assertTrue(idList.contains(0L)); Assertions.assertTrue(idList.contains(1L)); } @@ -239,7 +240,7 @@ void testCreateSingleWithNoAutoIdInteger( customerRepository.save(customer1); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { final Optional loadedCustomer = customerRepository.findById(0); Assertions.assertTrue(loadedCustomer.isPresent()); @@ -261,7 +262,7 @@ void testCreateMultipleWithNoAutoIdInteger( customerRepository.save(customer2); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { final List loadedCustomers = TestUtil.iterableToList(customerRepository.findAllById(List.of(0, 1))); @@ -280,7 +281,7 @@ void testSaveSingleWithAutoIdInteger( customerRepository.save(customer1); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { final List loadedCustomer = TestUtil.iterableToList(customerRepository.findAll()); @@ -300,7 +301,7 @@ void testSaveSingleWithNoAutoIdInteger( customerRepository.save(customer1); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { final List loadedCustomer = TestUtil.iterableToList(customerRepository.findAll()); @@ -322,7 +323,7 @@ void testAutoIdWithSubnodeWithId( customerRepository.save(customer1); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { final List loadedCustomer = TestUtil.iterableToList(customerRepository.findAll()); @@ -345,7 +346,7 @@ void testAutoIdWithTwoSubnodeWithId( customerRepository.save(customer1); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { final List loadedCustomer = TestUtil.iterableToList(customerRepository.findAll()); @@ -370,7 +371,7 @@ void testAutoIdWithTwoSameSubnodesWithSameIdDifferentNod( customerRepository.save(customer2); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { final List loadedCustomer = TestUtil.iterableToList(customerRepository.findAll()); @@ -400,7 +401,7 @@ void testAutoIdWithTwoSameSubnodesWithSameIdSameNode( customerRepository.save(customer1); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { final List loadedCustomer = TestUtil.iterableToList(customerRepository.findAll()); diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/tests/InheritanceTest.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/tests/InheritanceTest.java similarity index 87% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/tests/InheritanceTest.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/tests/InheritanceTest.java index b28c3c01..28da0952 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/tests/InheritanceTest.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/tests/InheritanceTest.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package software.xdev.spring.data.eclipse.store.integration.tests; +package software.xdev.spring.data.eclipse.store.integration.shared.tests; import java.util.List; @@ -23,14 +23,14 @@ import software.xdev.spring.data.eclipse.store.helper.TestData; import software.xdev.spring.data.eclipse.store.helper.TestUtil; -import software.xdev.spring.data.eclipse.store.integration.DefaultTestAnnotations; -import software.xdev.spring.data.eclipse.store.integration.repositories.ChildCustomer; -import software.xdev.spring.data.eclipse.store.integration.repositories.ChildCustomerRepository; -import software.xdev.spring.data.eclipse.store.integration.repositories.ParentCustomer; -import software.xdev.spring.data.eclipse.store.integration.repositories.ParentCustomerRepository; -import software.xdev.spring.data.eclipse.store.integration.repositories.SubCustomer; -import software.xdev.spring.data.eclipse.store.integration.repositories.SubCustomerRepository; -import software.xdev.spring.data.eclipse.store.repository.EclipseStoreStorage; +import software.xdev.spring.data.eclipse.store.integration.shared.DefaultTestAnnotations; +import software.xdev.spring.data.eclipse.store.integration.shared.SharedTestConfiguration; +import software.xdev.spring.data.eclipse.store.integration.shared.repositories.ChildCustomer; +import software.xdev.spring.data.eclipse.store.integration.shared.repositories.ChildCustomerRepository; +import software.xdev.spring.data.eclipse.store.integration.shared.repositories.ParentCustomer; +import software.xdev.spring.data.eclipse.store.integration.shared.repositories.ParentCustomerRepository; +import software.xdev.spring.data.eclipse.store.integration.shared.repositories.SubCustomer; +import software.xdev.spring.data.eclipse.store.integration.shared.repositories.SubCustomerRepository; @DefaultTestAnnotations @@ -43,7 +43,7 @@ class InheritanceTest @Autowired private SubCustomerRepository subCustomerRepository; @Autowired - private EclipseStoreStorage storage; + private SharedTestConfiguration configuration; @Test void testSaveChildFindParent() @@ -53,7 +53,7 @@ void testSaveChildFindParent() this.childCustomerRepository.save(customer1); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { final List parentCustomers = TestUtil.iterableToList(this.parentCustomerRepository.findAll()); @@ -77,7 +77,7 @@ void testRemoveChildFindParent() this.childCustomerRepository.delete(customer1); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { final List parentCustomers = TestUtil.iterableToList(this.parentCustomerRepository.findAll()); @@ -102,7 +102,7 @@ void testAddChildAndParent() this.parentCustomerRepository.save(parentCustomer); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { final List parentCustomers = TestUtil.iterableToList(this.parentCustomerRepository.findAll()); @@ -125,7 +125,7 @@ void testRemoveOnlyChildFindParent() this.childCustomerRepository.delete(customer1); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { final List parentCustomers = TestUtil.iterableToList(this.parentCustomerRepository.findAll()); @@ -152,7 +152,7 @@ void testRemoveOnlyParentFindParent() this.parentCustomerRepository.delete(parentCustomer); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { final List parentCustomers = TestUtil.iterableToList(this.parentCustomerRepository.findAll()); @@ -179,7 +179,7 @@ void testRemoveAllChildren() this.childCustomerRepository.deleteAll(); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { final List parentCustomers = TestUtil.iterableToList(this.parentCustomerRepository.findAll()); @@ -206,7 +206,7 @@ void testRemoveAllParents() this.parentCustomerRepository.deleteAll(); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { final List parentCustomers = TestUtil.iterableToList(this.parentCustomerRepository.findAll()); @@ -233,7 +233,7 @@ void testChangeChildFindParent() this.childCustomerRepository.save(foundCustomer); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { final List parentCustomers = TestUtil.iterableToList(this.parentCustomerRepository.findAll()); @@ -255,7 +255,7 @@ void testRecursiveFindByFirstNameOneResult() this.subCustomerRepository.save(customer1); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { final SubCustomer foundCustomer = this.subCustomerRepository.findByFirstName(TestData.FIRST_NAME); Assertions.assertNotNull(foundCustomer); diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/tests/JpaCompatibilityTest.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/tests/JpaCompatibilityTest.java similarity index 81% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/tests/JpaCompatibilityTest.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/tests/JpaCompatibilityTest.java index 4a130e3d..5a1a095f 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/tests/JpaCompatibilityTest.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/tests/JpaCompatibilityTest.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,22 +13,21 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package software.xdev.spring.data.eclipse.store.integration.tests; +package software.xdev.spring.data.eclipse.store.integration.shared.tests; import java.util.List; import java.util.Optional; -import org.springframework.beans.factory.annotation.Autowired; - import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; import software.xdev.spring.data.eclipse.store.helper.TestData; import software.xdev.spring.data.eclipse.store.helper.TestUtil; -import software.xdev.spring.data.eclipse.store.integration.DefaultTestAnnotations; -import software.xdev.spring.data.eclipse.store.integration.repositories.CustomerRepositoryWithQuery; -import software.xdev.spring.data.eclipse.store.integration.repositories.CustomerWithQuery; -import software.xdev.spring.data.eclipse.store.repository.EclipseStoreStorage; +import software.xdev.spring.data.eclipse.store.integration.shared.DefaultTestAnnotations; +import software.xdev.spring.data.eclipse.store.integration.shared.SharedTestConfiguration; +import software.xdev.spring.data.eclipse.store.integration.shared.repositories.CustomerRepositoryWithQuery; +import software.xdev.spring.data.eclipse.store.integration.shared.repositories.CustomerWithQuery; @DefaultTestAnnotations @@ -38,7 +37,7 @@ class JpaCompatibilityTest private CustomerRepositoryWithQuery customerRepository; @Autowired - private EclipseStoreStorage storage; + private SharedTestConfiguration configuration; @Test void testUseQueryAnnotationFindAll() @@ -47,7 +46,7 @@ void testUseQueryAnnotationFindAll() this.customerRepository.save(customer1); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { final List customers = TestUtil.iterableToList(this.customerRepository.findAll()); Assertions.assertEquals(1, customers.size()); @@ -64,7 +63,7 @@ void testUseQueryAnnotationFindByFirstName() this.customerRepository.save(customer1); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { final Optional foundCustomer = this.customerRepository.findByFirstName(TestData.FIRST_NAME); @@ -82,7 +81,7 @@ void testUseQueryAnnotationFindAllByLastName() this.customerRepository.save(customer1); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { final List customers = TestUtil.iterableToList(this.customerRepository.findAllByLastName(TestData.LAST_NAME)); diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/tests/QueryTest.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/tests/QueryTest.java similarity index 91% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/tests/QueryTest.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/tests/QueryTest.java index 7ed3c8f9..bf6d24b1 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/tests/QueryTest.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/tests/QueryTest.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,28 +13,27 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package software.xdev.spring.data.eclipse.store.integration.tests; +package software.xdev.spring.data.eclipse.store.integration.shared.tests; import java.util.List; import java.util.Optional; -import org.springframework.beans.factory.annotation.Autowired; - import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Sort; import software.xdev.spring.data.eclipse.store.helper.TestData; import software.xdev.spring.data.eclipse.store.helper.TestUtil; -import software.xdev.spring.data.eclipse.store.integration.DefaultTestAnnotations; -import software.xdev.spring.data.eclipse.store.integration.repositories.Child; -import software.xdev.spring.data.eclipse.store.integration.repositories.Customer; -import software.xdev.spring.data.eclipse.store.integration.repositories.CustomerRepository; -import software.xdev.spring.data.eclipse.store.integration.repositories.CustomerWithChild; -import software.xdev.spring.data.eclipse.store.integration.repositories.CustomerWithChildRepository; -import software.xdev.spring.data.eclipse.store.repository.EclipseStoreStorage; +import software.xdev.spring.data.eclipse.store.integration.shared.DefaultTestAnnotations; +import software.xdev.spring.data.eclipse.store.integration.shared.SharedTestConfiguration; +import software.xdev.spring.data.eclipse.store.integration.shared.repositories.Child; +import software.xdev.spring.data.eclipse.store.integration.shared.repositories.Customer; +import software.xdev.spring.data.eclipse.store.integration.shared.repositories.CustomerRepository; +import software.xdev.spring.data.eclipse.store.integration.shared.repositories.CustomerWithChild; +import software.xdev.spring.data.eclipse.store.integration.shared.repositories.CustomerWithChildRepository; @DefaultTestAnnotations @@ -46,7 +45,7 @@ class QueryTest private CustomerWithChildRepository customerWithChildRepository; @Autowired - private EclipseStoreStorage storage; + private SharedTestConfiguration configuration; @Test void testBasicFindAllByLastNameTwoResults() @@ -57,7 +56,7 @@ void testBasicFindAllByLastNameTwoResults() this.customerRepository.save(customer2); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { final List customers = TestUtil.iterableToList(this.customerRepository.findAllByLastName(TestData.LAST_NAME)); @@ -79,7 +78,7 @@ void testBasicFindAllByLastNameOneResult() this.customerRepository.save(customer2); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { final List customers = TestUtil.iterableToList(this.customerRepository.findAllByLastName(TestData.LAST_NAME_ALTERNATIVE)); @@ -96,7 +95,7 @@ void testBasicFindByFirstNameOneResult() this.customerRepository.save(customer1); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { final Optional foundCustomer = this.customerRepository.findByFirstName(TestData.FIRST_NAME); Assertions.assertTrue(foundCustomer.isPresent()); @@ -114,7 +113,7 @@ void testPageableFindAllTwoPages() this.customerRepository.save(customer2); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { final Pageable pageable = PageRequest.of(0, 1); final List customersPage1 = @@ -139,7 +138,7 @@ void testPageableFindAllUnpaged() this.customerRepository.save(customer2); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { final Pageable pageable = Pageable.unpaged(); final List customersPage = TestUtil.iterableToList(this.customerRepository.findAll(pageable)); @@ -158,7 +157,7 @@ void testPageableFindAllOnePage() this.customerRepository.save(customer2); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { final Pageable pageable = PageRequest.of(0, 2); final List customersPage1 = @@ -183,7 +182,7 @@ void testPageableFindByLastName() this.customerRepository.save(customer2); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { final Pageable pageable = PageRequest.of(0, 10); final List customersPage = @@ -203,7 +202,7 @@ void testPageableFindByFirstNameWithList() this.customerRepository.save(customer2); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { final Pageable pageable = PageRequest.of(0, 10); final List customersPage = @@ -223,7 +222,7 @@ void testSortFindByLastNameDefault() this.customerRepository.save(customer2); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { final Sort sort = Sort.by("firstName"); final List customersPage = @@ -244,7 +243,7 @@ void testSortFindByFirstNameAscending() this.customerRepository.save(customer2); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { final Sort sort = Sort.by("firstName").ascending(); final List customersPage = @@ -265,7 +264,7 @@ void testSortFindByFirstNameAscendingVariant() this.customerRepository.save(customer2); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { final Sort sort = Sort.by(Sort.Direction.ASC, "lastName"); final List customersPage = @@ -286,7 +285,7 @@ void testFindByOrderByLastNameAsc() this.customerRepository.save(customer2); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { final List customersPage = TestUtil.iterableToList(this.customerRepository.findByOrderByLastNameAsc()); @@ -306,7 +305,7 @@ void testSortFindByLastNameDescending() this.customerRepository.save(customer2); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { final Sort sort = Sort.by("firstName").descending(); final List customersPage = @@ -326,7 +325,7 @@ void testFindByChildExistingChild() this.customerWithChildRepository.save(customer); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { final Optional foundCustomer = this.customerWithChildRepository.findByChild(child); Assertions.assertTrue(foundCustomer.isPresent()); @@ -342,7 +341,7 @@ void testFindByChildNewChild() this.customerWithChildRepository.save(customer); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { final Child queryChild = new Child(TestData.FIRST_NAME_ALTERNATIVE, TestData.LAST_NAME_ALTERNATIVE); final Optional foundCustomer = @@ -360,7 +359,7 @@ void testFindByChildWhenNullNotExists() this.customerWithChildRepository.save(customer); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { final Optional foundCustomer = this.customerWithChildRepository.findByChild(null); Assertions.assertTrue(foundCustomer.isEmpty()); @@ -375,7 +374,7 @@ void testFindByChildWhenNullExists() this.customerWithChildRepository.save(customer); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { final Optional foundCustomer = this.customerWithChildRepository.findByChild(null); Assertions.assertTrue(foundCustomer.isPresent()); diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/tests/RealLifeTests.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/tests/RealLifeTests.java similarity index 89% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/tests/RealLifeTests.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/tests/RealLifeTests.java index 75bdba68..026a3a05 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/tests/RealLifeTests.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/tests/RealLifeTests.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package software.xdev.spring.data.eclipse.store.integration.tests; +package software.xdev.spring.data.eclipse.store.integration.shared.tests; -import static software.xdev.spring.data.eclipse.store.integration.repositories.real.life.example.Position.getPositionWithArticleWithName; +import static software.xdev.spring.data.eclipse.store.integration.shared.repositories.real.life.example.Position.getPositionWithArticleWithName; import java.util.ArrayList; import java.util.Arrays; @@ -24,18 +24,18 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; - import org.springframework.beans.factory.annotation.Autowired; + import software.xdev.spring.data.eclipse.store.helper.TestUtil; -import software.xdev.spring.data.eclipse.store.integration.DefaultTestAnnotations; -import software.xdev.spring.data.eclipse.store.integration.repositories.real.life.example.Article; -import software.xdev.spring.data.eclipse.store.integration.repositories.real.life.example.ArticleGroup; -import software.xdev.spring.data.eclipse.store.integration.repositories.real.life.example.Invoice; -import software.xdev.spring.data.eclipse.store.integration.repositories.real.life.example.InvoiceRepository; -import software.xdev.spring.data.eclipse.store.integration.repositories.real.life.example.Position; -import software.xdev.spring.data.eclipse.store.integration.repositories.real.life.example.PositionRepository; -import software.xdev.spring.data.eclipse.store.integration.repositories.real.life.example.Warehouse; -import software.xdev.spring.data.eclipse.store.repository.EclipseStoreStorage; +import software.xdev.spring.data.eclipse.store.integration.shared.DefaultTestAnnotations; +import software.xdev.spring.data.eclipse.store.integration.shared.SharedTestConfiguration; +import software.xdev.spring.data.eclipse.store.integration.shared.repositories.real.life.example.Article; +import software.xdev.spring.data.eclipse.store.integration.shared.repositories.real.life.example.ArticleGroup; +import software.xdev.spring.data.eclipse.store.integration.shared.repositories.real.life.example.Invoice; +import software.xdev.spring.data.eclipse.store.integration.shared.repositories.real.life.example.InvoiceRepository; +import software.xdev.spring.data.eclipse.store.integration.shared.repositories.real.life.example.Position; +import software.xdev.spring.data.eclipse.store.integration.shared.repositories.real.life.example.PositionRepository; +import software.xdev.spring.data.eclipse.store.integration.shared.repositories.real.life.example.Warehouse; @SuppressWarnings("OptionalGetWithoutIsPresent") @@ -54,7 +54,7 @@ public class RealLifeTests @Autowired PositionRepository positionRepository; @Autowired - private EclipseStoreStorage storage; + private SharedTestConfiguration configuration; private Invoice buildDefaultModel() { @@ -90,7 +90,7 @@ void testReplacePositionWithExistingArticle() this.invoiceRepository.save(invoice); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { final Invoice loadedInvoice = TestUtil.iterableToList(this.invoiceRepository.findAll()).get(0); Assertions.assertEquals(2, loadedInvoice.getPositions().size()); @@ -121,7 +121,7 @@ void testReplacePositionWithNewArticleThroughInvoiceRepository() this.invoiceRepository.save(invoice); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { final Invoice loadedInvoice = TestUtil.iterableToList(this.invoiceRepository.findAll()).get(0); final Optional @@ -154,7 +154,7 @@ void testAddNewArticleWithSameWarehouse() this.invoiceRepository.save(invoice); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { final Invoice loadedInvoice = TestUtil.iterableToList(this.invoiceRepository.findAll()).get(0); final Optional @@ -191,7 +191,7 @@ void testReplacePositionWithNewArticleThroughPositionRepository() this.positionRepository.saveAll(positions); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { final List loadedPositions = TestUtil.iterableToList(this.positionRepository.findAll()); final Optional @@ -223,7 +223,7 @@ void testReplacePositionWithNewArticleAndUseImmutableList() this.positionRepository.saveAll(positions); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { final List loadedPositions = TestUtil.iterableToList(this.positionRepository.findAll()); Assertions.assertSame( @@ -238,7 +238,7 @@ void testSaveTwoObjectsWithSameReferenceThroughPositionRepository() { this.buildDefaultModelAndSaveIt(); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { final List positions = TestUtil.iterableToList(this.positionRepository.findAll()); Assertions.assertSame( @@ -253,7 +253,7 @@ void testSaveTwoObjectsWithSameReferenceThroughInvoiceRepository() { this.buildDefaultModelAndSaveIt(); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { final List invoices = TestUtil.iterableToList(this.invoiceRepository.findAll()); Assertions.assertSame( @@ -268,7 +268,7 @@ void testCreateTwoWorkingCopiesThroughTwoRepositories() { this.buildDefaultModelAndSaveIt(); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { final List invoices = TestUtil.iterableToList(this.invoiceRepository.findAll()); final List positions = TestUtil.iterableToList(this.positionRepository.findAll()); @@ -286,7 +286,7 @@ void testCreateTwoWorkingCopiesThroughOneRepository() { this.buildDefaultModelAndSaveIt(); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { final List invoices1 = TestUtil.iterableToList(this.invoiceRepository.findAll()); final List invoices2 = TestUtil.iterableToList(this.invoiceRepository.findAll()); @@ -308,7 +308,7 @@ void testChangeSharedWarehouse() this.positionRepository.save(position1); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { final Position position2 = TestUtil.iterableToList(this.positionRepository.findAll()).get(1); Assertions.assertEquals(newWarehouseName, position2.getArticle().getWarehouses().get(0).getName()); @@ -328,7 +328,7 @@ void testSaveSubRepositoryEntities() this.invoiceRepository.save(invoice); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { final List positions2 = TestUtil.iterableToList(this.positionRepository.findAll()); Assertions.assertEquals(2, positions2.size()); diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/tests/SimpleMultipleTest.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/tests/SimpleMultipleTest.java similarity index 86% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/tests/SimpleMultipleTest.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/tests/SimpleMultipleTest.java index 78869b9b..a9650158 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/tests/SimpleMultipleTest.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/tests/SimpleMultipleTest.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,22 +13,22 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package software.xdev.spring.data.eclipse.store.integration.tests; +package software.xdev.spring.data.eclipse.store.integration.shared.tests; import java.util.List; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; - import org.springframework.beans.factory.annotation.Autowired; + import software.xdev.spring.data.eclipse.store.helper.TestData; import software.xdev.spring.data.eclipse.store.helper.TestUtil; -import software.xdev.spring.data.eclipse.store.integration.DefaultTestAnnotations; -import software.xdev.spring.data.eclipse.store.integration.repositories.Customer; -import software.xdev.spring.data.eclipse.store.integration.repositories.CustomerRepository; -import software.xdev.spring.data.eclipse.store.integration.repositories.Owner; -import software.xdev.spring.data.eclipse.store.integration.repositories.OwnerRepository; -import software.xdev.spring.data.eclipse.store.repository.EclipseStoreStorage; +import software.xdev.spring.data.eclipse.store.integration.shared.DefaultTestAnnotations; +import software.xdev.spring.data.eclipse.store.integration.shared.SharedTestConfiguration; +import software.xdev.spring.data.eclipse.store.integration.shared.repositories.Customer; +import software.xdev.spring.data.eclipse.store.integration.shared.repositories.CustomerRepository; +import software.xdev.spring.data.eclipse.store.integration.shared.repositories.Owner; +import software.xdev.spring.data.eclipse.store.integration.shared.repositories.OwnerRepository; @DefaultTestAnnotations @@ -39,7 +39,7 @@ class SimpleMultipleTest @Autowired private OwnerRepository ownerRepository; @Autowired - private EclipseStoreStorage storage; + private SharedTestConfiguration configuration; @Test void testBasicSaveAndFindAll() @@ -53,7 +53,7 @@ void testBasicSaveAndFindAll() this.ownerRepository.save(owner); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { final List customers = TestUtil.iterableToList(this.customerRepository.findAll()); Assertions.assertEquals(1, customers.size()); @@ -84,7 +84,7 @@ void testMultipleSaveAndFindAll() this.ownerRepository.save(owner2); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { final List customers = TestUtil.iterableToList(this.customerRepository.findAll()); Assertions.assertEquals(2, customers.size()); @@ -115,7 +115,7 @@ void testBasicRemove() this.ownerRepository.delete(owner); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { final List customers = TestUtil.iterableToList(this.customerRepository.findAll()); Assertions.assertTrue(customers.isEmpty()); @@ -150,7 +150,7 @@ void testBasicChange() this.ownerRepository.save(owner); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { // Check saved customer final List customers = TestUtil.iterableToList(this.customerRepository.findAll()); diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/tests/SimpleSingleTest.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/tests/SimpleSingleTest.java similarity index 85% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/tests/SimpleSingleTest.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/tests/SimpleSingleTest.java index 992d2e01..4052eeef 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/tests/SimpleSingleTest.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/tests/SimpleSingleTest.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,27 +13,25 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package software.xdev.spring.data.eclipse.store.integration.tests; +package software.xdev.spring.data.eclipse.store.integration.shared.tests; import java.util.List; import java.util.Optional; -import org.springframework.beans.factory.annotation.Autowired; - import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import software.xdev.spring.data.eclipse.store.helper.TestData; import software.xdev.spring.data.eclipse.store.helper.TestUtil; -import software.xdev.spring.data.eclipse.store.integration.DefaultTestAnnotations; -import software.xdev.spring.data.eclipse.store.integration.repositories.Customer; -import software.xdev.spring.data.eclipse.store.integration.repositories.CustomerAsRecord; -import software.xdev.spring.data.eclipse.store.integration.repositories.CustomerAsRecordRepository; -import software.xdev.spring.data.eclipse.store.integration.repositories.CustomerNotCrud; -import software.xdev.spring.data.eclipse.store.integration.repositories.CustomerNotCrudRepository; -import software.xdev.spring.data.eclipse.store.integration.repositories.CustomerRepository; -import software.xdev.spring.data.eclipse.store.repository.EclipseStoreStorage; +import software.xdev.spring.data.eclipse.store.integration.shared.DefaultTestAnnotations; +import software.xdev.spring.data.eclipse.store.integration.shared.SharedTestConfiguration; +import software.xdev.spring.data.eclipse.store.integration.shared.repositories.Customer; +import software.xdev.spring.data.eclipse.store.integration.shared.repositories.CustomerAsRecord; +import software.xdev.spring.data.eclipse.store.integration.shared.repositories.CustomerAsRecordRepository; +import software.xdev.spring.data.eclipse.store.integration.shared.repositories.CustomerNotCrud; +import software.xdev.spring.data.eclipse.store.integration.shared.repositories.CustomerNotCrudRepository; +import software.xdev.spring.data.eclipse.store.integration.shared.repositories.CustomerRepository; @DefaultTestAnnotations @@ -45,13 +43,13 @@ class SimpleSingleTest private CustomerAsRecordRepository recordRepository; @Autowired - private EclipseStoreStorage storage; + private SharedTestConfiguration configuration; @Test void testNullFindAll() { TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { final List customers = TestUtil.iterableToList(this.repository.findAll()); Assertions.assertTrue(customers.isEmpty()); @@ -66,7 +64,7 @@ void testBasicSaveAndFindSingleRecords() this.recordRepository.save(customer); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { final List customers = TestUtil.iterableToList(this.recordRepository.findAll()); Assertions.assertEquals(1, customers.size()); @@ -84,7 +82,7 @@ void testBasicSaveAndFindMultipleRecords() this.recordRepository.save(customer2); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { final List customers = TestUtil.iterableToList(this.recordRepository.findAll()); final CustomerAsRecord foundCustomer = @@ -108,7 +106,7 @@ void testBasicSaveAndFindByFirstNameRecords() this.recordRepository.save(customer2); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { final Optional foundCustomer = this.recordRepository.findByFirstName(TestData.FIRST_NAME); @@ -139,7 +137,7 @@ void testBasicSaveAndFindAll() this.repository.save(customer); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { final List customers = TestUtil.iterableToList(this.repository.findAll()); Assertions.assertEquals(1, customers.size()); @@ -157,7 +155,7 @@ void testDoubleSaveAndFindAll() this.repository.save(customer); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { final Optional foundCustomer = this.repository.findByFirstName(TestData.FIRST_NAME_ALTERNATIVE); @@ -173,7 +171,7 @@ void testBasicSaveAndFindAllWithNotCrudRepository(@Autowired final CustomerNotCr notCrudRepository.save(customer); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { final List customers = TestUtil.iterableToList(notCrudRepository.findAll()); Assertions.assertEquals(1, customers.size()); @@ -191,7 +189,7 @@ void testMultipleSaveAndFindAll() this.repository.save(customer2); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { final List customers = TestUtil.iterableToList(this.repository.findAll()); Assertions.assertEquals(2, customers.size()); @@ -213,7 +211,7 @@ void testBasicRemove() this.repository.delete(customer); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { final List customers = TestUtil.iterableToList(this.repository.findAll()); Assertions.assertTrue(customers.isEmpty()); @@ -234,7 +232,7 @@ void testBasicChange() this.repository.save(customer); // Check saved customer TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { final List customers = TestUtil.iterableToList(this.repository.findAll()); Assertions.assertEquals(1, customers.size()); @@ -247,7 +245,7 @@ void testBasicChange() @Test void testRestart() { - TestUtil.restartDatastore(this.storage); + TestUtil.restartDatastore(this.configuration); final List customers = TestUtil.iterableToList(this.repository.findAll()); Assertions.assertTrue(customers.isEmpty()); } @@ -257,7 +255,7 @@ void testSaveWithRestart() { final Customer customer = new Customer(TestData.FIRST_NAME, TestData.LAST_NAME); this.repository.save(customer); - TestUtil.restartDatastore(this.storage); + TestUtil.restartDatastore(this.configuration); // Automatically restarts if needed final List customers = TestUtil.iterableToList(this.repository.findAll()); Assertions.assertEquals(1, customers.size()); diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/tests/SpecificInterfacesTest.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/tests/SpecificInterfacesTest.java similarity index 65% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/tests/SpecificInterfacesTest.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/tests/SpecificInterfacesTest.java index 613c1c39..e428269a 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/tests/SpecificInterfacesTest.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/tests/SpecificInterfacesTest.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package software.xdev.spring.data.eclipse.store.integration.tests; +package software.xdev.spring.data.eclipse.store.integration.shared.tests; import java.util.List; @@ -24,18 +24,18 @@ import software.xdev.spring.data.eclipse.store.helper.TestData; import software.xdev.spring.data.eclipse.store.helper.TestUtil; -import software.xdev.spring.data.eclipse.store.integration.DefaultTestAnnotations; -import software.xdev.spring.data.eclipse.store.integration.repositories.interfaces.CustomerCrud; -import software.xdev.spring.data.eclipse.store.integration.repositories.interfaces.CustomerEclipseStoreCrudRepository; -import software.xdev.spring.data.eclipse.store.integration.repositories.interfaces.CustomerEclipseStoreListCrudRepository; -import software.xdev.spring.data.eclipse.store.integration.repositories.interfaces.CustomerEclipseStoreListPagingAndSortingRepository; -import software.xdev.spring.data.eclipse.store.integration.repositories.interfaces.CustomerEclipseStorePagingAndSortingRepository; -import software.xdev.spring.data.eclipse.store.integration.repositories.interfaces.CustomerEclipseStoreRepository; -import software.xdev.spring.data.eclipse.store.integration.repositories.interfaces.CustomerListCrud; -import software.xdev.spring.data.eclipse.store.integration.repositories.interfaces.CustomerListPagingAndSorting; -import software.xdev.spring.data.eclipse.store.integration.repositories.interfaces.CustomerPagingAndSorting; -import software.xdev.spring.data.eclipse.store.integration.repositories.interfaces.CustomerSimple; -import software.xdev.spring.data.eclipse.store.repository.EclipseStoreStorage; +import software.xdev.spring.data.eclipse.store.integration.shared.DefaultTestAnnotations; +import software.xdev.spring.data.eclipse.store.integration.shared.SharedTestConfiguration; +import software.xdev.spring.data.eclipse.store.integration.shared.repositories.interfaces.CustomerCrud; +import software.xdev.spring.data.eclipse.store.integration.shared.repositories.interfaces.CustomerEclipseStoreCrudRepository; +import software.xdev.spring.data.eclipse.store.integration.shared.repositories.interfaces.CustomerEclipseStoreListCrudRepository; +import software.xdev.spring.data.eclipse.store.integration.shared.repositories.interfaces.CustomerEclipseStoreListPagingAndSortingRepository; +import software.xdev.spring.data.eclipse.store.integration.shared.repositories.interfaces.CustomerEclipseStorePagingAndSortingRepository; +import software.xdev.spring.data.eclipse.store.integration.shared.repositories.interfaces.CustomerEclipseStoreRepository; +import software.xdev.spring.data.eclipse.store.integration.shared.repositories.interfaces.CustomerListCrud; +import software.xdev.spring.data.eclipse.store.integration.shared.repositories.interfaces.CustomerListPagingAndSorting; +import software.xdev.spring.data.eclipse.store.integration.shared.repositories.interfaces.CustomerPagingAndSorting; +import software.xdev.spring.data.eclipse.store.integration.shared.repositories.interfaces.CustomerSimple; @DefaultTestAnnotations @@ -53,7 +53,7 @@ class SpecificInterfacesTest private CustomerEclipseStoreListPagingAndSortingRepository listPagingAndSortingRepository; @Autowired - private EclipseStoreStorage storage; + private SharedTestConfiguration configuration; @Test void testSimple() @@ -62,7 +62,7 @@ void testSimple() this.repository.save(customer); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { final List customers = this.repository.findAll(); Assertions.assertEquals(1, customers.size()); @@ -78,7 +78,7 @@ void testCrud() this.crudRepository.save(customer); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { final List customers = TestUtil.iterableToList(this.crudRepository.findAll()); Assertions.assertEquals(1, customers.size()); @@ -94,7 +94,7 @@ void testListCrud() this.listCrudRepository.save(customer); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { final List customers = this.listCrudRepository.findAll(); Assertions.assertEquals(1, customers.size()); @@ -107,7 +107,7 @@ void testListCrud() void testPagingAndSorting() { TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { final List customers = TestUtil.iterableToList(this.pagingAndSortingRepository.findAll( @@ -121,7 +121,7 @@ void testPagingAndSorting() void testListPagingAndSorting() { TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { final List customers = this.listPagingAndSortingRepository.findAll( Sort.unsorted()); diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/tests/StressTest.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/tests/StressTest.java similarity index 78% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/tests/StressTest.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/tests/StressTest.java index 8d97fcd0..a7f59903 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/tests/StressTest.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/tests/StressTest.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package software.xdev.spring.data.eclipse.store.integration.tests; +package software.xdev.spring.data.eclipse.store.integration.shared.tests; import java.util.List; import java.util.stream.IntStream; @@ -21,13 +21,13 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.ValueSource; - import org.springframework.beans.factory.annotation.Autowired; + import software.xdev.spring.data.eclipse.store.helper.TestUtil; -import software.xdev.spring.data.eclipse.store.integration.DefaultTestAnnotations; -import software.xdev.spring.data.eclipse.store.integration.repositories.Customer; -import software.xdev.spring.data.eclipse.store.integration.repositories.CustomerRepository; -import software.xdev.spring.data.eclipse.store.repository.EclipseStoreStorage; +import software.xdev.spring.data.eclipse.store.integration.shared.DefaultTestAnnotations; +import software.xdev.spring.data.eclipse.store.integration.shared.SharedTestConfiguration; +import software.xdev.spring.data.eclipse.store.integration.shared.repositories.Customer; +import software.xdev.spring.data.eclipse.store.integration.shared.repositories.CustomerRepository; @DefaultTestAnnotations @@ -37,7 +37,7 @@ class StressTest private CustomerRepository repository; @Autowired - private EclipseStoreStorage storage; + private SharedTestConfiguration configuration; /** * @param customerCount beyond 5_000 takes quite a long time. That's why 5_000 is the biggest number for single @@ -52,7 +52,7 @@ void testSaveSingleAndRestoreManyCustomers(final int customerCount) ); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { final List customers = TestUtil.iterableToList(this.repository.findAll()); Assertions.assertEquals(customerCount, customers.size()); @@ -71,7 +71,7 @@ void testSaveBulkAndRestoreManyCustomers(final int customerCount) ); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { final List customers = TestUtil.iterableToList(this.repository.findAll()); Assertions.assertEquals(customerCount, customers.size()); diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/tests/WorkingCopyTests.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/tests/WorkingCopyTests.java similarity index 91% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/tests/WorkingCopyTests.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/tests/WorkingCopyTests.java index 55974dec..84de03cb 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/tests/WorkingCopyTests.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/tests/WorkingCopyTests.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package software.xdev.spring.data.eclipse.store.integration.tests; +package software.xdev.spring.data.eclipse.store.integration.shared.tests; import java.util.List; import java.util.Optional; @@ -24,12 +24,12 @@ import software.xdev.spring.data.eclipse.store.helper.TestData; import software.xdev.spring.data.eclipse.store.helper.TestUtil; -import software.xdev.spring.data.eclipse.store.integration.DefaultTestAnnotations; -import software.xdev.spring.data.eclipse.store.integration.repositories.Customer; -import software.xdev.spring.data.eclipse.store.integration.repositories.CustomerRepository; -import software.xdev.spring.data.eclipse.store.integration.repositories.Node; -import software.xdev.spring.data.eclipse.store.integration.repositories.NodeRepository; -import software.xdev.spring.data.eclipse.store.repository.EclipseStoreStorage; +import software.xdev.spring.data.eclipse.store.integration.shared.DefaultTestAnnotations; +import software.xdev.spring.data.eclipse.store.integration.shared.SharedTestConfiguration; +import software.xdev.spring.data.eclipse.store.integration.shared.repositories.Customer; +import software.xdev.spring.data.eclipse.store.integration.shared.repositories.CustomerRepository; +import software.xdev.spring.data.eclipse.store.integration.shared.repositories.Node; +import software.xdev.spring.data.eclipse.store.integration.shared.repositories.NodeRepository; @SuppressWarnings("OptionalGetWithoutIsPresent") @@ -44,7 +44,7 @@ public class WorkingCopyTests @Autowired NodeRepository nodeRepository; @Autowired - private EclipseStoreStorage storage; + private SharedTestConfiguration configuration; @Test void testBasicChangeOnlyAfterSave() @@ -66,7 +66,7 @@ void testBasicChangeOnlyAfterSave() this.customerRepository.save(customer); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { // Check saved customer final List customers2 = TestUtil.iterableToList(this.customerRepository.findAll()); @@ -115,7 +115,7 @@ void testStoreGraphWithCircularRelation() this.nodeRepository.save(parentNode1); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { final List loadedNodes = TestUtil.iterableToList(this.nodeRepository.findAll()); Assertions.assertEquals(3, loadedNodes.size()); @@ -154,7 +154,7 @@ void testStoreGraphWithCircularRelationWithDoubleSave() this.nodeRepository.save(parentNode2); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { final List loadedNodes = TestUtil.iterableToList(this.nodeRepository.findAll()); Assertions.assertEquals(3, loadedNodes.size()); @@ -194,7 +194,7 @@ void testStoreGraphWithCircularRelationWithTrippleSave() this.nodeRepository.save(childNode); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { final List loadedNodes = TestUtil.iterableToList(this.nodeRepository.findAll()); Assertions.assertEquals(3, loadedNodes.size()); @@ -250,7 +250,7 @@ void testModifyGraph() this.nodeRepository.saveAll(loadedNodes1); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { final List loadedNodes3 = TestUtil.iterableToList(this.nodeRepository.findAll()); final Node loadedChildNode2 = @@ -267,7 +267,7 @@ void testBasicFindByFirstNameOneResult() this.customerRepository.save(customer1); TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, + this.configuration, () -> { final Optional foundCustomer = this.customerRepository.findByFirstName(TestData.FIRST_NAME); Assertions.assertNotSame(customer1, foundCustomer.get()); diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/repository/query/EclipseStoreQueryCreatorAndOrTest.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/repository/query/EclipseStoreQueryCreatorAndOrTest.java index 344496c4..99541199 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/repository/query/EclipseStoreQueryCreatorAndOrTest.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/repository/query/EclipseStoreQueryCreatorAndOrTest.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/repository/query/EclipseStoreQueryCreatorBooleanTest.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/repository/query/EclipseStoreQueryCreatorBooleanTest.java index a3e4164e..87047cf1 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/repository/query/EclipseStoreQueryCreatorBooleanTest.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/repository/query/EclipseStoreQueryCreatorBooleanTest.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/repository/query/EclipseStoreQueryCreatorCollectionTest.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/repository/query/EclipseStoreQueryCreatorCollectionTest.java index 107b90fc..9c791de5 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/repository/query/EclipseStoreQueryCreatorCollectionTest.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/repository/query/EclipseStoreQueryCreatorCollectionTest.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/repository/query/EclipseStoreQueryCreatorGreaterLessTest.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/repository/query/EclipseStoreQueryCreatorGreaterLessTest.java index 652c21fe..c21f14f9 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/repository/query/EclipseStoreQueryCreatorGreaterLessTest.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/repository/query/EclipseStoreQueryCreatorGreaterLessTest.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/repository/query/EclipseStoreQueryCreatorIsIsNotTest.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/repository/query/EclipseStoreQueryCreatorIsIsNotTest.java index 7b8ae212..7414f93c 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/repository/query/EclipseStoreQueryCreatorIsIsNotTest.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/repository/query/EclipseStoreQueryCreatorIsIsNotTest.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/repository/query/EclipseStoreQueryCreatorStringTest.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/repository/query/EclipseStoreQueryCreatorStringTest.java index f05f6589..5908e5d9 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/repository/query/EclipseStoreQueryCreatorStringTest.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/repository/query/EclipseStoreQueryCreatorStringTest.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/repository/query/QueryCreatorUtil.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/repository/query/QueryCreatorUtil.java index 4d365471..c7c283f4 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/repository/query/QueryCreatorUtil.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/repository/query/QueryCreatorUtil.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/repository/query/executors/PageableSortableCollectionQuerierTest.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/repository/query/executors/PageableSortableCollectionQuerierTest.java index 9e8d6ebb..b6798947 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/repository/query/executors/PageableSortableCollectionQuerierTest.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/repository/query/executors/PageableSortableCollectionQuerierTest.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/repository/support/copier/DataTypeUtilTest.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/repository/support/copier/DataTypeUtilTest.java index b1ec1493..4f997a50 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/repository/support/copier/DataTypeUtilTest.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/repository/support/copier/DataTypeUtilTest.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/repository/support/copier/object/EclipseStoreRegisteringCopierTest.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/repository/support/copier/registering/RegisteringStorageToWorkingCopyCopierTest.java similarity index 65% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/repository/support/copier/object/EclipseStoreRegisteringCopierTest.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/repository/support/copier/registering/RegisteringStorageToWorkingCopyCopierTest.java index 51ad01bf..2c54b385 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/repository/support/copier/object/EclipseStoreRegisteringCopierTest.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/repository/support/copier/registering/RegisteringStorageToWorkingCopyCopierTest.java @@ -1,5 +1,5 @@ /* - * Copyright © 2023 XDEV Software (https://xdev.software) + * Copyright © 2024 XDEV Software (https://xdev.software) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package software.xdev.spring.data.eclipse.store.repository.support.copier.object; +package software.xdev.spring.data.eclipse.store.repository.support.copier.registering; import java.util.List; import java.util.stream.IntStream; @@ -21,11 +21,12 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; +import software.xdev.spring.data.eclipse.store.helper.DummyWorkingCopier; import software.xdev.spring.data.eclipse.store.repository.SupportedChecker; import software.xdev.spring.data.eclipse.store.repository.WorkingCopyRegistry; -class EclipseStoreRegisteringCopierTest +class RegisteringStorageToWorkingCopyCopierTest { private record DummyData(String data, int number) { @@ -34,8 +35,12 @@ private record DummyData(String data, int number) @Test void testCopyManyCopiesSingle() { - try(final EclipseSerializerRegisteringCopier copier = - new EclipseSerializerRegisteringCopier(new WorkingCopyRegistry(), new SupportedChecker.Implementation())) + try(final RegisteringStorageToWorkingCopyCopier copier = + new RegisteringStorageToWorkingCopyCopier( + new WorkingCopyRegistry(), + new SupportedChecker.Implementation(), + o -> null, + new DummyWorkingCopier())) { final List originalObjects = IntStream.range(0, 1_000).mapToObj( i -> new DummyData("Data" + i, i) @@ -50,8 +55,12 @@ void testCopyManyCopiesSingle() @Test void testCopyAgainSameObject() { - try(final EclipseSerializerRegisteringCopier copier = - new EclipseSerializerRegisteringCopier(new WorkingCopyRegistry(), new SupportedChecker.Implementation())) + try(final RegisteringStorageToWorkingCopyCopier copier = + new RegisteringStorageToWorkingCopyCopier( + new WorkingCopyRegistry(), + new SupportedChecker.Implementation(), + o -> null, + new DummyWorkingCopier())) { final DummyData originalObject = new DummyData("Test", 1); @@ -65,8 +74,12 @@ void testCopyAgainSameObject() @Test void testCopyAgainTheCopy() { - try(final EclipseSerializerRegisteringCopier copier = - new EclipseSerializerRegisteringCopier(new WorkingCopyRegistry(), new SupportedChecker.Implementation())) + try(final RegisteringStorageToWorkingCopyCopier copier = + new RegisteringStorageToWorkingCopyCopier( + new WorkingCopyRegistry(), + new SupportedChecker.Implementation(), + o -> null, + new DummyWorkingCopier())) { final DummyData originalObject = new DummyData("Test", 1); @@ -82,8 +95,12 @@ void testCopyAgainTheCopy() @Test void testCopyManyCopiesBulk() { - try(final EclipseSerializerRegisteringCopier copier = - new EclipseSerializerRegisteringCopier(new WorkingCopyRegistry(), new SupportedChecker.Implementation())) + try(final RegisteringStorageToWorkingCopyCopier copier = + new RegisteringStorageToWorkingCopyCopier( + new WorkingCopyRegistry(), + new SupportedChecker.Implementation(), + o -> null, + new DummyWorkingCopier())) { final List originalObjects = IntStream.range(0, 100_000).mapToObj( i -> new DummyData("Data" + i, i) @@ -98,8 +115,12 @@ void testCopyManyCopiesBulk() @Test void testCopyEmpty() { - try(final EclipseSerializerRegisteringCopier copier = - new EclipseSerializerRegisteringCopier(new WorkingCopyRegistry(), new SupportedChecker.Implementation())) + try(final RegisteringStorageToWorkingCopyCopier copier = + new RegisteringStorageToWorkingCopyCopier( + new WorkingCopyRegistry(), + new SupportedChecker.Implementation(), + o -> null, + new DummyWorkingCopier())) { Assertions.assertThrows(NullPointerException.class, () -> copier.copy(null)); } diff --git a/spring-data-eclipse-store/src/test/resources/application.properties b/spring-data-eclipse-store/src/test/resources/application.properties deleted file mode 100644 index 8f7f502f..00000000 --- a/spring-data-eclipse-store/src/test/resources/application.properties +++ /dev/null @@ -1 +0,0 @@ -org.eclipse.store.storage-directory=./target/tempstorage