diff --git a/.config/pmd/ruleset.xml b/.config/pmd/ruleset.xml
new file mode 100644
index 00000000..5f881567
--- /dev/null
+++ b/.config/pmd/ruleset.xml
@@ -0,0 +1,152 @@
+
+
+
+
+ This ruleset checks the code for discouraged programming constructs.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml
index 68299d5d..041c89bc 100644
--- a/.github/ISSUE_TEMPLATE/bug_report.yml
+++ b/.github/ISSUE_TEMPLATE/bug_report.yml
@@ -14,9 +14,9 @@ body:
attributes:
label: "Checklist"
options:
- - label: "I am able to reproduce the bug with the [latest version](https://github.com/xdev-software/template-placeholder/releases/latest)"
+ - label: "I am able to reproduce the bug with the [latest version](https://github.com/xdev-software/spring-data-eclipse-store/releases/latest)"
required: true
- - label: "I made sure that there are *no existing issues* - [open](https://github.com/xdev-software/template-placeholder/issues) or [closed](https://github.com/xdev-software/template-placeholder/issues?q=is%3Aissue+is%3Aclosed) - which I could contribute my information to."
+ - label: "I made sure that there are *no existing issues* - [open](https://github.com/xdev-software/spring-data-eclipse-store/issues) or [closed](https://github.com/xdev-software/spring-data-eclipse-store/issues?q=is%3Aissue+is%3Aclosed) - which I could contribute my information to."
required: true
- label: "I have taken the time to fill in all the required details. I understand that the bug report will be dismissed otherwise."
required: true
diff --git a/.github/ISSUE_TEMPLATE/enhancement.yml b/.github/ISSUE_TEMPLATE/enhancement.yml
index 75231293..4ed79471 100644
--- a/.github/ISSUE_TEMPLATE/enhancement.yml
+++ b/.github/ISSUE_TEMPLATE/enhancement.yml
@@ -12,7 +12,7 @@ body:
attributes:
label: "Checklist"
options:
- - label: "I made sure that there are *no existing issues* - [open](https://github.com/xdev-software/template-placeholder/issues) or [closed](https://github.com/xdev-software/template-placeholder/issues?q=is%3Aissue+is%3Aclosed) - which I could contribute my information to."
+ - label: "I made sure that there are *no existing issues* - [open](https://github.com/xdev-software/spring-data-eclipse-store/issues) or [closed](https://github.com/xdev-software/spring-data-eclipse-store/issues?q=is%3Aissue+is%3Aclosed) - which I could contribute my information to."
required: true
- label: "I have taken the time to fill in all the required details. I understand that the feature request will be dismissed otherwise."
required: true
diff --git a/.github/ISSUE_TEMPLATE/question.yml b/.github/ISSUE_TEMPLATE/question.yml
index 6ecd6ad5..05f66d4b 100644
--- a/.github/ISSUE_TEMPLATE/question.yml
+++ b/.github/ISSUE_TEMPLATE/question.yml
@@ -12,7 +12,7 @@ body:
attributes:
label: "Checklist"
options:
- - label: "I made sure that there are *no existing issues* - [open](https://github.com/xdev-software/template-placeholder/issues) or [closed](https://github.com/xdev-software/template-placeholder/issues?q=is%3Aissue+is%3Aclosed) - which I could contribute my information to."
+ - label: "I made sure that there are *no existing issues* - [open](https://github.com/xdev-software/spring-data-eclipse-store/issues) or [closed](https://github.com/xdev-software/spring-data-eclipse-store/issues?q=is%3Aissue+is%3Aclosed) - which I could contribute my information to."
required: true
- label: "I have taken the time to fill in all the required details. I understand that the question will be dismissed otherwise."
required: true
diff --git a/.github/workflows/check-build.yml b/.github/workflows/check-build.yml
index a1fc53b5..24130cd2 100644
--- a/.github/workflows/check-build.yml
+++ b/.github/workflows/check-build.yml
@@ -70,7 +70,7 @@ jobs:
path: ${{ env.DEMO_MAVEN_MODULE }}/target/${{ env.DEMO_MAVEN_MODULE }}.jar
if-no-files-found: error
- code-style:
+ checkstyle:
runs-on: ubuntu-latest
if: ${{ github.event_name != 'pull_request' || !startsWith(github.head_ref, 'renovate/') }}
@@ -92,6 +92,43 @@ jobs:
- name: Run Checkstyle
run: ./mvnw -B checkstyle:check -P checkstyle -T2C
+ pmd:
+ runs-on: ubuntu-latest
+ if: ${{ github.event_name != 'pull_request' || !startsWith(github.head_ref, 'renovate/') }}
+
+ strategy:
+ matrix:
+ java: [17]
+ distribution: [temurin]
+
+ steps:
+ - uses: actions/checkout@v4
+
+ - name: Set up JDK
+ uses: actions/setup-java@v4
+ with:
+ distribution: ${{ matrix.distribution }}
+ java-version: ${{ matrix.java }}
+ cache: 'maven'
+
+ - name: Run PMD
+ run: ./mvnw -B test pmd:aggregate-pmd-no-fork pmd:check -P pmd -DskipTests -T2C
+
+ - name: Run CPD (Copy Paste Detector)
+ run: ./mvnw -B pmd:aggregate-cpd pmd:cpd-check -P pmd -DskipTests -T2C
+
+ - name: Upload report
+ if: always()
+ uses: actions/upload-artifact@v4
+ with:
+ name: pmd-report
+ if-no-files-found: ignore
+ path: |
+ target/site/*.html
+ target/site/css/**
+ target/site/images/logos/maven-feather.png
+ target/site/images/external.png
+
docs:
runs-on: ubuntu-latest
@@ -107,4 +144,4 @@ jobs:
run: npm i antora @antora/lunr-extension
- name: Generate Site
- run: npx antora docs/antora-playbook.yml
\ No newline at end of file
+ run: npx antora docs/antora-playbook.yml
diff --git a/.github/workflows/update-from-template.yml b/.github/workflows/update-from-template.yml
index 33ac9b94..aa33de40 100644
--- a/.github/workflows/update-from-template.yml
+++ b/.github/workflows/update-from-template.yml
@@ -211,6 +211,8 @@ jobs:
echo "Checking if update-branch-merged exists"
git fetch
if [[ $(git rev-parse origin/${{ env.UPDATE_BRANCH_MERGED }}) ]]; then
+ echo "Branch still exists; Continuing..."
+ else
echo "Branch origin/${{ env.UPDATE_BRANCH_MERGED }} is missing"
exit 0
fi
@@ -274,6 +276,8 @@ jobs:
echo "Fetching..."
git fetch
if [[ $(git rev-parse origin/${{ env.UPDATE_BRANCH_MERGED }}) ]]; then
+ echo "Branch still exists; Continuing..."
+ else
echo "Branch origin/${{ env.UPDATE_BRANCH_MERGED }} is missing"
exit 0
fi
diff --git a/.gitignore b/.gitignore
index fb4acbe5..9ed140af 100644
--- a/.gitignore
+++ b/.gitignore
@@ -39,11 +39,6 @@ buildNumber.properties
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
-
-# bin / compiled stuff
-target/
-
-
# JRebel
**/resources/rebel.xml
**/resources/rebel-remote.xml
diff --git a/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties
index f800e78d..e56bc180 100644
--- a/.mvn/wrapper/maven-wrapper.properties
+++ b/.mvn/wrapper/maven-wrapper.properties
@@ -14,4 +14,4 @@
# 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.7/apache-maven-3.9.7-bin.zip
+distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.8/apache-maven-3.9.8-bin.zip
diff --git a/CHANGELOG.md b/CHANGELOG.md
index a3569d9d..377a3011 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,8 @@
+# 1.0.8
+
+* Entities with same ID are replaced on saved and not added
+* Updated Spring to version 3.3.1
+
# 1.0.7
* QueryByExample now possible
diff --git a/README.md b/README.md
index 675d9cb7..d1654ce1 100644
--- a/README.md
+++ b/README.md
@@ -52,7 +52,8 @@ instructions** are in the documentation](https://xdev-software.github.io/spring-
|---------------------------|--------|-------------|--------------|
| ``<= 1.0.2`` | ``17`` | ``3.2.2`` | ``1.1.0`` |
| ``1.0.3/1.0.4`` | ``17`` | ``3.2.3`` | ``1.2.0`` |
-| ``>= 1.0.5`` | ``17`` | ``3.2.5`` | ``1.3.2`` |
+| ``1.0.5-1.0.7`` | ``17`` | ``3.2.5`` | ``1.3.2`` |
+| ``>= 1.0.8`` | ``17`` | ``3.3.1`` | ``1.3.2`` |
## Demo
@@ -82,4 +83,5 @@ 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).
diff --git a/docs/package.json b/docs/package.json
index 86a7578d..8b030e18 100644
--- a/docs/package.json
+++ b/docs/package.json
@@ -3,7 +3,7 @@
"@antora/lunr-extension": "^1.0.0-alpha.8"
},
"devDependencies": {
- "@antora/cli": "3.1.7",
- "@antora/site-generator": "3.1.7"
+ "@antora/cli": "3.1.8",
+ "@antora/site-generator": "3.1.8"
}
}
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index a2b492b2..c3d84890 100644
--- a/pom.xml
+++ b/pom.xml
@@ -17,6 +17,9 @@
17
${javaVersion}
+
+ UTF-8
+ UTF-8
@@ -36,7 +39,6 @@
-
checkstyle
@@ -44,12 +46,74 @@
org.apache.maven.plugins
maven-checkstyle-plugin
3.4.0
+
+
+ com.puppycrawl.tools
+ checkstyle
+ 10.17.0
+
+
+
+ .config/checkstyle/checkstyle.xml
+ true
+
+
+
+
+ check
+
+
+
+
+
+
+
+
+ pmd
+
+
+
+ org.apache.maven.plugins
+ maven-pmd-plugin
+ 3.23.0
- true
+ true
+ true
+
+ .config/pmd/ruleset.xml
+
+
+ **/benchmark/**/jmh_generated/**
+
+ **/shared/**/Customer*
+ **/shared/**/Child*
+
+
+
+ net.sourceforge.pmd
+ pmd-core
+ 7.2.0
+
+
+ net.sourceforge.pmd
+ pmd-java
+ 7.2.0
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-jxr-plugin
+ 3.4.0
+
+
+
diff --git a/renovate.json5 b/renovate.json5
index 11a77b2a..0c1deaad 100644
--- a/renovate.json5
+++ b/renovate.json5
@@ -1,4 +1,14 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
- "rebaseWhen": "behind-base-branch"
+ "rebaseWhen": "behind-base-branch",
+ "packageRules": [
+ {
+ "description": "Ignore project internal dependencies",
+ "packagePattern": "^software.xdev:spring-data-eclipse-store",
+ "datasources": [
+ "maven"
+ ],
+ "enabled": false
+ }
+ ]
}
diff --git a/spring-data-eclipse-store-benchmark/pom.xml b/spring-data-eclipse-store-benchmark/pom.xml
index 911fd26b..1ab40c77 100644
--- a/spring-data-eclipse-store-benchmark/pom.xml
+++ b/spring-data-eclipse-store-benchmark/pom.xml
@@ -1,117 +1,91 @@
- 4.0.0
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ 4.0.0
- com.xdev-software
- spring-data-eclipse-store-benchmark
- 1.0.8-SNAPSHOT
- jar
+
+ software.xdev
+ spring-data-eclipse-store-root
+ 1.0.8-SNAPSHOT
+
- 2023
+ spring-data-eclipse-store-benchmark
+ 1.0.8-SNAPSHOT
+ jar
-
- XDEV Software
- https://xdev.software
-
+ 2023
-
- 17
- ${javaVersion}
- UTF-8
- UTF-8
+
+ XDEV Software
+ https://xdev.software
+
- 3.2.5
- 1.37
-
+
+ 17
+ ${javaVersion}
+ UTF-8
+ UTF-8
-
-
-
- org.springframework.boot
- spring-boot-dependencies
- ${org.springframework.boot.version}
- pom
- import
-
-
-
+ 3.3.1
+ 1.37
+
-
-
- software.xdev
- spring-data-eclipse-store
- ${project.version}
-
+
+
+
+ org.springframework.boot
+ spring-boot-dependencies
+ ${org.springframework.boot.version}
+ pom
+ import
+
+
+
-
- org.springframework.boot
- spring-boot
-
-
- org.springframework.boot
- spring-boot-starter
-
+
+
+ software.xdev
+ spring-data-eclipse-store
+ ${project.version}
+
-
- org.openjdk.jmh
- jmh-core
- ${jmh.version}
-
-
- org.openjdk.jmh
- jmh-generator-annprocess
- ${jmh.version}
-
-
+
+ org.springframework.boot
+ spring-boot
+
+
+ org.springframework.boot
+ spring-boot-starter
+
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
- 3.13.0
-
- ${maven.compiler.release}
-
-
- org.openjdk.jmh
- jmh-generator-annprocess
- ${jmh.version}
-
-
-
-
-
-
-
-
- checkstyle
-
-
-
- org.apache.maven.plugins
- maven-checkstyle-plugin
- 3.4.0
-
-
- com.puppycrawl.tools
- checkstyle
- 10.17.0
-
-
-
- ../.config/checkstyle/checkstyle.xml
-
-
-
-
- check
-
-
-
-
-
-
-
-
+
+ org.openjdk.jmh
+ jmh-core
+ ${jmh.version}
+
+
+ org.openjdk.jmh
+ jmh-generator-annprocess
+ ${jmh.version}
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.13.0
+
+ ${maven.compiler.release}
+
+
+ org.openjdk.jmh
+ jmh-generator-annprocess
+ ${jmh.version}
+
+
+
+
+
+
diff --git a/spring-data-eclipse-store-benchmark/src/main/java/software/xdev/spring/data/eclipse/store/benchmark/benchmarks/simple/customer/AbstractStoringSimpleCustomerBenchmark.java b/spring-data-eclipse-store-benchmark/src/main/java/software/xdev/spring/data/eclipse/store/benchmark/benchmarks/simple/customer/AbstractStoringSimpleCustomerBenchmark.java
new file mode 100644
index 00000000..0931bd64
--- /dev/null
+++ b/spring-data-eclipse-store-benchmark/src/main/java/software/xdev/spring/data/eclipse/store/benchmark/benchmarks/simple/customer/AbstractStoringSimpleCustomerBenchmark.java
@@ -0,0 +1,50 @@
+package software.xdev.spring.data.eclipse.store.benchmark.benchmarks.simple.customer;
+
+import org.openjdk.jmh.annotations.Benchmark;
+
+import software.xdev.spring.data.eclipse.store.benchmark.SpringState;
+
+
+@SuppressWarnings("checkstyle:MagicNumber")
+public abstract class AbstractStoringSimpleCustomerBenchmark
+{
+ protected abstract void saveCustomerInForEach(final SpringState state, final int entityCount);
+
+ protected abstract void saveCustomerInSaveAll(final SpringState state, final int entityCount);
+
+ @Benchmark
+ public void save100CustomerInForEach(final SpringState state)
+ {
+ this.saveCustomerInForEach(state, 100);
+ }
+
+ @Benchmark
+ public void save1000CustomerInForEach(final SpringState state)
+ {
+ this.saveCustomerInForEach(state, 1_000);
+ }
+
+ @Benchmark
+ public void save100CustomerInSaveAll(final SpringState state)
+ {
+ this.saveCustomerInSaveAll(state, 100);
+ }
+
+ @Benchmark
+ public void save1000CustomerInSaveAll(final SpringState state)
+ {
+ this.saveCustomerInSaveAll(state, 1_000);
+ }
+
+ @Benchmark
+ public void save10000CustomerInSaveAll(final SpringState state)
+ {
+ this.saveCustomerInSaveAll(state, 10_000);
+ }
+
+ @Benchmark
+ public void save100000CustomerInSaveAll(final SpringState state)
+ {
+ this.saveCustomerInSaveAll(state, 100_000);
+ }
+}
diff --git a/spring-data-eclipse-store-benchmark/src/main/java/software/xdev/spring/data/eclipse/store/benchmark/benchmarks/simple/customer/StoringAndChangingSimpleCustomerBenchmark.java b/spring-data-eclipse-store-benchmark/src/main/java/software/xdev/spring/data/eclipse/store/benchmark/benchmarks/simple/customer/StoringAndChangingSimpleCustomerBenchmark.java
index aea67d84..83f63914 100644
--- a/spring-data-eclipse-store-benchmark/src/main/java/software/xdev/spring/data/eclipse/store/benchmark/benchmarks/simple/customer/StoringAndChangingSimpleCustomerBenchmark.java
+++ b/spring-data-eclipse-store-benchmark/src/main/java/software/xdev/spring/data/eclipse/store/benchmark/benchmarks/simple/customer/StoringAndChangingSimpleCustomerBenchmark.java
@@ -8,8 +8,7 @@
import software.xdev.spring.data.eclipse.store.repository.config.EclipseStoreClientConfiguration;
-@SuppressWarnings("checkstyle:MagicNumber")
-public class StoringAndChangingSimpleCustomerBenchmark
+public class StoringAndChangingSimpleCustomerBenchmark extends AbstractStoringSimpleCustomerBenchmark
{
@Benchmark
public void saveSingleCustomer(final SpringState state)
@@ -29,43 +28,8 @@ public void saveSingleCustomer(final SpringState state)
});
}
- @Benchmark
- public void save100CustomerInForEach(final SpringState state)
- {
- this.saveCustomerInForEach(state, 100);
- }
-
- @Benchmark
- public void save100CustomerInSaveAll(final SpringState state)
- {
- this.saveCustomerInSaveAll(state, 100);
- }
-
- @Benchmark
- public void save1000CustomerInSaveAll(final SpringState state)
- {
- this.saveCustomerInSaveAll(state, 1_000);
- }
-
- @Benchmark
- public void save10000CustomerInSaveAll(final SpringState state)
- {
- this.saveCustomerInSaveAll(state, 10_000);
- }
-
- @Benchmark
- public void save1000CustomerInForEach(final SpringState state)
- {
- this.saveCustomerInForEach(state, 1_000);
- }
-
- @Benchmark
- public void save100000CustomerInSaveAll(final SpringState state)
- {
- this.saveCustomerInSaveAll(state, 100_000);
- }
-
- private void saveCustomerInForEach(final SpringState state, final int entityCount)
+ @Override
+ protected void saveCustomerInForEach(final SpringState state, final int entityCount)
{
final CustomerRepository customerRepository1 = state.getBean(CustomerRepository.class);
IntStream.range(0, entityCount).forEach(
@@ -84,7 +48,8 @@ private void saveCustomerInForEach(final SpringState state, final int entityCoun
});
}
- private void saveCustomerInSaveAll(final SpringState state, final int entityCount)
+ @Override
+ protected void saveCustomerInSaveAll(final SpringState state, final int entityCount)
{
final CustomerRepository customerRepository = state.getBean(CustomerRepository.class);
customerRepository.saveAll(
diff --git a/spring-data-eclipse-store-benchmark/src/main/java/software/xdev/spring/data/eclipse/store/benchmark/benchmarks/simple/customer/StoringSimpleCustomerBenchmark.java b/spring-data-eclipse-store-benchmark/src/main/java/software/xdev/spring/data/eclipse/store/benchmark/benchmarks/simple/customer/StoringSimpleCustomerBenchmark.java
index cd14c20f..bf86ccae 100644
--- a/spring-data-eclipse-store-benchmark/src/main/java/software/xdev/spring/data/eclipse/store/benchmark/benchmarks/simple/customer/StoringSimpleCustomerBenchmark.java
+++ b/spring-data-eclipse-store-benchmark/src/main/java/software/xdev/spring/data/eclipse/store/benchmark/benchmarks/simple/customer/StoringSimpleCustomerBenchmark.java
@@ -8,7 +8,7 @@
@SuppressWarnings("checkstyle:MagicNumber")
-public class StoringSimpleCustomerBenchmark
+public class StoringSimpleCustomerBenchmark extends AbstractStoringSimpleCustomerBenchmark
{
@Benchmark
public void saveSingleCustomer(final SpringState state)
@@ -17,36 +17,6 @@ public void saveSingleCustomer(final SpringState state)
customerRepository.save(new Customer("Test", "Test"));
}
- @Benchmark
- public void save100CustomerInForEach(final SpringState state)
- {
- this.saveCustomerInForEach(state, 100);
- }
-
- @Benchmark
- public void save100CustomerInSaveAll(final SpringState state)
- {
- this.saveCustomerInSaveAll(state, 100);
- }
-
- @Benchmark
- public void save1000CustomerInSaveAll(final SpringState state)
- {
- this.saveCustomerInSaveAll(state, 1_000);
- }
-
- @Benchmark
- public void save10000CustomerInSaveAll(final SpringState state)
- {
- this.saveCustomerInSaveAll(state, 10_000);
- }
-
- @Benchmark
- public void save1000CustomerInForEach(final SpringState state)
- {
- this.saveCustomerInForEach(state, 1_000);
- }
-
@Benchmark
public void save10000CustomerInForEach(final SpringState state)
{
@@ -59,13 +29,8 @@ public void save10000CustomerInForEachParallel(final SpringState state)
this.saveCustomerInForEachParallel(state, 10_000);
}
- @Benchmark
- public void save100000CustomerInSaveAll(final SpringState state)
- {
- this.saveCustomerInSaveAll(state, 100_000);
- }
-
- private void saveCustomerInForEach(final SpringState state, final int entityCount)
+ @Override
+ protected void saveCustomerInForEach(final SpringState state, final int entityCount)
{
final CustomerRepository customerRepository = state.getBean(CustomerRepository.class);
IntStream.range(0, entityCount).forEach(
@@ -81,7 +46,8 @@ private void saveCustomerInForEachParallel(final SpringState state, final int en
);
}
- private void saveCustomerInSaveAll(final SpringState state, final int entityCount)
+ @Override
+ protected void saveCustomerInSaveAll(final SpringState state, final int entityCount)
{
final CustomerRepository customerRepository = state.getBean(CustomerRepository.class);
customerRepository.saveAll(
diff --git a/spring-data-eclipse-store-demo/pom.xml b/spring-data-eclipse-store-demo/pom.xml
index 372f2fcc..ee3542ee 100644
--- a/spring-data-eclipse-store-demo/pom.xml
+++ b/spring-data-eclipse-store-demo/pom.xml
@@ -4,7 +4,12 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
- software.xdev
+
+ software.xdev
+ spring-data-eclipse-store-root
+ 1.0.8-SNAPSHOT
+
+
spring-data-eclipse-store-demo
1.0.8-SNAPSHOT
jar
@@ -23,7 +28,7 @@
software.xdev.spring.data.eclipse.store.demo.complex.ComplexDemoApplication
- 3.2.5
+ 3.3.1
@@ -88,36 +93,4 @@
-
-
- checkstyle
-
-
-
- org.apache.maven.plugins
- maven-checkstyle-plugin
- 3.4.0
-
-
- com.puppycrawl.tools
- checkstyle
- 10.17.0
-
-
-
- ../.config/checkstyle/checkstyle.xml
- true
-
-
-
-
- check
-
-
-
-
-
-
-
-
diff --git a/spring-data-eclipse-store-jpa/pom.xml b/spring-data-eclipse-store-jpa/pom.xml
index b1ac0322..404a5462 100644
--- a/spring-data-eclipse-store-jpa/pom.xml
+++ b/spring-data-eclipse-store-jpa/pom.xml
@@ -4,7 +4,12 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
- software.xdev
+
+ software.xdev
+ spring-data-eclipse-store-root
+ 1.0.8-SNAPSHOT
+
+
spring-data-eclipse-store-jpa
1.0.8-SNAPSHOT
jar
@@ -25,7 +30,7 @@
software.xdev.spring.data.eclipse.store.demo.complex.ComplexDemoApplication
- 3.2.5
+ 3.3.1
@@ -110,35 +115,4 @@
-
-
- checkstyle
-
-
-
- org.apache.maven.plugins
- maven-checkstyle-plugin
- 3.4.0
-
-
- com.puppycrawl.tools
- checkstyle
- 10.17.0
-
-
-
- ../.config/checkstyle/checkstyle.xml
-
-
-
-
- check
-
-
-
-
-
-
-
-
diff --git a/spring-data-eclipse-store-jpa/src/test/java/software/xdev/spring/data/eclipse/store/jpa/integration/JpaImportExplicitTest.java b/spring-data-eclipse-store-jpa/src/test/java/software/xdev/spring/data/eclipse/store/jpa/integration/JpaImportExplicitTest.java
index daaaf988..70e452fb 100644
--- a/spring-data-eclipse-store-jpa/src/test/java/software/xdev/spring/data/eclipse/store/jpa/integration/JpaImportExplicitTest.java
+++ b/spring-data-eclipse-store-jpa/src/test/java/software/xdev/spring/data/eclipse/store/jpa/integration/JpaImportExplicitTest.java
@@ -49,7 +49,7 @@ class JpaImportExplicitTest
private EclipseStoreClientConfiguration configuration;
@Test
- void testEclipseStoreImport_ExplicitNoComponent()
+ void testEclipseStoreImportExplicitNoComponent()
{
final PersonToTestInJpa customer = new PersonToTestInJpa("", "");
this.personToTestInJpaRepository.save(customer);
diff --git a/spring-data-eclipse-store-jpa/src/test/java/software/xdev/spring/data/eclipse/store/jpa/integration/JpaImportTest.java b/spring-data-eclipse-store-jpa/src/test/java/software/xdev/spring/data/eclipse/store/jpa/integration/JpaImportTest.java
index aebba495..b1a3bf03 100644
--- a/spring-data-eclipse-store-jpa/src/test/java/software/xdev/spring/data/eclipse/store/jpa/integration/JpaImportTest.java
+++ b/spring-data-eclipse-store-jpa/src/test/java/software/xdev/spring/data/eclipse/store/jpa/integration/JpaImportTest.java
@@ -49,7 +49,7 @@ class JpaImportTest
@Test
void testBasicSaveAndFindSingleRecords()
{
- final PersonToTestInEclipseStore customer = new PersonToTestInEclipseStore("", "");
+ final PersonToTestInEclipseStore customer = new PersonToTestInEclipseStore("1", "", "");
this.personToTestInEclipseStoreRepository.save(customer);
final List customers = this.personToTestInEclipseStoreRepository.findAll();
diff --git a/spring-data-eclipse-store-jpa/src/test/java/software/xdev/spring/data/eclipse/store/jpa/integration/repository/PersonToTestInEclipseStore.java b/spring-data-eclipse-store-jpa/src/test/java/software/xdev/spring/data/eclipse/store/jpa/integration/repository/PersonToTestInEclipseStore.java
index f57f21e2..ff0b17f2 100644
--- a/spring-data-eclipse-store-jpa/src/test/java/software/xdev/spring/data/eclipse/store/jpa/integration/repository/PersonToTestInEclipseStore.java
+++ b/spring-data-eclipse-store-jpa/src/test/java/software/xdev/spring/data/eclipse/store/jpa/integration/repository/PersonToTestInEclipseStore.java
@@ -8,13 +8,14 @@
public class PersonToTestInEclipseStore
{
@Id
- private String id;
+ private final String id;
private final String firstName;
private final String lastName;
- public PersonToTestInEclipseStore(final String firstName, final String lastName)
+ public PersonToTestInEclipseStore(final String id, final String firstName, final String lastName)
{
+ this.id = id;
this.firstName = firstName;
this.lastName = lastName;
}
diff --git a/spring-data-eclipse-store/pom.xml b/spring-data-eclipse-store/pom.xml
index 8ebdb428..078c591f 100644
--- a/spring-data-eclipse-store/pom.xml
+++ b/spring-data-eclipse-store/pom.xml
@@ -50,7 +50,7 @@
UTF-8
- 3.2.5
+ 3.3.1
1.3.2
1.3.2
@@ -202,7 +202,7 @@
org.apache.maven.plugins
maven-project-info-reports-plugin
- 3.5.0
+ 3.6.1
@@ -269,7 +269,7 @@
org.apache.maven.plugins
maven-surefire-plugin
- 3.2.5
+ 3.3.0
--add-opens java.base/java.util=ALL-UNNAMED
@@ -389,5 +389,51 @@
+
+ pmd
+
+
+
+ org.apache.maven.plugins
+ maven-pmd-plugin
+ 3.23.0
+
+ true
+ true
+
+ ../.config/pmd/ruleset.xml
+
+
+ **/benchmark/**/jmh_generated/**
+
+ **/store/integration/**
+
+
+
+
+ net.sourceforge.pmd
+ pmd-core
+ 7.2.0
+
+
+ net.sourceforge.pmd
+ pmd-java
+ 7.2.0
+
+
+
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-jxr-plugin
+ 3.4.0
+
+
+
+
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 b5fe9aa1..26611997 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
@@ -21,4 +21,9 @@ public NotComparableException(final String message)
{
super(message);
}
+
+ public NotComparableException(final String message, final Throwable cause)
+ {
+ super(message, cause);
+ }
}
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 91134d7c..44322910 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
@@ -34,6 +34,7 @@
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.id.IdManager;
import software.xdev.spring.data.eclipse.store.repository.support.copier.working.RecursiveWorkingCopier;
import software.xdev.spring.data.eclipse.store.transactions.EclipseStoreTransactionManager;
@@ -254,6 +255,7 @@ private void createRepositoryForType(
private SimpleEclipseStoreRepository createEclipseStoreRepo(final Class domainClass)
{
final EclipseStoreStorage storageInstance = this.configuration.getStorageInstance();
+ final IdManager idManager = storageInstance.ensureIdManager(domainClass);
return new SimpleEclipseStoreRepository<>(
storageInstance,
new RecursiveWorkingCopier<>(
@@ -265,7 +267,8 @@ private void createRepositoryForType(
storageInstance
),
domainClass,
- new EclipseStoreTransactionManager()
+ new EclipseStoreTransactionManager(),
+ idManager
);
}
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 952dd0b1..f05422f6 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
@@ -38,17 +38,18 @@
import software.xdev.spring.data.eclipse.store.repository.support.SimpleEclipseStoreRepository;
import software.xdev.spring.data.eclipse.store.repository.support.concurrency.ReadWriteLock;
import software.xdev.spring.data.eclipse.store.repository.support.concurrency.ReentrantJavaReadWriteLock;
+import software.xdev.spring.data.eclipse.store.repository.support.copier.id.IdManager;
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;
public class EclipseStoreStorage
- implements EntityListProvider, IdSetterProvider, PersistableChecker, ObjectSwizzling
+ implements EntityListProvider, IdManagerProvider, PersistableChecker, ObjectSwizzling
{
private static final Logger LOG = LoggerFactory.getLogger(EclipseStoreStorage.class);
private final Map, SimpleEclipseStoreRepository, ?>> entityClassToRepository = new HashMap<>();
- private final Map, IdSetter>> idSetters = new ConcurrentHashMap<>();
+ private final Map, IdManager, ?>> idManagers = new ConcurrentHashMap<>();
private final EclipseStoreStorageFoundationProvider foundationProvider;
private EntitySetCollector entitySetCollector;
private PersistableChecker persistenceChecker;
@@ -317,7 +318,7 @@ public synchronized void stop()
this.storageManager = null;
this.root = null;
this.registry.reset();
- this.idSetters.clear();
+ this.idManagers.clear();
LOG.info("Stopped storage.");
}
else
@@ -330,16 +331,20 @@ public synchronized void stop()
@Override
@SuppressWarnings("unchecked")
- public IdSetter ensureIdSetter(final Class domainClass)
+ public IdManager ensureIdManager(final Class domainClass)
{
this.ensureEntitiesInRoot();
- return (IdSetter)this.idSetters.computeIfAbsent(
+ return (IdManager)this.idManagers.computeIfAbsent(
domainClass,
clazz ->
- IdSetter.createIdSetter(
- clazz,
- id -> this.setLastId(clazz, id),
- () -> this.getLastId(clazz)
+ new IdManager<>(
+ domainClass,
+ (IdSetter)IdSetter.createIdSetter(
+ clazz,
+ id -> this.setLastId(clazz, id),
+ () -> this.getLastId(clazz)
+ ),
+ this
)
);
}
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/IdManagerProvider.java
similarity index 85%
rename from spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/IdSetterProvider.java
rename to spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/IdManagerProvider.java
index 08b9536c..dbe88f61 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/IdManagerProvider.java
@@ -15,10 +15,10 @@
*/
package software.xdev.spring.data.eclipse.store.repository;
-import software.xdev.spring.data.eclipse.store.repository.support.copier.id.IdSetter;
+import software.xdev.spring.data.eclipse.store.repository.support.copier.id.IdManager;
-public interface IdSetterProvider
+public interface IdManagerProvider
{
- IdSetter ensureIdSetter(final Class domainClass);
+ IdManager ensureIdManager(final Class domainClass);
}
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
index 2d745474..2d29d410 100644
--- 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
@@ -64,8 +64,8 @@ static SpringDataEclipseStoreLazy.Default buildWithLazy(final Lazy laz
*
* @param the type of the lazily referenced element
*/
- @SuppressWarnings({"java:S2065", "checkstyle:FinalClass"})
- class Default implements SpringDataEclipseStoreLazy
+ @SuppressWarnings({"java:S2065"})
+ final class Default implements SpringDataEclipseStoreLazy
{
private T objectToBeWrapped;
private Lazy wrappedLazy;
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 341afd13..8f1ade91 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
@@ -118,6 +118,7 @@ protected QueryExecutor complete(final AbstractCriteriaNode criteria, @Non
return QueryExecutorCreator.createQuery(this.typeInformation, this.copier, criteria, sort);
}
+ @SuppressWarnings("PMD.CyclomaticComplexity")
private AbstractCriteriaNode from(
final Part part,
final AbstractCriteriaNode criteria,
diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/query/criteria/CriteriaByExample.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/query/criteria/CriteriaByExample.java
index e6b4d988..5e45f834 100644
--- a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/query/criteria/CriteriaByExample.java
+++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/query/criteria/CriteriaByExample.java
@@ -19,7 +19,9 @@
import java.util.Collection;
import java.util.Locale;
import java.util.Map;
+import java.util.Objects;
import java.util.Optional;
+import java.util.function.BiPredicate;
import java.util.function.Predicate;
import java.util.regex.Pattern;
@@ -107,78 +109,60 @@ private Predicate createPredicateForSpecif
? example.getMatcher().getDefaultStringMatcher()
: specifier.getStringMatcher();
- switch(setOrDefaultMatcher)
+ return this.createPredicateForStringMatcher(
+ specifier,
+ setOrDefaultMatcher,
+ transformedExampledValue.get(),
+ transformedValue.orElse(null));
+ };
+ }
+
+ private boolean createPredicateForStringMatcher(
+ final ExampleMatcher.PropertySpecifier specifier,
+ final ExampleMatcher.StringMatcher setOrDefaultMatcher,
+ final Object transformedExampledValue, // Never null
+ final Object transformedValue) // Nullable
+ {
+ // Check exact matches
+ if(ExampleMatcher.StringMatcher.DEFAULT.equals(setOrDefaultMatcher)
+ || ExampleMatcher.StringMatcher.EXACT.equals(setOrDefaultMatcher))
+ {
+ if(transformedExampledValue instanceof String)
{
- case DEFAULT, EXACT ->
- {
- if(transformedExampledValue.get() instanceof String)
- {
- return this.valueToString(transformedValue, specifier).equals(this.valueToString(
- transformedExampledValue,
- specifier));
- }
- return transformedExampledValue.equals(transformedValue);
- }
- case STARTING ->
- {
- final Optional valueAsString = this.valueToString(transformedValue, specifier);
- if(valueAsString.isEmpty())
- {
- return false;
- }
- return valueAsString.get()
- .startsWith(this.valueToString(transformedExampledValue, specifier).get());
- }
- case ENDING ->
- {
- final Optional valueAsString = this.valueToString(transformedValue, specifier);
- if(valueAsString.isEmpty())
- {
- return false;
- }
- return valueAsString.get().endsWith(this.valueToString(transformedExampledValue, specifier).get());
- }
- case CONTAINING ->
- {
- final Optional valueAsString = this.valueToString(transformedValue, specifier);
- if(valueAsString.isEmpty())
- {
- return false;
- }
- return valueAsString.get().contains(this.valueToString(transformedExampledValue, specifier).get());
- }
- case REGEX ->
- {
- final Optional valueAsString = this.valueToString(transformedValue, specifier);
- if(valueAsString.isEmpty())
- {
- return false;
- }
- return Pattern.compile(
- this.valueToString(transformedExampledValue, specifier).get()
- )
- .matcher(valueAsString.get()).find();
- }
- default ->
- {
- return false;
- }
+ return Objects.equals(
+ this.valueToString(transformedExampledValue, specifier),
+ this.valueToString(transformedValue, specifier));
}
+ return Objects.equals(transformedExampledValue, transformedValue);
+ }
+
+ // Check comparisons
+ final BiPredicate compareFunc = switch(setOrDefaultMatcher)
+ {
+ case STARTING -> String::startsWith;
+ case ENDING -> String::endsWith;
+ case CONTAINING -> String::contains;
+ case REGEX -> (v, example) -> Pattern.compile(example).matcher(v).find();
+ default -> null;
};
+
+ return compareFunc != null
+ && Optional.ofNullable(this.valueToString(transformedValue, specifier))
+ .map(v -> compareFunc.test(v, this.valueToString(transformedExampledValue, specifier)))
+ .orElse(false);
}
- private Optional valueToString(
- final Optional