From ced45851db792b1944caa1387776253f3ec2519b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 6 Feb 2024 00:33:27 +0000 Subject: [PATCH 01/31] Bump com.puppycrawl.tools:checkstyle from 10.12.7 to 10.13.0 Bumps [com.puppycrawl.tools:checkstyle](https://github.com/checkstyle/checkstyle) from 10.12.7 to 10.13.0. - [Release notes](https://github.com/checkstyle/checkstyle/releases) - [Commits](https://github.com/checkstyle/checkstyle/compare/checkstyle-10.12.7...checkstyle-10.13.0) --- updated-dependencies: - dependency-name: com.puppycrawl.tools:checkstyle dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- spring-data-eclipse-store-jpa/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-data-eclipse-store-jpa/pom.xml b/spring-data-eclipse-store-jpa/pom.xml index edcd39bf..48d95ac2 100644 --- a/spring-data-eclipse-store-jpa/pom.xml +++ b/spring-data-eclipse-store-jpa/pom.xml @@ -123,7 +123,7 @@ com.puppycrawl.tools checkstyle - 10.12.7 + 10.13.0 From 1ca2f11d9aaf434bffef38c72d50dcd6a48079f7 Mon Sep 17 00:00:00 2001 From: JohannesRabauer Date: Thu, 8 Feb 2024 11:52:23 +0100 Subject: [PATCH 02/31] Minor fixes for starting storage in an unusual way --- .../data/eclipse/store/repository/EclipseStoreStorage.java | 4 ++++ 1 file changed, 4 insertions(+) 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 0bd12465..56d75c2c 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 @@ -158,6 +158,7 @@ public synchronized void store( final Class clazz, final Iterable entitiesToStore) { + this.ensureEntitiesInRoot(); final Collection entitiesAndPossiblyNonEntitiesToStore = this.collectRootEntitiesToStore(clazz, entitiesToStore); entitiesAndPossiblyNonEntitiesToStore.addAll(nonEntitiesToStore); @@ -205,6 +206,7 @@ private Collection collectRootEntitiesToStore(final Class clazz, public synchronized void delete(final Class clazz, final T objectToRemove) { + this.ensureEntitiesInRoot(); final List> entityLists = this.entitySetCollector.getRelatedIdentitySets(clazz); entityLists.forEach(entityList -> @@ -239,6 +241,7 @@ public synchronized void deleteAll(final Class clazz) public synchronized void clearData() { + this.ensureEntitiesInRoot(); this.root = new Root(); final StorageManager instanceOfstorageManager = this.getInstanceOfStorageManager(); this.initRoot(); @@ -273,6 +276,7 @@ public synchronized void stop() @SuppressWarnings("unchecked") public IdSetter ensureIdSetter(final Class domainClass) { + this.ensureEntitiesInRoot(); return (IdSetter)this.entityClassToIdSetter.computeIfAbsent( domainClass, clazz -> From 302d307f728c30267472d794475de0cb5aec3710 Mon Sep 17 00:00:00 2001 From: JohannesRabauer Date: Thu, 8 Feb 2024 14:28:27 +0100 Subject: [PATCH 03/31] Basically working, but tests failing --- .../eclipse/store/jpa/TestConfiguration.java | 3 + .../jpa/integration/IntegrationTest.java | 35 +++- ...t.java => PersonToTestInEclipseStore.java} | 6 +- ...PersonToTestInEclipseStoreRepository.java} | 2 +- .../repository/PersonToTestInJpa.java | 50 ++++++ .../PersonToTestInJpaRepository.java | 8 + .../importer/EclipseStoreDataImporter.java | 158 ++++++++++++++++++ .../EclipseStoreDataImporterComponent.java | 50 ++++++ .../EclipseStoreSingleRepositoryImporter.java | 147 ++++++++++++++++ .../EnableEclipseStoreRepositories.java | 1 + 10 files changed, 450 insertions(+), 10 deletions(-) rename spring-data-eclipse-store-jpa/src/test/java/software/xdev/spring/data/eclipse/store/jpa/integration/repository/{PersonToTest.java => PersonToTestInEclipseStore.java} (79%) rename spring-data-eclipse-store-jpa/src/test/java/software/xdev/spring/data/eclipse/store/jpa/integration/repository/{PersonToTestRepository.java => PersonToTestInEclipseStoreRepository.java} (58%) create mode 100644 spring-data-eclipse-store-jpa/src/test/java/software/xdev/spring/data/eclipse/store/jpa/integration/repository/PersonToTestInJpa.java create mode 100644 spring-data-eclipse-store-jpa/src/test/java/software/xdev/spring/data/eclipse/store/jpa/integration/repository/PersonToTestInJpaRepository.java create mode 100644 spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/importer/EclipseStoreDataImporter.java create mode 100644 spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/importer/EclipseStoreDataImporterComponent.java create mode 100644 spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/importer/EclipseStoreSingleRepositoryImporter.java diff --git a/spring-data-eclipse-store-jpa/src/test/java/software/xdev/spring/data/eclipse/store/jpa/TestConfiguration.java b/spring-data-eclipse-store-jpa/src/test/java/software/xdev/spring/data/eclipse/store/jpa/TestConfiguration.java index 002eb1fb..c430b01e 100644 --- a/spring-data-eclipse-store-jpa/src/test/java/software/xdev/spring/data/eclipse/store/jpa/TestConfiguration.java +++ b/spring-data-eclipse-store-jpa/src/test/java/software/xdev/spring/data/eclipse/store/jpa/TestConfiguration.java @@ -20,6 +20,7 @@ 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.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.context.event.ContextRefreshedEvent; import org.springframework.context.event.EventListener; @@ -28,7 +29,9 @@ import software.xdev.spring.data.eclipse.store.repository.EclipseStoreStorage; import software.xdev.spring.data.eclipse.store.repository.config.EnableEclipseStoreRepositories; + @Configuration +@ComponentScan("software.xdev.spring.data.eclipse.store.importer") @EnableEclipseStoreRepositories public class TestConfiguration implements DisposableBean { 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 fca98c97..1cb4f282 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 @@ -22,16 +22,26 @@ import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; +import software.xdev.spring.data.eclipse.store.importer.EclipseStoreDataImporterComponent; import software.xdev.spring.data.eclipse.store.jpa.DefaultTestAnnotations; -import software.xdev.spring.data.eclipse.store.jpa.integration.repository.PersonToTest; -import software.xdev.spring.data.eclipse.store.jpa.integration.repository.PersonToTestRepository; +import software.xdev.spring.data.eclipse.store.jpa.integration.repository.PersonToTestInEclipseStore; +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.support.SimpleEclipseStoreRepository; @DefaultTestAnnotations public class IntegrationTest { @Autowired - private PersonToTestRepository personToTestRepository; + private PersonToTestInEclipseStoreRepository personToTestInEclipseStoreRepository; + + @Autowired + private PersonToTestInJpaRepository personToTestInJpaRepository; + + @Autowired + private EclipseStoreDataImporterComponent eclipseStoreDataImporter; /** * Super simple test if there are any start-up errors when running parallel to a JPA configuration @@ -39,11 +49,24 @@ public class IntegrationTest @Test void testBasicSaveAndFindSingleRecords() { - final PersonToTest customer = new PersonToTest("", ""); - this.personToTestRepository.save(customer); + final PersonToTestInEclipseStore customer = new PersonToTestInEclipseStore("", ""); + this.personToTestInEclipseStoreRepository.save(customer); - final List customers = this.personToTestRepository.findAll(); + final List customers = this.personToTestInEclipseStoreRepository.findAll(); Assertions.assertEquals(1, customers.size()); Assertions.assertEquals(customer, customers.get(0)); } + + @Test + void testEclipseStoreImport() + { + final PersonToTestInJpa customer = new PersonToTestInJpa("", ""); + this.personToTestInJpaRepository.save(customer); + + final List> simpleEclipseStoreRepositories = + this.eclipseStoreDataImporter.importData(); + Assertions.assertEquals(1, simpleEclipseStoreRepositories.size()); + final List allEntities = simpleEclipseStoreRepositories.get(0).findAll(); + Assertions.assertEquals(1, allEntities.size()); + } } diff --git a/spring-data-eclipse-store-jpa/src/test/java/software/xdev/spring/data/eclipse/store/jpa/integration/repository/PersonToTest.java b/spring-data-eclipse-store-jpa/src/test/java/software/xdev/spring/data/eclipse/store/jpa/integration/repository/PersonToTestInEclipseStore.java similarity index 79% rename from spring-data-eclipse-store-jpa/src/test/java/software/xdev/spring/data/eclipse/store/jpa/integration/repository/PersonToTest.java rename to spring-data-eclipse-store-jpa/src/test/java/software/xdev/spring/data/eclipse/store/jpa/integration/repository/PersonToTestInEclipseStore.java index 652e91c2..f57f21e2 100644 --- a/spring-data-eclipse-store-jpa/src/test/java/software/xdev/spring/data/eclipse/store/jpa/integration/repository/PersonToTest.java +++ b/spring-data-eclipse-store-jpa/src/test/java/software/xdev/spring/data/eclipse/store/jpa/integration/repository/PersonToTestInEclipseStore.java @@ -5,7 +5,7 @@ import org.springframework.data.annotation.Id; -public class PersonToTest +public class PersonToTestInEclipseStore { @Id private String id; @@ -13,7 +13,7 @@ public class PersonToTest private final String firstName; private final String lastName; - public PersonToTest(final String firstName, final String lastName) + public PersonToTestInEclipseStore(final String firstName, final String lastName) { this.firstName = firstName; this.lastName = lastName; @@ -30,7 +30,7 @@ public boolean equals(final Object o) { return false; } - final PersonToTest customer = (PersonToTest)o; + final PersonToTestInEclipseStore customer = (PersonToTestInEclipseStore)o; return Objects.equals(this.id, customer.id) && Objects.equals(this.firstName, customer.firstName) && Objects.equals(this.lastName, customer.lastName); } diff --git a/spring-data-eclipse-store-jpa/src/test/java/software/xdev/spring/data/eclipse/store/jpa/integration/repository/PersonToTestRepository.java b/spring-data-eclipse-store-jpa/src/test/java/software/xdev/spring/data/eclipse/store/jpa/integration/repository/PersonToTestInEclipseStoreRepository.java similarity index 58% rename from spring-data-eclipse-store-jpa/src/test/java/software/xdev/spring/data/eclipse/store/jpa/integration/repository/PersonToTestRepository.java rename to spring-data-eclipse-store-jpa/src/test/java/software/xdev/spring/data/eclipse/store/jpa/integration/repository/PersonToTestInEclipseStoreRepository.java index 4f3ff7e8..1f2b5418 100644 --- a/spring-data-eclipse-store-jpa/src/test/java/software/xdev/spring/data/eclipse/store/jpa/integration/repository/PersonToTestRepository.java +++ b/spring-data-eclipse-store-jpa/src/test/java/software/xdev/spring/data/eclipse/store/jpa/integration/repository/PersonToTestInEclipseStoreRepository.java @@ -3,6 +3,6 @@ import software.xdev.spring.data.eclipse.store.repository.interfaces.EclipseStoreListCrudRepository; -public interface PersonToTestRepository extends EclipseStoreListCrudRepository +public interface PersonToTestInEclipseStoreRepository extends EclipseStoreListCrudRepository { } diff --git a/spring-data-eclipse-store-jpa/src/test/java/software/xdev/spring/data/eclipse/store/jpa/integration/repository/PersonToTestInJpa.java b/spring-data-eclipse-store-jpa/src/test/java/software/xdev/spring/data/eclipse/store/jpa/integration/repository/PersonToTestInJpa.java new file mode 100644 index 00000000..38db32d3 --- /dev/null +++ b/spring-data-eclipse-store-jpa/src/test/java/software/xdev/spring/data/eclipse/store/jpa/integration/repository/PersonToTestInJpa.java @@ -0,0 +1,50 @@ +package software.xdev.spring.data.eclipse.store.jpa.integration.repository; + +import java.util.Objects; + +import jakarta.persistence.Entity; +import jakarta.persistence.Id; + + +@Entity +public class PersonToTestInJpa +{ + @Id + private String id; + + private String firstName; + private String lastName; + + public PersonToTestInJpa(final String firstName, final String lastName) + { + this.firstName = firstName; + this.lastName = lastName; + } + + public PersonToTestInJpa() + { + + } + + @Override + public boolean equals(final Object o) + { + if(this == o) + { + return true; + } + if(o == null || this.getClass() != o.getClass()) + { + return false; + } + final PersonToTestInJpa customer = (PersonToTestInJpa)o; + return Objects.equals(this.id, customer.id) && Objects.equals(this.firstName, customer.firstName) + && Objects.equals(this.lastName, customer.lastName); + } + + @Override + public int hashCode() + { + return Objects.hash(this.id, this.firstName, this.lastName); + } +} diff --git a/spring-data-eclipse-store-jpa/src/test/java/software/xdev/spring/data/eclipse/store/jpa/integration/repository/PersonToTestInJpaRepository.java b/spring-data-eclipse-store-jpa/src/test/java/software/xdev/spring/data/eclipse/store/jpa/integration/repository/PersonToTestInJpaRepository.java new file mode 100644 index 00000000..a9072413 --- /dev/null +++ b/spring-data-eclipse-store-jpa/src/test/java/software/xdev/spring/data/eclipse/store/jpa/integration/repository/PersonToTestInJpaRepository.java @@ -0,0 +1,8 @@ +package software.xdev.spring.data.eclipse.store.jpa.integration.repository; + +import org.springframework.data.jpa.repository.JpaRepository; + + +public interface PersonToTestInJpaRepository extends JpaRepository +{ +} 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 new file mode 100644 index 00000000..944c3a5d --- /dev/null +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/importer/EclipseStoreDataImporter.java @@ -0,0 +1,158 @@ +/* + * 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.importer; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import java.util.stream.StreamSupport; + +import jakarta.persistence.EntityManagerFactory; +import jakarta.persistence.metamodel.EntityType; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import software.xdev.spring.data.eclipse.store.repository.EclipseStoreStorage; +import software.xdev.spring.data.eclipse.store.repository.support.SimpleEclipseStoreRepository; +import software.xdev.spring.data.eclipse.store.repository.support.copier.working.RecursiveWorkingCopier; + + +public class EclipseStoreDataImporter +{ + private static final Logger LOG = LoggerFactory.getLogger(EclipseStoreDataImporter.class); + private final EclipseStoreStorage eclipseStoreStorage; + + public EclipseStoreDataImporter(final EclipseStoreStorage eclipseStoreStorage) + { + this.eclipseStoreStorage = eclipseStoreStorage; + } + + public List> importData(final EntityManagerFactory... entityManagerFactories) + { + return this.importData(Arrays.stream(entityManagerFactories)); + } + + public List> importData(final Iterable entityManagerFactories) + { + return this.importData(StreamSupport.stream(entityManagerFactories.spliterator(), false)); + } + + public List> importData(final Stream entityManagerFactories) + { + LOG.info("Start importing data from JPA Repositories to EclipseStore..."); + + // First create all repositories to register them in the EclipseStoreStorage + final List allRepositories = + entityManagerFactories + .map(this::createEclipseStoreRepositoriesFromEntityManager) + .toList(); + LOG.info(String.format("Found %d repositories to export data from.", allRepositories.size())); + + // Now copy the data + allRepositories.forEach( + entityManagerFactoryRepositoryListPair -> + entityManagerFactoryRepositoryListPair + .classRepositoryPairs + .forEach( + classRepositoryPair -> copyData(entityManagerFactoryRepositoryListPair, classRepositoryPair) + ) + ); + LOG.info("Done importing data from JPA Repositories to EclipseStore."); + + return allRepositories + .stream() + .map(EntityManagerFactoryRepositoryListPair::classRepositoryPairs) + .flatMap(List::stream) + .map(ClassRepositoryPair::repository) + .collect(Collectors.toList()); + } + + private static void copyData( + final EntityManagerFactoryRepositoryListPair entityManagerFactoryRepositoryListPair, + final ClassRepositoryPair classRepositoryPair) + { + final String className = classRepositoryPair.domainClass.getName(); + + LOG.info(String.format("Loading entities of %s...", className)); + final List existingEntitiesToExport = + entityManagerFactoryRepositoryListPair.entityManagerFactory.createEntityManager() + .createQuery("SELECT c FROM " + className + " c") + .getResultList(); + LOG.info(String.format( + "Loaded %d entities of type %s to export.", + existingEntitiesToExport.size(), + className + )); + + LOG.info(String.format( + "Saving %d entities of type %s to the EclipseStore Repository...", + existingEntitiesToExport.size(), + className + )); + classRepositoryPair.repository.saveAll(existingEntitiesToExport); + LOG.info(String.format( + "Done saving entities of type %s. The EclipseStore now holds %d entities of that type.", + className, + classRepositoryPair.repository.count() + )); + } + + private EntityManagerFactoryRepositoryListPair createEclipseStoreRepositoriesFromEntityManager( + final EntityManagerFactory entityManagerFactory) + { + final List> repositoryList = new ArrayList<>(); + entityManagerFactory.getMetamodel().getEntities().forEach( + entityType -> this.createRepositoryForType(entityType, repositoryList) + ); + + return new EntityManagerFactoryRepositoryListPair(entityManagerFactory, repositoryList); + } + + private void createRepositoryForType( + final EntityType entityType, + final List> repositoryList) + { + final Class javaType = entityType.getJavaType(); + repositoryList.add(new ClassRepositoryPair<>(javaType, this.createEclipseStoreRepo(javaType))); + } + + private SimpleEclipseStoreRepository createEclipseStoreRepo(final Class domainClass) + { + return new SimpleEclipseStoreRepository<>( + this.eclipseStoreStorage, + new RecursiveWorkingCopier<>( + domainClass, + this.eclipseStoreStorage.getRegistry(), + this.eclipseStoreStorage, + this.eclipseStoreStorage), + domainClass); + } + + private record EntityManagerFactoryRepositoryListPair( + EntityManagerFactory entityManagerFactory, + List> classRepositoryPairs + ) + { + } + + + private record ClassRepositoryPair(Class domainClass, SimpleEclipseStoreRepository repository) + { + } +} 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 new file mode 100644 index 00000000..29e5517f --- /dev/null +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/importer/EclipseStoreDataImporterComponent.java @@ -0,0 +1,50 @@ +/* + * 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.importer; + +import java.util.List; +import java.util.Map; + +import jakarta.persistence.EntityManagerFactory; + +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.support.SimpleEclipseStoreRepository; + + +@Component +public class EclipseStoreDataImporterComponent +{ + private final EclipseStoreDataImporter importer; + private final ApplicationContext applicationContext; + + public EclipseStoreDataImporterComponent( + final EclipseStoreStorage eclipseStoreStorage, + final ApplicationContext applicationContext) + { + this.importer = new EclipseStoreDataImporter(eclipseStoreStorage); + this.applicationContext = applicationContext; + } + + public List> importData() + { + final Map beansOfEms = + this.applicationContext.getBeansOfType(EntityManagerFactory.class); + return this.importer.importData(beansOfEms.values()); + } +} diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/importer/EclipseStoreSingleRepositoryImporter.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/importer/EclipseStoreSingleRepositoryImporter.java new file mode 100644 index 00000000..738552f9 --- /dev/null +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/importer/EclipseStoreSingleRepositoryImporter.java @@ -0,0 +1,147 @@ +/* + * 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.importer; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import jakarta.persistence.EntityManagerFactory; +import jakarta.persistence.metamodel.EntityType; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.context.ApplicationContext; + +import software.xdev.spring.data.eclipse.store.repository.EclipseStoreStorage; +import software.xdev.spring.data.eclipse.store.repository.support.SimpleEclipseStoreRepository; +import software.xdev.spring.data.eclipse.store.repository.support.copier.working.RecursiveWorkingCopier; + + +public class EclipseStoreSingleRepositoryImporter +{ + private static final Logger LOG = LoggerFactory.getLogger(EclipseStoreSingleRepositoryImporter.class); + private final EclipseStoreStorage eclipseStoreStorage; + private final ApplicationContext applicationContext; + + public EclipseStoreSingleRepositoryImporter( + final EclipseStoreStorage eclipseStoreStorage, + final ApplicationContext applicationContext) + { + this.eclipseStoreStorage = eclipseStoreStorage; + this.applicationContext = applicationContext; + } + + public void importData() + { + LOG.info("Start importing data from JPA Repositories to EclipseStore..."); + final Map beansOfEms = + this.applicationContext.getBeansOfType(EntityManagerFactory.class); + + // First create all repositories to register them in the EclipseStoreStorage + final List allRepositories = + beansOfEms + .values() + .stream() + .map(this::createEclipseStoreRepositoriesFromEntityManager) + .toList(); + LOG.info(String.format("Found %d repositories to export data from.", allRepositories.size())); + + // Now copy the data + allRepositories.forEach( + entityManagerFactoryRepositoryListPair -> + entityManagerFactoryRepositoryListPair + .classRepositoryPairs + .forEach( + classRepositoryPair -> copyData(entityManagerFactoryRepositoryListPair, classRepositoryPair) + ) + ); + LOG.info("Done importing data from JPA Repositories to EclipseStore."); + } + + private static void copyData( + final EntityManagerFactoryRepositoryListPair entityManagerFactoryRepositoryListPair, + final ClassRepositoryPair classRepositoryPair) + { + final String className = classRepositoryPair.domainClass.getName(); + + LOG.info(String.format("Loading entities of %s...", className)); + final List existingEntitiesToExport = + entityManagerFactoryRepositoryListPair.entityManagerFactory.createEntityManager() + .createQuery("SELECT c FROM " + className + " c") + .getResultList(); + LOG.info(String.format( + "Loaded %d entities of type %s to export.", + existingEntitiesToExport.size(), + className + )); + + LOG.info(String.format( + "Saving %d entities of type %s to the EclipseStore Repository...", + existingEntitiesToExport.size(), + className + )); + classRepositoryPair.repository.saveAll(existingEntitiesToExport); + LOG.info(String.format( + "Done saving entities of type %s. The EclipseStore now holds %d entities of that type.", + className, + classRepositoryPair.repository.count() + )); + } + + private EntityManagerFactoryRepositoryListPair createEclipseStoreRepositoriesFromEntityManager( + final EntityManagerFactory entityManagerFactory) + { + final List> repositoryList = new ArrayList<>(); + entityManagerFactory.getMetamodel().getEntities().forEach( + entityType -> this.createRepositoryForType(entityType, repositoryList) + ); + + return new EntityManagerFactoryRepositoryListPair(entityManagerFactory, repositoryList); + } + + private void createRepositoryForType( + final EntityType entityType, + final List> repositoryList) + { + final Class javaType = entityType.getJavaType(); + repositoryList.add(new ClassRepositoryPair<>(javaType, this.createEclipseStoreRepo(javaType))); + } + + private SimpleEclipseStoreRepository createEclipseStoreRepo(final Class domainClass) + { + return new SimpleEclipseStoreRepository<>( + this.eclipseStoreStorage, + new RecursiveWorkingCopier<>( + domainClass, + this.eclipseStoreStorage.getRegistry(), + this.eclipseStoreStorage, + this.eclipseStoreStorage), + domainClass); + } + + private record EntityManagerFactoryRepositoryListPair( + EntityManagerFactory entityManagerFactory, + List> classRepositoryPairs + ) + { + } + + + private record ClassRepositoryPair(Class domainClass, SimpleEclipseStoreRepository repository) + { + } +} 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 4df9335d..c200a994 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 @@ -43,6 +43,7 @@ @Inherited @Import(EclipseStoreRepositoriesRegistrar.class) @ComponentScan({ + "software.xdev.spring.data.eclipse.store.importer", "software.xdev.spring.data.eclipse.store.repository", "org.eclipse.store.integrations.spring.boot.types"}) public @interface EnableEclipseStoreRepositories From c19e3daa945e873701f9d6b82d0e3afbe601a312 Mon Sep 17 00:00:00 2001 From: JohannesRabauer Date: Fri, 9 Feb 2024 10:11:29 +0100 Subject: [PATCH 04/31] Cleanup --- .../importer/EclipseStoreDataImporter.java | 63 +++++++++++-------- 1 file changed, 38 insertions(+), 25 deletions(-) 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 944c3a5d..a81fafaa 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 @@ -22,6 +22,7 @@ import java.util.stream.Stream; import java.util.stream.StreamSupport; +import jakarta.persistence.EntityManager; import jakarta.persistence.EntityManagerFactory; import jakarta.persistence.metamodel.EntityType; @@ -43,17 +44,24 @@ public EclipseStoreDataImporter(final EclipseStoreStorage eclipseStoreStorage) this.eclipseStoreStorage = eclipseStoreStorage; } + @SuppressWarnings("java:S1452") public List> importData(final EntityManagerFactory... entityManagerFactories) { return this.importData(Arrays.stream(entityManagerFactories)); } - public List> importData(final Iterable entityManagerFactories) + @SuppressWarnings("java:S1452") + public List> importData( + final Iterable entityManagerFactories + ) { return this.importData(StreamSupport.stream(entityManagerFactories.spliterator(), false)); } - public List> importData(final Stream entityManagerFactories) + @SuppressWarnings({"java:S1452", "java:S6204"}) + public List> importData( + final Stream entityManagerFactories + ) { LOG.info("Start importing data from JPA Repositories to EclipseStore..."); @@ -62,7 +70,7 @@ public EclipseStoreDataImporter(final EclipseStoreStorage eclipseStoreStorage) entityManagerFactories .map(this::createEclipseStoreRepositoriesFromEntityManager) .toList(); - LOG.info(String.format("Found %d repositories to export data from.", allRepositories.size())); + LOG.info("Found {} repositories to export data from.", allRepositories.size()); // Now copy the data allRepositories.forEach( @@ -89,28 +97,33 @@ private static void copyData( { final String className = classRepositoryPair.domainClass.getName(); - LOG.info(String.format("Loading entities of %s...", className)); - final List existingEntitiesToExport = - entityManagerFactoryRepositoryListPair.entityManagerFactory.createEntityManager() - .createQuery("SELECT c FROM " + className + " c") - .getResultList(); - LOG.info(String.format( - "Loaded %d entities of type %s to export.", - existingEntitiesToExport.size(), - className - )); - - LOG.info(String.format( - "Saving %d entities of type %s to the EclipseStore Repository...", - existingEntitiesToExport.size(), - className - )); - classRepositoryPair.repository.saveAll(existingEntitiesToExport); - LOG.info(String.format( - "Done saving entities of type %s. The EclipseStore now holds %d entities of that type.", - className, - classRepositoryPair.repository.count() - )); + LOG.info("Loading entities of {}...", className); + try(final EntityManager entityManager = + entityManagerFactoryRepositoryListPair.entityManagerFactory.createEntityManager()) + { + final List existingEntitiesToExport = + entityManager + .createQuery("SELECT c FROM " + className + " c", classRepositoryPair.domainClass) + .getResultList(); + + LOG.info( + "Loaded {} entities of type {} to export.", + existingEntitiesToExport.size(), + className + ); + + LOG.info( + "Saving {} entities of type {} to the EclipseStore Repository...", + existingEntitiesToExport.size(), + className + ); + classRepositoryPair.repository.saveAll(existingEntitiesToExport); + LOG.info( + "Done saving entities of type {}. The EclipseStore now holds {} entities of that type.", + className, + classRepositoryPair.repository.count() + ); + } } private EntityManagerFactoryRepositoryListPair createEclipseStoreRepositoriesFromEntityManager( From 89bc6b0c963cb4eb1de51a8c9b6937143bc1d4b3 Mon Sep 17 00:00:00 2001 From: JohannesRabauer Date: Fri, 9 Feb 2024 10:11:54 +0100 Subject: [PATCH 05/31] Importer Tests now running --- .../data/eclipse/store/jpa/DefaultTestAnnotations.java | 3 --- .../spring/data/eclipse/store/jpa/TestConfiguration.java | 4 ++++ .../eclipse/store/jpa/integration/IntegrationTest.java | 2 +- .../jpa/integration/repository/PersonToTestInJpa.java | 3 ++- .../eclipse/store/repository/EclipseStoreStorage.java | 9 +++++++++ .../eclipse/store/repository/EntityListProvider.java | 2 ++ .../repository/support/SimpleEclipseStoreRepository.java | 2 +- 7 files changed, 19 insertions(+), 6 deletions(-) diff --git a/spring-data-eclipse-store-jpa/src/test/java/software/xdev/spring/data/eclipse/store/jpa/DefaultTestAnnotations.java b/spring-data-eclipse-store-jpa/src/test/java/software/xdev/spring/data/eclipse/store/jpa/DefaultTestAnnotations.java index c2f5158a..b42457b2 100644 --- a/spring-data-eclipse-store-jpa/src/test/java/software/xdev/spring/data/eclipse/store/jpa/DefaultTestAnnotations.java +++ b/spring-data-eclipse-store-jpa/src/test/java/software/xdev/spring/data/eclipse/store/jpa/DefaultTestAnnotations.java @@ -28,8 +28,6 @@ import org.springframework.test.context.TestPropertySource; import org.springframework.test.context.junit.jupiter.SpringExtension; -import software.xdev.spring.data.eclipse.store.repository.config.EnableEclipseStoreRepositories; - @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE) @@ -37,7 +35,6 @@ @ContextConfiguration(classes = {TestConfiguration.class}) @DirtiesContext(classMode = BEFORE_EACH_TEST_METHOD) @TestPropertySource("/application.properties") -@EnableEclipseStoreRepositories public @interface DefaultTestAnnotations { } diff --git a/spring-data-eclipse-store-jpa/src/test/java/software/xdev/spring/data/eclipse/store/jpa/TestConfiguration.java b/spring-data-eclipse-store-jpa/src/test/java/software/xdev/spring/data/eclipse/store/jpa/TestConfiguration.java index c430b01e..350461c1 100644 --- a/spring-data-eclipse-store-jpa/src/test/java/software/xdev/spring/data/eclipse/store/jpa/TestConfiguration.java +++ b/spring-data-eclipse-store-jpa/src/test/java/software/xdev/spring/data/eclipse/store/jpa/TestConfiguration.java @@ -20,6 +20,8 @@ import org.springframework.beans.factory.DisposableBean; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.SpringBootConfiguration; +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.context.event.ContextRefreshedEvent; @@ -33,6 +35,8 @@ @Configuration @ComponentScan("software.xdev.spring.data.eclipse.store.importer") @EnableEclipseStoreRepositories +@SpringBootConfiguration +@EnableAutoConfiguration public class TestConfiguration implements DisposableBean { @Autowired 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 1cb4f282..f273a738 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 @@ -60,7 +60,7 @@ void testBasicSaveAndFindSingleRecords() @Test void testEclipseStoreImport() { - final PersonToTestInJpa customer = new PersonToTestInJpa("", ""); + final PersonToTestInJpa customer = new PersonToTestInJpa("1", "", ""); this.personToTestInJpaRepository.save(customer); final List> simpleEclipseStoreRepositories = diff --git a/spring-data-eclipse-store-jpa/src/test/java/software/xdev/spring/data/eclipse/store/jpa/integration/repository/PersonToTestInJpa.java b/spring-data-eclipse-store-jpa/src/test/java/software/xdev/spring/data/eclipse/store/jpa/integration/repository/PersonToTestInJpa.java index 38db32d3..a8c0fee4 100644 --- a/spring-data-eclipse-store-jpa/src/test/java/software/xdev/spring/data/eclipse/store/jpa/integration/repository/PersonToTestInJpa.java +++ b/spring-data-eclipse-store-jpa/src/test/java/software/xdev/spring/data/eclipse/store/jpa/integration/repository/PersonToTestInJpa.java @@ -15,8 +15,9 @@ public class PersonToTestInJpa private String firstName; private String lastName; - public PersonToTestInJpa(final String firstName, final String lastName) + public PersonToTestInJpa(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/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 56d75c2c..b0fde193 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 @@ -153,6 +153,15 @@ public synchronized IdentitySet getEntityList(final Class clazz) return (IdentitySet)this.root.getEntityLists().get(this.getEntityName(clazz)); } + @SuppressWarnings("unchecked") + @Override + public synchronized long getEntityCount(final Class clazz) + { + this.ensureEntitiesInRoot(); + final IdentitySet entityList = (IdentitySet)this.root.getEntityLists().get(this.getEntityName(clazz)); + return entityList == null ? 0 : entityList.size(); + } + public synchronized void store( final Collection nonEntitiesToStore, final Class clazz, 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 ef1edfd3..1be8b552 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 @@ -21,4 +21,6 @@ public interface EntityListProvider { IdentitySet getEntityList(final Class clazz); + + long getEntityCount(final Class clazz); } 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 0752c852..b366c873 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 @@ -227,7 +227,7 @@ public List findAllById(@Nonnull final Iterable ids) @Override public long count() { - return this.storage.getEntityList(this.domainClass).size(); + return this.storage.getEntityCount(this.domainClass); } @Override From 2d88243dba33e3bf38fb2b3cc8bfa59424ccd44c Mon Sep 17 00:00:00 2001 From: AB Date: Fri, 9 Feb 2024 11:04:52 +0100 Subject: [PATCH 06/31] [Checkstyle] Fix suppression comments not working properly --- .config/checkstyle/checkstyle.xml | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/.config/checkstyle/checkstyle.xml b/.config/checkstyle/checkstyle.xml index 506f37c0..97893200 100644 --- a/.config/checkstyle/checkstyle.xml +++ b/.config/checkstyle/checkstyle.xml @@ -43,7 +43,15 @@ + + + + + + + + @@ -131,11 +139,5 @@ - - - - - - From 98515615ceca684a94b78481068b74797f56cece Mon Sep 17 00:00:00 2001 From: AB Date: Fri, 9 Feb 2024 11:05:38 +0100 Subject: [PATCH 07/31] [Checkstyle] Generated files should always be located in src/gen... folder --- .config/checkstyle/checkstyle.xml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.config/checkstyle/checkstyle.xml b/.config/checkstyle/checkstyle.xml index 97893200..dc528437 100644 --- a/.config/checkstyle/checkstyle.xml +++ b/.config/checkstyle/checkstyle.xml @@ -30,10 +30,6 @@ - - - - From 91285bb0790db11b0085238c72074fd511b6f1d3 Mon Sep 17 00:00:00 2001 From: AB Date: Fri, 9 Feb 2024 11:05:46 +0100 Subject: [PATCH 08/31] [Checkstyle] Fix incorrect comment --- .config/checkstyle/checkstyle.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.config/checkstyle/checkstyle.xml b/.config/checkstyle/checkstyle.xml index dc528437..a0d7f178 100644 --- a/.config/checkstyle/checkstyle.xml +++ b/.config/checkstyle/checkstyle.xml @@ -16,7 +16,7 @@ - + From 074af81ea3a35bff5f18ba5befba90ce5070cbc1 Mon Sep 17 00:00:00 2001 From: JohannesRabauer Date: Fri, 9 Feb 2024 14:01:51 +0100 Subject: [PATCH 09/31] Finished Importer --- .../DefaultTestAnnotations.java | 2 +- .../jpa/integration/IntegrationTest.java | 23 ++- .../{ => integration}/TestConfiguration.java | 2 +- .../importer/EclipseStoreDataImporter.java | 54 ++++++- .../EclipseStoreDataImporterComponent.java | 15 ++ .../EclipseStoreSingleRepositoryImporter.java | 147 ------------------ .../store/repository/EclipseStoreStorage.java | 9 +- 7 files changed, 96 insertions(+), 156 deletions(-) rename spring-data-eclipse-store-jpa/src/test/java/software/xdev/spring/data/eclipse/store/jpa/{ => integration}/DefaultTestAnnotations.java (95%) rename spring-data-eclipse-store-jpa/src/test/java/software/xdev/spring/data/eclipse/store/jpa/{ => integration}/TestConfiguration.java (97%) delete mode 100644 spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/importer/EclipseStoreSingleRepositoryImporter.java diff --git a/spring-data-eclipse-store-jpa/src/test/java/software/xdev/spring/data/eclipse/store/jpa/DefaultTestAnnotations.java b/spring-data-eclipse-store-jpa/src/test/java/software/xdev/spring/data/eclipse/store/jpa/integration/DefaultTestAnnotations.java similarity index 95% rename from spring-data-eclipse-store-jpa/src/test/java/software/xdev/spring/data/eclipse/store/jpa/DefaultTestAnnotations.java rename to spring-data-eclipse-store-jpa/src/test/java/software/xdev/spring/data/eclipse/store/jpa/integration/DefaultTestAnnotations.java index b42457b2..2ab31c92 100644 --- a/spring-data-eclipse-store-jpa/src/test/java/software/xdev/spring/data/eclipse/store/jpa/DefaultTestAnnotations.java +++ b/spring-data-eclipse-store-jpa/src/test/java/software/xdev/spring/data/eclipse/store/jpa/integration/DefaultTestAnnotations.java @@ -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.jpa; +package software.xdev.spring.data.eclipse.store.jpa.integration; import static org.springframework.test.annotation.DirtiesContext.ClassMode.BEFORE_EACH_TEST_METHOD; 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 f273a738..3a8f91d0 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 @@ -23,16 +23,16 @@ import org.springframework.beans.factory.annotation.Autowired; import software.xdev.spring.data.eclipse.store.importer.EclipseStoreDataImporterComponent; -import software.xdev.spring.data.eclipse.store.jpa.DefaultTestAnnotations; import software.xdev.spring.data.eclipse.store.jpa.integration.repository.PersonToTestInEclipseStore; 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.support.SimpleEclipseStoreRepository; @DefaultTestAnnotations -public class IntegrationTest +class IntegrationTest { @Autowired private PersonToTestInEclipseStoreRepository personToTestInEclipseStoreRepository; @@ -43,6 +43,9 @@ public class IntegrationTest @Autowired private EclipseStoreDataImporterComponent eclipseStoreDataImporter; + @Autowired + private EclipseStoreStorage eclipseStoreStorage; + /** * Super simple test if there are any start-up errors when running parallel to a JPA configuration */ @@ -68,5 +71,21 @@ void testEclipseStoreImport() Assertions.assertEquals(1, simpleEclipseStoreRepositories.size()); final List allEntities = simpleEclipseStoreRepositories.get(0).findAll(); Assertions.assertEquals(1, allEntities.size()); + + this.eclipseStoreStorage.stop(); + Assertions.assertEquals( + 1, + this.eclipseStoreStorage.getEntityCount(PersonToTestInJpa.class), + "After restart the imported entities are not there anymore."); + } + + @Test + void testEclipseStoreEmptyImport() + { + final List> simpleEclipseStoreRepositories = + this.eclipseStoreDataImporter.importData(); + Assertions.assertEquals(1, simpleEclipseStoreRepositories.size()); + final List allEntities = simpleEclipseStoreRepositories.get(0).findAll(); + Assertions.assertEquals(0, allEntities.size()); } } diff --git a/spring-data-eclipse-store-jpa/src/test/java/software/xdev/spring/data/eclipse/store/jpa/TestConfiguration.java b/spring-data-eclipse-store-jpa/src/test/java/software/xdev/spring/data/eclipse/store/jpa/integration/TestConfiguration.java similarity index 97% rename from spring-data-eclipse-store-jpa/src/test/java/software/xdev/spring/data/eclipse/store/jpa/TestConfiguration.java rename to spring-data-eclipse-store-jpa/src/test/java/software/xdev/spring/data/eclipse/store/jpa/integration/TestConfiguration.java index 350461c1..bb73884f 100644 --- a/spring-data-eclipse-store-jpa/src/test/java/software/xdev/spring/data/eclipse/store/jpa/TestConfiguration.java +++ b/spring-data-eclipse-store-jpa/src/test/java/software/xdev/spring/data/eclipse/store/jpa/integration/TestConfiguration.java @@ -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.jpa; +package software.xdev.spring.data.eclipse.store.jpa.integration; import java.nio.file.Path; 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 a81fafaa..56cf2509 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,9 @@ import software.xdev.spring.data.eclipse.store.repository.support.copier.working.RecursiveWorkingCopier; +/** + * Imports entities from {@link EntityManagerFactory}s into the EclipseStore storage. + */ public class EclipseStoreDataImporter { private static final Logger LOG = LoggerFactory.getLogger(EclipseStoreDataImporter.class); @@ -44,12 +47,39 @@ public EclipseStoreDataImporter(final EclipseStoreStorage eclipseStoreStorage) this.eclipseStoreStorage = eclipseStoreStorage; } + /** + * Imports entities from all given {@link EntityManagerFactory}s that are available into the EclipseStore storage. + *

+ * This should be done only once. Otherwise entities may be imported multiple times. + *

+ *

+ * After importing all the entities, the existing repositories should be converted to + * {@link software.xdev.spring.data.eclipse.store.repository.interfaces.EclipseStoreRepository}. + *

+ * + * @param entityManagerFactories which are searched for entities + * @return all the newly created {@link SimpleEclipseStoreRepository} for the specific entities. + */ @SuppressWarnings("java:S1452") public List> importData(final EntityManagerFactory... entityManagerFactories) { return this.importData(Arrays.stream(entityManagerFactories)); } + /** + * Imports entities from all given {@link EntityManagerFactory}s that are available into the EclipseStore storage. + *

+ * This should be done only once. Otherwise entities may be imported multiple times. + *

+ *

+ * After importing all the entities, the existing repositories should be converted to + * {@link software.xdev.spring.data.eclipse.store.repository.interfaces.EclipseStoreRepository}. + *

+ * + * @param entityManagerFactories which are searched for entities + * + * @return all the newly created {@link SimpleEclipseStoreRepository} for the specific entities. + */ @SuppressWarnings("java:S1452") public List> importData( final Iterable entityManagerFactories @@ -58,6 +88,20 @@ public EclipseStoreDataImporter(final EclipseStoreStorage eclipseStoreStorage) return this.importData(StreamSupport.stream(entityManagerFactories.spliterator(), false)); } + /** + * Imports entities from all given {@link EntityManagerFactory}s that are available into the EclipseStore storage. + *

+ * This should be done only once. Otherwise entities may be imported multiple times. + *

+ *

+ * After importing all the entities, the existing repositories should be converted to + * {@link software.xdev.spring.data.eclipse.store.repository.interfaces.EclipseStoreRepository}. + *

+ * + * @param entityManagerFactories which are searched for entities + * + * @return all the newly created {@link SimpleEclipseStoreRepository} for the specific entities. + */ @SuppressWarnings({"java:S1452", "java:S6204"}) public List> importData( final Stream entityManagerFactories @@ -78,7 +122,8 @@ public EclipseStoreDataImporter(final EclipseStoreStorage eclipseStoreStorage) entityManagerFactoryRepositoryListPair .classRepositoryPairs .forEach( - classRepositoryPair -> copyData(entityManagerFactoryRepositoryListPair, classRepositoryPair) + classRepositoryPair -> + this.copyData(entityManagerFactoryRepositoryListPair, classRepositoryPair) ) ); LOG.info("Done importing data from JPA Repositories to EclipseStore."); @@ -91,7 +136,7 @@ public EclipseStoreDataImporter(final EclipseStoreStorage eclipseStoreStorage) .collect(Collectors.toList()); } - private static void copyData( + private void copyData( final EntityManagerFactoryRepositoryListPair entityManagerFactoryRepositoryListPair, final ClassRepositoryPair classRepositoryPair) { @@ -103,7 +148,10 @@ private static void copyData( { final List existingEntitiesToExport = entityManager - .createQuery("SELECT c FROM " + className + " c", classRepositoryPair.domainClass) + .createQuery( + "SELECT c FROM " + className + " c", + classRepositoryPair.domainClass + ) .getResultList(); LOG.info( 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 29e5517f..b6494f93 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 @@ -27,6 +27,9 @@ import software.xdev.spring.data.eclipse.store.repository.support.SimpleEclipseStoreRepository; +/** + * Imports entities from {@link EntityManagerFactory}s into the EclipseStore storage. + */ @Component public class EclipseStoreDataImporterComponent { @@ -41,6 +44,18 @@ public EclipseStoreDataImporterComponent( this.applicationContext = applicationContext; } + /** + * Imports entities from all {@link EntityManagerFactory}s that are available into the EclipseStore storage. + *

+ * This should be done only once. Otherwise entities may be imported multiple times. + *

+ *

+ * After importing all the entities, the existing repositories should be converted to + * {@link software.xdev.spring.data.eclipse.store.repository.interfaces.EclipseStoreRepository}. + *

+ * + * @return all the newly created {@link SimpleEclipseStoreRepository} for the specific entities. + */ public List> importData() { final Map beansOfEms = diff --git a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/importer/EclipseStoreSingleRepositoryImporter.java b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/importer/EclipseStoreSingleRepositoryImporter.java deleted file mode 100644 index 738552f9..00000000 --- a/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/importer/EclipseStoreSingleRepositoryImporter.java +++ /dev/null @@ -1,147 +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.importer; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import jakarta.persistence.EntityManagerFactory; -import jakarta.persistence.metamodel.EntityType; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.context.ApplicationContext; - -import software.xdev.spring.data.eclipse.store.repository.EclipseStoreStorage; -import software.xdev.spring.data.eclipse.store.repository.support.SimpleEclipseStoreRepository; -import software.xdev.spring.data.eclipse.store.repository.support.copier.working.RecursiveWorkingCopier; - - -public class EclipseStoreSingleRepositoryImporter -{ - private static final Logger LOG = LoggerFactory.getLogger(EclipseStoreSingleRepositoryImporter.class); - private final EclipseStoreStorage eclipseStoreStorage; - private final ApplicationContext applicationContext; - - public EclipseStoreSingleRepositoryImporter( - final EclipseStoreStorage eclipseStoreStorage, - final ApplicationContext applicationContext) - { - this.eclipseStoreStorage = eclipseStoreStorage; - this.applicationContext = applicationContext; - } - - public void importData() - { - LOG.info("Start importing data from JPA Repositories to EclipseStore..."); - final Map beansOfEms = - this.applicationContext.getBeansOfType(EntityManagerFactory.class); - - // First create all repositories to register them in the EclipseStoreStorage - final List allRepositories = - beansOfEms - .values() - .stream() - .map(this::createEclipseStoreRepositoriesFromEntityManager) - .toList(); - LOG.info(String.format("Found %d repositories to export data from.", allRepositories.size())); - - // Now copy the data - allRepositories.forEach( - entityManagerFactoryRepositoryListPair -> - entityManagerFactoryRepositoryListPair - .classRepositoryPairs - .forEach( - classRepositoryPair -> copyData(entityManagerFactoryRepositoryListPair, classRepositoryPair) - ) - ); - LOG.info("Done importing data from JPA Repositories to EclipseStore."); - } - - private static void copyData( - final EntityManagerFactoryRepositoryListPair entityManagerFactoryRepositoryListPair, - final ClassRepositoryPair classRepositoryPair) - { - final String className = classRepositoryPair.domainClass.getName(); - - LOG.info(String.format("Loading entities of %s...", className)); - final List existingEntitiesToExport = - entityManagerFactoryRepositoryListPair.entityManagerFactory.createEntityManager() - .createQuery("SELECT c FROM " + className + " c") - .getResultList(); - LOG.info(String.format( - "Loaded %d entities of type %s to export.", - existingEntitiesToExport.size(), - className - )); - - LOG.info(String.format( - "Saving %d entities of type %s to the EclipseStore Repository...", - existingEntitiesToExport.size(), - className - )); - classRepositoryPair.repository.saveAll(existingEntitiesToExport); - LOG.info(String.format( - "Done saving entities of type %s. The EclipseStore now holds %d entities of that type.", - className, - classRepositoryPair.repository.count() - )); - } - - private EntityManagerFactoryRepositoryListPair createEclipseStoreRepositoriesFromEntityManager( - final EntityManagerFactory entityManagerFactory) - { - final List> repositoryList = new ArrayList<>(); - entityManagerFactory.getMetamodel().getEntities().forEach( - entityType -> this.createRepositoryForType(entityType, repositoryList) - ); - - return new EntityManagerFactoryRepositoryListPair(entityManagerFactory, repositoryList); - } - - private void createRepositoryForType( - final EntityType entityType, - final List> repositoryList) - { - final Class javaType = entityType.getJavaType(); - repositoryList.add(new ClassRepositoryPair<>(javaType, this.createEclipseStoreRepo(javaType))); - } - - private SimpleEclipseStoreRepository createEclipseStoreRepo(final Class domainClass) - { - return new SimpleEclipseStoreRepository<>( - this.eclipseStoreStorage, - new RecursiveWorkingCopier<>( - domainClass, - this.eclipseStoreStorage.getRegistry(), - this.eclipseStoreStorage, - this.eclipseStoreStorage), - domainClass); - } - - private record EntityManagerFactoryRepositoryListPair( - EntityManagerFactory entityManagerFactory, - List> classRepositoryPairs - ) - { - } - - - private record ClassRepositoryPair(Class domainClass, SimpleEclipseStoreRepository repository) - { - } -} 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 b0fde193..da2c3312 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 @@ -32,7 +32,6 @@ import org.eclipse.store.storage.types.StorageManager; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import software.xdev.spring.data.eclipse.store.core.IdentitySet; @@ -60,7 +59,6 @@ public class EclipseStoreStorage private final WorkingCopyRegistry registry = new WorkingCopyRegistry(); private RepositorySynchronizer repositorySynchronizer; - @Autowired public EclipseStoreStorage( final EclipseStoreProperties storeConfiguration, final EclipseStoreProvider storeProvider) @@ -138,6 +136,13 @@ public synchronized void registerEntity(final Class classToRegister) throw new AlreadyRegisteredException(entityName); } this.entityClassToRepositoryName.put(classToRegister, entityName); + + // If the storage is running and a new entity is registered, we need to stop the storage to restart + // again with the registered entity. + if(this.storageManager != null) + { + this.stop(); + } } private String getEntityName(final Class classToRegister) From 379bd94a0420d8e97e474b1fc7c94983280a1131 Mon Sep 17 00:00:00 2001 From: JohannesRabauer Date: Fri, 9 Feb 2024 14:05:41 +0100 Subject: [PATCH 10/31] Checkstyle fix --- .../store/importer/EclipseStoreDataImporterComponent.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 b6494f93..adf1b878 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 @@ -56,7 +56,7 @@ public EclipseStoreDataImporterComponent( * * @return all the newly created {@link SimpleEclipseStoreRepository} for the specific entities. */ - public List> importData() + public List> importData() { final Map beansOfEms = this.applicationContext.getBeansOfType(EntityManagerFactory.class); From 05774b7eec4a75087001f607a4ff3d06f5694e90 Mon Sep 17 00:00:00 2001 From: JohannesRabauer Date: Fri, 9 Feb 2024 14:06:26 +0100 Subject: [PATCH 11/31] Update CHANGELOG.md --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ff3e150e..7a7e53aa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# 1.0.3 + +* Added the EclipseStoreDataImporter to import data from JPA repositories. + # 1.0.2 * Added the EclipseStoreCustomRepository which has no methods defined at all. From 8b9c55fb1881bdd9573a641e464259f281e66b23 Mon Sep 17 00:00:00 2001 From: JohannesRabauer Date: Mon, 12 Feb 2024 16:23:01 +0100 Subject: [PATCH 12/31] Implemented plenty of Tests for specific Java Types --- .../tests/IsolatedTestAnnotations.java | 38 +++ .../tests/IsolatedTestConfiguration.java | 57 ++++ .../special/types/BigDecimalDaoObject.java | 28 ++ .../special/types/BigDecimalRepository.java | 23 ++ .../special/types/BigIntegerDaoObject.java | 28 ++ .../special/types/BigIntegerRepository.java | 23 ++ .../special/types/CalendarDaoObject.java | 27 ++ .../special/types/CalendarRepository.java | 23 ++ .../tests/special/types/ComplexObject.java | 71 ++++ .../tests/special/types/DateDaoObject.java | 27 ++ .../tests/special/types/DateRepository.java | 23 ++ .../tests/special/types/EnumMapDaoObject.java | 33 ++ .../special/types/EnumMapRepository.java | 23 ++ .../tests/special/types/EnumSetDaoObject.java | 33 ++ .../special/types/EnumSetRepository.java | 23 ++ .../tests/special/types/LazyDaoObject.java | 27 ++ .../tests/special/types/LazyRepository.java | 23 ++ .../tests/special/types/ListDaoObject.java | 28 ++ .../tests/special/types/ListRepository.java | 23 ++ .../special/types/LocalDateDaoObject.java | 27 ++ .../special/types/LocalDateRepository.java | 23 ++ .../special/types/LocalDateTimeDaoObject.java | 28 ++ .../types/LocalDateTimeRepository.java | 23 ++ .../special/types/LocalTimeDaoObject.java | 27 ++ .../special/types/LocalTimeRepository.java | 23 ++ .../tests/special/types/MapDaoObject.java | 27 ++ .../tests/special/types/MapRepository.java | 23 ++ .../special/types/OptionalDaoObject.java | 27 ++ .../special/types/OptionalRepository.java | 23 ++ .../tests/special/types/SetDaoObject.java | 27 ++ .../tests/special/types/SetRepository.java | 23 ++ .../tests/special/types/TypesData.java | 308 ++++++++++++++++++ .../tests/special/types/TypesTest.java | 138 ++++++++ 33 files changed, 1328 insertions(+) create mode 100644 spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/IsolatedTestAnnotations.java create mode 100644 spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/IsolatedTestConfiguration.java create mode 100644 spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/BigDecimalDaoObject.java create mode 100644 spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/BigDecimalRepository.java create mode 100644 spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/BigIntegerDaoObject.java create mode 100644 spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/BigIntegerRepository.java create mode 100644 spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/CalendarDaoObject.java create mode 100644 spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/CalendarRepository.java create mode 100644 spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/ComplexObject.java create mode 100644 spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/DateDaoObject.java create mode 100644 spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/DateRepository.java create mode 100644 spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/EnumMapDaoObject.java create mode 100644 spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/EnumMapRepository.java create mode 100644 spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/EnumSetDaoObject.java create mode 100644 spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/EnumSetRepository.java create mode 100644 spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/LazyDaoObject.java create mode 100644 spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/LazyRepository.java create mode 100644 spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/ListDaoObject.java create mode 100644 spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/ListRepository.java create mode 100644 spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/LocalDateDaoObject.java create mode 100644 spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/LocalDateRepository.java create mode 100644 spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/LocalDateTimeDaoObject.java create mode 100644 spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/LocalDateTimeRepository.java create mode 100644 spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/LocalTimeDaoObject.java create mode 100644 spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/LocalTimeRepository.java create mode 100644 spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/MapDaoObject.java create mode 100644 spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/MapRepository.java create mode 100644 spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/OptionalDaoObject.java create mode 100644 spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/OptionalRepository.java create mode 100644 spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/SetDaoObject.java create mode 100644 spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/SetRepository.java create mode 100644 spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/TypesData.java create mode 100644 spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/TypesTest.java diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/IsolatedTestAnnotations.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/IsolatedTestAnnotations.java new file mode 100644 index 00000000..fd64c3cb --- /dev/null +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/IsolatedTestAnnotations.java @@ -0,0 +1,38 @@ +/* + * 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.isolatet.tests; + +import static org.springframework.test.annotation.DirtiesContext.ClassMode.BEFORE_EACH_TEST_METHOD; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +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/isolatet/tests/IsolatedTestConfiguration.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/IsolatedTestConfiguration.java new file mode 100644 index 00000000..5b9a91bf --- /dev/null +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/IsolatedTestConfiguration.java @@ -0,0 +1,57 @@ +/* + * 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.isolatet.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/isolatet/tests/special/types/BigDecimalDaoObject.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/BigDecimalDaoObject.java new file mode 100644 index 00000000..752427b6 --- /dev/null +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/BigDecimalDaoObject.java @@ -0,0 +1,28 @@ +/* + * 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.isolatet.tests.special.types; + +import java.math.BigDecimal; +import java.util.List; + + +public class BigDecimalDaoObject extends ComplexObject +{ + public BigDecimalDaoObject(final Integer id, final BigDecimal value) + { + super(id, value); + } +} diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/BigDecimalRepository.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/BigDecimalRepository.java new file mode 100644 index 00000000..1966bd63 --- /dev/null +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/BigDecimalRepository.java @@ -0,0 +1,23 @@ +/* + * 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.isolatet.tests.special.types; + +import software.xdev.spring.data.eclipse.store.repository.interfaces.EclipseStoreRepository; + + +public interface BigDecimalRepository extends EclipseStoreRepository +{ +} diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/BigIntegerDaoObject.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/BigIntegerDaoObject.java new file mode 100644 index 00000000..7d096309 --- /dev/null +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/BigIntegerDaoObject.java @@ -0,0 +1,28 @@ +/* + * 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.isolatet.tests.special.types; + +import java.math.BigDecimal; +import java.math.BigInteger; + + +public class BigIntegerDaoObject extends ComplexObject +{ + public BigIntegerDaoObject(final Integer id, final BigInteger value) + { + super(id, value); + } +} diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/BigIntegerRepository.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/BigIntegerRepository.java new file mode 100644 index 00000000..48cadeb5 --- /dev/null +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/BigIntegerRepository.java @@ -0,0 +1,23 @@ +/* + * 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.isolatet.tests.special.types; + +import software.xdev.spring.data.eclipse.store.repository.interfaces.EclipseStoreRepository; + + +public interface BigIntegerRepository extends EclipseStoreRepository +{ +} diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/CalendarDaoObject.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/CalendarDaoObject.java new file mode 100644 index 00000000..3fc062a3 --- /dev/null +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/CalendarDaoObject.java @@ -0,0 +1,27 @@ +/* + * 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.isolatet.tests.special.types; + +import java.util.Calendar; + + +public class CalendarDaoObject extends ComplexObject +{ + public CalendarDaoObject(final Integer id, final Calendar value) + { + super(id, value); + } +} diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/CalendarRepository.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/CalendarRepository.java new file mode 100644 index 00000000..c4b347c5 --- /dev/null +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/CalendarRepository.java @@ -0,0 +1,23 @@ +/* + * 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.isolatet.tests.special.types; + +import software.xdev.spring.data.eclipse.store.repository.interfaces.EclipseStoreRepository; + + +public interface CalendarRepository extends EclipseStoreRepository +{ +} diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/ComplexObject.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/ComplexObject.java new file mode 100644 index 00000000..482436ba --- /dev/null +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/ComplexObject.java @@ -0,0 +1,71 @@ +/* + * 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.isolatet.tests.special.types; + +import java.util.Objects; + +import jakarta.persistence.Id; + + +public class ComplexObject +{ + @Id + private final Integer id; + + private T value; + + public ComplexObject(final Integer id, final T value) + { + this.id = id; + this.value = value; + } + + public T getValue() + { + return this.value; + } + + public void setValue(final T value) + { + this.value = value; + } + + public Integer getId() + { + return this.id; + } + + @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.id, that.id) && Objects.equals(this.value, that.value); + } + + @Override + public int hashCode() + { + return Objects.hash(this.id, this.value); + } +} diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/DateDaoObject.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/DateDaoObject.java new file mode 100644 index 00000000..64d9afa4 --- /dev/null +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/DateDaoObject.java @@ -0,0 +1,27 @@ +/* + * 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.isolatet.tests.special.types; + +import java.util.Date; + + +public class DateDaoObject extends ComplexObject +{ + public DateDaoObject(final Integer id, final Date value) + { + super(id, value); + } +} diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/DateRepository.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/DateRepository.java new file mode 100644 index 00000000..11742a7a --- /dev/null +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/DateRepository.java @@ -0,0 +1,23 @@ +/* + * 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.isolatet.tests.special.types; + +import software.xdev.spring.data.eclipse.store.repository.interfaces.EclipseStoreRepository; + + +public interface DateRepository extends EclipseStoreRepository +{ +} diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/EnumMapDaoObject.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/EnumMapDaoObject.java new file mode 100644 index 00000000..1665eb85 --- /dev/null +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/EnumMapDaoObject.java @@ -0,0 +1,33 @@ +/* + * 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.isolatet.tests.special.types; + +import java.util.EnumMap; +import java.util.Map; + + +public class EnumMapDaoObject extends ComplexObject> +{ + public enum Album + { + RUMOURS, + TUSK + } + public EnumMapDaoObject(final Integer id, final EnumMap value) + { + super(id, value); + } +} diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/EnumMapRepository.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/EnumMapRepository.java new file mode 100644 index 00000000..f6097bea --- /dev/null +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/EnumMapRepository.java @@ -0,0 +1,23 @@ +/* + * 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.isolatet.tests.special.types; + +import software.xdev.spring.data.eclipse.store.repository.interfaces.EclipseStoreRepository; + + +public interface EnumMapRepository extends EclipseStoreRepository +{ +} diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/EnumSetDaoObject.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/EnumSetDaoObject.java new file mode 100644 index 00000000..455a23fa --- /dev/null +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/EnumSetDaoObject.java @@ -0,0 +1,33 @@ +/* + * 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.isolatet.tests.special.types; + +import java.util.EnumSet; + + +public class EnumSetDaoObject extends ComplexObject> +{ + public enum Album + { + RUMOURS, + TUSK + } + + public EnumSetDaoObject(final Integer id, final EnumSet value) + { + super(id, value); + } +} diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/EnumSetRepository.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/EnumSetRepository.java new file mode 100644 index 00000000..cc12a148 --- /dev/null +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/EnumSetRepository.java @@ -0,0 +1,23 @@ +/* + * 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.isolatet.tests.special.types; + +import software.xdev.spring.data.eclipse.store.repository.interfaces.EclipseStoreRepository; + + +public interface EnumSetRepository extends EclipseStoreRepository +{ +} diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/LazyDaoObject.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/LazyDaoObject.java new file mode 100644 index 00000000..45c437d7 --- /dev/null +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/LazyDaoObject.java @@ -0,0 +1,27 @@ +/* + * 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.isolatet.tests.special.types; + +import org.eclipse.serializer.reference.Lazy; + + +public class LazyDaoObject extends ComplexObject> +{ + public LazyDaoObject(final Integer id, final Lazy value) + { + super(id, value); + } +} diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/LazyRepository.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/LazyRepository.java new file mode 100644 index 00000000..3fd7fcbe --- /dev/null +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/LazyRepository.java @@ -0,0 +1,23 @@ +/* + * 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.isolatet.tests.special.types; + +import software.xdev.spring.data.eclipse.store.repository.interfaces.EclipseStoreRepository; + + +public interface LazyRepository extends EclipseStoreRepository +{ +} diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/ListDaoObject.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/ListDaoObject.java new file mode 100644 index 00000000..795b06c2 --- /dev/null +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/ListDaoObject.java @@ -0,0 +1,28 @@ +/* + * 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.isolatet.tests.special.types; + +import java.util.List; +import java.util.Set; + + +public class ListDaoObject extends ComplexObject> +{ + public ListDaoObject(final Integer id, final List value) + { + super(id, value); + } +} diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/ListRepository.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/ListRepository.java new file mode 100644 index 00000000..f934f059 --- /dev/null +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/ListRepository.java @@ -0,0 +1,23 @@ +/* + * 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.isolatet.tests.special.types; + +import software.xdev.spring.data.eclipse.store.repository.interfaces.EclipseStoreRepository; + + +public interface ListRepository extends EclipseStoreRepository +{ +} diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/LocalDateDaoObject.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/LocalDateDaoObject.java new file mode 100644 index 00000000..45801556 --- /dev/null +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/LocalDateDaoObject.java @@ -0,0 +1,27 @@ +/* + * 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.isolatet.tests.special.types; + +import java.time.LocalDate; + + +public class LocalDateDaoObject extends ComplexObject +{ + public LocalDateDaoObject(final Integer id, final LocalDate value) + { + super(id, value); + } +} diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/LocalDateRepository.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/LocalDateRepository.java new file mode 100644 index 00000000..9ec2097d --- /dev/null +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/LocalDateRepository.java @@ -0,0 +1,23 @@ +/* + * 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.isolatet.tests.special.types; + +import software.xdev.spring.data.eclipse.store.repository.interfaces.EclipseStoreRepository; + + +public interface LocalDateRepository extends EclipseStoreRepository +{ +} diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/LocalDateTimeDaoObject.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/LocalDateTimeDaoObject.java new file mode 100644 index 00000000..dce2b378 --- /dev/null +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/LocalDateTimeDaoObject.java @@ -0,0 +1,28 @@ +/* + * 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.isolatet.tests.special.types; + +import java.math.BigInteger; +import java.time.LocalDateTime; + + +public class LocalDateTimeDaoObject extends ComplexObject +{ + public LocalDateTimeDaoObject(final Integer id, final LocalDateTime value) + { + super(id, value); + } +} diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/LocalDateTimeRepository.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/LocalDateTimeRepository.java new file mode 100644 index 00000000..beab0ee6 --- /dev/null +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/LocalDateTimeRepository.java @@ -0,0 +1,23 @@ +/* + * 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.isolatet.tests.special.types; + +import software.xdev.spring.data.eclipse.store.repository.interfaces.EclipseStoreRepository; + + +public interface LocalDateTimeRepository extends EclipseStoreRepository +{ +} diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/LocalTimeDaoObject.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/LocalTimeDaoObject.java new file mode 100644 index 00000000..d6fdd556 --- /dev/null +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/LocalTimeDaoObject.java @@ -0,0 +1,27 @@ +/* + * 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.isolatet.tests.special.types; + +import java.time.LocalTime; + + +public class LocalTimeDaoObject extends ComplexObject +{ + public LocalTimeDaoObject(final Integer id, final LocalTime value) + { + super(id, value); + } +} diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/LocalTimeRepository.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/LocalTimeRepository.java new file mode 100644 index 00000000..1737efc6 --- /dev/null +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/LocalTimeRepository.java @@ -0,0 +1,23 @@ +/* + * 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.isolatet.tests.special.types; + +import software.xdev.spring.data.eclipse.store.repository.interfaces.EclipseStoreRepository; + + +public interface LocalTimeRepository extends EclipseStoreRepository +{ +} diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/MapDaoObject.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/MapDaoObject.java new file mode 100644 index 00000000..877cc6aa --- /dev/null +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/MapDaoObject.java @@ -0,0 +1,27 @@ +/* + * 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.isolatet.tests.special.types; + +import java.util.Map; + + +public class MapDaoObject extends ComplexObject> +{ + public MapDaoObject(final Integer id, final Map value) + { + super(id, value); + } +} diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/MapRepository.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/MapRepository.java new file mode 100644 index 00000000..3c1e822f --- /dev/null +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/MapRepository.java @@ -0,0 +1,23 @@ +/* + * 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.isolatet.tests.special.types; + +import software.xdev.spring.data.eclipse.store.repository.interfaces.EclipseStoreRepository; + + +public interface MapRepository extends EclipseStoreRepository +{ +} diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/OptionalDaoObject.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/OptionalDaoObject.java new file mode 100644 index 00000000..212f4006 --- /dev/null +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/OptionalDaoObject.java @@ -0,0 +1,27 @@ +/* + * 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.isolatet.tests.special.types; + +import java.util.Optional; + + +public class OptionalDaoObject extends ComplexObject> +{ + public OptionalDaoObject(final Integer id, final Optional value) + { + super(id, value); + } +} diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/OptionalRepository.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/OptionalRepository.java new file mode 100644 index 00000000..615bcc51 --- /dev/null +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/OptionalRepository.java @@ -0,0 +1,23 @@ +/* + * 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.isolatet.tests.special.types; + +import software.xdev.spring.data.eclipse.store.repository.interfaces.EclipseStoreRepository; + + +public interface OptionalRepository extends EclipseStoreRepository +{ +} diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/SetDaoObject.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/SetDaoObject.java new file mode 100644 index 00000000..79eb8385 --- /dev/null +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/SetDaoObject.java @@ -0,0 +1,27 @@ +/* + * 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.isolatet.tests.special.types; + +import java.util.Set; + + +public class SetDaoObject extends ComplexObject> +{ + public SetDaoObject(final Integer id, final Set value) + { + super(id, value); + } +} diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/SetRepository.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/SetRepository.java new file mode 100644 index 00000000..9ea3d361 --- /dev/null +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/SetRepository.java @@ -0,0 +1,23 @@ +/* + * 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.isolatet.tests.special.types; + +import software.xdev.spring.data.eclipse.store.repository.interfaces.EclipseStoreRepository; + + +public interface SetRepository extends EclipseStoreRepository +{ +} diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/TypesData.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/TypesData.java new file mode 100644 index 00000000..70086fa0 --- /dev/null +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/TypesData.java @@ -0,0 +1,308 @@ +package software.xdev.spring.data.eclipse.store.integration.isolatet.tests.special.types; + +import java.math.BigDecimal; +import java.math.BigInteger; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.LocalTime; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.EnumMap; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import java.util.function.Consumer; +import java.util.function.Function; +import java.util.stream.Stream; + +import org.junit.jupiter.params.provider.Arguments; + +import software.xdev.spring.data.eclipse.store.repository.interfaces.EclipseStoreRepository; + + +public final class TypesData +{ + public record ListOfTestArguments(List testArguments) + { + public Stream toArguments() + { + return this.testArguments.stream().map(TestArguments::toArguments); + } + } + + + public record TestArguments( + Class> repositoryClass, + Function objectCreator, + Consumer objectChanger) + { + public Arguments toArguments() + { + return Arguments.of(this.repositoryClass, this.objectCreator, this.objectChanger); + } + } + + public static Stream generateData() + { + return new ListOfTestArguments( + List.of( + new TestArguments<>( + SetRepository.class, + id -> new SetDaoObject(id, Set.of()), + set -> set.setValue(Set.of("1")) + ), + new TestArguments<>( + SetRepository.class, + id -> new SetDaoObject(id, Set.of("1")), + set -> set.setValue(Set.of("1", "2")) + ), + new TestArguments<>( + SetRepository.class, + id -> new SetDaoObject(id, Set.of("1", "2")), + set -> set.setValue(Set.of("1", "2", "3")) + ), + new TestArguments<>( + SetRepository.class, + id -> new SetDaoObject(id, new HashSet<>()), + set -> set.getValue().add("1") + ), + new TestArguments<>( + SetRepository.class, + id -> new SetDaoObject(id, new HashSet<>(List.of("1"))), + set -> set.getValue().add("2") + ), + new TestArguments<>( + SetRepository.class, + id -> new SetDaoObject(id, new HashSet<>(List.of("1", "2"))), + set -> set.getValue().add("3") + ), + new TestArguments<>( + SetRepository.class, + id -> new SetDaoObject(id, new LinkedHashSet<>()), + set -> set.getValue().add("1") + ), + new TestArguments<>( + SetRepository.class, + id -> new SetDaoObject(id, new LinkedHashSet<>(List.of("1"))), + set -> set.getValue().add("2") + ), + new TestArguments<>( + SetRepository.class, + id -> new SetDaoObject(id, new LinkedHashSet<>(List.of("1", "2"))), + set -> set.getValue().add("3") + ), + new TestArguments<>( + BigDecimalRepository.class, + id -> new BigDecimalDaoObject(id, BigDecimal.ONE), + object -> object.getValue().add(BigDecimal.ONE) + ), + new TestArguments<>( + BigDecimalRepository.class, + id -> new BigDecimalDaoObject(id, BigDecimal.ZERO), + object -> object.getValue().add(BigDecimal.ONE) + ), + new TestArguments<>( + BigDecimalRepository.class, + id -> new BigDecimalDaoObject(id, null), + object -> object.setValue(BigDecimal.ONE) + ), + new TestArguments<>( + BigIntegerRepository.class, + id -> new BigIntegerDaoObject(id, BigInteger.ONE), + object -> object.getValue().add(BigInteger.ONE) + ), + new TestArguments<>( + BigIntegerRepository.class, + id -> new BigIntegerDaoObject(id, BigInteger.ZERO), + object -> object.getValue().add(BigInteger.ONE) + ), + new TestArguments<>( + BigIntegerRepository.class, + id -> new BigIntegerDaoObject(id, null), + object -> object.setValue(BigInteger.ONE) + ), + new TestArguments<>( + BigIntegerRepository.class, + id -> new BigIntegerDaoObject(id, BigInteger.ONE), + object -> object.setValue(null) + ), + new TestArguments<>( + DateRepository.class, + id -> new DateDaoObject(id, null), + object -> object.setValue(new Date(System.currentTimeMillis())) + ), + new TestArguments<>( + DateRepository.class, + id -> new DateDaoObject(id, new Date(System.currentTimeMillis())), + object -> object.getValue().setTime(System.currentTimeMillis() + 1) + ), + new TestArguments<>( + CalendarRepository.class, + id -> new CalendarDaoObject(id, null), + object -> object.setValue(Calendar.getInstance()) + ), + new TestArguments<>( + CalendarRepository.class, + id -> new CalendarDaoObject(id, Calendar.getInstance()), + object -> object.getValue().add(Calendar.DAY_OF_MONTH, 1) + ), + new TestArguments<>( + EnumMapRepository.class, + id -> new EnumMapDaoObject(id, new EnumMap<>(EnumMapDaoObject.Album.class)), + object -> object.getValue().put(EnumMapDaoObject.Album.RUMOURS, "1") + ), + new TestArguments<>( + EnumMapRepository.class, + id -> new EnumMapDaoObject(id, new EnumMap<>(Map.of(EnumMapDaoObject.Album.RUMOURS, "1"))), + object -> object.getValue().put(EnumMapDaoObject.Album.TUSK, "2") + ), + new TestArguments<>( + EnumMapRepository.class, + id -> new EnumMapDaoObject(id, new EnumMap<>(Map.of(EnumMapDaoObject.Album.RUMOURS, "1"))), + object -> object.getValue().remove(EnumMapDaoObject.Album.RUMOURS) + ), + new TestArguments<>( + EnumMapRepository.class, + id -> new EnumMapDaoObject(id, null), + object -> object.setValue(new EnumMap<>(Map.of(EnumMapDaoObject.Album.RUMOURS, "1"))) + ), + new TestArguments<>( + LazyRepository.class, + id -> new LazyDaoObject(id, org.eclipse.serializer.reference.Lazy.Reference("1")), + object -> object.setValue(org.eclipse.serializer.reference.Lazy.Reference("2")) + ), + new TestArguments<>( + LazyRepository.class, + id -> new LazyDaoObject(id, null), + object -> object.setValue(org.eclipse.serializer.reference.Lazy.Reference("1")) + ), + new TestArguments<>( + LazyRepository.class, + id -> new LazyDaoObject(id, org.eclipse.serializer.reference.Lazy.Reference("1")), + object -> object.getValue().clear() + ), + new TestArguments<>( + ListRepository.class, + id -> new ListDaoObject(id, List.of()), + object -> object.setValue(List.of("1")) + ), + new TestArguments<>( + ListRepository.class, + id -> new ListDaoObject(id, List.of("1")), + object -> object.setValue(List.of("1", "2")) + ), + new TestArguments<>( + ListRepository.class, + id -> new ListDaoObject(id, List.of("1", "2")), + object -> object.setValue(List.of("1", "2", "3")) + ), + new TestArguments<>( + ListRepository.class, + id -> new ListDaoObject(id, null), + object -> object.setValue(List.of("1")) + ), + new TestArguments<>( + ListRepository.class, + id -> new ListDaoObject(id, new ArrayList<>()), + object -> object.getValue().add("1") + ), + new TestArguments<>( + ListRepository.class, + id -> new ListDaoObject(id, new ArrayList<>(Set.of("1"))), + object -> object.getValue().add("2") + ), + new TestArguments<>( + ListRepository.class, + id -> new ListDaoObject(id, new ArrayList<>(Set.of("1", "2"))), + object -> object.getValue().add("3") + ), + new TestArguments<>( + ListRepository.class, + id -> new ListDaoObject(id, new ArrayList<>(Set.of("1"))), + object -> object.getValue().remove("1") + ), + new TestArguments<>( + LocalDateRepository.class, + id -> new LocalDateDaoObject(id, LocalDate.of(2000, 1, 1)), + object -> object.getValue().plusDays(1) + ), + new TestArguments<>( + LocalDateTimeRepository.class, + id -> new LocalDateTimeDaoObject(id, LocalDateTime.of(2000, 1, 1, 1, 1, 1)), + object -> object.getValue().plusDays(1) + ), + new TestArguments<>( + LocalTimeRepository.class, + id -> new LocalTimeDaoObject(id, LocalTime.of(1, 1, 1)), + object -> object.getValue().plusHours(1) + ), + new TestArguments<>( + MapRepository.class, + id -> new MapDaoObject(id, Map.of()), + set -> set.setValue(Map.of("1", "1")) + ), + new TestArguments<>( + MapRepository.class, + id -> new MapDaoObject(id, Map.of("1", "1")), + set -> set.setValue(Map.of("1", "1", "2", "2")) + ), + new TestArguments<>( + MapRepository.class, + id -> new MapDaoObject(id, Map.of("1", "1", "2", "2")), + set -> set.setValue(Map.of("1", "1", "2", "2", "3", "3")) + ), + new TestArguments<>( + MapRepository.class, + id -> new MapDaoObject(id, new HashMap<>()), + set -> set.getValue().put("1", "1") + ), + new TestArguments<>( + MapRepository.class, + id -> new MapDaoObject(id, new HashMap<>(Map.of("1", "1"))), + set -> set.getValue().put("2", "2") + ), + new TestArguments<>( + MapRepository.class, + id -> new MapDaoObject(id, new HashMap<>(Map.of("1", "1", "2", "2"))), + set -> set.getValue().put("3", "3") + ), + new TestArguments<>( + MapRepository.class, + id -> new MapDaoObject(id, new LinkedHashMap<>()), + set -> set.getValue().put("1", "1") + ), + new TestArguments<>( + MapRepository.class, + id -> new MapDaoObject(id, new LinkedHashMap<>(Map.of("1", "1"))), + set -> set.getValue().put("2", "2") + ), + new TestArguments<>( + MapRepository.class, + id -> new MapDaoObject(id, new LinkedHashMap<>(Map.of("1", "1", "2", "2"))), + set -> set.getValue().put("3", "3") + ), + new TestArguments<>( + OptionalRepository.class, + id -> new OptionalDaoObject(id, Optional.of("1")), + set -> set.setValue(Optional.of("2")) + ), + new TestArguments<>( + OptionalRepository.class, + id -> new OptionalDaoObject(id, Optional.empty()), + set -> set.setValue(Optional.of("1")) + ), + new TestArguments<>( + OptionalRepository.class, + id -> new OptionalDaoObject(id, null), + set -> set.setValue(Optional.of("1")) + ) + ) + ).toArguments(); + } +} diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/TypesTest.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/TypesTest.java new file mode 100644 index 00000000..3e91fde7 --- /dev/null +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/TypesTest.java @@ -0,0 +1,138 @@ +/* + * 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.isolatet.tests.special.types; + +import java.util.List; +import java.util.Optional; +import java.util.function.Consumer; +import java.util.function.Function; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.params.ParameterizedTest; +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 software.xdev.spring.data.eclipse.store.helper.TestUtil; +import software.xdev.spring.data.eclipse.store.integration.isolatet.tests.IsolatedTestAnnotations; +import software.xdev.spring.data.eclipse.store.repository.EclipseStoreStorage; +import software.xdev.spring.data.eclipse.store.repository.interfaces.EclipseStoreRepository; + + +@IsolatedTestAnnotations +@TestPropertySource( + properties = + "org.eclipse.store.storage-directory=./target/isolated-tests-storage" +) +class TypesTest +{ + public static final String TYPES_DATA_SOURCE = + "software.xdev.spring.data.eclipse.store.integration.isolatet.tests.special.types" + + ".TypesData#generateData"; + + @Autowired + private EclipseStoreStorage storage; + + @ParameterizedTest + @MethodSource(TYPES_DATA_SOURCE) + @Disabled("Should get fixed") + void simpleStoreAndRead( + final Class> repositoryClass, + final Function objectCreator, + final Consumer objectChanger, + @Autowired final ApplicationContext context) + { + final EclipseStoreRepository repository = context.getBean(repositoryClass); + final T objectToStore = objectCreator.apply(1); + repository.save(objectToStore); + + TestUtil.doBeforeAndAfterRestartOfDatastore( + this.storage, + () -> { + final List customers = TestUtil.iterableToList(repository.findAll()); + Assertions.assertEquals(1, customers.size()); + Assertions.assertEquals(objectToStore, customers.get(0)); + } + ); + } + + @ParameterizedTest + @MethodSource(TYPES_DATA_SOURCE) + @Disabled("Should get fixed") + void simpleChangeToNullAfterStore( + final Class> repositoryClass, + final Function objectCreator, + final Consumer objectChanger, + @Autowired final ApplicationContext context) + { + this.simpleChangeAfterStore(repositoryClass, objectCreator, object -> object.setValue(null), context); + } + + @ParameterizedTest + @MethodSource(TYPES_DATA_SOURCE) + @Disabled("Should get fixed") + void simpleChangeAfterStore( + final Class> repositoryClass, + final Function objectCreator, + final Consumer objectChanger, + @Autowired final ApplicationContext context) + { + final EclipseStoreRepository repository = context.getBean(repositoryClass); + final T objectToStore = objectCreator.apply(2); + repository.save(objectToStore); + + final Optional storedObject = repository.findById(2); + Assertions.assertTrue(storedObject.isPresent()); + + objectChanger.accept(storedObject.get()); + repository.save(storedObject.get()); + + TestUtil.doBeforeAndAfterRestartOfDatastore( + this.storage, + () -> { + final Optional storedObject2 = repository.findById(2); + Assertions.assertTrue(storedObject2.isPresent()); + Assertions.assertEquals(storedObject, storedObject2); + } + ); + } + + @ParameterizedTest + @MethodSource(TYPES_DATA_SOURCE) + @Disabled("Should get fixed") + void simpleChangeBeforeStore( + final Class> repositoryClass, + final Function objectCreator, + final Consumer objectChanger, + @Autowired final ApplicationContext context) + { + final EclipseStoreRepository repository = context.getBean(repositoryClass); + final T objectToStore = objectCreator.apply(3); + objectChanger.accept(objectToStore); + repository.save(objectToStore); + + TestUtil.doBeforeAndAfterRestartOfDatastore( + this.storage, + () -> { + final Optional storedObject2 = repository.findById(3); + Assertions.assertTrue(storedObject2.isPresent()); + Assertions.assertEquals(objectToStore, storedObject2.get()); + } + ); + } +} From 37c9f72563c62e9d915c6f5ed72c884fb708b802 Mon Sep 17 00:00:00 2001 From: JohannesRabauer Date: Tue, 13 Feb 2024 07:02:41 +0100 Subject: [PATCH 13/31] Renamed package --- .../tests/IsolatedTestAnnotations.java | 2 +- .../tests/IsolatedTestConfiguration.java | 2 +- .../tests/special/types/BigDecimalDaoObject.java | 3 +-- .../tests/special/types/BigDecimalRepository.java | 2 +- .../tests/special/types/BigIntegerDaoObject.java | 3 +-- .../tests/special/types/BigIntegerRepository.java | 2 +- .../tests/special/types/CalendarDaoObject.java | 2 +- .../tests/special/types/CalendarRepository.java | 2 +- .../tests/special/types/ComplexObject.java | 2 +- .../tests/special/types/DateDaoObject.java | 2 +- .../tests/special/types/DateRepository.java | 2 +- .../tests/special/types/EnumMapDaoObject.java | 3 +-- .../tests/special/types/EnumMapRepository.java | 2 +- .../tests/special/types/EnumSetDaoObject.java | 2 +- .../tests/special/types/EnumSetRepository.java | 2 +- .../tests/special/types/LazyDaoObject.java | 2 +- .../tests/special/types/LazyRepository.java | 2 +- .../tests/special/types/ListDaoObject.java | 3 +-- .../tests/special/types/ListRepository.java | 2 +- .../tests/special/types/LocalDateDaoObject.java | 2 +- .../tests/special/types/LocalDateRepository.java | 2 +- .../tests/special/types/LocalDateTimeDaoObject.java | 3 +-- .../tests/special/types/LocalDateTimeRepository.java | 2 +- .../tests/special/types/LocalTimeDaoObject.java | 2 +- .../tests/special/types/LocalTimeRepository.java | 2 +- .../tests/special/types/MapDaoObject.java | 2 +- .../tests/special/types/MapRepository.java | 2 +- .../tests/special/types/OptionalDaoObject.java | 2 +- .../tests/special/types/OptionalRepository.java | 2 +- .../tests/special/types/SetDaoObject.java | 2 +- .../tests/special/types/SetRepository.java | 2 +- .../tests/special/types/TypesData.java | 2 +- .../tests/special/types/TypesTest.java | 6 +++--- 33 files changed, 35 insertions(+), 40 deletions(-) rename spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/{isolatet => isolated}/tests/IsolatedTestAnnotations.java (99%) rename spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/{isolatet => isolated}/tests/IsolatedTestConfiguration.java (99%) rename spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/{isolatet => isolated}/tests/special/types/BigDecimalDaoObject.java (94%) rename spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/{isolatet => isolated}/tests/special/types/BigDecimalRepository.java (97%) rename spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/{isolatet => isolated}/tests/special/types/BigIntegerDaoObject.java (94%) rename spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/{isolatet => isolated}/tests/special/types/BigIntegerRepository.java (97%) rename spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/{isolatet => isolated}/tests/special/types/CalendarDaoObject.java (97%) rename spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/{isolatet => isolated}/tests/special/types/CalendarRepository.java (97%) rename spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/{isolatet => isolated}/tests/special/types/ComplexObject.java (98%) rename spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/{isolatet => isolated}/tests/special/types/DateDaoObject.java (97%) rename spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/{isolatet => isolated}/tests/special/types/DateRepository.java (97%) rename spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/{isolatet => isolated}/tests/special/types/EnumMapDaoObject.java (95%) rename spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/{isolatet => isolated}/tests/special/types/EnumMapRepository.java (97%) rename spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/{isolatet => isolated}/tests/special/types/EnumSetDaoObject.java (97%) rename spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/{isolatet => isolated}/tests/special/types/EnumSetRepository.java (97%) rename spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/{isolatet => isolated}/tests/special/types/LazyDaoObject.java (97%) rename spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/{isolatet => isolated}/tests/special/types/LazyRepository.java (97%) rename spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/{isolatet => isolated}/tests/special/types/ListDaoObject.java (94%) rename spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/{isolatet => isolated}/tests/special/types/ListRepository.java (97%) rename spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/{isolatet => isolated}/tests/special/types/LocalDateDaoObject.java (97%) rename spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/{isolatet => isolated}/tests/special/types/LocalDateRepository.java (97%) rename spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/{isolatet => isolated}/tests/special/types/LocalDateTimeDaoObject.java (94%) rename spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/{isolatet => isolated}/tests/special/types/LocalDateTimeRepository.java (97%) rename spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/{isolatet => isolated}/tests/special/types/LocalTimeDaoObject.java (97%) rename spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/{isolatet => isolated}/tests/special/types/LocalTimeRepository.java (97%) rename spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/{isolatet => isolated}/tests/special/types/MapDaoObject.java (97%) rename spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/{isolatet => isolated}/tests/special/types/MapRepository.java (97%) rename spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/{isolatet => isolated}/tests/special/types/OptionalDaoObject.java (97%) rename spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/{isolatet => isolated}/tests/special/types/OptionalRepository.java (97%) rename spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/{isolatet => isolated}/tests/special/types/SetDaoObject.java (97%) rename spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/{isolatet => isolated}/tests/special/types/SetRepository.java (97%) rename spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/{isolatet => isolated}/tests/special/types/TypesData.java (99%) rename spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/{isolatet => isolated}/tests/special/types/TypesTest.java (97%) diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/IsolatedTestAnnotations.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/IsolatedTestAnnotations.java similarity index 99% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/IsolatedTestAnnotations.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/IsolatedTestAnnotations.java index fd64c3cb..61d27ef1 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/IsolatedTestAnnotations.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/IsolatedTestAnnotations.java @@ -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.isolatet.tests; +package software.xdev.spring.data.eclipse.store.integration.isolated.tests; import static org.springframework.test.annotation.DirtiesContext.ClassMode.BEFORE_EACH_TEST_METHOD; diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/IsolatedTestConfiguration.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/IsolatedTestConfiguration.java similarity index 99% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/IsolatedTestConfiguration.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/IsolatedTestConfiguration.java index 5b9a91bf..a5be2ce0 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/IsolatedTestConfiguration.java +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/IsolatedTestConfiguration.java @@ -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.isolatet.tests; +package software.xdev.spring.data.eclipse.store.integration.isolated.tests; import java.nio.file.Path; diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/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 similarity index 94% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/BigDecimalDaoObject.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/BigDecimalDaoObject.java index 752427b6..52c42c58 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/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 @@ -13,10 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package software.xdev.spring.data.eclipse.store.integration.isolatet.tests.special.types; +package software.xdev.spring.data.eclipse.store.integration.isolated.tests.special.types; import java.math.BigDecimal; -import java.util.List; public class BigDecimalDaoObject extends ComplexObject diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/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 similarity index 97% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/BigDecimalRepository.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/BigDecimalRepository.java index 1966bd63..f56eb4a8 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/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 @@ -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.isolatet.tests.special.types; +package software.xdev.spring.data.eclipse.store.integration.isolated.tests.special.types; 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/isolatet/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 similarity index 94% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/BigIntegerDaoObject.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/BigIntegerDaoObject.java index 7d096309..90dc44f1 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/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 @@ -13,9 +13,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package software.xdev.spring.data.eclipse.store.integration.isolatet.tests.special.types; +package software.xdev.spring.data.eclipse.store.integration.isolated.tests.special.types; -import java.math.BigDecimal; import java.math.BigInteger; diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/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 similarity index 97% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/BigIntegerRepository.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/BigIntegerRepository.java index 48cadeb5..74a8d364 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/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 @@ -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.isolatet.tests.special.types; +package software.xdev.spring.data.eclipse.store.integration.isolated.tests.special.types; 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/isolatet/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 similarity index 97% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/CalendarDaoObject.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/CalendarDaoObject.java index 3fc062a3..3b835475 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/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 @@ -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.isolatet.tests.special.types; +package software.xdev.spring.data.eclipse.store.integration.isolated.tests.special.types; import java.util.Calendar; diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/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 similarity index 97% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/CalendarRepository.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/CalendarRepository.java index c4b347c5..187d33fb 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/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 @@ -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.isolatet.tests.special.types; +package software.xdev.spring.data.eclipse.store.integration.isolated.tests.special.types; 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/isolatet/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 similarity index 98% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/ComplexObject.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/ComplexObject.java index 482436ba..5561bb6c 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/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 @@ -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.isolatet.tests.special.types; +package software.xdev.spring.data.eclipse.store.integration.isolated.tests.special.types; import java.util.Objects; diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/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 similarity index 97% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/DateDaoObject.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/DateDaoObject.java index 64d9afa4..f93dfa12 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/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 @@ -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.isolatet.tests.special.types; +package software.xdev.spring.data.eclipse.store.integration.isolated.tests.special.types; import java.util.Date; diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/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 similarity index 97% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/DateRepository.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/DateRepository.java index 11742a7a..f967c16f 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/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 @@ -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.isolatet.tests.special.types; +package software.xdev.spring.data.eclipse.store.integration.isolated.tests.special.types; 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/isolatet/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 similarity index 95% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/EnumMapDaoObject.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/EnumMapDaoObject.java index 1665eb85..cd81c07c 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/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 @@ -13,10 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package software.xdev.spring.data.eclipse.store.integration.isolatet.tests.special.types; +package software.xdev.spring.data.eclipse.store.integration.isolated.tests.special.types; import java.util.EnumMap; -import java.util.Map; public class EnumMapDaoObject extends ComplexObject> diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/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 similarity index 97% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/EnumMapRepository.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/EnumMapRepository.java index f6097bea..4f49be48 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/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 @@ -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.isolatet.tests.special.types; +package software.xdev.spring.data.eclipse.store.integration.isolated.tests.special.types; 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/isolatet/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 similarity index 97% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/EnumSetDaoObject.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/EnumSetDaoObject.java index 455a23fa..31acf389 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/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 @@ -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.isolatet.tests.special.types; +package software.xdev.spring.data.eclipse.store.integration.isolated.tests.special.types; import java.util.EnumSet; diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/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 similarity index 97% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/EnumSetRepository.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/EnumSetRepository.java index cc12a148..f2f186b8 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/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 @@ -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.isolatet.tests.special.types; +package software.xdev.spring.data.eclipse.store.integration.isolated.tests.special.types; 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/isolatet/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 similarity index 97% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/LazyDaoObject.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/LazyDaoObject.java index 45c437d7..41221a67 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/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 @@ -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.isolatet.tests.special.types; +package software.xdev.spring.data.eclipse.store.integration.isolated.tests.special.types; import org.eclipse.serializer.reference.Lazy; diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/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 similarity index 97% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/LazyRepository.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/LazyRepository.java index 3fd7fcbe..a3cd5e37 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/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 @@ -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.isolatet.tests.special.types; +package software.xdev.spring.data.eclipse.store.integration.isolated.tests.special.types; 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/isolatet/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 similarity index 94% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/ListDaoObject.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/ListDaoObject.java index 795b06c2..f4cb80e7 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/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 @@ -13,10 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package software.xdev.spring.data.eclipse.store.integration.isolatet.tests.special.types; +package software.xdev.spring.data.eclipse.store.integration.isolated.tests.special.types; import java.util.List; -import java.util.Set; public class ListDaoObject extends ComplexObject> diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/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 similarity index 97% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/ListRepository.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/ListRepository.java index f934f059..b0351524 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/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 @@ -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.isolatet.tests.special.types; +package software.xdev.spring.data.eclipse.store.integration.isolated.tests.special.types; 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/isolatet/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 similarity index 97% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/LocalDateDaoObject.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/LocalDateDaoObject.java index 45801556..bf6cf781 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/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 @@ -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.isolatet.tests.special.types; +package software.xdev.spring.data.eclipse.store.integration.isolated.tests.special.types; import java.time.LocalDate; diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/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 similarity index 97% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/LocalDateRepository.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/LocalDateRepository.java index 9ec2097d..0aa50229 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/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 @@ -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.isolatet.tests.special.types; +package software.xdev.spring.data.eclipse.store.integration.isolated.tests.special.types; 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/isolatet/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 similarity index 94% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/LocalDateTimeDaoObject.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/LocalDateTimeDaoObject.java index dce2b378..169ea937 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/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 @@ -13,9 +13,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package software.xdev.spring.data.eclipse.store.integration.isolatet.tests.special.types; +package software.xdev.spring.data.eclipse.store.integration.isolated.tests.special.types; -import java.math.BigInteger; import java.time.LocalDateTime; diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/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 similarity index 97% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/LocalDateTimeRepository.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/LocalDateTimeRepository.java index beab0ee6..737c6ebf 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/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 @@ -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.isolatet.tests.special.types; +package software.xdev.spring.data.eclipse.store.integration.isolated.tests.special.types; 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/isolatet/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 similarity index 97% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/LocalTimeDaoObject.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/LocalTimeDaoObject.java index d6fdd556..953aeab5 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/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 @@ -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.isolatet.tests.special.types; +package software.xdev.spring.data.eclipse.store.integration.isolated.tests.special.types; import java.time.LocalTime; diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/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 similarity index 97% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/LocalTimeRepository.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/LocalTimeRepository.java index 1737efc6..db1cac67 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/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 @@ -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.isolatet.tests.special.types; +package software.xdev.spring.data.eclipse.store.integration.isolated.tests.special.types; 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/isolatet/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 similarity index 97% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/MapDaoObject.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/MapDaoObject.java index 877cc6aa..372ec6b3 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/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 @@ -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.isolatet.tests.special.types; +package software.xdev.spring.data.eclipse.store.integration.isolated.tests.special.types; import java.util.Map; diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/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 similarity index 97% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/MapRepository.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/MapRepository.java index 3c1e822f..ebbb1d18 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/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 @@ -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.isolatet.tests.special.types; +package software.xdev.spring.data.eclipse.store.integration.isolated.tests.special.types; 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/isolatet/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 similarity index 97% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/OptionalDaoObject.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/OptionalDaoObject.java index 212f4006..228abedc 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/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 @@ -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.isolatet.tests.special.types; +package software.xdev.spring.data.eclipse.store.integration.isolated.tests.special.types; import java.util.Optional; diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/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 similarity index 97% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/OptionalRepository.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/OptionalRepository.java index 615bcc51..7868afc6 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/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 @@ -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.isolatet.tests.special.types; +package software.xdev.spring.data.eclipse.store.integration.isolated.tests.special.types; 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/isolatet/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 similarity index 97% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/SetDaoObject.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/SetDaoObject.java index 79eb8385..be214b09 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/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 @@ -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.isolatet.tests.special.types; +package software.xdev.spring.data.eclipse.store.integration.isolated.tests.special.types; import java.util.Set; diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/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 similarity index 97% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/SetRepository.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/SetRepository.java index 9ea3d361..e3ed468b 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/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 @@ -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.isolatet.tests.special.types; +package software.xdev.spring.data.eclipse.store.integration.isolated.tests.special.types; 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/isolatet/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 similarity index 99% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/TypesData.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/TypesData.java index 70086fa0..0474f117 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/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,4 +1,4 @@ -package software.xdev.spring.data.eclipse.store.integration.isolatet.tests.special.types; +package software.xdev.spring.data.eclipse.store.integration.isolated.tests.special.types; import java.math.BigDecimal; import java.math.BigInteger; diff --git a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/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 similarity index 97% rename from spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/tests/special/types/TypesTest.java rename to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/TypesTest.java index 3e91fde7..29387ac8 100644 --- a/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolatet/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 @@ -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.isolatet.tests.special.types; +package software.xdev.spring.data.eclipse.store.integration.isolated.tests.special.types; import java.util.List; import java.util.Optional; @@ -29,7 +29,7 @@ import org.springframework.test.context.TestPropertySource; import software.xdev.spring.data.eclipse.store.helper.TestUtil; -import software.xdev.spring.data.eclipse.store.integration.isolatet.tests.IsolatedTestAnnotations; +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.repository.interfaces.EclipseStoreRepository; @@ -42,7 +42,7 @@ class TypesTest { public static final String TYPES_DATA_SOURCE = - "software.xdev.spring.data.eclipse.store.integration.isolatet.tests.special.types" + "software.xdev.spring.data.eclipse.store.integration.isolated.tests.special.types" + ".TypesData#generateData"; @Autowired From 89d1414e0e5db86f1f5ca3ea6b9b434d5f87ca1a Mon Sep 17 00:00:00 2001 From: JohannesRabauer Date: Tue, 13 Feb 2024 11:55:37 +0100 Subject: [PATCH 14/31] Cleaned up tests --- spring-data-eclipse-store/pom.xml | 5 + .../working/RecursiveWorkingCopier.java | 25 +++-- .../tests/special/types/TypesData.java | 100 ++++++++++-------- .../tests/special/types/TypesTest.java | 75 +++++++++---- .../store/integration/tests/HashSetTest.java | 24 +---- 5 files changed, 134 insertions(+), 95 deletions(-) diff --git a/spring-data-eclipse-store/pom.xml b/spring-data-eclipse-store/pom.xml index c76a5ac2..979aab56 100644 --- a/spring-data-eclipse-store/pom.xml +++ b/spring-data-eclipse-store/pom.xml @@ -258,6 +258,11 @@ --add-opens java.base/java.util=ALL-UNNAMED + --add-opens java.base/java.math=ALL-UNNAMED + --add-opens java.base/java.time=ALL-UNNAMED + --add-opens java.base/java.time.zone=ALL-UNNAMED + --add-opens java.base/java.util.concurrent=ALL-UNNAMED + --add-opens java.base/sun.util.calendar=ALL-UNNAMED --add-exports java.base/jdk.internal.misc=ALL-UNNAMED 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 7aec5d35..08485c4f 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 @@ -160,17 +160,24 @@ private void mergeValues( // alreadyMergedTargets prevent endless loops return; } - alreadyMergedTargets.collectMergedTarget(targetObject); - - if(sourceObject instanceof String) + try { - // no merge needed and no merge possible - return; + alreadyMergedTargets.collectMergedTarget(targetObject); + + if(sourceObject instanceof String) + { + // no merge needed and no merge possible + return; + } + AccessHelper.getInheritedPrivateFieldsByName(sourceObject.getClass()).values().forEach( + field -> + this.mergeValueOfField(sourceObject, targetObject, field, alreadyMergedTargets, changedCollector) + ); + } + catch(final Exception e) + { + throw new MergeFailedException(sourceObject, targetObject, e); } - AccessHelper.getInheritedPrivateFieldsByName(sourceObject.getClass()).values().forEach( - field -> - this.mergeValueOfField(sourceObject, targetObject, field, alreadyMergedTargets, changedCollector) - ); } private void mergeValueOfField( 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 0474f117..5fc269c4 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,3 +1,18 @@ +/* + * 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.special.types; import java.math.BigDecimal; @@ -142,51 +157,6 @@ public static Stream generateData() id -> new DateDaoObject(id, new Date(System.currentTimeMillis())), object -> object.getValue().setTime(System.currentTimeMillis() + 1) ), - new TestArguments<>( - CalendarRepository.class, - id -> new CalendarDaoObject(id, null), - object -> object.setValue(Calendar.getInstance()) - ), - new TestArguments<>( - CalendarRepository.class, - id -> new CalendarDaoObject(id, Calendar.getInstance()), - object -> object.getValue().add(Calendar.DAY_OF_MONTH, 1) - ), - new TestArguments<>( - EnumMapRepository.class, - id -> new EnumMapDaoObject(id, new EnumMap<>(EnumMapDaoObject.Album.class)), - object -> object.getValue().put(EnumMapDaoObject.Album.RUMOURS, "1") - ), - new TestArguments<>( - EnumMapRepository.class, - id -> new EnumMapDaoObject(id, new EnumMap<>(Map.of(EnumMapDaoObject.Album.RUMOURS, "1"))), - object -> object.getValue().put(EnumMapDaoObject.Album.TUSK, "2") - ), - new TestArguments<>( - EnumMapRepository.class, - id -> new EnumMapDaoObject(id, new EnumMap<>(Map.of(EnumMapDaoObject.Album.RUMOURS, "1"))), - object -> object.getValue().remove(EnumMapDaoObject.Album.RUMOURS) - ), - new TestArguments<>( - EnumMapRepository.class, - id -> new EnumMapDaoObject(id, null), - object -> object.setValue(new EnumMap<>(Map.of(EnumMapDaoObject.Album.RUMOURS, "1"))) - ), - new TestArguments<>( - LazyRepository.class, - id -> new LazyDaoObject(id, org.eclipse.serializer.reference.Lazy.Reference("1")), - object -> object.setValue(org.eclipse.serializer.reference.Lazy.Reference("2")) - ), - new TestArguments<>( - LazyRepository.class, - id -> new LazyDaoObject(id, null), - object -> object.setValue(org.eclipse.serializer.reference.Lazy.Reference("1")) - ), - new TestArguments<>( - LazyRepository.class, - id -> new LazyDaoObject(id, org.eclipse.serializer.reference.Lazy.Reference("1")), - object -> object.getValue().clear() - ), new TestArguments<>( ListRepository.class, id -> new ListDaoObject(id, List.of()), @@ -305,4 +275,44 @@ public static Stream generateData() ) ).toArguments(); } + + public static Stream generateNotWorkingData() + { + return new ListOfTestArguments( + List.of( + new TestArguments<>( + LazyRepository.class, + id -> new LazyDaoObject(id, org.eclipse.serializer.reference.Lazy.Reference("1")), + object -> object.setValue(org.eclipse.serializer.reference.Lazy.Reference("2")) + ), + new TestArguments<>( + LazyRepository.class, + id -> new LazyDaoObject(id, org.eclipse.serializer.reference.Lazy.Reference("1")), + object -> object.getValue().clear() + ), + // Here EclipseStore has problems too: https://github.com/microstream-one/microstream/issues/204 + new TestArguments<>( + EnumMapRepository.class, + id -> new EnumMapDaoObject(id, new EnumMap<>(EnumMapDaoObject.Album.class)), + object -> object.getValue().put(EnumMapDaoObject.Album.RUMOURS, "1") + ), + new TestArguments<>( + EnumMapRepository.class, + id -> new EnumMapDaoObject(id, new EnumMap<>(Map.of(EnumMapDaoObject.Album.RUMOURS, "1"))), + object -> object.getValue().put(EnumMapDaoObject.Album.TUSK, "2") + ), + new TestArguments<>( + EnumMapRepository.class, + id -> new EnumMapDaoObject(id, new EnumMap<>(Map.of(EnumMapDaoObject.Album.RUMOURS, "1"))), + object -> object.getValue().remove(EnumMapDaoObject.Album.RUMOURS) + ), + // Here EclipseStore has problems: https://github.com/microstream-one/microstream/issues/173 + new TestArguments<>( + CalendarRepository.class, + id -> new CalendarDaoObject(id, Calendar.getInstance()), + object -> object.getValue().add(Calendar.DAY_OF_MONTH, 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 29387ac8..d7128d5c 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 @@ -44,17 +44,19 @@ class TypesTest public static final String TYPES_DATA_SOURCE = "software.xdev.spring.data.eclipse.store.integration.isolated.tests.special.types" + ".TypesData#generateData"; + public static final String TYPES_NOT_WORKING_DATA_SOURCE = + "software.xdev.spring.data.eclipse.store.integration.isolated.tests.special.types" + + ".TypesData#generateNotWorkingData"; @Autowired private EclipseStoreStorage storage; @ParameterizedTest @MethodSource(TYPES_DATA_SOURCE) - @Disabled("Should get fixed") - void simpleStoreAndRead( + > void simpleStoreAndRead( final Class> repositoryClass, final Function objectCreator, - final Consumer objectChanger, + final Consumer ignoredObjectChanger, @Autowired final ApplicationContext context) { final EclipseStoreRepository repository = context.getBean(repositoryClass); @@ -64,20 +66,32 @@ void simpleStoreAndRead( TestUtil.doBeforeAndAfterRestartOfDatastore( this.storage, () -> { - final List customers = TestUtil.iterableToList(repository.findAll()); - Assertions.assertEquals(1, customers.size()); - Assertions.assertEquals(objectToStore, customers.get(0)); + final List storedObjects = TestUtil.iterableToList(repository.findAll()); + Assertions.assertEquals(1, storedObjects.size()); + Assertions.assertEquals(objectToStore, storedObjects.get(0)); } ); } + @ParameterizedTest + @MethodSource(TYPES_NOT_WORKING_DATA_SOURCE) + > void simpleStoreAndReadForNotWorkingTypes( + final Class> repositoryClass, + final Function objectCreator, + final Consumer ignoredObjectChanger, + @Autowired final ApplicationContext context) + { + Assertions.assertThrows( + Exception.class, + () -> this.simpleChangeAfterStore(repositoryClass, objectCreator, ignoredObjectChanger, context)); + } + @ParameterizedTest @MethodSource(TYPES_DATA_SOURCE) - @Disabled("Should get fixed") - void simpleChangeToNullAfterStore( + > void simpleChangeToNullAfterStore( final Class> repositoryClass, final Function objectCreator, - final Consumer objectChanger, + final Consumer ignoredObjectChanger, @Autowired final ApplicationContext context) { this.simpleChangeAfterStore(repositoryClass, objectCreator, object -> object.setValue(null), context); @@ -85,18 +99,17 @@ void simpleChangeToNullAfterStore( @ParameterizedTest @MethodSource(TYPES_DATA_SOURCE) - @Disabled("Should get fixed") - void simpleChangeAfterStore( + > void simpleChangeAfterStore( final Class> repositoryClass, final Function objectCreator, final Consumer objectChanger, @Autowired final ApplicationContext context) { final EclipseStoreRepository repository = context.getBean(repositoryClass); - final T objectToStore = objectCreator.apply(2); + final T objectToStore = objectCreator.apply(1); repository.save(objectToStore); - final Optional storedObject = repository.findById(2); + final Optional storedObject = repository.findById(1); Assertions.assertTrue(storedObject.isPresent()); objectChanger.accept(storedObject.get()); @@ -105,7 +118,7 @@ void simpleChangeAfterStore( TestUtil.doBeforeAndAfterRestartOfDatastore( this.storage, () -> { - final Optional storedObject2 = repository.findById(2); + final Optional storedObject2 = repository.findById(1); Assertions.assertTrue(storedObject2.isPresent()); Assertions.assertEquals(storedObject, storedObject2); } @@ -114,22 +127,48 @@ void simpleChangeAfterStore( @ParameterizedTest @MethodSource(TYPES_DATA_SOURCE) - @Disabled("Should get fixed") - void simpleChangeBeforeStore( + // TODO: Fix this. + @Disabled("Is not fixed yet, but will be.") + > void doubleStoreSameEntityWithChange( final Class> repositoryClass, final Function objectCreator, final Consumer objectChanger, @Autowired final ApplicationContext context) { final EclipseStoreRepository repository = context.getBean(repositoryClass); - final T objectToStore = objectCreator.apply(3); + final T objectToStore = objectCreator.apply(1); + repository.save(objectToStore); + + objectChanger.accept(objectToStore); + repository.save(objectToStore); + + TestUtil.doBeforeAndAfterRestartOfDatastore( + this.storage, + () -> { + final Optional storedObject = repository.findById(1); + Assertions.assertTrue(storedObject.isPresent()); + Assertions.assertEquals(objectToStore, storedObject.get()); + } + ); + } + + @ParameterizedTest + @MethodSource(TYPES_DATA_SOURCE) + > void simpleChangeBeforeStore( + final Class> repositoryClass, + final Function objectCreator, + final Consumer objectChanger, + @Autowired final ApplicationContext context) + { + final EclipseStoreRepository repository = context.getBean(repositoryClass); + final T objectToStore = objectCreator.apply(1); objectChanger.accept(objectToStore); repository.save(objectToStore); TestUtil.doBeforeAndAfterRestartOfDatastore( this.storage, () -> { - final Optional storedObject2 = repository.findById(3); + final Optional storedObject2 = repository.findById(1); Assertions.assertTrue(storedObject2.isPresent()); Assertions.assertEquals(objectToStore, storedObject2.get()); } 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/tests/HashSetTest.java index faec4a23..3c4acc2a 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/tests/HashSetTest.java @@ -18,11 +18,9 @@ import java.util.List; import java.util.Set; -import org.springframework.beans.factory.annotation.Autowired; - 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 software.xdev.spring.data.eclipse.store.helper.TestData; import software.xdev.spring.data.eclipse.store.helper.TestUtil; @@ -165,26 +163,6 @@ void testSaveAndSetNullAndFindAllNonFinal() ); } - // TODO: Fix this. - @Test - @Disabled("Is not fixed yet, but will be.") - void testDoubleSaveAndFindAll() - { - final CustomerWithHashSet customer = new CustomerWithHashSet(TestData.FIRST_NAME, TestData.LAST_NAME); - this.repository.save(customer); - customer.getValues().add("Test"); - this.repository.save(customer); - - TestUtil.doBeforeAndAfterRestartOfDatastore( - this.storage, - () -> { - final List customers = TestUtil.iterableToList(this.repository.findAll()); - Assertions.assertEquals(1, customers.size()); - Assertions.assertEquals(1, customers.get(0).getValues().size()); - } - ); - } - @Test void testDoubleSaveWithNewInstanceAndFindAll() { From 86f95f6871a805c704386fc4884310d8cc6bea6a Mon Sep 17 00:00:00 2001 From: JohannesRabauer Date: Tue, 13 Feb 2024 12:50:07 +0100 Subject: [PATCH 15/31] Added more java types for tests --- .../tests/special/types/TypesData.java | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) 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 5fc269c4..be809bc7 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 @@ -22,16 +22,19 @@ import java.time.LocalTime; import java.util.ArrayList; import java.util.Calendar; +import java.util.Collections; import java.util.Date; import java.util.EnumMap; import java.util.HashMap; import java.util.HashSet; +import java.util.Hashtable; import java.util.LinkedHashMap; import java.util.LinkedHashSet; import java.util.List; import java.util.Map; import java.util.Optional; import java.util.Set; +import java.util.Vector; import java.util.function.Consumer; import java.util.function.Function; import java.util.stream.Stream; @@ -197,6 +200,16 @@ public static Stream generateData() id -> new ListDaoObject(id, new ArrayList<>(Set.of("1"))), object -> object.getValue().remove("1") ), + new TestArguments<>( + ListRepository.class, + id -> new ListDaoObject(id, new Vector<>(Set.of("1"))), + object -> object.getValue().remove("1") + ), + new TestArguments<>( + ListRepository.class, + id -> new ListDaoObject(id, Collections.emptyList()), + object -> object.setValue(List.of("1")) + ), new TestArguments<>( LocalDateRepository.class, id -> new LocalDateDaoObject(id, LocalDate.of(2000, 1, 1)), @@ -257,6 +270,21 @@ public static Stream generateData() id -> new MapDaoObject(id, new LinkedHashMap<>(Map.of("1", "1", "2", "2"))), set -> set.getValue().put("3", "3") ), + new TestArguments<>( + MapRepository.class, + id -> new MapDaoObject(id, new Hashtable<>()), + set -> set.getValue().put("1", "1") + ), + new TestArguments<>( + MapRepository.class, + id -> new MapDaoObject(id, new Hashtable<>(Map.of("1", "1"))), + set -> set.getValue().put("2", "2") + ), + new TestArguments<>( + MapRepository.class, + id -> new MapDaoObject(id, new Hashtable<>(Map.of("1", "1", "2", "2"))), + set -> set.getValue().put("3", "3") + ), new TestArguments<>( OptionalRepository.class, id -> new OptionalDaoObject(id, Optional.of("1")), From 9ea0ed3d8a21c562dda42c2c5e82622d005c79f8 Mon Sep 17 00:00:00 2001 From: JohannesRabauer Date: Tue, 13 Feb 2024 14:58:43 +0100 Subject: [PATCH 16/31] HashMaps are now specifically copied when merged. There is no other, clean way. --- .../working/RecursiveWorkingCopier.java | 41 ++++++++++++++++--- .../tests/special/types/TypesTest.java | 3 -- 2 files changed, 35 insertions(+), 9 deletions(-) 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 08485c4f..e0b566fc 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 @@ -19,6 +19,9 @@ import java.lang.reflect.Field; import java.lang.reflect.Modifier; import java.util.Collection; +import java.util.HashMap; +import java.util.Hashtable; +import java.util.LinkedHashMap; import java.util.Objects; import org.slf4j.Logger; @@ -253,12 +256,23 @@ else if(DataTypeUtil.isObjectArray(valueOfSourceObject)) originalValueObjectOfSource, !targetObjectIsPartOfJavaPackage); } - // Merge after setting reference to avoid endless loops - this.mergeValues( - valueOfSourceObject, - originalValueObjectOfSource, - alreadyMergedTargets, - changedCollector); + + 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); + } } } } @@ -269,6 +283,21 @@ else if(DataTypeUtil.isObjectArray(valueOfSourceObject)) } } + /** + * 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. + */ + private boolean isSpecialCaseWhereOnlyAFullCopyWorks(final Object valueOfSourceObject) + { + return + valueOfSourceObject != null + && ( + valueOfSourceObject.getClass().isAssignableFrom(HashMap.class) + || valueOfSourceObject.getClass().isAssignableFrom(LinkedHashMap.class) + || valueOfSourceObject.getClass().isAssignableFrom(Hashtable.class) + ); + } + @SuppressWarnings("unchecked") private E[] createGenericObjectArray( final Class clazz, 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 d7128d5c..4d86e12d 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 @@ -21,7 +21,6 @@ import java.util.function.Function; import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Disabled; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; import org.springframework.beans.factory.annotation.Autowired; @@ -127,8 +126,6 @@ > void simpleChangeAfterStore( @ParameterizedTest @MethodSource(TYPES_DATA_SOURCE) - // TODO: Fix this. - @Disabled("Is not fixed yet, but will be.") > void doubleStoreSameEntityWithChange( final Class> repositoryClass, final Function objectCreator, From d8fd82a18c2246573c5a7e1a8ce3a1c29339a844 Mon Sep 17 00:00:00 2001 From: JohannesRabauer Date: Wed, 14 Feb 2024 11:25:54 +0100 Subject: [PATCH 17/31] Added more types to test for TypesTest --- .../working/RecursiveWorkingCopier.java | 6 + .../tests/special/types/TypesData.java | 112 ++++++++++++++++-- .../tests/special/types/TypesTest.java | 48 ++++---- 3 files changed, 135 insertions(+), 31 deletions(-) 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 e0b566fc..326c4e34 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 @@ -21,8 +21,11 @@ import java.util.Collection; import java.util.HashMap; import java.util.Hashtable; +import java.util.IdentityHashMap; import java.util.LinkedHashMap; import java.util.Objects; +import java.util.TreeMap; +import java.util.TreeSet; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -295,6 +298,9 @@ private boolean isSpecialCaseWhereOnlyAFullCopyWorks(final Object valueOfSourceO valueOfSourceObject.getClass().isAssignableFrom(HashMap.class) || valueOfSourceObject.getClass().isAssignableFrom(LinkedHashMap.class) || valueOfSourceObject.getClass().isAssignableFrom(Hashtable.class) + || valueOfSourceObject.getClass().isAssignableFrom(TreeSet.class) + || valueOfSourceObject.getClass().isAssignableFrom(TreeMap.class) + || valueOfSourceObject.getClass().isAssignableFrom(IdentityHashMap.class) ); } 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 be809bc7..b0d1f331 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 @@ -28,13 +28,18 @@ import java.util.HashMap; import java.util.HashSet; import java.util.Hashtable; +import java.util.IdentityHashMap; import java.util.LinkedHashMap; import java.util.LinkedHashSet; import java.util.List; import java.util.Map; import java.util.Optional; import java.util.Set; +import java.util.Stack; +import java.util.TreeMap; +import java.util.TreeSet; import java.util.Vector; +import java.util.WeakHashMap; import java.util.function.Consumer; import java.util.function.Function; import java.util.stream.Stream; @@ -46,7 +51,7 @@ public final class TypesData { - public record ListOfTestArguments(List testArguments) + public record ListOfTestArguments(List> testArguments) { public Stream toArguments() { @@ -55,7 +60,7 @@ public Stream toArguments() } - public record TestArguments( + public record TestArguments>( Class> repositoryClass, Function objectCreator, Consumer objectChanger) @@ -68,8 +73,9 @@ public Arguments toArguments() public static Stream generateData() { + // noinspection RedundantTypeArguments (explicit type arguments speedup compilation and analysis time) return new ListOfTestArguments( - List.of( + List.>of( new TestArguments<>( SetRepository.class, id -> new SetDaoObject(id, Set.of()), @@ -100,6 +106,21 @@ public static Stream generateData() id -> new SetDaoObject(id, new HashSet<>(List.of("1", "2"))), set -> set.getValue().add("3") ), + new TestArguments<>( + SetRepository.class, + id -> new SetDaoObject(id, new TreeSet<>()), + set -> set.getValue().add("1") + ), + new TestArguments<>( + SetRepository.class, + id -> new SetDaoObject(id, new TreeSet<>(List.of("1"))), + set -> set.getValue().add("2") + ), + new TestArguments<>( + SetRepository.class, + id -> new SetDaoObject(id, new TreeSet<>(List.of("1", "2"))), + set -> set.getValue().add("3") + ), new TestArguments<>( SetRepository.class, id -> new SetDaoObject(id, new LinkedHashSet<>()), @@ -118,12 +139,12 @@ public static Stream generateData() new TestArguments<>( BigDecimalRepository.class, id -> new BigDecimalDaoObject(id, BigDecimal.ONE), - object -> object.getValue().add(BigDecimal.ONE) + object -> object.setValue(object.getValue().add(BigDecimal.ONE)) ), new TestArguments<>( BigDecimalRepository.class, id -> new BigDecimalDaoObject(id, BigDecimal.ZERO), - object -> object.getValue().add(BigDecimal.ONE) + object -> object.setValue(object.getValue().add(BigDecimal.ONE)) ), new TestArguments<>( BigDecimalRepository.class, @@ -133,12 +154,12 @@ public static Stream generateData() new TestArguments<>( BigIntegerRepository.class, id -> new BigIntegerDaoObject(id, BigInteger.ONE), - object -> object.getValue().add(BigInteger.ONE) + object -> object.setValue(object.getValue().add(BigInteger.ONE)) ), new TestArguments<>( BigIntegerRepository.class, id -> new BigIntegerDaoObject(id, BigInteger.ZERO), - object -> object.getValue().add(BigInteger.ONE) + object -> object.setValue(object.getValue().add(BigInteger.ONE)) ), new TestArguments<>( BigIntegerRepository.class, @@ -195,6 +216,32 @@ public static Stream generateData() id -> new ListDaoObject(id, new ArrayList<>(Set.of("1", "2"))), object -> object.getValue().add("3") ), + new TestArguments<>( + ListRepository.class, + id -> new ListDaoObject(id, new Stack<>()), + object -> object.getValue().add("1") + ), + new TestArguments<>( + ListRepository.class, + id -> + { + final Stack stack = new Stack<>(); + stack.add("1"); + return new ListDaoObject(id, stack); + }, + object -> object.getValue().add("2") + ), + new TestArguments<>( + ListRepository.class, + id -> + { + final Stack stack = new Stack<>(); + stack.push("1"); + stack.push("2"); + return new ListDaoObject(id, stack); + }, + object -> object.getValue().add("3") + ), new TestArguments<>( ListRepository.class, id -> new ListDaoObject(id, new ArrayList<>(Set.of("1"))), @@ -213,17 +260,17 @@ public static Stream generateData() new TestArguments<>( LocalDateRepository.class, id -> new LocalDateDaoObject(id, LocalDate.of(2000, 1, 1)), - object -> object.getValue().plusDays(1) + object -> object.setValue(object.getValue().plusDays(1)) ), new TestArguments<>( LocalDateTimeRepository.class, id -> new LocalDateTimeDaoObject(id, LocalDateTime.of(2000, 1, 1, 1, 1, 1)), - object -> object.getValue().plusDays(1) + object -> object.setValue(object.getValue().plusDays(1)) ), new TestArguments<>( LocalTimeRepository.class, id -> new LocalTimeDaoObject(id, LocalTime.of(1, 1, 1)), - object -> object.getValue().plusHours(1) + object -> object.setValue(object.getValue().plusHours(1)) ), new TestArguments<>( MapRepository.class, @@ -285,6 +332,36 @@ public static Stream generateData() id -> new MapDaoObject(id, new Hashtable<>(Map.of("1", "1", "2", "2"))), set -> set.getValue().put("3", "3") ), + new TestArguments<>( + MapRepository.class, + id -> new MapDaoObject(id, new TreeMap<>()), + set -> set.getValue().put("1", "1") + ), + new TestArguments<>( + MapRepository.class, + id -> new MapDaoObject(id, new TreeMap<>(Map.of("1", "1"))), + set -> set.getValue().put("2", "2") + ), + new TestArguments<>( + MapRepository.class, + id -> new MapDaoObject(id, new TreeMap<>(Map.of("1", "1", "2", "2"))), + set -> set.getValue().put("3", "3") + ), + new TestArguments<>( + MapRepository.class, + id -> new MapDaoObject(id, new IdentityHashMap<>()), + set -> set.getValue().put("1", "1") + ), + new TestArguments<>( + MapRepository.class, + id -> new MapDaoObject(id, new IdentityHashMap<>(Map.of("1", "1"))), + set -> set.getValue().put("2", "2") + ), + new TestArguments<>( + MapRepository.class, + id -> new MapDaoObject(id, new IdentityHashMap<>(Map.of("1", "1", "2", "2"))), + set -> set.getValue().put("3", "3") + ), new TestArguments<>( OptionalRepository.class, id -> new OptionalDaoObject(id, Optional.of("1")), @@ -334,6 +411,21 @@ public static Stream generateNotWorkingData() id -> new EnumMapDaoObject(id, new EnumMap<>(Map.of(EnumMapDaoObject.Album.RUMOURS, "1"))), object -> object.getValue().remove(EnumMapDaoObject.Album.RUMOURS) ), + new TestArguments<>( + MapRepository.class, + id -> new MapDaoObject(id, new WeakHashMap<>()), + set -> set.getValue().put("1", "1") + ), + new TestArguments<>( + MapRepository.class, + id -> new MapDaoObject(id, new WeakHashMap<>(Map.of("1", "1"))), + set -> set.getValue().put("2", "2") + ), + new TestArguments<>( + MapRepository.class, + id -> new MapDaoObject(id, new WeakHashMap<>(Map.of("1", "1", "2", "2"))), + set -> set.getValue().put("3", "3") + ), // Here EclipseStore has problems: https://github.com/microstream-one/microstream/issues/173 new TestArguments<>( CalendarRepository.class, 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 4d86e12d..7c671d18 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 @@ -15,7 +15,8 @@ */ package software.xdev.spring.data.eclipse.store.integration.isolated.tests.special.types; -import java.util.List; +import java.util.Collection; +import java.util.Map; import java.util.Optional; import java.util.function.Consumer; import java.util.function.Function; @@ -64,11 +65,7 @@ > void simpleStoreAndRead( TestUtil.doBeforeAndAfterRestartOfDatastore( this.storage, - () -> { - final List storedObjects = TestUtil.iterableToList(repository.findAll()); - Assertions.assertEquals(1, storedObjects.size()); - Assertions.assertEquals(objectToStore, storedObjects.get(0)); - } + () -> this.dynamicAssertEquals(1, repository, objectToStore) ); } @@ -116,11 +113,7 @@ > void simpleChangeAfterStore( TestUtil.doBeforeAndAfterRestartOfDatastore( this.storage, - () -> { - final Optional storedObject2 = repository.findById(1); - Assertions.assertTrue(storedObject2.isPresent()); - Assertions.assertEquals(storedObject, storedObject2); - } + () -> this.dynamicAssertEquals(1, repository, storedObject.get()) ); } @@ -141,11 +134,7 @@ > void doubleStoreSameEntityWithChange( TestUtil.doBeforeAndAfterRestartOfDatastore( this.storage, - () -> { - final Optional storedObject = repository.findById(1); - Assertions.assertTrue(storedObject.isPresent()); - Assertions.assertEquals(objectToStore, storedObject.get()); - } + () -> this.dynamicAssertEquals(1, repository, objectToStore) ); } @@ -164,11 +153,28 @@ > void simpleChangeBeforeStore( TestUtil.doBeforeAndAfterRestartOfDatastore( this.storage, - () -> { - final Optional storedObject2 = repository.findById(1); - Assertions.assertTrue(storedObject2.isPresent()); - Assertions.assertEquals(objectToStore, storedObject2.get()); - } + () -> this.dynamicAssertEquals(1, repository, objectToStore) ); } + + private > void dynamicAssertEquals( + final int id, + final EclipseStoreRepository repository, + final T objectToStore) + { + final Optional storedObject2 = repository.findById(id); + Assertions.assertTrue(storedObject2.isPresent()); + if(storedObject2.get().getValue() instanceof final Map storedMap) + { + Assertions.assertEquals(((Map)objectToStore.getValue()).size(), storedMap.size()); + } + else if(storedObject2.get().getValue() instanceof final Collection storedList) + { + Assertions.assertEquals(((Collection)objectToStore.getValue()).size(), storedList.size()); + } + else + { + Assertions.assertEquals(objectToStore, storedObject2.get()); + } + } } From 27596cd4518658aa194889c598b00556431db4c2 Mon Sep 17 00:00:00 2001 From: JohannesRabauer Date: Wed, 14 Feb 2024 14:22:54 +0100 Subject: [PATCH 18/31] Test for keyword "exists" created --- .../isolated/tests/keywords/KeywordsTest.java | 58 +++++++++++++++++++ .../tests/keywords/MinimalDaoObject.java | 54 +++++++++++++++++ .../tests/keywords/MinimalRepository.java | 26 +++++++++ 3 files changed, 138 insertions(+) create mode 100644 spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/keywords/KeywordsTest.java create mode 100644 spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/keywords/MinimalDaoObject.java create mode 100644 spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/keywords/MinimalRepository.java 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 new file mode 100644 index 00000000..61c012ca --- /dev/null +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/keywords/KeywordsTest.java @@ -0,0 +1,58 @@ +/* + * 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.keywords; + +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.TestPropertySource; + +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; + + +/** + * These tests should show that all or most of the following keywords are available in this library: Repository query + * keywords + */ +@IsolatedTestAnnotations +@TestPropertySource( + properties = + "org.eclipse.store.storage-directory=./target/keywords-tests-storage" +) +class KeywordsTest +{ + @Autowired + private EclipseStoreStorage storage; + + @Test + @Disabled("For now we don't need 'existsBy'") + void simpleStoreAndRead(final MinimalRepository repository) + { + repository.save(new MinimalDaoObject("1")); + + TestUtil.doBeforeAndAfterRestartOfDatastore( + this.storage, + () -> { + 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/MinimalDaoObject.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/keywords/MinimalDaoObject.java new file mode 100644 index 00000000..f306c867 --- /dev/null +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/keywords/MinimalDaoObject.java @@ -0,0 +1,54 @@ +/* + * 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.keywords; + +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; + + +public class MinimalDaoObject +{ + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + private int id; + private String value; + + public MinimalDaoObject(final String value) + { + this.value = value; + } + + public int getId() + { + return this.id; + } + + public void setId(final int id) + { + this.id = id; + } + + 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/keywords/MinimalRepository.java b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/keywords/MinimalRepository.java new file mode 100644 index 00000000..c1db0a3f --- /dev/null +++ b/spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/keywords/MinimalRepository.java @@ -0,0 +1,26 @@ +/* + * 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.keywords; + +import org.springframework.data.repository.Repository; + + +public interface MinimalRepository extends Repository +{ + MinimalDaoObject save(MinimalDaoObject entity); + + boolean existsByValue(String lastName); +} From d64f0d787a7b5f373cf1c3f3c4b762e1b0515a6b Mon Sep 17 00:00:00 2001 From: JohannesRabauer Date: Thu, 15 Feb 2024 08:25:07 +0100 Subject: [PATCH 19/31] Cleanup --- .../copier/object/EclipseSerializerRegisteringCopier.java | 6 +++--- .../integration/isolated/tests/special/types/TypesData.java | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) 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/object/EclipseSerializerRegisteringCopier.java index 76b98338..08b3268a 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/object/EclipseSerializerRegisteringCopier.java @@ -105,8 +105,8 @@ private void lazyInit() * A storer is created. Then a loader. By then calling {@link PersistenceStorer#store(Object)} the source-object is * serialized in memory. Then the created objects are put in a Map which holds the EclipseStore-ObjectId and all * the - * serialized objects. By calling {@link PersistenceLoader#get()} the serilized objects are deserialized. Then we - * iterate over the deserlized objects and pair them with the corresponding source-objects through the + * serialized objects. By calling {@link PersistenceLoader#get()} the serialized objects are deserialized. Then we + * iterate over the deserialized objects and pair them with the corresponding source-objects through the * EclipseStore-ObjectId. *

*/ @@ -182,7 +182,7 @@ public void incrementCopiedObjectsCount() this.copiedObjectsCount += 1; } - public void incrementRegisteredObjectsCountt() + public void incrementRegisteredObjectsCount() { this.registeredObjectsCount += 1; } 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 b0d1f331..f11a0e1a 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 @@ -49,7 +49,7 @@ import software.xdev.spring.data.eclipse.store.repository.interfaces.EclipseStoreRepository; -public final class TypesData +final class TypesData { public record ListOfTestArguments(List> testArguments) { @@ -71,6 +71,7 @@ public Arguments toArguments() } } + @SuppressWarnings("checkstyle:MethodLength") public static Stream generateData() { // noinspection RedundantTypeArguments (explicit type arguments speedup compilation and analysis time) From cd80f3a39d00df0c1b0be29a3c283c7e92ac8406 Mon Sep 17 00:00:00 2001 From: JohannesRabauer Date: Thu, 15 Feb 2024 10:16:53 +0100 Subject: [PATCH 20/31] Mini fix of cleanup --- .../copier/object/EclipseSerializerRegisteringCopier.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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/object/EclipseSerializerRegisteringCopier.java index 08b3268a..658a4cd6 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/object/EclipseSerializerRegisteringCopier.java @@ -142,7 +142,7 @@ public synchronized T copy(final T source, final boolean invertRegistering) final Object originalObject = originalObjects.get(id); if(originalObject != null) { - summarizer.incrementRegisteredObjectsCountt(); + summarizer.incrementRegisteredObjectsCount(); if(invertRegistering) { this.registry.invertRegister(copiedObject, originalObject); From fe8bfb4ad58966a3d7f92d6a4ff7518f75c469d6 Mon Sep 17 00:00:00 2001 From: JohannesRabauer Date: Thu, 15 Feb 2024 11:19:24 +0100 Subject: [PATCH 21/31] Implemented a definitive list that includes unsupported data types --- .../DataTypeNotSupportedException.java | 39 ++++++++++ .../importer/EclipseStoreDataImporter.java | 4 +- .../store/repository/PersistableChecker.java | 8 +++ .../store/repository/SupportedChecker.java | 71 +++++++++++++++++++ .../EclipseStoreRepositoryFactory.java | 9 ++- .../EclipseSerializerRegisteringCopier.java | 12 +++- .../working/RecursiveWorkingCopier.java | 6 +- .../data/eclipse/store/util/StringUtil.java | 2 + .../tests/special/types/TypesData.java | 14 ++-- .../tests/special/types/TypesTest.java | 3 +- .../EclipseStoreRegisteringCopierTest.java | 11 +-- 11 files changed, 163 insertions(+), 16 deletions(-) create mode 100644 spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/exceptions/DataTypeNotSupportedException.java create mode 100644 spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/SupportedChecker.java 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 new file mode 100644 index 00000000..c6184649 --- /dev/null +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/exceptions/DataTypeNotSupportedException.java @@ -0,0 +1,39 @@ +/* + * 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.exceptions; + +import software.xdev.spring.data.eclipse.store.util.StringUtil; + + +public class DataTypeNotSupportedException extends RuntimeException +{ + public DataTypeNotSupportedException(final String message) + { + super(message); + } + + public DataTypeNotSupportedException(final Class clazz) + { + this( + String.format( + "Datatype %s is not supported right now. Please open a ticket at %s if you feel that this type should " + + "be supported.", + clazz.getSimpleName(), + StringUtil.REPOSITORY_URL + ) + ); + } +} 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 56cf2509..d5256f34 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 @@ -30,6 +30,7 @@ import org.slf4j.LoggerFactory; 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.support.SimpleEclipseStoreRepository; import software.xdev.spring.data.eclipse.store.repository.support.copier.working.RecursiveWorkingCopier; @@ -201,7 +202,8 @@ private void createRepositoryForType( domainClass, this.eclipseStoreStorage.getRegistry(), this.eclipseStoreStorage, - this.eclipseStoreStorage), + this.eclipseStoreStorage, + new SupportedChecker.Implementation()), domainClass); } 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 c243618f..b342a204 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 @@ -15,8 +15,16 @@ */ package software.xdev.spring.data.eclipse.store.repository; +/** + * Checks if a class is persistable by EclipseStore through the + * {@link org.eclipse.store.storage.embedded.types.EmbeddedStorage}. + */ @FunctionalInterface public interface PersistableChecker { + /** + * Checks if a class is persistable by EclipseStore through the + * {@link org.eclipse.store.storage.embedded.types.EmbeddedStorage}. + */ boolean isPersistable(Class clazz); } 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 new file mode 100644 index 00000000..9d9cfc7b --- /dev/null +++ b/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/SupportedChecker.java @@ -0,0 +1,71 @@ +/* + * 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.repository; + +import java.util.Calendar; +import java.util.EnumMap; +import java.util.List; +import java.util.WeakHashMap; + +import org.eclipse.serializer.reference.Lazy; + + +/** + * Checks if a class is supported by the Spring-Data-Eclipse-Store library. + *

+ * 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. + *

+ */ +@FunctionalInterface +public interface SupportedChecker +{ + /** + * Checks if a class is supported by the Spring-Data-Eclipse-Store library. + *

+ * 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 + ); + + @Override + public boolean isSupported(final Class clazz) + { + return !UNSUPPORTED_DATA_TYPES.stream().anyMatch( + unsupportedClazz -> unsupportedClazz.isAssignableFrom(clazz) + ); + } + } +} 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 e8469e04..2f42894f 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 @@ -32,6 +32,7 @@ import org.springframework.lang.Nullable; 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.support.copier.working.RecursiveWorkingCopier; import software.xdev.spring.data.eclipse.store.repository.support.copier.working.WorkingCopier; @@ -80,7 +81,13 @@ private WorkingCopier createWorkingCopier( final Class domainType, final EclipseStoreStorage storage) { - return new RecursiveWorkingCopier<>(domainType, storage.getRegistry(), storage, storage); + return new RecursiveWorkingCopier<>( + domainType, + storage.getRegistry(), + storage, + storage, + new SupportedChecker.Implementation() + ); } @Override 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/object/EclipseSerializerRegisteringCopier.java index 658a4cd6..00f6f8e5 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/object/EclipseSerializerRegisteringCopier.java @@ -32,6 +32,8 @@ 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; @@ -45,16 +47,20 @@ public class EclipseSerializerRegisteringCopier implements RegisteringObjectCopi private static final Logger LOG = LoggerFactory.getLogger(EclipseSerializerRegisteringCopier.class); private final SerializerFoundation foundation; private PersistenceManager persistenceManager; + private final SupportedChecker supportedChecker; private final WorkingCopyRegistry registry; - public EclipseSerializerRegisteringCopier(final WorkingCopyRegistry registry) + public EclipseSerializerRegisteringCopier( + final WorkingCopyRegistry registry, + final SupportedChecker supportedChecker) { final SerializerFoundation newFoundation = SerializerFoundation.New(); newFoundation.registerCustomTypeHandler(BinaryHandlerImmutableCollectionsSet12.New()); newFoundation.registerCustomTypeHandler(BinaryHandlerImmutableCollectionsList12.New()); this.foundation = newFoundation; this.registry = registry; + this.supportedChecker = supportedChecker; } @Override @@ -134,6 +140,10 @@ public synchronized T copy(final T source, final boolean invertRegistering) loader.iterateEntries( (id, copiedObject) -> { + if(copiedObject != null && !this.supportedChecker.isSupported(copiedObject.getClass())) + { + throw new DataTypeNotSupportedException(copiedObject.getClass()); + } summarizer.incrementCopiedObjectsCount(); if(DataTypeUtil.isPrimitiveType(copiedObject.getClass())) { 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 326c4e34..a781da27 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 @@ -33,6 +33,7 @@ import software.xdev.spring.data.eclipse.store.exceptions.MergeFailedException; import software.xdev.spring.data.eclipse.store.repository.IdSetterProvider; import software.xdev.spring.data.eclipse.store.repository.PersistableChecker; +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.access.AccessHelper; import software.xdev.spring.data.eclipse.store.repository.access.modifier.FieldAccessModifier; @@ -57,11 +58,12 @@ public RecursiveWorkingCopier( final Class domainClass, final WorkingCopyRegistry registry, final IdSetterProvider idSetterProvider, - final PersistableChecker persistableChecker) + final PersistableChecker persistableChecker, + final SupportedChecker supportedChecker) { this.domainClass = domainClass; this.registry = registry; - this.objectCopier = new EclipseSerializerRegisteringCopier(registry); + this.objectCopier = new EclipseSerializerRegisteringCopier(registry, supportedChecker); this.idSetterProvider = idSetterProvider; this.persistableChecker = persistableChecker; } 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 d79f240b..bcf1a600 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 @@ -22,6 +22,8 @@ public final class StringUtil { + public static final String REPOSITORY_URL = "https://github.com/xdev-software/spring-data-eclipse-store"; + private StringUtil() { } 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 f11a0e1a..4429ddb6 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 @@ -44,6 +44,7 @@ import java.util.function.Function; import java.util.stream.Stream; +import org.eclipse.serializer.reference.Lazy; import org.junit.jupiter.params.provider.Arguments; import software.xdev.spring.data.eclipse.store.repository.interfaces.EclipseStoreRepository; @@ -382,21 +383,25 @@ public static Stream generateData() ).toArguments(); } + /** + * Should be identical to + * {@link + * software.xdev.spring.data.eclipse.store.repository.SupportedChecker.Implementation#UNSUPPORTED_DATA_TYPES} + */ public static Stream generateNotWorkingData() { return new ListOfTestArguments( List.of( new TestArguments<>( LazyRepository.class, - id -> new LazyDaoObject(id, org.eclipse.serializer.reference.Lazy.Reference("1")), - object -> object.setValue(org.eclipse.serializer.reference.Lazy.Reference("2")) + id -> new LazyDaoObject(id, Lazy.Reference("1")), + object -> object.setValue(Lazy.Reference("2")) ), new TestArguments<>( LazyRepository.class, - id -> new LazyDaoObject(id, org.eclipse.serializer.reference.Lazy.Reference("1")), + id -> new LazyDaoObject(id, Lazy.Reference("1")), object -> object.getValue().clear() ), - // Here EclipseStore has problems too: https://github.com/microstream-one/microstream/issues/204 new TestArguments<>( EnumMapRepository.class, id -> new EnumMapDaoObject(id, new EnumMap<>(EnumMapDaoObject.Album.class)), @@ -427,7 +432,6 @@ public static Stream generateNotWorkingData() id -> new MapDaoObject(id, new WeakHashMap<>(Map.of("1", "1", "2", "2"))), set -> set.getValue().put("3", "3") ), - // Here EclipseStore has problems: https://github.com/microstream-one/microstream/issues/173 new TestArguments<>( CalendarRepository.class, id -> new CalendarDaoObject(id, Calendar.getInstance()), 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 7c671d18..8c28d405 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 @@ -28,6 +28,7 @@ import org.springframework.context.ApplicationContext; import org.springframework.test.context.TestPropertySource; +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; @@ -78,7 +79,7 @@ > void simpleStoreAndReadForNotWorkingTypes( @Autowired final ApplicationContext context) { Assertions.assertThrows( - Exception.class, + DataTypeNotSupportedException.class, () -> this.simpleChangeAfterStore(repositoryClass, objectCreator, ignoredObjectChanger, context)); } 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/object/EclipseStoreRegisteringCopierTest.java index 9cbd8cad..51ad01bf 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/object/EclipseStoreRegisteringCopierTest.java @@ -21,6 +21,7 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; +import software.xdev.spring.data.eclipse.store.repository.SupportedChecker; import software.xdev.spring.data.eclipse.store.repository.WorkingCopyRegistry; @@ -34,7 +35,7 @@ private record DummyData(String data, int number) void testCopyManyCopiesSingle() { try(final EclipseSerializerRegisteringCopier copier = - new EclipseSerializerRegisteringCopier(new WorkingCopyRegistry())) + new EclipseSerializerRegisteringCopier(new WorkingCopyRegistry(), new SupportedChecker.Implementation())) { final List originalObjects = IntStream.range(0, 1_000).mapToObj( i -> new DummyData("Data" + i, i) @@ -50,7 +51,7 @@ void testCopyManyCopiesSingle() void testCopyAgainSameObject() { try(final EclipseSerializerRegisteringCopier copier = - new EclipseSerializerRegisteringCopier(new WorkingCopyRegistry())) + new EclipseSerializerRegisteringCopier(new WorkingCopyRegistry(), new SupportedChecker.Implementation())) { final DummyData originalObject = new DummyData("Test", 1); @@ -65,7 +66,7 @@ void testCopyAgainSameObject() void testCopyAgainTheCopy() { try(final EclipseSerializerRegisteringCopier copier = - new EclipseSerializerRegisteringCopier(new WorkingCopyRegistry())) + new EclipseSerializerRegisteringCopier(new WorkingCopyRegistry(), new SupportedChecker.Implementation())) { final DummyData originalObject = new DummyData("Test", 1); @@ -82,7 +83,7 @@ void testCopyAgainTheCopy() void testCopyManyCopiesBulk() { try(final EclipseSerializerRegisteringCopier copier = - new EclipseSerializerRegisteringCopier(new WorkingCopyRegistry())) + new EclipseSerializerRegisteringCopier(new WorkingCopyRegistry(), new SupportedChecker.Implementation())) { final List originalObjects = IntStream.range(0, 100_000).mapToObj( i -> new DummyData("Data" + i, i) @@ -98,7 +99,7 @@ void testCopyManyCopiesBulk() void testCopyEmpty() { try(final EclipseSerializerRegisteringCopier copier = - new EclipseSerializerRegisteringCopier(new WorkingCopyRegistry())) + new EclipseSerializerRegisteringCopier(new WorkingCopyRegistry(), new SupportedChecker.Implementation())) { Assertions.assertThrows(NullPointerException.class, () -> copier.copy(null)); } From d80e7afb673b66781da1ea16ac22001245a23829 Mon Sep 17 00:00:00 2001 From: Alex B <45384811+AB-xdev@users.noreply.github.com> Date: Wed, 21 Feb 2024 14:51:08 +0100 Subject: [PATCH 22/31] Update LICENSE to ``2024`` --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index 2316c756..864bb41e 100644 --- a/LICENSE +++ b/LICENSE @@ -186,7 +186,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2023 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. From 8b1a861c0f3fa01d45be2deb9f81a8d8cd6e5305 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 23 Feb 2024 00:22:34 +0000 Subject: [PATCH 23/31] Bump org.springframework.boot.version from 3.2.2 to 3.2.3 Bumps `org.springframework.boot.version` from 3.2.2 to 3.2.3. Updates `org.springframework.boot:spring-boot-dependencies` from 3.2.2 to 3.2.3 - [Release notes](https://github.com/spring-projects/spring-boot/releases) - [Commits](https://github.com/spring-projects/spring-boot/compare/v3.2.2...v3.2.3) Updates `org.springframework.boot:spring-boot-maven-plugin` from 3.2.2 to 3.2.3 - [Release notes](https://github.com/spring-projects/spring-boot/releases) - [Commits](https://github.com/spring-projects/spring-boot/compare/v3.2.2...v3.2.3) --- updated-dependencies: - dependency-name: org.springframework.boot:spring-boot-dependencies dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: org.springframework.boot:spring-boot-maven-plugin dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- spring-data-eclipse-store-benchmark/pom.xml | 2 +- spring-data-eclipse-store-demo/pom.xml | 2 +- spring-data-eclipse-store-jpa/pom.xml | 2 +- spring-data-eclipse-store/pom.xml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/spring-data-eclipse-store-benchmark/pom.xml b/spring-data-eclipse-store-benchmark/pom.xml index 0f87fd78..1b9a2839 100644 --- a/spring-data-eclipse-store-benchmark/pom.xml +++ b/spring-data-eclipse-store-benchmark/pom.xml @@ -20,7 +20,7 @@ UTF-8 UTF-8 - 3.2.2 + 3.2.3 1.37 diff --git a/spring-data-eclipse-store-demo/pom.xml b/spring-data-eclipse-store-demo/pom.xml index fb8cb27b..b34ff610 100644 --- a/spring-data-eclipse-store-demo/pom.xml +++ b/spring-data-eclipse-store-demo/pom.xml @@ -25,7 +25,7 @@ software.xdev.spring.data.eclipse.store.demo.complex.ComplexDemoApplication - 3.2.2 + 3.2.3 diff --git a/spring-data-eclipse-store-jpa/pom.xml b/spring-data-eclipse-store-jpa/pom.xml index 09663797..ee05bf25 100644 --- a/spring-data-eclipse-store-jpa/pom.xml +++ b/spring-data-eclipse-store-jpa/pom.xml @@ -25,7 +25,7 @@ software.xdev.spring.data.eclipse.store.demo.complex.ComplexDemoApplication - 3.2.2 + 3.2.3 diff --git a/spring-data-eclipse-store/pom.xml b/spring-data-eclipse-store/pom.xml index 979aab56..f614ae04 100644 --- a/spring-data-eclipse-store/pom.xml +++ b/spring-data-eclipse-store/pom.xml @@ -50,7 +50,7 @@ UTF-8 - 3.2.2 + 3.2.3 1.1.0 From f9231cf0635da103ba35a22f269e5596125705db Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 23 Feb 2024 00:22:48 +0000 Subject: [PATCH 24/31] Bump org.springframework.boot:spring-boot-dependencies Bumps [org.springframework.boot:spring-boot-dependencies](https://github.com/spring-projects/spring-boot) from 3.2.2 to 3.2.3. - [Release notes](https://github.com/spring-projects/spring-boot/releases) - [Commits](https://github.com/spring-projects/spring-boot/compare/v3.2.2...v3.2.3) --- updated-dependencies: - dependency-name: org.springframework.boot:spring-boot-dependencies dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- spring-data-eclipse-store-benchmark/pom.xml | 2 +- spring-data-eclipse-store-demo/pom.xml | 2 +- spring-data-eclipse-store-jpa/pom.xml | 2 +- spring-data-eclipse-store/pom.xml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/spring-data-eclipse-store-benchmark/pom.xml b/spring-data-eclipse-store-benchmark/pom.xml index 0f87fd78..1b9a2839 100644 --- a/spring-data-eclipse-store-benchmark/pom.xml +++ b/spring-data-eclipse-store-benchmark/pom.xml @@ -20,7 +20,7 @@ UTF-8 UTF-8 - 3.2.2 + 3.2.3 1.37 diff --git a/spring-data-eclipse-store-demo/pom.xml b/spring-data-eclipse-store-demo/pom.xml index fb8cb27b..b34ff610 100644 --- a/spring-data-eclipse-store-demo/pom.xml +++ b/spring-data-eclipse-store-demo/pom.xml @@ -25,7 +25,7 @@ software.xdev.spring.data.eclipse.store.demo.complex.ComplexDemoApplication - 3.2.2 + 3.2.3 diff --git a/spring-data-eclipse-store-jpa/pom.xml b/spring-data-eclipse-store-jpa/pom.xml index 09663797..ee05bf25 100644 --- a/spring-data-eclipse-store-jpa/pom.xml +++ b/spring-data-eclipse-store-jpa/pom.xml @@ -25,7 +25,7 @@ software.xdev.spring.data.eclipse.store.demo.complex.ComplexDemoApplication - 3.2.2 + 3.2.3 diff --git a/spring-data-eclipse-store/pom.xml b/spring-data-eclipse-store/pom.xml index 979aab56..f614ae04 100644 --- a/spring-data-eclipse-store/pom.xml +++ b/spring-data-eclipse-store/pom.xml @@ -50,7 +50,7 @@ UTF-8 - 3.2.2 + 3.2.3 1.1.0 From 5a1acfba6829df527fd6b8d0e5b06c813464f3bd Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 29 Feb 2024 00:13:16 +0000 Subject: [PATCH 25/31] Bump com.puppycrawl.tools:checkstyle from 10.13.0 to 10.14.0 Bumps [com.puppycrawl.tools:checkstyle](https://github.com/checkstyle/checkstyle) from 10.13.0 to 10.14.0. - [Release notes](https://github.com/checkstyle/checkstyle/releases) - [Commits](https://github.com/checkstyle/checkstyle/compare/checkstyle-10.13.0...checkstyle-10.14.0) --- updated-dependencies: - dependency-name: com.puppycrawl.tools:checkstyle dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- spring-data-eclipse-store-benchmark/pom.xml | 2 +- spring-data-eclipse-store-demo/pom.xml | 2 +- spring-data-eclipse-store-jpa/pom.xml | 2 +- spring-data-eclipse-store/pom.xml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/spring-data-eclipse-store-benchmark/pom.xml b/spring-data-eclipse-store-benchmark/pom.xml index 0f87fd78..0507394a 100644 --- a/spring-data-eclipse-store-benchmark/pom.xml +++ b/spring-data-eclipse-store-benchmark/pom.xml @@ -96,7 +96,7 @@ com.puppycrawl.tools checkstyle - 10.13.0 + 10.14.0 diff --git a/spring-data-eclipse-store-demo/pom.xml b/spring-data-eclipse-store-demo/pom.xml index fb8cb27b..9be3da2d 100644 --- a/spring-data-eclipse-store-demo/pom.xml +++ b/spring-data-eclipse-store-demo/pom.xml @@ -103,7 +103,7 @@ com.puppycrawl.tools checkstyle - 10.13.0 + 10.14.0 diff --git a/spring-data-eclipse-store-jpa/pom.xml b/spring-data-eclipse-store-jpa/pom.xml index 09663797..43bd29f1 100644 --- a/spring-data-eclipse-store-jpa/pom.xml +++ b/spring-data-eclipse-store-jpa/pom.xml @@ -123,7 +123,7 @@ com.puppycrawl.tools checkstyle - 10.13.0 + 10.14.0 diff --git a/spring-data-eclipse-store/pom.xml b/spring-data-eclipse-store/pom.xml index 979aab56..02e12d75 100644 --- a/spring-data-eclipse-store/pom.xml +++ b/spring-data-eclipse-store/pom.xml @@ -339,7 +339,7 @@ com.puppycrawl.tools checkstyle - 10.13.0 + 10.14.0 From 406bfa0dcf5742b3ad237b568b0604b251670c11 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 29 Feb 2024 00:43:48 +0000 Subject: [PATCH 26/31] Bump com.puppycrawl.tools:checkstyle from 10.13.0 to 10.14.0 Bumps [com.puppycrawl.tools:checkstyle](https://github.com/checkstyle/checkstyle) from 10.13.0 to 10.14.0. - [Release notes](https://github.com/checkstyle/checkstyle/releases) - [Commits](https://github.com/checkstyle/checkstyle/compare/checkstyle-10.13.0...checkstyle-10.14.0) --- updated-dependencies: - dependency-name: com.puppycrawl.tools:checkstyle dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- standard-maven-template-demo/pom.xml | 2 +- standard-maven-template/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/standard-maven-template-demo/pom.xml b/standard-maven-template-demo/pom.xml index 920d15d0..2b80c696 100644 --- a/standard-maven-template-demo/pom.xml +++ b/standard-maven-template-demo/pom.xml @@ -92,7 +92,7 @@ com.puppycrawl.tools checkstyle - 10.13.0 + 10.14.0 diff --git a/standard-maven-template/pom.xml b/standard-maven-template/pom.xml index c19cdceb..b8a7cc2f 100644 --- a/standard-maven-template/pom.xml +++ b/standard-maven-template/pom.xml @@ -216,7 +216,7 @@ com.puppycrawl.tools checkstyle - 10.13.0 + 10.14.0 From 5f9e8ad2962db6a402f9245d3af03ce8e18b01c8 Mon Sep 17 00:00:00 2001 From: AB Date: Thu, 29 Feb 2024 13:24:12 +0100 Subject: [PATCH 27/31] Introduce default license --- LICENSE | 201 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 201 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..864bb41e --- /dev/null +++ b/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + 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. + 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. From ff1bbdf68fecb28fc7454658e0b2e0972b720a3a Mon Sep 17 00:00:00 2001 From: Alex B <45384811+AB-xdev@users.noreply.github.com> Date: Fri, 1 Mar 2024 10:20:36 +0100 Subject: [PATCH 28/31] Update checkBuild.yml --- .github/workflows/checkBuild.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/checkBuild.yml b/.github/workflows/checkBuild.yml index c7b324d9..da4fbd43 100644 --- a/.github/workflows/checkBuild.yml +++ b/.github/workflows/checkBuild.yml @@ -7,6 +7,7 @@ on: paths-ignore: - '**.md' - '.config/**' + - '.github/**' - '.idea/**' - 'assets/**' pull_request: @@ -14,6 +15,7 @@ on: paths-ignore: - '**.md' - '.config/**' + - '.github/**' - '.idea/**' - 'assets/**' From 49b63d329416bd584a2efd0b13a5fb78f94d9965 Mon Sep 17 00:00:00 2001 From: Alex B <45384811+AB-xdev@users.noreply.github.com> Date: Fri, 1 Mar 2024 10:20:45 +0100 Subject: [PATCH 29/31] Update sonar.yml --- .github/workflows/sonar.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/sonar.yml b/.github/workflows/sonar.yml index bd37fc96..39335e05 100644 --- a/.github/workflows/sonar.yml +++ b/.github/workflows/sonar.yml @@ -7,6 +7,7 @@ on: paths-ignore: - '**.md' - '.config/**' + - '.github/**' - '.idea/**' - 'assets/**' pull_request: @@ -14,6 +15,7 @@ on: paths-ignore: - '**.md' - '.config/**' + - '.github/**' - '.idea/**' - 'assets/**' From dc1835431bd941888824901bd9da47acb82fe2d9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 4 Mar 2024 06:21:17 +0000 Subject: [PATCH 30/31] Bump org.eclipse.store.version from 1.1.0 to 1.2.0 Bumps `org.eclipse.store.version` from 1.1.0 to 1.2.0. Updates `org.eclipse.store:storage-embedded` from 1.1.0 to 1.2.0 Updates `org.eclipse.store:integrations-spring-boot3` from 1.1.0 to 1.2.0 Updates `org.eclipse.serializer:serializer` from 1.1.0 to 1.2.0 - [Release notes](https://github.com/eclipse-serializer/serializer/releases) - [Commits](https://github.com/eclipse-serializer/serializer/compare/1.1.0...1.2.0) Updates `org.eclipse.serializer:persistence-binary-jdk17` from 1.1.0 to 1.2.0 --- updated-dependencies: - dependency-name: org.eclipse.store:storage-embedded dependency-type: direct:production update-type: version-update:semver-minor - dependency-name: org.eclipse.store:integrations-spring-boot3 dependency-type: direct:production update-type: version-update:semver-minor - dependency-name: org.eclipse.serializer:serializer dependency-type: direct:production update-type: version-update:semver-minor - dependency-name: org.eclipse.serializer:persistence-binary-jdk17 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- spring-data-eclipse-store/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-data-eclipse-store/pom.xml b/spring-data-eclipse-store/pom.xml index 7e4a20b7..09d66c48 100644 --- a/spring-data-eclipse-store/pom.xml +++ b/spring-data-eclipse-store/pom.xml @@ -51,7 +51,7 @@ 3.2.3 - 1.1.0 + 1.2.0 From 92b61d2b77241eec3738b987dcf7ea4a03fe0d7e Mon Sep 17 00:00:00 2001 From: JohannesRabauer Date: Mon, 4 Mar 2024 08:01:58 +0100 Subject: [PATCH 31/31] Adjusted CHANGELOG and README --- CHANGELOG.md | 2 ++ README.md | 11 +++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7a7e53aa..faad4e2e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ # 1.0.3 * Added the EclipseStoreDataImporter to import data from JPA repositories. +* Updated EclipseStore to version 1.2.0 +* Updated Spring to version 3.2.3 # 1.0.2 diff --git a/README.md b/README.md index a0585e91..40cf0f50 100644 --- a/README.md +++ b/README.md @@ -53,13 +53,12 @@ With *Spring-Data-Eclipse-Store* every time an object is loaded from the datasto ## Installation [Installation guide for the latest release](https://github.com/xdev-software/spring-data-eclipse-store/releases/latest#Installation) -### Prerequisites +### Supported versions -| | Minimal Version | -|--------------|-----------------| -| Java | ``17`` | -| Spring Data | ``3.2.2`` | -| EclipseStore | ``1.1.0`` | +| 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