Skip to content

Commit fe2d9a2

Browse files
Merge pull request #29 from xdev-software/develop
v1.0.3
2 parents 9516878 + 92b61d2 commit fe2d9a2

File tree

68 files changed

+2321
-98
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+2321
-98
lines changed

.config/checkstyle/checkstyle.xml

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<module name="LineLength">
1717
<property name="max" value="120"/>
1818
<property name="fileExtensions" value="java"/>
19-
<!-- Ignore default + links in comments -->
19+
<!-- Ignore default + links -->
2020
<property name="ignorePattern" value="(^(package|import))|(^\s*(\/\/|\*) .*https?.*$)"/>
2121
</module>
2222
<module name="NewlineAtEndOfFile"/>
@@ -30,10 +30,6 @@
3030
</module>
3131

3232
<!-- Generated code -->
33-
<module name="SuppressionSingleFilter">
34-
<property name="checks" value="."/>
35-
<property name="files" value="[\\/](src)?gen[\\/].*\.java$"/>
36-
</module>
3733
<module name="SuppressionSingleFilter">
3834
<property name="checks" value="."/>
3935
<property name="files" value="[\\/]src[\\/]gen(erated)?[\\/].*\.java$"/>
@@ -43,7 +39,15 @@
4339
<property name="checks" value="MagicNumberCheck"/>
4440
<property name="files" value="[\\/]test[\\/].*\.java$"/>
4541
</module>
42+
43+
<!-- Suppressions -->
4644
<module name="SuppressWarningsFilter"/>
45+
<!-- https://github.com/checkstyle/checkstyle/issues/7287 -->
46+
<module name="SuppressWithPlainTextCommentFilter">
47+
<property name="offCommentFormat" value="// CHECKSTYLE\:OFF ([\w\|]+)"/>
48+
<property name="onCommentFormat" value="// CHECKSTYLE\:ON ([\w\|]+)"/>
49+
<property name="checkFormat" value="$1"/>
50+
</module>
4751

4852
<module name="TreeWalker">
4953
<!-- Checks - sorted alphabetically -->
@@ -131,11 +135,5 @@
131135
<property name="tokens"
132136
value="ASSIGN,BAND,BAND_ASSIGN,BOR,BOR_ASSIGN,BSR,BSR_ASSIGN,BXOR,BXOR_ASSIGN,COLON,DIV,DIV_ASSIGN,EQUAL,GE,GT,LAND,LCURLY,LE,LOR,LT,MINUS,MINUS_ASSIGN,MOD,MOD_ASSIGN,NOT_EQUAL,PLUS,PLUS_ASSIGN,QUESTION,RCURLY,SL,SLIST,SL_ASSIGN,SR,SR_ASSIGN,STAR,STAR_ASSIGN,TYPE_EXTENSION_AND"/>
133137
</module>
134-
135-
<!-- Filter -->
136-
<module name="SuppressionCommentFilter">
137-
<property name="offCommentFormat" value="\s*CHECKSTYLE:OFF\s*[^\s]{1,}"/>
138-
<property name="onCommentFormat" value="\s*CHECKSTYLE:ON"/>
139-
</module>
140138
</module>
141139
</module>

.github/workflows/checkBuild.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,15 @@ on:
77
paths-ignore:
88
- '**.md'
99
- '.config/**'
10+
- '.github/**'
1011
- '.idea/**'
1112
- 'assets/**'
1213
pull_request:
1314
branches: [ develop ]
1415
paths-ignore:
1516
- '**.md'
1617
- '.config/**'
18+
- '.github/**'
1719
- '.idea/**'
1820
- 'assets/**'
1921

.github/workflows/sonar.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,15 @@ on:
77
paths-ignore:
88
- '**.md'
99
- '.config/**'
10+
- '.github/**'
1011
- '.idea/**'
1112
- 'assets/**'
1213
pull_request:
1314
types: [opened, synchronize, reopened]
1415
paths-ignore:
1516
- '**.md'
1617
- '.config/**'
18+
- '.github/**'
1719
- '.idea/**'
1820
- 'assets/**'
1921

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# 1.0.3
2+
3+
* Added the EclipseStoreDataImporter to import data from JPA repositories.
4+
* Updated EclipseStore to version 1.2.0
5+
* Updated Spring to version 3.2.3
6+
17
# 1.0.2
28

39
* Added the EclipseStoreCustomRepository which has no methods defined at all.

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@
186186
same "printed page" as the copyright notice for easier
187187
identification within third-party archives.
188188

189-
Copyright 2023 XDEV Software
189+
Copyright 2024 XDEV Software
190190

191191
Licensed under the Apache License, Version 2.0 (the "License");
192192
you may not use this file except in compliance with the License.

README.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,12 @@ With *Spring-Data-Eclipse-Store* every time an object is loaded from the datasto
5353
## Installation
5454
[Installation guide for the latest release](https://github.com/xdev-software/spring-data-eclipse-store/releases/latest#Installation)
5555

56-
### Prerequisites
56+
### Supported versions
5757

58-
| | Minimal Version |
59-
|--------------|-----------------|
60-
| Java | ``17`` |
61-
| Spring Data | ``3.2.2`` |
62-
| EclipseStore | ``1.1.0`` |
58+
| Spring-Data-Eclipse-Store | Java | Spring Data | EclipseStore |
59+
|---------------------------|--------|-------------|--------------|
60+
| ``<= 1.0.2`` | ``17`` | ``3.2.2`` | ``1.1.0`` |
61+
| ``1.0.3`` | ``17`` | ``3.2.3`` | ``1.2.0`` |
6362

6463
### Usage
6564

spring-data-eclipse-store-benchmark/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
2121
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
2222

23-
<org.springframework.boot.version>3.2.2</org.springframework.boot.version>
23+
<org.springframework.boot.version>3.2.3</org.springframework.boot.version>
2424
<jmh.version>1.37</jmh.version>
2525
</properties>
2626

@@ -96,7 +96,7 @@
9696
<dependency>
9797
<groupId>com.puppycrawl.tools</groupId>
9898
<artifactId>checkstyle</artifactId>
99-
<version>10.13.0</version>
99+
<version>10.14.0</version>
100100
</dependency>
101101
</dependencies>
102102
<configuration>

spring-data-eclipse-store-demo/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
<mainClass>software.xdev.spring.data.eclipse.store.demo.complex.ComplexDemoApplication</mainClass>
2727

28-
<org.springframework.boot.version>3.2.2</org.springframework.boot.version>
28+
<org.springframework.boot.version>3.2.3</org.springframework.boot.version>
2929
</properties>
3030

3131
<dependencyManagement>
@@ -103,7 +103,7 @@
103103
<dependency>
104104
<groupId>com.puppycrawl.tools</groupId>
105105
<artifactId>checkstyle</artifactId>
106-
<version>10.13.0</version>
106+
<version>10.14.0</version>
107107
</dependency>
108108
</dependencies>
109109
<configuration>

spring-data-eclipse-store-jpa/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
<mainClass>software.xdev.spring.data.eclipse.store.demo.complex.ComplexDemoApplication</mainClass>
2727

28-
<org.springframework.boot.version>3.2.2</org.springframework.boot.version>
28+
<org.springframework.boot.version>3.2.3</org.springframework.boot.version>
2929
</properties>
3030

3131
<dependencyManagement>
@@ -123,7 +123,7 @@
123123
<dependency>
124124
<groupId>com.puppycrawl.tools</groupId>
125125
<artifactId>checkstyle</artifactId>
126-
<version>10.12.7</version>
126+
<version>10.14.0</version>
127127
</dependency>
128128
</dependencies>
129129
<configuration>
Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
package software.xdev.spring.data.eclipse.store.jpa;
16+
package software.xdev.spring.data.eclipse.store.jpa.integration;
1717

1818
import static org.springframework.test.annotation.DirtiesContext.ClassMode.BEFORE_EACH_TEST_METHOD;
1919

@@ -28,16 +28,13 @@
2828
import org.springframework.test.context.TestPropertySource;
2929
import org.springframework.test.context.junit.jupiter.SpringExtension;
3030

31-
import software.xdev.spring.data.eclipse.store.repository.config.EnableEclipseStoreRepositories;
32-
3331

3432
@Retention(RetentionPolicy.RUNTIME)
3533
@Target(ElementType.TYPE)
3634
@ExtendWith(SpringExtension.class)
3735
@ContextConfiguration(classes = {TestConfiguration.class})
3836
@DirtiesContext(classMode = BEFORE_EACH_TEST_METHOD)
3937
@TestPropertySource("/application.properties")
40-
@EnableEclipseStoreRepositories
4138
public @interface DefaultTestAnnotations
4239
{
4340
}

spring-data-eclipse-store-jpa/src/test/java/software/xdev/spring/data/eclipse/store/jpa/integration/IntegrationTest.java

Lines changed: 50 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,28 +22,70 @@
2222
import org.junit.jupiter.api.Test;
2323
import org.springframework.beans.factory.annotation.Autowired;
2424

25-
import software.xdev.spring.data.eclipse.store.jpa.DefaultTestAnnotations;
26-
import software.xdev.spring.data.eclipse.store.jpa.integration.repository.PersonToTest;
27-
import software.xdev.spring.data.eclipse.store.jpa.integration.repository.PersonToTestRepository;
25+
import software.xdev.spring.data.eclipse.store.importer.EclipseStoreDataImporterComponent;
26+
import software.xdev.spring.data.eclipse.store.jpa.integration.repository.PersonToTestInEclipseStore;
27+
import software.xdev.spring.data.eclipse.store.jpa.integration.repository.PersonToTestInEclipseStoreRepository;
28+
import software.xdev.spring.data.eclipse.store.jpa.integration.repository.PersonToTestInJpa;
29+
import software.xdev.spring.data.eclipse.store.jpa.integration.repository.PersonToTestInJpaRepository;
30+
import software.xdev.spring.data.eclipse.store.repository.EclipseStoreStorage;
31+
import software.xdev.spring.data.eclipse.store.repository.support.SimpleEclipseStoreRepository;
2832

2933

3034
@DefaultTestAnnotations
31-
public class IntegrationTest
35+
class IntegrationTest
3236
{
3337
@Autowired
34-
private PersonToTestRepository personToTestRepository;
38+
private PersonToTestInEclipseStoreRepository personToTestInEclipseStoreRepository;
39+
40+
@Autowired
41+
private PersonToTestInJpaRepository personToTestInJpaRepository;
42+
43+
@Autowired
44+
private EclipseStoreDataImporterComponent eclipseStoreDataImporter;
45+
46+
@Autowired
47+
private EclipseStoreStorage eclipseStoreStorage;
3548

3649
/**
3750
* Super simple test if there are any start-up errors when running parallel to a JPA configuration
3851
*/
3952
@Test
4053
void testBasicSaveAndFindSingleRecords()
4154
{
42-
final PersonToTest customer = new PersonToTest("", "");
43-
this.personToTestRepository.save(customer);
55+
final PersonToTestInEclipseStore customer = new PersonToTestInEclipseStore("", "");
56+
this.personToTestInEclipseStoreRepository.save(customer);
4457

45-
final List<PersonToTest> customers = this.personToTestRepository.findAll();
58+
final List<PersonToTestInEclipseStore> customers = this.personToTestInEclipseStoreRepository.findAll();
4659
Assertions.assertEquals(1, customers.size());
4760
Assertions.assertEquals(customer, customers.get(0));
4861
}
62+
63+
@Test
64+
void testEclipseStoreImport()
65+
{
66+
final PersonToTestInJpa customer = new PersonToTestInJpa("1", "", "");
67+
this.personToTestInJpaRepository.save(customer);
68+
69+
final List<SimpleEclipseStoreRepository<?, ?>> simpleEclipseStoreRepositories =
70+
this.eclipseStoreDataImporter.importData();
71+
Assertions.assertEquals(1, simpleEclipseStoreRepositories.size());
72+
final List<?> allEntities = simpleEclipseStoreRepositories.get(0).findAll();
73+
Assertions.assertEquals(1, allEntities.size());
74+
75+
this.eclipseStoreStorage.stop();
76+
Assertions.assertEquals(
77+
1,
78+
this.eclipseStoreStorage.getEntityCount(PersonToTestInJpa.class),
79+
"After restart the imported entities are not there anymore.");
80+
}
81+
82+
@Test
83+
void testEclipseStoreEmptyImport()
84+
{
85+
final List<SimpleEclipseStoreRepository<?, ?>> simpleEclipseStoreRepositories =
86+
this.eclipseStoreDataImporter.importData();
87+
Assertions.assertEquals(1, simpleEclipseStoreRepositories.size());
88+
final List<?> allEntities = simpleEclipseStoreRepositories.get(0).findAll();
89+
Assertions.assertEquals(0, allEntities.size());
90+
}
4991
}

spring-data-eclipse-store-jpa/src/test/java/software/xdev/spring/data/eclipse/store/jpa/TestConfiguration.java renamed to spring-data-eclipse-store-jpa/src/test/java/software/xdev/spring/data/eclipse/store/jpa/integration/TestConfiguration.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,16 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
package software.xdev.spring.data.eclipse.store.jpa;
16+
package software.xdev.spring.data.eclipse.store.jpa.integration;
1717

1818
import java.nio.file.Path;
1919

2020
import org.springframework.beans.factory.DisposableBean;
2121
import org.springframework.beans.factory.annotation.Autowired;
2222
import org.springframework.beans.factory.annotation.Value;
23+
import org.springframework.boot.SpringBootConfiguration;
24+
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
25+
import org.springframework.context.annotation.ComponentScan;
2326
import org.springframework.context.annotation.Configuration;
2427
import org.springframework.context.event.ContextRefreshedEvent;
2528
import org.springframework.context.event.EventListener;
@@ -28,8 +31,12 @@
2831
import software.xdev.spring.data.eclipse.store.repository.EclipseStoreStorage;
2932
import software.xdev.spring.data.eclipse.store.repository.config.EnableEclipseStoreRepositories;
3033

34+
3135
@Configuration
36+
@ComponentScan("software.xdev.spring.data.eclipse.store.importer")
3237
@EnableEclipseStoreRepositories
38+
@SpringBootConfiguration
39+
@EnableAutoConfiguration
3340
public class TestConfiguration implements DisposableBean
3441
{
3542
@Autowired
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55
import org.springframework.data.annotation.Id;
66

77

8-
public class PersonToTest
8+
public class PersonToTestInEclipseStore
99
{
1010
@Id
1111
private String id;
1212

1313
private final String firstName;
1414
private final String lastName;
1515

16-
public PersonToTest(final String firstName, final String lastName)
16+
public PersonToTestInEclipseStore(final String firstName, final String lastName)
1717
{
1818
this.firstName = firstName;
1919
this.lastName = lastName;
@@ -30,7 +30,7 @@ public boolean equals(final Object o)
3030
{
3131
return false;
3232
}
33-
final PersonToTest customer = (PersonToTest)o;
33+
final PersonToTestInEclipseStore customer = (PersonToTestInEclipseStore)o;
3434
return Objects.equals(this.id, customer.id) && Objects.equals(this.firstName, customer.firstName)
3535
&& Objects.equals(this.lastName, customer.lastName);
3636
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
import software.xdev.spring.data.eclipse.store.repository.interfaces.EclipseStoreListCrudRepository;
44

55

6-
public interface PersonToTestRepository extends EclipseStoreListCrudRepository<PersonToTest, String>
6+
public interface PersonToTestInEclipseStoreRepository extends EclipseStoreListCrudRepository<PersonToTestInEclipseStore, String>
77
{
88
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
package software.xdev.spring.data.eclipse.store.jpa.integration.repository;
2+
3+
import java.util.Objects;
4+
5+
import jakarta.persistence.Entity;
6+
import jakarta.persistence.Id;
7+
8+
9+
@Entity
10+
public class PersonToTestInJpa
11+
{
12+
@Id
13+
private String id;
14+
15+
private String firstName;
16+
private String lastName;
17+
18+
public PersonToTestInJpa(final String id, final String firstName, final String lastName)
19+
{
20+
this.id = id;
21+
this.firstName = firstName;
22+
this.lastName = lastName;
23+
}
24+
25+
public PersonToTestInJpa()
26+
{
27+
28+
}
29+
30+
@Override
31+
public boolean equals(final Object o)
32+
{
33+
if(this == o)
34+
{
35+
return true;
36+
}
37+
if(o == null || this.getClass() != o.getClass())
38+
{
39+
return false;
40+
}
41+
final PersonToTestInJpa customer = (PersonToTestInJpa)o;
42+
return Objects.equals(this.id, customer.id) && Objects.equals(this.firstName, customer.firstName)
43+
&& Objects.equals(this.lastName, customer.lastName);
44+
}
45+
46+
@Override
47+
public int hashCode()
48+
{
49+
return Objects.hash(this.id, this.firstName, this.lastName);
50+
}
51+
}

0 commit comments

Comments
 (0)