From 7ec9af10da95d696fe04ce8f3574e8922cbb2e53 Mon Sep 17 00:00:00 2001 From: Pavel Vetokhin Date: Sat, 21 Oct 2023 17:00:24 +0300 Subject: [PATCH] Modes inside dm models --- .../smecalculus/bezmen/construction/App.java | 12 ++++---- .../bezmen/core/SepulkaServiceImpl.java | 8 +++--- .../bezmen/messaging/SepulkaClientImpl.java | 4 +-- .../springmvc/SepulkaController.java | 4 +-- .../bezmen/storage/SepulkaDao.java | 8 +++--- .../bezmen/storage/SepulkaDaoMyBatis.java | 8 +++--- .../bezmen/storage/SepulkaDaoSpringData.java | 14 +++++----- .../bezmen/storage/SepulkaStateMapper.java | 14 +++++----- .../storage/{StateEdge.java => StateEm.java} | 2 +- .../storage/mybatis/SepulkaSqlMapper.java | 8 +++--- .../storage/springdata/SepulkaRepository.java | 4 +-- .../bezmen/construction/SepulkaDaoBeans.java | 2 +- .../construction/StoragePropsBeans.java | 20 ++++++------- .../bezmen/messaging/SepulkaClientIT.java | 10 +++---- .../bezmen/storage/SepulkaDaoIT.java | 14 +++++----- .../{MessageEdge.java => MessageEm.java} | 2 +- .../{MessageEdgeEg.java => MessageEmEg.java} | 6 ++-- .../bezmen/messaging/SepulkaClient.java | 4 +-- .../{MessageDomain.java => MessageDm.java} | 2 +- ...{MessageDomainEg.java => MessageDmEg.java} | 4 +-- .../bezmen/core/SepulkaMapper.java | 6 ++-- .../bezmen/core/SepulkaService.java | 8 +++--- .../core/{StateDomain.java => StateDm.java} | 2 +- .../{StateDomainEg.java => StateDmEg.java} | 10 +++---- .../messaging/BezmenClientJavaHttp.java | 6 ++-- .../bezmen/configuration/MessagingDm.java | 26 +++++++++++++++++ .../bezmen/configuration/MessagingDmEg.java | 25 +++++++++++++++++ .../bezmen/configuration/MessagingDomain.java | 16 ----------- .../configuration/MessagingDomainEg.java | 25 ----------------- .../{MessagingEdge.java => MessagingEm.java} | 8 ++++-- ...essagingEdgeEg.java => MessagingEmEg.java} | 2 +- .../configuration/MessagingMappingMode.java | 6 ---- .../configuration/MessagingPropsMapper.java | 16 ++++++----- .../configuration/MessagingProtocolMode.java | 6 ---- ...> ConditionalOnMessagingMappingModes.java} | 8 +++--- .../ConditionalOnMessagingProtocolModes.java | 4 +-- .../MappingSpringJmxManagementBeans.java | 9 +++--- .../MappingSpringWebManagementBeans.java | 9 +++--- .../MappingSpringWebMvcBeans.java | 9 +++--- .../construction/MessagingConfigBeans.java | 8 +++--- ...ava => MessagingMappingModeCondition.java} | 10 +++---- .../MessagingProtocolModeCondition.java | 6 ++-- .../construction/ProtocolHttpBeans.java | 5 ++-- .../bezmen/construction/ProtocolJmxBeans.java | 5 ++-- .../messaging/SepulkaMessageMapper.java | 6 ++-- .../construction/MessagingConfigBeansIT.java | 4 +-- .../{StorageDomain.java => StorageDm.java} | 17 ++++++++--- ...{StorageDomainEg.java => StorageDmEg.java} | 28 ++++++++++--------- .../{StorageEdge.java => StorageEm.java} | 8 ++++-- .../{StorageEdgeEg.java => StorageEmEg.java} | 12 ++++---- .../configuration/StorageMappingMode.java | 6 ---- .../configuration/StoragePropsMapper.java | 16 ++++++----- .../configuration/StorageProtocolMode.java | 6 ---- ...a => ConditionalOnStorageMappingMode.java} | 8 +++--- .../construction/MappingMyBatisBeans.java | 4 +-- .../construction/MappingSpringDataBeans.java | 6 ++-- .../bezmen/construction/StorageBeans.java | 6 ++-- .../construction/StorageConfigBeans.java | 6 ++-- ....java => StorageMappingModeCondition.java} | 10 +++---- .../construction/StorageConfigBeansIT.java | 4 +-- .../construction/StorageConfigBeansTest.java | 4 +-- .../messaging/SepulkaClientSpringWebTest.java | 4 +-- .../bezmen/registration/SepulkaTest.java | 6 ++-- 63 files changed, 278 insertions(+), 268 deletions(-) rename apps/sepuling/src/main/java/smecalculus/bezmen/storage/{StateEdge.java => StateEm.java} (97%) rename libs/abstraction-client/src/main/java/smecalculus/bezmen/messaging/{MessageEdge.java => MessageEm.java} (92%) rename libs/abstraction-client/src/main/java/smecalculus/bezmen/messaging/{MessageEdgeEg.java => MessageEmEg.java} (83%) rename libs/abstraction/src/main/java/smecalculus/bezmen/core/{MessageDomain.java => MessageDm.java} (93%) rename libs/abstraction/src/main/java/smecalculus/bezmen/core/{MessageDomainEg.java => MessageDmEg.java} (79%) rename libs/abstraction/src/main/java/smecalculus/bezmen/core/{StateDomain.java => StateDm.java} (96%) rename libs/abstraction/src/main/java/smecalculus/bezmen/core/{StateDomainEg.java => StateDmEg.java} (79%) create mode 100644 libs/messaging/src/main/java/smecalculus/bezmen/configuration/MessagingDm.java create mode 100644 libs/messaging/src/main/java/smecalculus/bezmen/configuration/MessagingDmEg.java delete mode 100644 libs/messaging/src/main/java/smecalculus/bezmen/configuration/MessagingDomain.java delete mode 100644 libs/messaging/src/main/java/smecalculus/bezmen/configuration/MessagingDomainEg.java rename libs/messaging/src/main/java/smecalculus/bezmen/configuration/{MessagingEdge.java => MessagingEm.java} (66%) rename libs/messaging/src/main/java/smecalculus/bezmen/configuration/{MessagingEdgeEg.java => MessagingEmEg.java} (51%) delete mode 100644 libs/messaging/src/main/java/smecalculus/bezmen/configuration/MessagingMappingMode.java delete mode 100644 libs/messaging/src/main/java/smecalculus/bezmen/configuration/MessagingProtocolMode.java rename libs/messaging/src/main/java/smecalculus/bezmen/construction/{ConditionalOnMessageMappingModes.java => ConditionalOnMessagingMappingModes.java} (63%) rename libs/messaging/src/main/java/smecalculus/bezmen/construction/{MessageMappingModeCondition.java => MessagingMappingModeCondition.java} (73%) rename libs/storage/src/main/java/smecalculus/bezmen/configuration/{StorageDomain.java => StorageDm.java} (59%) rename libs/storage/src/main/java/smecalculus/bezmen/configuration/{StorageDomainEg.java => StorageDmEg.java} (59%) rename libs/storage/src/main/java/smecalculus/bezmen/configuration/{StorageEdge.java => StorageEm.java} (81%) rename libs/storage/src/main/java/smecalculus/bezmen/configuration/{StorageEdgeEg.java => StorageEmEg.java} (60%) delete mode 100644 libs/storage/src/main/java/smecalculus/bezmen/configuration/StorageMappingMode.java delete mode 100644 libs/storage/src/main/java/smecalculus/bezmen/configuration/StorageProtocolMode.java rename libs/storage/src/main/java/smecalculus/bezmen/construction/{ConditionalOnStateMappingMode.java => ConditionalOnStorageMappingMode.java} (64%) rename libs/storage/src/main/java/smecalculus/bezmen/construction/{StateMappingModeCondition.java => StorageMappingModeCondition.java} (72%) diff --git a/apps/sepuling/src/main/java/smecalculus/bezmen/construction/App.java b/apps/sepuling/src/main/java/smecalculus/bezmen/construction/App.java index bf947a96..5a765edd 100644 --- a/apps/sepuling/src/main/java/smecalculus/bezmen/construction/App.java +++ b/apps/sepuling/src/main/java/smecalculus/bezmen/construction/App.java @@ -1,8 +1,8 @@ package smecalculus.bezmen.construction; -import static smecalculus.bezmen.configuration.MessagingMappingMode.SPRING_MVC; -import static smecalculus.bezmen.configuration.StorageMappingMode.MY_BATIS; -import static smecalculus.bezmen.configuration.StorageMappingMode.SPRING_DATA; +import static smecalculus.bezmen.configuration.MessagingDm.MappingMode.SPRING_MVC; +import static smecalculus.bezmen.configuration.StorageDm.MappingMode.MY_BATIS; +import static smecalculus.bezmen.configuration.StorageDm.MappingMode.SPRING_DATA; import org.springframework.boot.SpringApplication; import org.springframework.context.annotation.Bean; @@ -37,7 +37,7 @@ public static void main(String[] args) { } @Bean - @ConditionalOnMessageMappingModes(SPRING_MVC) + @ConditionalOnMessagingMappingModes(SPRING_MVC) SepulkaController sepulkaControllerSpringMvc(SepulkaClient client) { return new SepulkaController(client); } @@ -68,13 +68,13 @@ SepulkaStateMapper sepulkaStateMapper() { } @Bean - @ConditionalOnStateMappingMode(SPRING_DATA) + @ConditionalOnStorageMappingMode(SPRING_DATA) SepulkaDaoSpringData sepulkaDaoSpringData(SepulkaStateMapper mapper, SepulkaRepository repository) { return new SepulkaDaoSpringData(mapper, repository); } @Bean - @ConditionalOnStateMappingMode(MY_BATIS) + @ConditionalOnStorageMappingMode(MY_BATIS) SepulkaDaoMyBatis sepulkaDaoMyBatis(SepulkaStateMapper recMapper, SepulkaSqlMapper sqlMapper) { return new SepulkaDaoMyBatis(recMapper, sqlMapper); } diff --git a/apps/sepuling/src/main/java/smecalculus/bezmen/core/SepulkaServiceImpl.java b/apps/sepuling/src/main/java/smecalculus/bezmen/core/SepulkaServiceImpl.java index f149c838..8647cd57 100644 --- a/apps/sepuling/src/main/java/smecalculus/bezmen/core/SepulkaServiceImpl.java +++ b/apps/sepuling/src/main/java/smecalculus/bezmen/core/SepulkaServiceImpl.java @@ -7,10 +7,10 @@ import java.util.List; import lombok.NonNull; import lombok.RequiredArgsConstructor; -import smecalculus.bezmen.core.MessageDomain.PreviewRequest; -import smecalculus.bezmen.core.MessageDomain.PreviewResponse; -import smecalculus.bezmen.core.MessageDomain.RegistrationRequest; -import smecalculus.bezmen.core.MessageDomain.RegistrationResponse; +import smecalculus.bezmen.core.MessageDm.PreviewRequest; +import smecalculus.bezmen.core.MessageDm.PreviewResponse; +import smecalculus.bezmen.core.MessageDm.RegistrationRequest; +import smecalculus.bezmen.core.MessageDm.RegistrationResponse; import smecalculus.bezmen.storage.SepulkaDao; @RequiredArgsConstructor diff --git a/apps/sepuling/src/main/java/smecalculus/bezmen/messaging/SepulkaClientImpl.java b/apps/sepuling/src/main/java/smecalculus/bezmen/messaging/SepulkaClientImpl.java index 399b8d92..7d0fed9a 100644 --- a/apps/sepuling/src/main/java/smecalculus/bezmen/messaging/SepulkaClientImpl.java +++ b/apps/sepuling/src/main/java/smecalculus/bezmen/messaging/SepulkaClientImpl.java @@ -3,8 +3,8 @@ import lombok.NonNull; import lombok.RequiredArgsConstructor; import smecalculus.bezmen.core.SepulkaService; -import smecalculus.bezmen.messaging.MessageEdge.RegistrationRequest; -import smecalculus.bezmen.messaging.MessageEdge.RegistrationResponse; +import smecalculus.bezmen.messaging.MessageEm.RegistrationRequest; +import smecalculus.bezmen.messaging.MessageEm.RegistrationResponse; import smecalculus.bezmen.validation.EdgeValidator; @RequiredArgsConstructor diff --git a/apps/sepuling/src/main/java/smecalculus/bezmen/messaging/springmvc/SepulkaController.java b/apps/sepuling/src/main/java/smecalculus/bezmen/messaging/springmvc/SepulkaController.java index 308b30ce..75fffa61 100644 --- a/apps/sepuling/src/main/java/smecalculus/bezmen/messaging/springmvc/SepulkaController.java +++ b/apps/sepuling/src/main/java/smecalculus/bezmen/messaging/springmvc/SepulkaController.java @@ -8,8 +8,8 @@ import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; -import smecalculus.bezmen.messaging.MessageEdge.RegistrationRequest; -import smecalculus.bezmen.messaging.MessageEdge.RegistrationResponse; +import smecalculus.bezmen.messaging.MessageEm.RegistrationRequest; +import smecalculus.bezmen.messaging.MessageEm.RegistrationResponse; import smecalculus.bezmen.messaging.SepulkaClient; @RestController diff --git a/apps/sepuling/src/main/java/smecalculus/bezmen/storage/SepulkaDao.java b/apps/sepuling/src/main/java/smecalculus/bezmen/storage/SepulkaDao.java index adfb78e5..47fee827 100644 --- a/apps/sepuling/src/main/java/smecalculus/bezmen/storage/SepulkaDao.java +++ b/apps/sepuling/src/main/java/smecalculus/bezmen/storage/SepulkaDao.java @@ -2,10 +2,10 @@ import java.util.Optional; import java.util.UUID; -import smecalculus.bezmen.core.StateDomain.AggregateState; -import smecalculus.bezmen.core.StateDomain.ExistenceState; -import smecalculus.bezmen.core.StateDomain.PreviewState; -import smecalculus.bezmen.core.StateDomain.TouchState; +import smecalculus.bezmen.core.StateDm.AggregateState; +import smecalculus.bezmen.core.StateDm.ExistenceState; +import smecalculus.bezmen.core.StateDm.PreviewState; +import smecalculus.bezmen.core.StateDm.TouchState; /** * Port: server side diff --git a/apps/sepuling/src/main/java/smecalculus/bezmen/storage/SepulkaDaoMyBatis.java b/apps/sepuling/src/main/java/smecalculus/bezmen/storage/SepulkaDaoMyBatis.java index 2e5ab0fa..fe529e41 100644 --- a/apps/sepuling/src/main/java/smecalculus/bezmen/storage/SepulkaDaoMyBatis.java +++ b/apps/sepuling/src/main/java/smecalculus/bezmen/storage/SepulkaDaoMyBatis.java @@ -4,10 +4,10 @@ import java.util.UUID; import lombok.NonNull; import lombok.RequiredArgsConstructor; -import smecalculus.bezmen.core.StateDomain.AggregateState; -import smecalculus.bezmen.core.StateDomain.ExistenceState; -import smecalculus.bezmen.core.StateDomain.PreviewState; -import smecalculus.bezmen.core.StateDomain.TouchState; +import smecalculus.bezmen.core.StateDm.AggregateState; +import smecalculus.bezmen.core.StateDm.ExistenceState; +import smecalculus.bezmen.core.StateDm.PreviewState; +import smecalculus.bezmen.core.StateDm.TouchState; import smecalculus.bezmen.storage.mybatis.SepulkaSqlMapper; @RequiredArgsConstructor diff --git a/apps/sepuling/src/main/java/smecalculus/bezmen/storage/SepulkaDaoSpringData.java b/apps/sepuling/src/main/java/smecalculus/bezmen/storage/SepulkaDaoSpringData.java index d8bea31f..3ef5e4b1 100644 --- a/apps/sepuling/src/main/java/smecalculus/bezmen/storage/SepulkaDaoSpringData.java +++ b/apps/sepuling/src/main/java/smecalculus/bezmen/storage/SepulkaDaoSpringData.java @@ -4,7 +4,7 @@ import java.util.UUID; import lombok.NonNull; import lombok.RequiredArgsConstructor; -import smecalculus.bezmen.core.StateDomain; +import smecalculus.bezmen.core.StateDm; import smecalculus.bezmen.storage.springdata.SepulkaRepository; @RequiredArgsConstructor @@ -17,27 +17,27 @@ public class SepulkaDaoSpringData implements SepulkaDao { private SepulkaRepository repository; @Override - public StateDomain.AggregateState add(@NonNull StateDomain.AggregateState state) { + public StateDm.AggregateState add(@NonNull StateDm.AggregateState state) { var stateEdge = repository.save(mapper.toEdge(state)); return mapper.toDomain(stateEdge); } @Override - public Optional getBy(@NonNull String externalId) { + public Optional getBy(@NonNull String externalId) { return repository - .findByExternalId(externalId, StateEdge.ExistenceState.class) + .findByExternalId(externalId, StateEm.ExistenceState.class) .map(mapper::toDomain); } @Override - public Optional getBy(@NonNull UUID internalId) { + public Optional getBy(@NonNull UUID internalId) { return repository - .findByInternalId(internalId.toString(), StateEdge.PreviewState.class) + .findByInternalId(internalId.toString(), StateEm.PreviewState.class) .map(mapper::toDomain); } @Override - public void updateBy(StateDomain.TouchState state, UUID internalId) { + public void updateBy(StateDm.TouchState state, UUID internalId) { var stateEdge = mapper.toEdge(state); var matchedCount = repository.updateBy(stateEdge, internalId.toString()); if (matchedCount == 0) { diff --git a/apps/sepuling/src/main/java/smecalculus/bezmen/storage/SepulkaStateMapper.java b/apps/sepuling/src/main/java/smecalculus/bezmen/storage/SepulkaStateMapper.java index c4049e57..d939078f 100644 --- a/apps/sepuling/src/main/java/smecalculus/bezmen/storage/SepulkaStateMapper.java +++ b/apps/sepuling/src/main/java/smecalculus/bezmen/storage/SepulkaStateMapper.java @@ -1,20 +1,20 @@ package smecalculus.bezmen.storage; import org.mapstruct.Mapper; -import smecalculus.bezmen.core.StateDomain; +import smecalculus.bezmen.core.StateDm; import smecalculus.bezmen.mapping.EdgeMapper; @Mapper public interface SepulkaStateMapper extends EdgeMapper { - StateEdge.AggregateState toEdge(StateDomain.AggregateState state); + StateEm.AggregateState toEdge(StateDm.AggregateState state); - StateDomain.AggregateState toDomain(StateEdge.AggregateState state); + StateDm.AggregateState toDomain(StateEm.AggregateState state); - StateEdge.TouchState toEdge(StateDomain.TouchState state); + StateEm.TouchState toEdge(StateDm.TouchState state); - StateDomain.ExistenceState toDomain(StateEdge.ExistenceState state); + StateDm.ExistenceState toDomain(StateEm.ExistenceState state); - StateEdge.PreviewState toEdge(StateDomain.PreviewState state); + StateEm.PreviewState toEdge(StateDm.PreviewState state); - StateDomain.PreviewState toDomain(StateEdge.PreviewState state); + StateDm.PreviewState toDomain(StateEm.PreviewState state); } diff --git a/apps/sepuling/src/main/java/smecalculus/bezmen/storage/StateEdge.java b/apps/sepuling/src/main/java/smecalculus/bezmen/storage/StateEm.java similarity index 97% rename from apps/sepuling/src/main/java/smecalculus/bezmen/storage/StateEdge.java rename to apps/sepuling/src/main/java/smecalculus/bezmen/storage/StateEm.java index b305518d..96213ed6 100644 --- a/apps/sepuling/src/main/java/smecalculus/bezmen/storage/StateEdge.java +++ b/apps/sepuling/src/main/java/smecalculus/bezmen/storage/StateEm.java @@ -8,7 +8,7 @@ import org.springframework.data.relational.core.mapping.Column; import org.springframework.data.relational.core.mapping.Table; -public abstract class StateEdge { +public abstract class StateEm { @Data public static class ExistenceState { UUID internalId; diff --git a/apps/sepuling/src/main/java/smecalculus/bezmen/storage/mybatis/SepulkaSqlMapper.java b/apps/sepuling/src/main/java/smecalculus/bezmen/storage/mybatis/SepulkaSqlMapper.java index 68703231..2ef018a9 100644 --- a/apps/sepuling/src/main/java/smecalculus/bezmen/storage/mybatis/SepulkaSqlMapper.java +++ b/apps/sepuling/src/main/java/smecalculus/bezmen/storage/mybatis/SepulkaSqlMapper.java @@ -5,10 +5,10 @@ import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Update; -import smecalculus.bezmen.storage.StateEdge.AggregateState; -import smecalculus.bezmen.storage.StateEdge.ExistenceState; -import smecalculus.bezmen.storage.StateEdge.PreviewState; -import smecalculus.bezmen.storage.StateEdge.TouchState; +import smecalculus.bezmen.storage.StateEm.AggregateState; +import smecalculus.bezmen.storage.StateEm.ExistenceState; +import smecalculus.bezmen.storage.StateEm.PreviewState; +import smecalculus.bezmen.storage.StateEm.TouchState; public interface SepulkaSqlMapper { diff --git a/apps/sepuling/src/main/java/smecalculus/bezmen/storage/springdata/SepulkaRepository.java b/apps/sepuling/src/main/java/smecalculus/bezmen/storage/springdata/SepulkaRepository.java index 77aeff47..c86ed82d 100644 --- a/apps/sepuling/src/main/java/smecalculus/bezmen/storage/springdata/SepulkaRepository.java +++ b/apps/sepuling/src/main/java/smecalculus/bezmen/storage/springdata/SepulkaRepository.java @@ -6,8 +6,8 @@ import org.springframework.data.repository.CrudRepository; import org.springframework.data.repository.query.Param; import org.springframework.lang.Nullable; -import smecalculus.bezmen.storage.StateEdge.AggregateState; -import smecalculus.bezmen.storage.StateEdge.TouchState; +import smecalculus.bezmen.storage.StateEm.AggregateState; +import smecalculus.bezmen.storage.StateEm.TouchState; public interface SepulkaRepository extends CrudRepository { diff --git a/apps/sepuling/src/test/java/smecalculus/bezmen/construction/SepulkaDaoBeans.java b/apps/sepuling/src/test/java/smecalculus/bezmen/construction/SepulkaDaoBeans.java index 9c1bb094..ea69f29f 100644 --- a/apps/sepuling/src/test/java/smecalculus/bezmen/construction/SepulkaDaoBeans.java +++ b/apps/sepuling/src/test/java/smecalculus/bezmen/construction/SepulkaDaoBeans.java @@ -10,7 +10,7 @@ import org.springframework.context.annotation.Import; import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder; import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType; -import smecalculus.bezmen.configuration.StorageDomain.StorageProps; +import smecalculus.bezmen.configuration.StorageDm.StorageProps; import smecalculus.bezmen.storage.SepulkaDao; import smecalculus.bezmen.storage.SepulkaDaoMyBatis; import smecalculus.bezmen.storage.SepulkaDaoSpringData; diff --git a/apps/sepuling/src/test/java/smecalculus/bezmen/construction/StoragePropsBeans.java b/apps/sepuling/src/test/java/smecalculus/bezmen/construction/StoragePropsBeans.java index e6d9851d..c721b864 100644 --- a/apps/sepuling/src/test/java/smecalculus/bezmen/construction/StoragePropsBeans.java +++ b/apps/sepuling/src/test/java/smecalculus/bezmen/construction/StoragePropsBeans.java @@ -1,41 +1,41 @@ package smecalculus.bezmen.construction; -import static smecalculus.bezmen.configuration.StorageMappingMode.MY_BATIS; -import static smecalculus.bezmen.configuration.StorageMappingMode.SPRING_DATA; -import static smecalculus.bezmen.configuration.StorageProtocolMode.H2; -import static smecalculus.bezmen.configuration.StorageProtocolMode.POSTGRES; +import static smecalculus.bezmen.configuration.StorageDm.MappingMode.MY_BATIS; +import static smecalculus.bezmen.configuration.StorageDm.MappingMode.SPRING_DATA; +import static smecalculus.bezmen.configuration.StorageDm.ProtocolMode.H2; +import static smecalculus.bezmen.configuration.StorageDm.ProtocolMode.POSTGRES; import org.springframework.context.annotation.Bean; -import smecalculus.bezmen.configuration.StorageDomain.StorageProps; -import smecalculus.bezmen.configuration.StorageDomainEg; +import smecalculus.bezmen.configuration.StorageDm.StorageProps; +import smecalculus.bezmen.configuration.StorageDmEg; public class StoragePropsBeans { public static class SpringDataPostgres { @Bean public StorageProps storageProps() { - return StorageDomainEg.storageProps(SPRING_DATA, POSTGRES).build(); + return StorageDmEg.storageProps(SPRING_DATA, POSTGRES).build(); } } public static class SpringDataH2 { @Bean public StorageProps storageProps() { - return StorageDomainEg.storageProps(SPRING_DATA, H2).build(); + return StorageDmEg.storageProps(SPRING_DATA, H2).build(); } } public static class MyBatisPostgres { @Bean public StorageProps storageProps() { - return StorageDomainEg.storageProps(MY_BATIS, POSTGRES).build(); + return StorageDmEg.storageProps(MY_BATIS, POSTGRES).build(); } } public static class MyBatisH2 { @Bean public StorageProps storageProps() { - return StorageDomainEg.storageProps(MY_BATIS, H2).build(); + return StorageDmEg.storageProps(MY_BATIS, H2).build(); } } } diff --git a/apps/sepuling/src/test/java/smecalculus/bezmen/messaging/SepulkaClientIT.java b/apps/sepuling/src/test/java/smecalculus/bezmen/messaging/SepulkaClientIT.java index 1276eed4..df723440 100644 --- a/apps/sepuling/src/test/java/smecalculus/bezmen/messaging/SepulkaClientIT.java +++ b/apps/sepuling/src/test/java/smecalculus/bezmen/messaging/SepulkaClientIT.java @@ -11,8 +11,8 @@ import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit.jupiter.SpringExtension; import smecalculus.bezmen.construction.SepulkaClientBeans; -import smecalculus.bezmen.core.MessageDomain.RegistrationRequest; -import smecalculus.bezmen.core.MessageDomainEg; +import smecalculus.bezmen.core.MessageDm.RegistrationRequest; +import smecalculus.bezmen.core.MessageDmEg; import smecalculus.bezmen.core.SepulkaService; @ExtendWith(SpringExtension.class) @@ -30,12 +30,12 @@ void shouldRegisterSepulka() { // given var externalId = UUID.randomUUID().toString(); // and - var request = MessageEdgeEg.registrationRequest(externalId); + var request = MessageEmEg.registrationRequest(externalId); // and when(serviceMock.register(any(RegistrationRequest.class))) - .thenReturn(MessageDomainEg.registrationResponse(externalId).build()); + .thenReturn(MessageDmEg.registrationResponse(externalId).build()); // and - var expectedResponse = MessageEdgeEg.registrationResponse(externalId); + var expectedResponse = MessageEmEg.registrationResponse(externalId); // when var actualResponse = externalClient.register(request); // then diff --git a/apps/sepuling/src/test/java/smecalculus/bezmen/storage/SepulkaDaoIT.java b/apps/sepuling/src/test/java/smecalculus/bezmen/storage/SepulkaDaoIT.java index 11edcf0a..90ef4fe9 100644 --- a/apps/sepuling/src/test/java/smecalculus/bezmen/storage/SepulkaDaoIT.java +++ b/apps/sepuling/src/test/java/smecalculus/bezmen/storage/SepulkaDaoIT.java @@ -10,7 +10,7 @@ import org.springframework.test.context.jdbc.Sql; import org.springframework.test.context.junit.jupiter.SpringExtension; import smecalculus.bezmen.construction.SepulkaDaoBeans; -import smecalculus.bezmen.core.StateDomainEg; +import smecalculus.bezmen.core.StateDmEg; @DirtiesContext @ExtendWith(SpringExtension.class) @@ -24,10 +24,10 @@ abstract class SepulkaDaoIT { @Test void shouldAddOneSepulka() { // given - var expected1 = StateDomainEg.aggregateState().build(); + var expected1 = StateDmEg.aggregateState().build(); // and var expected2 = - StateDomainEg.creationState().internalId(expected1.internalId()).build(); + StateDmEg.creationState().internalId(expected1.internalId()).build(); // when var actualSaved = sepulkaDao.add(expected1); // and @@ -41,11 +41,11 @@ void shouldAddOneSepulka() { @Test void shouldViewOneSepulka() { // given - var aggregate = StateDomainEg.aggregateState().build(); + var aggregate = StateDmEg.aggregateState().build(); // and sepulkaDao.add(aggregate); // and - var expected = StateDomainEg.previewState(aggregate).build(); + var expected = StateDmEg.previewState(aggregate).build(); // when var actual = sepulkaDao.getBy(aggregate.internalId()); // then @@ -55,13 +55,13 @@ void shouldViewOneSepulka() { @Test void shouldUpdateOneSepulka() { // given - var aggregate = StateDomainEg.aggregateState().build(); + var aggregate = StateDmEg.aggregateState().build(); // and sepulkaDao.add(aggregate); // and var updatedAt = aggregate.updatedAt().plusSeconds(1); // and - var touch = StateDomainEg.touchState(aggregate).updatedAt(updatedAt).build(); + var touch = StateDmEg.touchState(aggregate).updatedAt(updatedAt).build(); // when sepulkaDao.updateBy(touch, aggregate.internalId()); // then diff --git a/libs/abstraction-client/src/main/java/smecalculus/bezmen/messaging/MessageEdge.java b/libs/abstraction-client/src/main/java/smecalculus/bezmen/messaging/MessageEm.java similarity index 92% rename from libs/abstraction-client/src/main/java/smecalculus/bezmen/messaging/MessageEdge.java rename to libs/abstraction-client/src/main/java/smecalculus/bezmen/messaging/MessageEm.java index 390263e8..b2a80ddc 100644 --- a/libs/abstraction-client/src/main/java/smecalculus/bezmen/messaging/MessageEdge.java +++ b/libs/abstraction-client/src/main/java/smecalculus/bezmen/messaging/MessageEm.java @@ -4,7 +4,7 @@ import jakarta.validation.constraints.Size; import lombok.Data; -public abstract class MessageEdge { +public abstract class MessageEm { @Data public static class RegistrationRequest { @NotNull diff --git a/libs/abstraction-client/src/main/java/smecalculus/bezmen/messaging/MessageEdgeEg.java b/libs/abstraction-client/src/main/java/smecalculus/bezmen/messaging/MessageEmEg.java similarity index 83% rename from libs/abstraction-client/src/main/java/smecalculus/bezmen/messaging/MessageEdgeEg.java rename to libs/abstraction-client/src/main/java/smecalculus/bezmen/messaging/MessageEmEg.java index 6d84c4ce..ff97a244 100644 --- a/libs/abstraction-client/src/main/java/smecalculus/bezmen/messaging/MessageEdgeEg.java +++ b/libs/abstraction-client/src/main/java/smecalculus/bezmen/messaging/MessageEmEg.java @@ -1,10 +1,10 @@ package smecalculus.bezmen.messaging; import java.util.UUID; -import smecalculus.bezmen.messaging.MessageEdge.RegistrationRequest; -import smecalculus.bezmen.messaging.MessageEdge.RegistrationResponse; +import smecalculus.bezmen.messaging.MessageEm.RegistrationRequest; +import smecalculus.bezmen.messaging.MessageEm.RegistrationResponse; -public abstract class MessageEdgeEg { +public abstract class MessageEmEg { public static RegistrationRequest registrationRequest() { var requestEdge = new RegistrationRequest(); requestEdge.setExternalId(UUID.randomUUID().toString()); diff --git a/libs/abstraction-client/src/main/java/smecalculus/bezmen/messaging/SepulkaClient.java b/libs/abstraction-client/src/main/java/smecalculus/bezmen/messaging/SepulkaClient.java index 8a28e06f..84fbea13 100644 --- a/libs/abstraction-client/src/main/java/smecalculus/bezmen/messaging/SepulkaClient.java +++ b/libs/abstraction-client/src/main/java/smecalculus/bezmen/messaging/SepulkaClient.java @@ -1,7 +1,7 @@ package smecalculus.bezmen.messaging; -import smecalculus.bezmen.messaging.MessageEdge.RegistrationRequest; -import smecalculus.bezmen.messaging.MessageEdge.RegistrationResponse; +import smecalculus.bezmen.messaging.MessageEm.RegistrationRequest; +import smecalculus.bezmen.messaging.MessageEm.RegistrationResponse; /** * Port: client side diff --git a/libs/abstraction/src/main/java/smecalculus/bezmen/core/MessageDomain.java b/libs/abstraction/src/main/java/smecalculus/bezmen/core/MessageDm.java similarity index 93% rename from libs/abstraction/src/main/java/smecalculus/bezmen/core/MessageDomain.java rename to libs/abstraction/src/main/java/smecalculus/bezmen/core/MessageDm.java index 36eabd5e..0f575b40 100644 --- a/libs/abstraction/src/main/java/smecalculus/bezmen/core/MessageDomain.java +++ b/libs/abstraction/src/main/java/smecalculus/bezmen/core/MessageDm.java @@ -3,7 +3,7 @@ import lombok.Builder; import lombok.NonNull; -public class MessageDomain { +public class MessageDm { @Builder public record RegistrationRequest(@NonNull String externalId) {} diff --git a/libs/abstraction/src/main/java/smecalculus/bezmen/core/MessageDomainEg.java b/libs/abstraction/src/main/java/smecalculus/bezmen/core/MessageDmEg.java similarity index 79% rename from libs/abstraction/src/main/java/smecalculus/bezmen/core/MessageDomainEg.java rename to libs/abstraction/src/main/java/smecalculus/bezmen/core/MessageDmEg.java index 07d31cd7..658af75d 100644 --- a/libs/abstraction/src/main/java/smecalculus/bezmen/core/MessageDomainEg.java +++ b/libs/abstraction/src/main/java/smecalculus/bezmen/core/MessageDmEg.java @@ -1,9 +1,9 @@ package smecalculus.bezmen.core; import java.util.UUID; -import smecalculus.bezmen.core.MessageDomain.RegistrationResponse; +import smecalculus.bezmen.core.MessageDm.RegistrationResponse; -public class MessageDomainEg { +public class MessageDmEg { public static RegistrationResponse.Builder registrationResponse() { return RegistrationResponse.builder().externalId(UUID.randomUUID().toString()); } diff --git a/libs/abstraction/src/main/java/smecalculus/bezmen/core/SepulkaMapper.java b/libs/abstraction/src/main/java/smecalculus/bezmen/core/SepulkaMapper.java index e03f1f32..0046e270 100644 --- a/libs/abstraction/src/main/java/smecalculus/bezmen/core/SepulkaMapper.java +++ b/libs/abstraction/src/main/java/smecalculus/bezmen/core/SepulkaMapper.java @@ -1,9 +1,9 @@ package smecalculus.bezmen.core; import org.mapstruct.Mapper; -import smecalculus.bezmen.core.MessageDomain.RegistrationRequest; -import smecalculus.bezmen.core.MessageDomain.RegistrationResponse; -import smecalculus.bezmen.core.StateDomain.AggregateState; +import smecalculus.bezmen.core.MessageDm.RegistrationRequest; +import smecalculus.bezmen.core.MessageDm.RegistrationResponse; +import smecalculus.bezmen.core.StateDm.AggregateState; @Mapper public interface SepulkaMapper { diff --git a/libs/abstraction/src/main/java/smecalculus/bezmen/core/SepulkaService.java b/libs/abstraction/src/main/java/smecalculus/bezmen/core/SepulkaService.java index 02e799e3..7e6de4f7 100644 --- a/libs/abstraction/src/main/java/smecalculus/bezmen/core/SepulkaService.java +++ b/libs/abstraction/src/main/java/smecalculus/bezmen/core/SepulkaService.java @@ -1,10 +1,10 @@ package smecalculus.bezmen.core; import java.util.List; -import smecalculus.bezmen.core.MessageDomain.PreviewRequest; -import smecalculus.bezmen.core.MessageDomain.PreviewResponse; -import smecalculus.bezmen.core.MessageDomain.RegistrationRequest; -import smecalculus.bezmen.core.MessageDomain.RegistrationResponse; +import smecalculus.bezmen.core.MessageDm.PreviewRequest; +import smecalculus.bezmen.core.MessageDm.PreviewResponse; +import smecalculus.bezmen.core.MessageDm.RegistrationRequest; +import smecalculus.bezmen.core.MessageDm.RegistrationResponse; public interface SepulkaService { RegistrationResponse register(RegistrationRequest request); diff --git a/libs/abstraction/src/main/java/smecalculus/bezmen/core/StateDomain.java b/libs/abstraction/src/main/java/smecalculus/bezmen/core/StateDm.java similarity index 96% rename from libs/abstraction/src/main/java/smecalculus/bezmen/core/StateDomain.java rename to libs/abstraction/src/main/java/smecalculus/bezmen/core/StateDm.java index 5a9d46f0..66aad16d 100644 --- a/libs/abstraction/src/main/java/smecalculus/bezmen/core/StateDomain.java +++ b/libs/abstraction/src/main/java/smecalculus/bezmen/core/StateDm.java @@ -5,7 +5,7 @@ import lombok.Builder; import lombok.NonNull; -public class StateDomain { +public class StateDm { @Builder public record ExistenceState(@NonNull UUID internalId) {} diff --git a/libs/abstraction/src/main/java/smecalculus/bezmen/core/StateDomainEg.java b/libs/abstraction/src/main/java/smecalculus/bezmen/core/StateDmEg.java similarity index 79% rename from libs/abstraction/src/main/java/smecalculus/bezmen/core/StateDomainEg.java rename to libs/abstraction/src/main/java/smecalculus/bezmen/core/StateDmEg.java index 0b5582f3..698483a7 100644 --- a/libs/abstraction/src/main/java/smecalculus/bezmen/core/StateDomainEg.java +++ b/libs/abstraction/src/main/java/smecalculus/bezmen/core/StateDmEg.java @@ -4,12 +4,12 @@ import java.time.LocalDateTime; import java.util.UUID; -import smecalculus.bezmen.core.StateDomain.AggregateState; -import smecalculus.bezmen.core.StateDomain.ExistenceState; -import smecalculus.bezmen.core.StateDomain.PreviewState; -import smecalculus.bezmen.core.StateDomain.TouchState; +import smecalculus.bezmen.core.StateDm.AggregateState; +import smecalculus.bezmen.core.StateDm.ExistenceState; +import smecalculus.bezmen.core.StateDm.PreviewState; +import smecalculus.bezmen.core.StateDm.TouchState; -public class StateDomainEg { +public class StateDmEg { public static AggregateState.Builder aggregateState() { return AggregateState.builder() .internalId(UUID.randomUUID()) diff --git a/libs/messaging-client/src/main/java/smecalculus/bezmen/messaging/BezmenClientJavaHttp.java b/libs/messaging-client/src/main/java/smecalculus/bezmen/messaging/BezmenClientJavaHttp.java index ea336b59..02a173dc 100644 --- a/libs/messaging-client/src/main/java/smecalculus/bezmen/messaging/BezmenClientJavaHttp.java +++ b/libs/messaging-client/src/main/java/smecalculus/bezmen/messaging/BezmenClientJavaHttp.java @@ -10,8 +10,8 @@ import java.net.http.HttpResponse.BodyHandlers; import lombok.NonNull; import lombok.RequiredArgsConstructor; -import smecalculus.bezmen.messaging.MessageEdge.RegistrationRequest; -import smecalculus.bezmen.messaging.MessageEdge.RegistrationResponse; +import smecalculus.bezmen.messaging.MessageEm.RegistrationRequest; +import smecalculus.bezmen.messaging.MessageEm.RegistrationResponse; @RequiredArgsConstructor public class BezmenClientJavaHttp implements BezmenClient { @@ -33,7 +33,7 @@ public RegistrationResponse register(RegistrationRequest request) { .header("Accept", "application/json") .build(); var httpResponse = client.send(httpRequest, BodyHandlers.ofString()); - return mapper.readValue(httpResponse.body(), MessageEdge.RegistrationResponse.class); + return mapper.readValue(httpResponse.body(), MessageEm.RegistrationResponse.class); } catch (JsonProcessingException e) { throw new RuntimeException(e); } catch (IOException | InterruptedException e) { diff --git a/libs/messaging/src/main/java/smecalculus/bezmen/configuration/MessagingDm.java b/libs/messaging/src/main/java/smecalculus/bezmen/configuration/MessagingDm.java new file mode 100644 index 00000000..03b334d8 --- /dev/null +++ b/libs/messaging/src/main/java/smecalculus/bezmen/configuration/MessagingDm.java @@ -0,0 +1,26 @@ +package smecalculus.bezmen.configuration; + +import java.util.Set; +import lombok.Builder; +import lombok.NonNull; + +public abstract class MessagingDm { + public enum MappingMode { + SPRING_MVC, + SPRING_MANAGEMENT + } + + public enum ProtocolMode { + HTTP, + JMX + } + + @Builder + public record MessagingProps(@NonNull ProtocolProps protocolProps, @NonNull MappingProps mappingProps) {} + + @Builder + public record ProtocolProps(@NonNull Set protocolModes) {} + + @Builder + public record MappingProps(@NonNull Set mappingModes) {} +} diff --git a/libs/messaging/src/main/java/smecalculus/bezmen/configuration/MessagingDmEg.java b/libs/messaging/src/main/java/smecalculus/bezmen/configuration/MessagingDmEg.java new file mode 100644 index 00000000..8738780e --- /dev/null +++ b/libs/messaging/src/main/java/smecalculus/bezmen/configuration/MessagingDmEg.java @@ -0,0 +1,25 @@ +package smecalculus.bezmen.configuration; + +import static smecalculus.bezmen.configuration.MessagingDm.MappingMode.SPRING_MVC; +import static smecalculus.bezmen.configuration.MessagingDm.ProtocolMode.HTTP; + +import java.util.Set; +import smecalculus.bezmen.configuration.MessagingDm.MappingProps; +import smecalculus.bezmen.configuration.MessagingDm.MessagingProps; +import smecalculus.bezmen.configuration.MessagingDm.ProtocolProps; + +public abstract class MessagingDmEg { + public static MessagingProps.Builder messagingProps() { + return MessagingProps.builder() + .protocolProps(protocolProps().build()) + .mappingProps(mappingProps().build()); + } + + public static ProtocolProps.Builder protocolProps() { + return ProtocolProps.builder().protocolModes(Set.of(HTTP)); + } + + public static MappingProps.Builder mappingProps() { + return MappingProps.builder().mappingModes(Set.of(SPRING_MVC)); + } +} diff --git a/libs/messaging/src/main/java/smecalculus/bezmen/configuration/MessagingDomain.java b/libs/messaging/src/main/java/smecalculus/bezmen/configuration/MessagingDomain.java deleted file mode 100644 index 2cadb817..00000000 --- a/libs/messaging/src/main/java/smecalculus/bezmen/configuration/MessagingDomain.java +++ /dev/null @@ -1,16 +0,0 @@ -package smecalculus.bezmen.configuration; - -import java.util.Set; -import lombok.Builder; -import lombok.NonNull; - -public abstract class MessagingDomain { - @Builder - public record MessagingProps(@NonNull ProtocolProps protocolProps, @NonNull MappingProps mappingProps) {} - - @Builder - public record ProtocolProps(@NonNull Set protocolModes) {} - - @Builder - public record MappingProps(@NonNull Set mappingModes) {} -} diff --git a/libs/messaging/src/main/java/smecalculus/bezmen/configuration/MessagingDomainEg.java b/libs/messaging/src/main/java/smecalculus/bezmen/configuration/MessagingDomainEg.java deleted file mode 100644 index 21e2f314..00000000 --- a/libs/messaging/src/main/java/smecalculus/bezmen/configuration/MessagingDomainEg.java +++ /dev/null @@ -1,25 +0,0 @@ -package smecalculus.bezmen.configuration; - -import static smecalculus.bezmen.configuration.MessagingMappingMode.SPRING_MVC; -import static smecalculus.bezmen.configuration.MessagingProtocolMode.HTTP; - -import java.util.Set; -import smecalculus.bezmen.configuration.MessagingDomain.MappingProps; -import smecalculus.bezmen.configuration.MessagingDomain.MessagingProps; -import smecalculus.bezmen.configuration.MessagingDomain.ProtocolProps; - -public abstract class MessagingDomainEg { - public static MessagingProps.Builder messagingProps() { - return MessagingProps.builder() - .protocolProps(protocolProps().build()) - .mappingProps(mappingProps().build()); - } - - public static ProtocolProps.Builder protocolProps() { - return MessagingDomain.ProtocolProps.builder().protocolModes(Set.of(HTTP)); - } - - public static MappingProps.Builder mappingProps() { - return MappingProps.builder().mappingModes(Set.of(SPRING_MVC)); - } -} diff --git a/libs/messaging/src/main/java/smecalculus/bezmen/configuration/MessagingEdge.java b/libs/messaging/src/main/java/smecalculus/bezmen/configuration/MessagingEm.java similarity index 66% rename from libs/messaging/src/main/java/smecalculus/bezmen/configuration/MessagingEdge.java rename to libs/messaging/src/main/java/smecalculus/bezmen/configuration/MessagingEm.java index 5cb49762..f6c068c1 100644 --- a/libs/messaging/src/main/java/smecalculus/bezmen/configuration/MessagingEdge.java +++ b/libs/messaging/src/main/java/smecalculus/bezmen/configuration/MessagingEm.java @@ -4,9 +4,11 @@ import jakarta.validation.constraints.Size; import java.util.Set; import lombok.Data; +import smecalculus.bezmen.configuration.MessagingDm.MappingMode; +import smecalculus.bezmen.configuration.MessagingDm.ProtocolMode; import smecalculus.bezmen.validation.ValueOfEnum; -public abstract class MessagingEdge { +public abstract class MessagingEm { @Data public static class MessagingProps { @NotNull @@ -20,13 +22,13 @@ public static class MessagingProps { public static class MappingProps { @NotNull @Size(min = 1) - Set<@ValueOfEnum(MessagingMappingMode.class) String> modes; + Set<@ValueOfEnum(MappingMode.class) String> modes; } @Data public static class ProtocolProps { @NotNull @Size(min = 1) - Set<@ValueOfEnum(MessagingProtocolMode.class) String> modes; + Set<@ValueOfEnum(ProtocolMode.class) String> modes; } } diff --git a/libs/messaging/src/main/java/smecalculus/bezmen/configuration/MessagingEdgeEg.java b/libs/messaging/src/main/java/smecalculus/bezmen/configuration/MessagingEmEg.java similarity index 51% rename from libs/messaging/src/main/java/smecalculus/bezmen/configuration/MessagingEdgeEg.java rename to libs/messaging/src/main/java/smecalculus/bezmen/configuration/MessagingEmEg.java index 49a1533d..6906365f 100644 --- a/libs/messaging/src/main/java/smecalculus/bezmen/configuration/MessagingEdgeEg.java +++ b/libs/messaging/src/main/java/smecalculus/bezmen/configuration/MessagingEmEg.java @@ -1,3 +1,3 @@ package smecalculus.bezmen.configuration; -public abstract class MessagingEdgeEg {} +public abstract class MessagingEmEg {} diff --git a/libs/messaging/src/main/java/smecalculus/bezmen/configuration/MessagingMappingMode.java b/libs/messaging/src/main/java/smecalculus/bezmen/configuration/MessagingMappingMode.java deleted file mode 100644 index 22acc1e4..00000000 --- a/libs/messaging/src/main/java/smecalculus/bezmen/configuration/MessagingMappingMode.java +++ /dev/null @@ -1,6 +0,0 @@ -package smecalculus.bezmen.configuration; - -public enum MessagingMappingMode { - SPRING_MVC, - SPRING_MANAGEMENT -} diff --git a/libs/messaging/src/main/java/smecalculus/bezmen/configuration/MessagingPropsMapper.java b/libs/messaging/src/main/java/smecalculus/bezmen/configuration/MessagingPropsMapper.java index 07806b7b..f2eb4a10 100644 --- a/libs/messaging/src/main/java/smecalculus/bezmen/configuration/MessagingPropsMapper.java +++ b/libs/messaging/src/main/java/smecalculus/bezmen/configuration/MessagingPropsMapper.java @@ -2,25 +2,27 @@ import org.mapstruct.Mapper; import org.mapstruct.Mapping; +import smecalculus.bezmen.configuration.MessagingDm.MappingMode; +import smecalculus.bezmen.configuration.MessagingDm.ProtocolMode; import smecalculus.bezmen.mapping.EdgeMapper; @Mapper public interface MessagingPropsMapper extends EdgeMapper { @Mapping(source = "protocol", target = "protocolProps") @Mapping(source = "mapping", target = "mappingProps") - MessagingDomain.MessagingProps toDomain(MessagingEdge.MessagingProps propsEdge); + MessagingDm.MessagingProps toDomain(MessagingEm.MessagingProps propsEdge); @Mapping(source = "modes", target = "protocolModes") - MessagingDomain.ProtocolProps toDomain(MessagingEdge.ProtocolProps propsEdge); + MessagingDm.ProtocolProps toDomain(MessagingEm.ProtocolProps propsEdge); @Mapping(source = "modes", target = "mappingModes") - MessagingDomain.MappingProps toDomain(MessagingEdge.MappingProps propsEdge); + MessagingDm.MappingProps toDomain(MessagingEm.MappingProps propsEdge); - default MessagingProtocolMode toProtocolMode(String value) { - return MessagingProtocolMode.valueOf(value.toUpperCase()); + default ProtocolMode toProtocolMode(String value) { + return ProtocolMode.valueOf(value.toUpperCase()); } - default MessagingMappingMode toMappingMode(String value) { - return MessagingMappingMode.valueOf(value.toUpperCase()); + default MappingMode toMappingMode(String value) { + return MappingMode.valueOf(value.toUpperCase()); } } diff --git a/libs/messaging/src/main/java/smecalculus/bezmen/configuration/MessagingProtocolMode.java b/libs/messaging/src/main/java/smecalculus/bezmen/configuration/MessagingProtocolMode.java deleted file mode 100644 index 81021b0c..00000000 --- a/libs/messaging/src/main/java/smecalculus/bezmen/configuration/MessagingProtocolMode.java +++ /dev/null @@ -1,6 +0,0 @@ -package smecalculus.bezmen.configuration; - -public enum MessagingProtocolMode { - HTTP, - JMX -} diff --git a/libs/messaging/src/main/java/smecalculus/bezmen/construction/ConditionalOnMessageMappingModes.java b/libs/messaging/src/main/java/smecalculus/bezmen/construction/ConditionalOnMessagingMappingModes.java similarity index 63% rename from libs/messaging/src/main/java/smecalculus/bezmen/construction/ConditionalOnMessageMappingModes.java rename to libs/messaging/src/main/java/smecalculus/bezmen/construction/ConditionalOnMessagingMappingModes.java index d04a8fcc..2de22299 100644 --- a/libs/messaging/src/main/java/smecalculus/bezmen/construction/ConditionalOnMessageMappingModes.java +++ b/libs/messaging/src/main/java/smecalculus/bezmen/construction/ConditionalOnMessagingMappingModes.java @@ -5,11 +5,11 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import org.springframework.context.annotation.Conditional; -import smecalculus.bezmen.configuration.MessagingMappingMode; +import smecalculus.bezmen.configuration.MessagingDm.MappingMode; @Target({ElementType.TYPE, ElementType.METHOD}) @Retention(RetentionPolicy.RUNTIME) -@Conditional(MessageMappingModeCondition.class) -public @interface ConditionalOnMessageMappingModes { - MessagingMappingMode[] value(); +@Conditional(MessagingMappingModeCondition.class) +public @interface ConditionalOnMessagingMappingModes { + MappingMode[] value(); } diff --git a/libs/messaging/src/main/java/smecalculus/bezmen/construction/ConditionalOnMessagingProtocolModes.java b/libs/messaging/src/main/java/smecalculus/bezmen/construction/ConditionalOnMessagingProtocolModes.java index df59ac98..4b74dcfe 100644 --- a/libs/messaging/src/main/java/smecalculus/bezmen/construction/ConditionalOnMessagingProtocolModes.java +++ b/libs/messaging/src/main/java/smecalculus/bezmen/construction/ConditionalOnMessagingProtocolModes.java @@ -5,11 +5,11 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import org.springframework.context.annotation.Conditional; -import smecalculus.bezmen.configuration.MessagingProtocolMode; +import smecalculus.bezmen.configuration.MessagingDm.ProtocolMode; @Target({ElementType.TYPE, ElementType.METHOD}) @Retention(RetentionPolicy.RUNTIME) @Conditional(MessagingProtocolModeCondition.class) public @interface ConditionalOnMessagingProtocolModes { - MessagingProtocolMode[] value(); + ProtocolMode[] value(); } diff --git a/libs/messaging/src/main/java/smecalculus/bezmen/construction/MappingSpringJmxManagementBeans.java b/libs/messaging/src/main/java/smecalculus/bezmen/construction/MappingSpringJmxManagementBeans.java index 2a4e9698..e5fde67b 100644 --- a/libs/messaging/src/main/java/smecalculus/bezmen/construction/MappingSpringJmxManagementBeans.java +++ b/libs/messaging/src/main/java/smecalculus/bezmen/construction/MappingSpringJmxManagementBeans.java @@ -1,10 +1,11 @@ package smecalculus.bezmen.construction; +import static smecalculus.bezmen.configuration.MessagingDm.MappingMode.SPRING_MANAGEMENT; +import static smecalculus.bezmen.configuration.MessagingDm.ProtocolMode.JMX; + import org.springframework.context.annotation.Configuration; -import smecalculus.bezmen.configuration.MessagingMappingMode; -import smecalculus.bezmen.configuration.MessagingProtocolMode; -@ConditionalOnMessagingProtocolModes(MessagingProtocolMode.JMX) -@ConditionalOnMessageMappingModes(MessagingMappingMode.SPRING_MANAGEMENT) +@ConditionalOnMessagingProtocolModes(JMX) +@ConditionalOnMessagingMappingModes(SPRING_MANAGEMENT) @Configuration(proxyBeanMethods = false) public class MappingSpringJmxManagementBeans {} diff --git a/libs/messaging/src/main/java/smecalculus/bezmen/construction/MappingSpringWebManagementBeans.java b/libs/messaging/src/main/java/smecalculus/bezmen/construction/MappingSpringWebManagementBeans.java index d0bfec10..914dcc0e 100644 --- a/libs/messaging/src/main/java/smecalculus/bezmen/construction/MappingSpringWebManagementBeans.java +++ b/libs/messaging/src/main/java/smecalculus/bezmen/construction/MappingSpringWebManagementBeans.java @@ -1,5 +1,8 @@ package smecalculus.bezmen.construction; +import static smecalculus.bezmen.configuration.MessagingDm.MappingMode.SPRING_MANAGEMENT; +import static smecalculus.bezmen.configuration.MessagingDm.ProtocolMode.HTTP; + import org.springframework.boot.actuate.autoconfigure.endpoint.EndpointAutoConfiguration; import org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointAutoConfiguration; import org.springframework.boot.actuate.autoconfigure.health.HealthEndpointAutoConfiguration; @@ -7,11 +10,9 @@ import org.springframework.boot.actuate.autoconfigure.web.servlet.ServletManagementContextAutoConfiguration; import org.springframework.boot.autoconfigure.ImportAutoConfiguration; import org.springframework.context.annotation.Configuration; -import smecalculus.bezmen.configuration.MessagingMappingMode; -import smecalculus.bezmen.configuration.MessagingProtocolMode; -@ConditionalOnMessagingProtocolModes(MessagingProtocolMode.HTTP) -@ConditionalOnMessageMappingModes(MessagingMappingMode.SPRING_MANAGEMENT) +@ConditionalOnMessagingProtocolModes(HTTP) +@ConditionalOnMessagingMappingModes(SPRING_MANAGEMENT) @ImportAutoConfiguration({ ManagementContextAutoConfiguration.class, ServletManagementContextAutoConfiguration.class, diff --git a/libs/messaging/src/main/java/smecalculus/bezmen/construction/MappingSpringWebMvcBeans.java b/libs/messaging/src/main/java/smecalculus/bezmen/construction/MappingSpringWebMvcBeans.java index f5d56996..11220643 100644 --- a/libs/messaging/src/main/java/smecalculus/bezmen/construction/MappingSpringWebMvcBeans.java +++ b/libs/messaging/src/main/java/smecalculus/bezmen/construction/MappingSpringWebMvcBeans.java @@ -1,12 +1,13 @@ package smecalculus.bezmen.construction; +import static smecalculus.bezmen.configuration.MessagingDm.MappingMode.SPRING_MVC; +import static smecalculus.bezmen.configuration.MessagingDm.ProtocolMode.HTTP; + import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.EnableWebMvc; -import smecalculus.bezmen.configuration.MessagingMappingMode; -import smecalculus.bezmen.configuration.MessagingProtocolMode; -@ConditionalOnMessagingProtocolModes(MessagingProtocolMode.HTTP) -@ConditionalOnMessageMappingModes(MessagingMappingMode.SPRING_MVC) +@ConditionalOnMessagingProtocolModes(HTTP) +@ConditionalOnMessagingMappingModes(SPRING_MVC) @EnableWebMvc @Configuration(proxyBeanMethods = false) public class MappingSpringWebMvcBeans {} diff --git a/libs/messaging/src/main/java/smecalculus/bezmen/construction/MessagingConfigBeans.java b/libs/messaging/src/main/java/smecalculus/bezmen/construction/MessagingConfigBeans.java index 379509e7..3353ba20 100644 --- a/libs/messaging/src/main/java/smecalculus/bezmen/construction/MessagingConfigBeans.java +++ b/libs/messaging/src/main/java/smecalculus/bezmen/construction/MessagingConfigBeans.java @@ -5,8 +5,8 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.PropertySource; -import smecalculus.bezmen.configuration.MessagingDomain; -import smecalculus.bezmen.configuration.MessagingEdge; +import smecalculus.bezmen.configuration.MessagingDm; +import smecalculus.bezmen.configuration.MessagingEm; import smecalculus.bezmen.configuration.MessagingPropsMapper; import smecalculus.bezmen.configuration.MessagingPropsMapperImpl; import smecalculus.bezmen.configuration.PropsKeeper; @@ -24,9 +24,9 @@ MessagingPropsMapper messagingPropsMapper() { } @Bean - MessagingDomain.MessagingProps messagingProps( + MessagingDm.MessagingProps messagingProps( PropsKeeper keeper, EdgeValidator validator, MessagingPropsMapper mapper) { - var propsEdge = keeper.read("bezmen.messaging", MessagingEdge.MessagingProps.class); + var propsEdge = keeper.read("bezmen.messaging", MessagingEm.MessagingProps.class); validator.validate(propsEdge); LOG.info("Read {}", propsEdge); return mapper.toDomain(propsEdge); diff --git a/libs/messaging/src/main/java/smecalculus/bezmen/construction/MessageMappingModeCondition.java b/libs/messaging/src/main/java/smecalculus/bezmen/construction/MessagingMappingModeCondition.java similarity index 73% rename from libs/messaging/src/main/java/smecalculus/bezmen/construction/MessageMappingModeCondition.java rename to libs/messaging/src/main/java/smecalculus/bezmen/construction/MessagingMappingModeCondition.java index 391e6545..f851e4be 100644 --- a/libs/messaging/src/main/java/smecalculus/bezmen/construction/MessageMappingModeCondition.java +++ b/libs/messaging/src/main/java/smecalculus/bezmen/construction/MessagingMappingModeCondition.java @@ -7,15 +7,15 @@ import org.springframework.context.annotation.ConditionContext; import org.springframework.context.annotation.ConfigurationCondition; import org.springframework.core.type.AnnotatedTypeMetadata; -import smecalculus.bezmen.configuration.MessagingDomain.MessagingProps; -import smecalculus.bezmen.configuration.MessagingMappingMode; +import smecalculus.bezmen.configuration.MessagingDm.MappingMode; +import smecalculus.bezmen.configuration.MessagingDm.MessagingProps; -class MessageMappingModeCondition implements ConfigurationCondition { +class MessagingMappingModeCondition implements ConfigurationCondition { @Override public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) { - var attributes = metadata.getAnnotationAttributes(ConditionalOnMessageMappingModes.class.getName()); - var expectedModes = (MessagingMappingMode[]) attributes.get("value"); + var attributes = metadata.getAnnotationAttributes(ConditionalOnMessagingMappingModes.class.getName()); + var expectedModes = (MappingMode[]) attributes.get("value"); var props = context.getBeanFactory().getBean(MessagingProps.class); var actualModes = props.mappingProps().mappingModes(); return Stream.of(expectedModes).anyMatch(actualModes::contains); diff --git a/libs/messaging/src/main/java/smecalculus/bezmen/construction/MessagingProtocolModeCondition.java b/libs/messaging/src/main/java/smecalculus/bezmen/construction/MessagingProtocolModeCondition.java index da05cf6a..ac53d62b 100644 --- a/libs/messaging/src/main/java/smecalculus/bezmen/construction/MessagingProtocolModeCondition.java +++ b/libs/messaging/src/main/java/smecalculus/bezmen/construction/MessagingProtocolModeCondition.java @@ -7,15 +7,15 @@ import org.springframework.context.annotation.ConditionContext; import org.springframework.context.annotation.ConfigurationCondition; import org.springframework.core.type.AnnotatedTypeMetadata; -import smecalculus.bezmen.configuration.MessagingDomain.MessagingProps; -import smecalculus.bezmen.configuration.MessagingProtocolMode; +import smecalculus.bezmen.configuration.MessagingDm.MessagingProps; +import smecalculus.bezmen.configuration.MessagingDm.ProtocolMode; class MessagingProtocolModeCondition implements ConfigurationCondition { @Override public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) { var attributes = metadata.getAnnotationAttributes(ConditionalOnMessagingProtocolModes.class.getName()); - var expectedModes = (MessagingProtocolMode[]) attributes.get("value"); + var expectedModes = (ProtocolMode[]) attributes.get("value"); var props = context.getBeanFactory().getBean(MessagingProps.class); var actualModes = props.protocolProps().protocolModes(); return Stream.of(expectedModes).anyMatch(actualModes::contains); diff --git a/libs/messaging/src/main/java/smecalculus/bezmen/construction/ProtocolHttpBeans.java b/libs/messaging/src/main/java/smecalculus/bezmen/construction/ProtocolHttpBeans.java index e0c3a3f2..4e756a1e 100644 --- a/libs/messaging/src/main/java/smecalculus/bezmen/construction/ProtocolHttpBeans.java +++ b/libs/messaging/src/main/java/smecalculus/bezmen/construction/ProtocolHttpBeans.java @@ -1,12 +1,13 @@ package smecalculus.bezmen.construction; +import static smecalculus.bezmen.configuration.MessagingDm.ProtocolMode.HTTP; + import org.springframework.boot.autoconfigure.ImportAutoConfiguration; import org.springframework.boot.autoconfigure.web.servlet.DispatcherServletAutoConfiguration; import org.springframework.boot.autoconfigure.web.servlet.ServletWebServerFactoryAutoConfiguration; import org.springframework.context.annotation.Configuration; -import smecalculus.bezmen.configuration.MessagingProtocolMode; -@ConditionalOnMessagingProtocolModes(MessagingProtocolMode.HTTP) +@ConditionalOnMessagingProtocolModes(HTTP) @ImportAutoConfiguration({ServletWebServerFactoryAutoConfiguration.class, DispatcherServletAutoConfiguration.class}) @Configuration(proxyBeanMethods = false) public class ProtocolHttpBeans {} diff --git a/libs/messaging/src/main/java/smecalculus/bezmen/construction/ProtocolJmxBeans.java b/libs/messaging/src/main/java/smecalculus/bezmen/construction/ProtocolJmxBeans.java index dc21c4dd..0a03fe21 100644 --- a/libs/messaging/src/main/java/smecalculus/bezmen/construction/ProtocolJmxBeans.java +++ b/libs/messaging/src/main/java/smecalculus/bezmen/construction/ProtocolJmxBeans.java @@ -1,11 +1,12 @@ package smecalculus.bezmen.construction; +import static smecalculus.bezmen.configuration.MessagingDm.ProtocolMode.JMX; + import org.springframework.boot.autoconfigure.ImportAutoConfiguration; import org.springframework.boot.autoconfigure.jmx.JmxAutoConfiguration; import org.springframework.context.annotation.Configuration; -import smecalculus.bezmen.configuration.MessagingProtocolMode; -@ConditionalOnMessagingProtocolModes(MessagingProtocolMode.JMX) +@ConditionalOnMessagingProtocolModes(JMX) @ImportAutoConfiguration({JmxAutoConfiguration.class}) @Configuration(proxyBeanMethods = false) public class ProtocolJmxBeans {} diff --git a/libs/messaging/src/main/java/smecalculus/bezmen/messaging/SepulkaMessageMapper.java b/libs/messaging/src/main/java/smecalculus/bezmen/messaging/SepulkaMessageMapper.java index e8f0dee1..210380c6 100644 --- a/libs/messaging/src/main/java/smecalculus/bezmen/messaging/SepulkaMessageMapper.java +++ b/libs/messaging/src/main/java/smecalculus/bezmen/messaging/SepulkaMessageMapper.java @@ -1,12 +1,12 @@ package smecalculus.bezmen.messaging; import org.mapstruct.Mapper; -import smecalculus.bezmen.core.MessageDomain; +import smecalculus.bezmen.core.MessageDm; import smecalculus.bezmen.mapping.EdgeMapper; @Mapper public interface SepulkaMessageMapper extends EdgeMapper { - MessageDomain.RegistrationRequest toDomain(MessageEdge.RegistrationRequest request); + MessageDm.RegistrationRequest toDomain(MessageEm.RegistrationRequest request); - MessageEdge.RegistrationResponse toEdge(MessageDomain.RegistrationResponse response); + MessageEm.RegistrationResponse toEdge(MessageDm.RegistrationResponse response); } diff --git a/libs/messaging/src/test/java/smecalculus/bezmen/construction/MessagingConfigBeansIT.java b/libs/messaging/src/test/java/smecalculus/bezmen/construction/MessagingConfigBeansIT.java index d807305a..ef584a8a 100644 --- a/libs/messaging/src/test/java/smecalculus/bezmen/construction/MessagingConfigBeansIT.java +++ b/libs/messaging/src/test/java/smecalculus/bezmen/construction/MessagingConfigBeansIT.java @@ -1,14 +1,14 @@ package smecalculus.bezmen.construction; import static org.assertj.core.api.Assertions.assertThat; -import static smecalculus.bezmen.configuration.MessagingDomainEg.messagingProps; +import static smecalculus.bezmen.configuration.MessagingDmEg.messagingProps; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit.jupiter.SpringExtension; -import smecalculus.bezmen.configuration.MessagingDomain.MessagingProps; +import smecalculus.bezmen.configuration.MessagingDm.MessagingProps; @ExtendWith(SpringExtension.class) @ContextConfiguration(classes = {MessagingConfigBeans.class, ConfigBeans.class, ValidationBeans.class}) diff --git a/libs/storage/src/main/java/smecalculus/bezmen/configuration/StorageDomain.java b/libs/storage/src/main/java/smecalculus/bezmen/configuration/StorageDm.java similarity index 59% rename from libs/storage/src/main/java/smecalculus/bezmen/configuration/StorageDomain.java rename to libs/storage/src/main/java/smecalculus/bezmen/configuration/StorageDm.java index eeae4a8b..276cd232 100644 --- a/libs/storage/src/main/java/smecalculus/bezmen/configuration/StorageDomain.java +++ b/libs/storage/src/main/java/smecalculus/bezmen/configuration/StorageDm.java @@ -4,16 +4,25 @@ import lombok.NonNull; import lombok.ToString; -public abstract class StorageDomain { +public abstract class StorageDm { + public enum MappingMode { + SPRING_DATA, + MY_BATIS + } + + public enum ProtocolMode { + H2, + POSTGRES + } + @Builder public record StorageProps(@NonNull ProtocolProps protocolProps, @NonNull MappingProps mappingProps) {} @Builder - public record ProtocolProps( - @NonNull StorageProtocolMode protocolMode, H2Props h2Props, PostgresProps postgresProps) {} + public record ProtocolProps(@NonNull ProtocolMode protocolMode, H2Props h2Props, PostgresProps postgresProps) {} @Builder - public record MappingProps(@NonNull StorageMappingMode mappingMode) {} + public record MappingProps(@NonNull MappingMode mappingMode) {} @Builder public record H2Props(@NonNull String url, @NonNull String username, @NonNull String password) {} diff --git a/libs/storage/src/main/java/smecalculus/bezmen/configuration/StorageDomainEg.java b/libs/storage/src/main/java/smecalculus/bezmen/configuration/StorageDmEg.java similarity index 59% rename from libs/storage/src/main/java/smecalculus/bezmen/configuration/StorageDomainEg.java rename to libs/storage/src/main/java/smecalculus/bezmen/configuration/StorageDmEg.java index 93d589cf..607580df 100644 --- a/libs/storage/src/main/java/smecalculus/bezmen/configuration/StorageDomainEg.java +++ b/libs/storage/src/main/java/smecalculus/bezmen/configuration/StorageDmEg.java @@ -1,22 +1,24 @@ package smecalculus.bezmen.configuration; -import static smecalculus.bezmen.configuration.StorageMappingMode.SPRING_DATA; -import static smecalculus.bezmen.configuration.StorageProtocolMode.H2; - -import smecalculus.bezmen.configuration.StorageDomain.H2Props; -import smecalculus.bezmen.configuration.StorageDomain.MappingProps; -import smecalculus.bezmen.configuration.StorageDomain.PostgresProps; -import smecalculus.bezmen.configuration.StorageDomain.ProtocolProps; -import smecalculus.bezmen.configuration.StorageDomain.StorageProps; - -public abstract class StorageDomainEg { +import static smecalculus.bezmen.configuration.StorageDm.MappingMode.SPRING_DATA; +import static smecalculus.bezmen.configuration.StorageDm.ProtocolMode.H2; + +import smecalculus.bezmen.configuration.StorageDm.H2Props; +import smecalculus.bezmen.configuration.StorageDm.MappingMode; +import smecalculus.bezmen.configuration.StorageDm.MappingProps; +import smecalculus.bezmen.configuration.StorageDm.PostgresProps; +import smecalculus.bezmen.configuration.StorageDm.ProtocolMode; +import smecalculus.bezmen.configuration.StorageDm.ProtocolProps; +import smecalculus.bezmen.configuration.StorageDm.StorageProps; + +public abstract class StorageDmEg { public static StorageProps.Builder storageProps() { return StorageProps.builder() .protocolProps(protocolProps().build()) .mappingProps(mappingProps().build()); } - public static StorageProps.Builder storageProps(StorageMappingMode mappingMode, StorageProtocolMode protocolMode) { + public static StorageProps.Builder storageProps(MappingMode mappingMode, ProtocolMode protocolMode) { return storageProps() .protocolProps(protocolProps(protocolMode).build()) .mappingProps(mappingProps(mappingMode).build()); @@ -26,7 +28,7 @@ public static MappingProps.Builder mappingProps() { return MappingProps.builder().mappingMode(SPRING_DATA); } - public static MappingProps.Builder mappingProps(StorageMappingMode mode) { + public static MappingProps.Builder mappingProps(MappingMode mode) { return mappingProps().mappingMode(mode); } @@ -45,7 +47,7 @@ public static ProtocolProps.Builder protocolProps() { .build()); } - public static ProtocolProps.Builder protocolProps(StorageProtocolMode mode) { + public static ProtocolProps.Builder protocolProps(ProtocolMode mode) { return protocolProps().protocolMode(mode); } } diff --git a/libs/storage/src/main/java/smecalculus/bezmen/configuration/StorageEdge.java b/libs/storage/src/main/java/smecalculus/bezmen/configuration/StorageEm.java similarity index 81% rename from libs/storage/src/main/java/smecalculus/bezmen/configuration/StorageEdge.java rename to libs/storage/src/main/java/smecalculus/bezmen/configuration/StorageEm.java index 1562f742..92426e12 100644 --- a/libs/storage/src/main/java/smecalculus/bezmen/configuration/StorageEdge.java +++ b/libs/storage/src/main/java/smecalculus/bezmen/configuration/StorageEm.java @@ -5,9 +5,11 @@ import jakarta.validation.constraints.NotNull; import lombok.Data; import lombok.ToString; +import smecalculus.bezmen.configuration.StorageDm.MappingMode; +import smecalculus.bezmen.configuration.StorageDm.ProtocolMode; import smecalculus.bezmen.validation.ValueOfEnum; -public abstract class StorageEdge { +public abstract class StorageEm { @Data public static class StorageProps { @NotNull @@ -19,7 +21,7 @@ public static class StorageProps { @Data public static class ProtocolProps { - @ValueOfEnum(StorageProtocolMode.class) + @ValueOfEnum(ProtocolMode.class) String mode; @Optional @@ -31,7 +33,7 @@ public static class ProtocolProps { @Data public static class MappingProps { - @ValueOfEnum(StorageMappingMode.class) + @ValueOfEnum(MappingMode.class) private String mode; } diff --git a/libs/storage/src/main/java/smecalculus/bezmen/configuration/StorageEdgeEg.java b/libs/storage/src/main/java/smecalculus/bezmen/configuration/StorageEmEg.java similarity index 60% rename from libs/storage/src/main/java/smecalculus/bezmen/configuration/StorageEdgeEg.java rename to libs/storage/src/main/java/smecalculus/bezmen/configuration/StorageEmEg.java index 296d2a15..1b16e91c 100644 --- a/libs/storage/src/main/java/smecalculus/bezmen/configuration/StorageEdgeEg.java +++ b/libs/storage/src/main/java/smecalculus/bezmen/configuration/StorageEmEg.java @@ -1,13 +1,13 @@ package smecalculus.bezmen.configuration; -import static smecalculus.bezmen.configuration.StorageMappingMode.SPRING_DATA; -import static smecalculus.bezmen.configuration.StorageProtocolMode.H2; +import static smecalculus.bezmen.configuration.StorageDm.MappingMode.SPRING_DATA; +import static smecalculus.bezmen.configuration.StorageDm.ProtocolMode.H2; -import smecalculus.bezmen.configuration.StorageEdge.MappingProps; -import smecalculus.bezmen.configuration.StorageEdge.ProtocolProps; -import smecalculus.bezmen.configuration.StorageEdge.StorageProps; +import smecalculus.bezmen.configuration.StorageEm.MappingProps; +import smecalculus.bezmen.configuration.StorageEm.ProtocolProps; +import smecalculus.bezmen.configuration.StorageEm.StorageProps; -public abstract class StorageEdgeEg { +public abstract class StorageEmEg { public static StorageProps storageProps() { var propsEdge = new StorageProps(); propsEdge.setMapping(mappingProps()); diff --git a/libs/storage/src/main/java/smecalculus/bezmen/configuration/StorageMappingMode.java b/libs/storage/src/main/java/smecalculus/bezmen/configuration/StorageMappingMode.java deleted file mode 100644 index 44cc2f87..00000000 --- a/libs/storage/src/main/java/smecalculus/bezmen/configuration/StorageMappingMode.java +++ /dev/null @@ -1,6 +0,0 @@ -package smecalculus.bezmen.configuration; - -public enum StorageMappingMode { - SPRING_DATA, - MY_BATIS -} diff --git a/libs/storage/src/main/java/smecalculus/bezmen/configuration/StoragePropsMapper.java b/libs/storage/src/main/java/smecalculus/bezmen/configuration/StoragePropsMapper.java index d2813e25..769a68fa 100644 --- a/libs/storage/src/main/java/smecalculus/bezmen/configuration/StoragePropsMapper.java +++ b/libs/storage/src/main/java/smecalculus/bezmen/configuration/StoragePropsMapper.java @@ -2,27 +2,29 @@ import org.mapstruct.Mapper; import org.mapstruct.Mapping; +import smecalculus.bezmen.configuration.StorageDm.MappingMode; +import smecalculus.bezmen.configuration.StorageDm.ProtocolMode; import smecalculus.bezmen.mapping.EdgeMapper; @Mapper public interface StoragePropsMapper extends EdgeMapper { @Mapping(source = "protocol", target = "protocolProps") @Mapping(source = "mapping", target = "mappingProps") - StorageDomain.StorageProps toDomain(StorageEdge.StorageProps propsEdge); + StorageDm.StorageProps toDomain(StorageEm.StorageProps propsEdge); @Mapping(source = "mode", target = "protocolMode") @Mapping(source = "h2", target = "h2Props") @Mapping(source = "postgres", target = "postgresProps") - StorageDomain.ProtocolProps toDomain(StorageEdge.ProtocolProps propsEdge); + StorageDm.ProtocolProps toDomain(StorageEm.ProtocolProps propsEdge); @Mapping(source = "mode", target = "mappingMode") - StorageDomain.MappingProps toDomain(StorageEdge.MappingProps propsEdge); + StorageDm.MappingProps toDomain(StorageEm.MappingProps propsEdge); - default StorageProtocolMode toProtocolMode(String mode) { - return StorageProtocolMode.valueOf(mode.toUpperCase()); + default ProtocolMode toProtocolMode(String mode) { + return ProtocolMode.valueOf(mode.toUpperCase()); } - default StorageMappingMode toMappingMode(String mode) { - return StorageMappingMode.valueOf(mode.toUpperCase()); + default MappingMode toMappingMode(String mode) { + return MappingMode.valueOf(mode.toUpperCase()); } } diff --git a/libs/storage/src/main/java/smecalculus/bezmen/configuration/StorageProtocolMode.java b/libs/storage/src/main/java/smecalculus/bezmen/configuration/StorageProtocolMode.java deleted file mode 100644 index 6c0eb350..00000000 --- a/libs/storage/src/main/java/smecalculus/bezmen/configuration/StorageProtocolMode.java +++ /dev/null @@ -1,6 +0,0 @@ -package smecalculus.bezmen.configuration; - -public enum StorageProtocolMode { - H2, - POSTGRES -} diff --git a/libs/storage/src/main/java/smecalculus/bezmen/construction/ConditionalOnStateMappingMode.java b/libs/storage/src/main/java/smecalculus/bezmen/construction/ConditionalOnStorageMappingMode.java similarity index 64% rename from libs/storage/src/main/java/smecalculus/bezmen/construction/ConditionalOnStateMappingMode.java rename to libs/storage/src/main/java/smecalculus/bezmen/construction/ConditionalOnStorageMappingMode.java index 23d10d62..45c6dfcd 100644 --- a/libs/storage/src/main/java/smecalculus/bezmen/construction/ConditionalOnStateMappingMode.java +++ b/libs/storage/src/main/java/smecalculus/bezmen/construction/ConditionalOnStorageMappingMode.java @@ -5,11 +5,11 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import org.springframework.context.annotation.Conditional; -import smecalculus.bezmen.configuration.StorageMappingMode; +import smecalculus.bezmen.configuration.StorageDm.MappingMode; @Target({ElementType.TYPE, ElementType.METHOD}) @Retention(RetentionPolicy.RUNTIME) -@Conditional(StateMappingModeCondition.class) -public @interface ConditionalOnStateMappingMode { - StorageMappingMode value(); +@Conditional(StorageMappingModeCondition.class) +public @interface ConditionalOnStorageMappingMode { + MappingMode value(); } diff --git a/libs/storage/src/main/java/smecalculus/bezmen/construction/MappingMyBatisBeans.java b/libs/storage/src/main/java/smecalculus/bezmen/construction/MappingMyBatisBeans.java index b2b82841..e84ff01e 100644 --- a/libs/storage/src/main/java/smecalculus/bezmen/construction/MappingMyBatisBeans.java +++ b/libs/storage/src/main/java/smecalculus/bezmen/construction/MappingMyBatisBeans.java @@ -1,6 +1,6 @@ package smecalculus.bezmen.construction; -import static smecalculus.bezmen.configuration.StorageMappingMode.MY_BATIS; +import static smecalculus.bezmen.configuration.StorageDm.MappingMode.MY_BATIS; import javax.sql.DataSource; import org.apache.ibatis.session.SqlSessionFactory; @@ -10,7 +10,7 @@ import org.springframework.context.annotation.Configuration; import smecalculus.bezmen.storage.mybatis.UuidTypeHandler; -@ConditionalOnStateMappingMode(MY_BATIS) +@ConditionalOnStorageMappingMode(MY_BATIS) @MapperScan(basePackages = "smecalculus.bezmen.storage.mybatis") @Configuration(proxyBeanMethods = false) public class MappingMyBatisBeans { diff --git a/libs/storage/src/main/java/smecalculus/bezmen/construction/MappingSpringDataBeans.java b/libs/storage/src/main/java/smecalculus/bezmen/construction/MappingSpringDataBeans.java index 5191b7a2..3e6495e6 100644 --- a/libs/storage/src/main/java/smecalculus/bezmen/construction/MappingSpringDataBeans.java +++ b/libs/storage/src/main/java/smecalculus/bezmen/construction/MappingSpringDataBeans.java @@ -1,6 +1,6 @@ package smecalculus.bezmen.construction; -import static smecalculus.bezmen.configuration.StorageMappingMode.SPRING_DATA; +import static smecalculus.bezmen.configuration.StorageDm.MappingMode.SPRING_DATA; import java.util.Optional; import javax.sql.DataSource; @@ -21,9 +21,9 @@ import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; import org.springframework.jdbc.datasource.DataSourceTransactionManager; import org.springframework.transaction.PlatformTransactionManager; -import smecalculus.bezmen.configuration.StorageDomain.StorageProps; +import smecalculus.bezmen.configuration.StorageDm.StorageProps; -@ConditionalOnStateMappingMode(SPRING_DATA) +@ConditionalOnStorageMappingMode(SPRING_DATA) @EnableJdbcRepositories("smecalculus.bezmen.storage.springdata") @Configuration(proxyBeanMethods = false) public class MappingSpringDataBeans extends AbstractJdbcConfiguration { diff --git a/libs/storage/src/main/java/smecalculus/bezmen/construction/StorageBeans.java b/libs/storage/src/main/java/smecalculus/bezmen/construction/StorageBeans.java index 439d56d4..a03118a7 100644 --- a/libs/storage/src/main/java/smecalculus/bezmen/construction/StorageBeans.java +++ b/libs/storage/src/main/java/smecalculus/bezmen/construction/StorageBeans.java @@ -5,9 +5,9 @@ import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; import org.springframework.jdbc.datasource.DriverManagerDataSource; -import smecalculus.bezmen.configuration.StorageDomain.H2Props; -import smecalculus.bezmen.configuration.StorageDomain.PostgresProps; -import smecalculus.bezmen.configuration.StorageDomain.StorageProps; +import smecalculus.bezmen.configuration.StorageDm.H2Props; +import smecalculus.bezmen.configuration.StorageDm.PostgresProps; +import smecalculus.bezmen.configuration.StorageDm.StorageProps; @Import({StorageConfigBeans.class, MappingMyBatisBeans.class, MappingSpringDataBeans.class}) @Configuration(proxyBeanMethods = false) diff --git a/libs/storage/src/main/java/smecalculus/bezmen/construction/StorageConfigBeans.java b/libs/storage/src/main/java/smecalculus/bezmen/construction/StorageConfigBeans.java index d2c9901c..aed999a3 100644 --- a/libs/storage/src/main/java/smecalculus/bezmen/construction/StorageConfigBeans.java +++ b/libs/storage/src/main/java/smecalculus/bezmen/construction/StorageConfigBeans.java @@ -6,8 +6,8 @@ import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.PropertySource; import smecalculus.bezmen.configuration.PropsKeeper; -import smecalculus.bezmen.configuration.StorageDomain.StorageProps; -import smecalculus.bezmen.configuration.StorageEdge; +import smecalculus.bezmen.configuration.StorageDm.StorageProps; +import smecalculus.bezmen.configuration.StorageEm; import smecalculus.bezmen.configuration.StoragePropsMapper; import smecalculus.bezmen.configuration.StoragePropsMapperImpl; import smecalculus.bezmen.validation.EdgeValidator; @@ -25,7 +25,7 @@ StoragePropsMapper storagePropsMapper() { @Bean StorageProps storageProps(PropsKeeper keeper, EdgeValidator validator, StoragePropsMapper mapper) { - var propsEdge = keeper.read("bezmen.storage", StorageEdge.StorageProps.class); + var propsEdge = keeper.read("bezmen.storage", StorageEm.StorageProps.class); validator.validate(propsEdge); LOG.info("Read {}", propsEdge); return mapper.toDomain(propsEdge); diff --git a/libs/storage/src/main/java/smecalculus/bezmen/construction/StateMappingModeCondition.java b/libs/storage/src/main/java/smecalculus/bezmen/construction/StorageMappingModeCondition.java similarity index 72% rename from libs/storage/src/main/java/smecalculus/bezmen/construction/StateMappingModeCondition.java rename to libs/storage/src/main/java/smecalculus/bezmen/construction/StorageMappingModeCondition.java index 08872015..6a865bf5 100644 --- a/libs/storage/src/main/java/smecalculus/bezmen/construction/StateMappingModeCondition.java +++ b/libs/storage/src/main/java/smecalculus/bezmen/construction/StorageMappingModeCondition.java @@ -6,15 +6,15 @@ import org.springframework.context.annotation.ConditionContext; import org.springframework.context.annotation.ConfigurationCondition; import org.springframework.core.type.AnnotatedTypeMetadata; -import smecalculus.bezmen.configuration.StorageDomain.StorageProps; -import smecalculus.bezmen.configuration.StorageMappingMode; +import smecalculus.bezmen.configuration.StorageDm.MappingMode; +import smecalculus.bezmen.configuration.StorageDm.StorageProps; -class StateMappingModeCondition implements ConfigurationCondition { +class StorageMappingModeCondition implements ConfigurationCondition { @Override public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) { - var attributes = metadata.getAnnotationAttributes(ConditionalOnStateMappingMode.class.getName()); - var mode = (StorageMappingMode) attributes.get("value"); + var attributes = metadata.getAnnotationAttributes(ConditionalOnStorageMappingMode.class.getName()); + var mode = (MappingMode) attributes.get("value"); var props = context.getBeanFactory().getBean(StorageProps.class); return mode == props.mappingProps().mappingMode(); } diff --git a/libs/storage/src/test/java/smecalculus/bezmen/construction/StorageConfigBeansIT.java b/libs/storage/src/test/java/smecalculus/bezmen/construction/StorageConfigBeansIT.java index 441551f0..67a6673f 100644 --- a/libs/storage/src/test/java/smecalculus/bezmen/construction/StorageConfigBeansIT.java +++ b/libs/storage/src/test/java/smecalculus/bezmen/construction/StorageConfigBeansIT.java @@ -1,14 +1,14 @@ package smecalculus.bezmen.construction; import static org.assertj.core.api.Assertions.assertThat; -import static smecalculus.bezmen.configuration.StorageDomainEg.storageProps; +import static smecalculus.bezmen.configuration.StorageDmEg.storageProps; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit.jupiter.SpringExtension; -import smecalculus.bezmen.configuration.StorageDomain.StorageProps; +import smecalculus.bezmen.configuration.StorageDm.StorageProps; @ExtendWith(SpringExtension.class) @ContextConfiguration(classes = {StorageConfigBeans.class, ConfigBeans.class, ValidationBeans.class}) diff --git a/libs/storage/src/test/java/smecalculus/bezmen/construction/StorageConfigBeansTest.java b/libs/storage/src/test/java/smecalculus/bezmen/construction/StorageConfigBeansTest.java index 04f98dd4..2a650a95 100644 --- a/libs/storage/src/test/java/smecalculus/bezmen/construction/StorageConfigBeansTest.java +++ b/libs/storage/src/test/java/smecalculus/bezmen/construction/StorageConfigBeansTest.java @@ -3,12 +3,12 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -import static smecalculus.bezmen.configuration.StorageEdgeEg.storageProps; +import static smecalculus.bezmen.configuration.StorageEmEg.storageProps; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import smecalculus.bezmen.configuration.PropsKeeper; -import smecalculus.bezmen.configuration.StorageEdge.StorageProps; +import smecalculus.bezmen.configuration.StorageEm.StorageProps; import smecalculus.bezmen.configuration.StoragePropsMapper; import smecalculus.bezmen.configuration.StoragePropsMapperImpl; import smecalculus.bezmen.validation.EdgeValidator; diff --git a/libs/testing/src/main/java/smecalculus/bezmen/messaging/SepulkaClientSpringWebTest.java b/libs/testing/src/main/java/smecalculus/bezmen/messaging/SepulkaClientSpringWebTest.java index 6997edbf..6ed01f2c 100644 --- a/libs/testing/src/main/java/smecalculus/bezmen/messaging/SepulkaClientSpringWebTest.java +++ b/libs/testing/src/main/java/smecalculus/bezmen/messaging/SepulkaClientSpringWebTest.java @@ -4,8 +4,8 @@ import lombok.RequiredArgsConstructor; import org.springframework.http.MediaType; import org.springframework.test.web.reactive.server.WebTestClient; -import smecalculus.bezmen.messaging.MessageEdge.RegistrationRequest; -import smecalculus.bezmen.messaging.MessageEdge.RegistrationResponse; +import smecalculus.bezmen.messaging.MessageEm.RegistrationRequest; +import smecalculus.bezmen.messaging.MessageEm.RegistrationResponse; @RequiredArgsConstructor public class SepulkaClientSpringWebTest implements SepulkaClient { diff --git a/tests/e2e/src/test/java/smecalculus/bezmen/registration/SepulkaTest.java b/tests/e2e/src/test/java/smecalculus/bezmen/registration/SepulkaTest.java index 31201cb4..36f0b6a9 100644 --- a/tests/e2e/src/test/java/smecalculus/bezmen/registration/SepulkaTest.java +++ b/tests/e2e/src/test/java/smecalculus/bezmen/registration/SepulkaTest.java @@ -14,7 +14,7 @@ import org.springframework.test.context.junit.jupiter.SpringExtension; import smecalculus.bezmen.StandBeans; import smecalculus.bezmen.messaging.BezmenClient; -import smecalculus.bezmen.messaging.MessageEdgeEg; +import smecalculus.bezmen.messaging.MessageEmEg; @ExtendWith(SpringExtension.class) @ContextConfiguration(classes = StandBeans.class) @@ -32,9 +32,9 @@ void beforeAll() { @Tag("smoke") void shouldRegisterSepulka() { // given - var request = MessageEdgeEg.registrationRequest(); + var request = MessageEmEg.registrationRequest(); // and - var expectedResponse = MessageEdgeEg.registrationResponse(request.getExternalId()); + var expectedResponse = MessageEmEg.registrationResponse(request.getExternalId()); // when var actualResponse = bezmenClient.register(request); // then