From 68eed46dd2a8bfb6448189ec730740e46b8176aa Mon Sep 17 00:00:00 2001 From: Pavel Vetokhin Date: Sat, 23 Sep 2023 15:30:28 +0300 Subject: [PATCH] Module and package structure (#139) --- .dx/group_vars/all.yml | 8 +- .github/dependabot.yml | 2 +- .github/workflows/pipeline-sanity.yml | 2 +- apps/foo/Dockerfile | 2 +- apps/foo/pom.xml | 7 +- .../bezmen/construction/{spec => }/App.java | 46 +++++----- .../bezmen/core/SepulkaConverterImpl.java | 9 ++ .../impl => core}/SepulkaServiceImpl.java | 8 +- .../domain/impl/SepulkaConverterImpl.java | 11 --- .../bezmen/messaging/SepulkaClientImpl.java | 22 +++++ .../{spec => }/SepulkaMsgMapper.java | 4 +- .../{spec => }/SepulkaRegReqMsg.java | 2 +- .../{spec => }/SepulkaRegResMsg.java | 2 +- .../messaging/impl/SepulkaClientImpl.java | 22 ----- .../springmvc/SepulkaController.java | 14 ++-- .../{data/spec => storage}/SepulkaDao.java | 4 +- .../impl => storage}/SepulkaDaoMyBatis.java | 9 +- .../SepulkaDaoSpringData.java | 9 +- .../{data/spec => storage}/SepulkaRec.java | 2 +- .../spec => storage}/SepulkaRecMapper.java | 4 +- .../mybatis/SepulkaSqlMapper.java | 4 +- .../springdata/SepulkaRepository.java | 4 +- .../{spec => }/SepulkaClientBeans.java | 24 +++--- .../{spec => }/SepulkaDaoBeans.java | 40 ++++----- .../messaging/{impl => }/SepulkaClientIT.java | 24 +++--- .../{impl => }/SepulkaClientSpringWeb.java | 10 +-- .../{impl => }/SepulkaClientSpringWebIT.java | 2 +- .../{data/impl => storage}/SepulkaDaoIT.java | 11 ++- .../SepulkaDaoMyBatisPostgresIT.java | 6 +- .../SepulkaDaoMyBatisTest.java | 2 +- .../SepulkaDaoSpringDataPostgresIT.java | 6 +- apps/pom.xml | 63 +++++++------- libs/README.adoc | 2 +- libs/client/README.adoc | 1 - libs/client/pom.xml | 29 ------- .../configuration/impl/DataConfigImpl.java | 26 ------ .../bezmen/configuration/spec/DataConfig.java | 5 -- .../bezmen/configuration/spec/DataProps.java | 7 -- .../construction/spec/DataConfigBeans.java | 30 ------- .../bezmen/configuration/DataConfigIT.java | 33 -------- .../configuration/DataConfigImplIT.java | 3 - .../configuration/DataConfigImplTest.java | 3 - .../bezmen/configuration/DataConfigTest.java | 41 --------- .../bezmen/fixture/DataPropsFixture.java | 25 ------ .../bezmen/fixture/OrmPropsFixture.java | 19 ----- .../bezmen/fixture/VendorPropsFixture.java | 25 ------ libs/essentials/pom.xml | 12 ++- .../ConfigKeeperLightbendConfig.java | 3 +- .../bezmen/configuration/ConfigMode.java | 5 ++ .../bezmen/configuration/spec/ConfigMode.java | 5 -- .../construction/{spec => }/ConfigBeans.java | 8 +- .../{spec => }/ValidationBeans.java | 10 +-- .../bezmen/domain/spec/SepulkaConverter.java | 7 -- ...a => EdgeValidatorHibernateValidator.java} | 5 +- .../validation/{spec => }/ValueOfEnum.java | 3 +- .../{impl => }/ValueOfEnumValidator.java | 3 +- .../validation/spec/BezmenValidator.java | 5 -- libs/messaging/pom.xml | 50 ++++++++++- .../configuration/{spec => }/HttpProps.java | 2 +- .../{spec => }/HttpPropsCfg.java | 2 +- .../bezmen/configuration/HttpPropsEg.java | 11 +++ .../{spec => }/MessagingCfgMapper.java | 2 +- .../{spec => }/MessagingConfig.java | 2 +- .../{impl => }/MessagingConfigImpl.java | 11 +-- .../{spec => }/MessagingProps.java | 2 +- .../{spec => }/MessagingPropsCfg.java | 2 +- .../configuration/MessagingPropsEg.java | 11 +++ .../configuration/MessagingProtocol.java | 5 ++ .../bezmen/configuration/MvcPropsEg.java | 11 +++ .../{spec => }/ProtocolProps.java | 5 +- .../{spec => }/ProtocolPropsCfg.java | 4 +- .../bezmen/configuration/ProtocolPropsEg.java | 16 ++++ .../bezmen/configuration/WebMode.java | 5 ++ .../configuration/{spec => }/WebProps.java | 2 +- .../configuration/{spec => }/WebPropsCfg.java | 4 +- .../configuration/spec/MessagingProtocol.java | 5 -- .../bezmen/configuration/spec/WebMode.java | 5 -- .../{spec => }/ConditionalOnWebMode.java | 4 +- .../{spec => }/MessagingBeans.java | 2 +- .../construction/MessagingConfigBeans.java | 30 +++++++ .../{spec => }/WebModeCondition.java | 10 +-- .../{spec => }/WebSpringMvcBeans.java | 4 +- .../spec/MessagingConfigBeans.java | 30 ------- .../client}/BezmenClientJavaHttp.java | 5 +- .../configuration/MessagingConfigIT.java | 10 +-- .../bezmen/fixture/HttpPropsFixture.java | 11 --- .../bezmen/fixture/MessagingPropsFixture.java | 11 --- .../bezmen/fixture/MvcPropsFixture.java | 11 --- .../bezmen/fixture/ProtocolPropsFixture.java | 13 --- libs/pom.xml | 84 ++++++++++++------- libs/signatures/pom.xml | 49 +++++++++++ .../bezmen/configuration}/ConfigKeeper.java | 2 +- .../smecalculus/bezmen/core}/Sepulka.java | 2 +- .../bezmen/core/SepulkaConverter.java | 7 ++ .../smecalculus/bezmen/core/SepulkaEg.java | 27 ++++++ .../bezmen/core}/SepulkaService.java | 4 +- .../messaging/client}/BezmenClient.java | 2 +- .../bezmen/messaging/client}/FooClient.java | 2 +- .../messaging/client}/SepulkaClient.java | 2 +- .../messaging/client}/SepulkaRegReq.java | 2 +- .../messaging/client/SepulkaRegReqEg.java | 11 +++ .../messaging/client}/SepulkaRegRes.java | 2 +- .../messaging/client/SepulkaRegResEg.java | 21 +++++ .../bezmen/validation/EdgeValidator.java | 5 ++ libs/{data => storage}/README.adoc | 0 libs/{data => storage}/pom.xml | 2 +- .../bezmen/configuration}/H2Props.java | 2 +- .../bezmen/configuration}/H2PropsCfg.java | 2 +- .../bezmen/configuration}/OrmMode.java | 2 +- .../bezmen/configuration}/OrmProps.java | 2 +- .../bezmen/configuration}/OrmPropsCfg.java | 4 +- .../bezmen/configuration/OrmPropsEg.java | 19 +++++ .../bezmen/configuration}/PostgresProps.java | 2 +- .../configuration}/PostgresPropsCfg.java | 2 +- .../configuration/StorageCfgMapper.java} | 6 +- .../bezmen/configuration/StorageConfig.java | 5 ++ .../configuration/StorageConfigImpl.java | 21 +++++ .../bezmen/configuration/StorageProps.java | 7 ++ .../configuration/StoragePropsCfg.java} | 4 +- .../bezmen/configuration/StoragePropsEg.java | 25 ++++++ .../bezmen/configuration}/VendorMode.java | 2 +- .../bezmen/configuration}/VendorProps.java | 2 +- .../bezmen/configuration}/VendorPropsCfg.java | 4 +- .../bezmen/configuration/VendorPropsEg.java | 24 ++++++ .../construction}/ConditionalOnOrmMode.java | 4 +- .../construction}/OrmModeCondition.java | 8 +- .../bezmen/construction}/OrmMyBatisBeans.java | 6 +- .../construction}/OrmSpringDataBeans.java | 14 ++-- .../bezmen/construction/StorageBeans.java} | 18 ++-- .../construction/StorageConfigBeans.java | 30 +++++++ .../src/main/resources/reference.conf | 2 +- .../bezmen/configuration/StorageConfigIT.java | 31 +++++++ .../configuration/StorageConfigImplIT.java | 3 + .../configuration/StorageConfigImplTest.java | 3 + .../configuration/StorageConfigTest.java | 36 ++++++++ .../src/test/resources/logback-test.xml | 0 libs/testing/pom.xml | 8 +- .../construction/{spec => }/TestingBeans.java | 2 +- .../bezmen/fixture/SepulkaFixtures.java | 38 --------- solutions/basis/church.conf | 2 +- solutions/basis/turing.conf | 2 +- tests/e2e/pom.xml | 3 +- .../java/smecalculus/bezmen/StandBeans.java | 4 +- .../bezmen/registration/SepulkaTest.java | 18 ++-- tests/prefs/church.properties | 4 +- tests/prefs/turing.properties | 4 +- 146 files changed, 833 insertions(+), 764 deletions(-) rename apps/foo/src/main/java/smecalculus/bezmen/construction/{spec => }/App.java (73%) create mode 100644 apps/foo/src/main/java/smecalculus/bezmen/core/SepulkaConverterImpl.java rename apps/foo/src/main/java/smecalculus/bezmen/{domain/impl => core}/SepulkaServiceImpl.java (68%) delete mode 100644 apps/foo/src/main/java/smecalculus/bezmen/domain/impl/SepulkaConverterImpl.java create mode 100644 apps/foo/src/main/java/smecalculus/bezmen/messaging/SepulkaClientImpl.java rename apps/foo/src/main/java/smecalculus/bezmen/messaging/{spec => }/SepulkaMsgMapper.java (67%) rename apps/foo/src/main/java/smecalculus/bezmen/messaging/{spec => }/SepulkaRegReqMsg.java (66%) rename apps/foo/src/main/java/smecalculus/bezmen/messaging/{spec => }/SepulkaRegResMsg.java (71%) delete mode 100644 apps/foo/src/main/java/smecalculus/bezmen/messaging/impl/SepulkaClientImpl.java rename apps/foo/src/main/java/smecalculus/bezmen/messaging/{impl => }/springmvc/SepulkaController.java (67%) rename apps/foo/src/main/java/smecalculus/bezmen/{data/spec => storage}/SepulkaDao.java (68%) rename apps/foo/src/main/java/smecalculus/bezmen/{data/impl => storage}/SepulkaDaoMyBatis.java (71%) rename apps/foo/src/main/java/smecalculus/bezmen/{data/impl => storage}/SepulkaDaoSpringData.java (75%) rename apps/foo/src/main/java/smecalculus/bezmen/{data/spec => storage}/SepulkaRec.java (89%) rename apps/foo/src/main/java/smecalculus/bezmen/{data/spec => storage}/SepulkaRecMapper.java (65%) rename apps/foo/src/main/java/smecalculus/bezmen/{data/spec => storage}/mybatis/SepulkaSqlMapper.java (85%) rename apps/foo/src/main/java/smecalculus/bezmen/{data/spec => storage}/springdata/SepulkaRepository.java (59%) rename apps/foo/src/test/java/smecalculus/bezmen/construction/{spec => }/SepulkaClientBeans.java (58%) rename apps/foo/src/test/java/smecalculus/bezmen/construction/{spec => }/SepulkaDaoBeans.java (68%) rename apps/foo/src/test/java/smecalculus/bezmen/messaging/{impl => }/SepulkaClientIT.java (63%) rename apps/foo/src/test/java/smecalculus/bezmen/messaging/{impl => }/SepulkaClientSpringWeb.java (70%) rename apps/foo/src/test/java/smecalculus/bezmen/messaging/{impl => }/SepulkaClientSpringWebIT.java (60%) rename apps/foo/src/test/java/smecalculus/bezmen/{data/impl => storage}/SepulkaDaoIT.java (75%) rename apps/foo/src/test/java/smecalculus/bezmen/{data/impl => storage}/SepulkaDaoMyBatisPostgresIT.java (58%) rename apps/foo/src/test/java/smecalculus/bezmen/{data/impl => storage}/SepulkaDaoMyBatisTest.java (72%) rename apps/foo/src/test/java/smecalculus/bezmen/{data/impl => storage}/SepulkaDaoSpringDataPostgresIT.java (58%) delete mode 100644 libs/client/README.adoc delete mode 100644 libs/client/pom.xml delete mode 100644 libs/data/src/main/java/smecalculus/bezmen/configuration/impl/DataConfigImpl.java delete mode 100644 libs/data/src/main/java/smecalculus/bezmen/configuration/spec/DataConfig.java delete mode 100644 libs/data/src/main/java/smecalculus/bezmen/configuration/spec/DataProps.java delete mode 100644 libs/data/src/main/java/smecalculus/bezmen/construction/spec/DataConfigBeans.java delete mode 100644 libs/data/src/test/java/smecalculus/bezmen/configuration/DataConfigIT.java delete mode 100644 libs/data/src/test/java/smecalculus/bezmen/configuration/DataConfigImplIT.java delete mode 100644 libs/data/src/test/java/smecalculus/bezmen/configuration/DataConfigImplTest.java delete mode 100644 libs/data/src/test/java/smecalculus/bezmen/configuration/DataConfigTest.java delete mode 100644 libs/data/src/test/java/smecalculus/bezmen/fixture/DataPropsFixture.java delete mode 100644 libs/data/src/test/java/smecalculus/bezmen/fixture/OrmPropsFixture.java delete mode 100644 libs/data/src/test/java/smecalculus/bezmen/fixture/VendorPropsFixture.java rename libs/essentials/src/main/java/smecalculus/bezmen/configuration/{impl => }/ConfigKeeperLightbendConfig.java (74%) create mode 100644 libs/essentials/src/main/java/smecalculus/bezmen/configuration/ConfigMode.java delete mode 100644 libs/essentials/src/main/java/smecalculus/bezmen/configuration/spec/ConfigMode.java rename libs/essentials/src/main/java/smecalculus/bezmen/construction/{spec => }/ConfigBeans.java (69%) rename libs/essentials/src/main/java/smecalculus/bezmen/construction/{spec => }/ValidationBeans.java (55%) delete mode 100644 libs/essentials/src/main/java/smecalculus/bezmen/domain/spec/SepulkaConverter.java rename libs/essentials/src/main/java/smecalculus/bezmen/validation/{impl/BezmenValidatorHibernateValidator.java => EdgeValidatorHibernateValidator.java} (68%) rename libs/essentials/src/main/java/smecalculus/bezmen/validation/{spec => }/ValueOfEnum.java (85%) rename libs/essentials/src/main/java/smecalculus/bezmen/validation/{impl => }/ValueOfEnumValidator.java (91%) delete mode 100644 libs/essentials/src/main/java/smecalculus/bezmen/validation/spec/BezmenValidator.java rename libs/messaging/src/main/java/smecalculus/bezmen/configuration/{spec => }/HttpProps.java (70%) rename libs/messaging/src/main/java/smecalculus/bezmen/configuration/{spec => }/HttpPropsCfg.java (74%) create mode 100644 libs/messaging/src/main/java/smecalculus/bezmen/configuration/HttpPropsEg.java rename libs/messaging/src/main/java/smecalculus/bezmen/configuration/{spec => }/MessagingCfgMapper.java (94%) rename libs/messaging/src/main/java/smecalculus/bezmen/configuration/{spec => }/MessagingConfig.java (62%) rename libs/messaging/src/main/java/smecalculus/bezmen/configuration/{impl => }/MessagingConfigImpl.java (50%) rename libs/messaging/src/main/java/smecalculus/bezmen/configuration/{spec => }/MessagingProps.java (72%) rename libs/messaging/src/main/java/smecalculus/bezmen/configuration/{spec => }/MessagingPropsCfg.java (76%) create mode 100644 libs/messaging/src/main/java/smecalculus/bezmen/configuration/MessagingPropsEg.java create mode 100644 libs/messaging/src/main/java/smecalculus/bezmen/configuration/MessagingProtocol.java create mode 100644 libs/messaging/src/main/java/smecalculus/bezmen/configuration/MvcPropsEg.java rename libs/messaging/src/main/java/smecalculus/bezmen/configuration/{spec => }/ProtocolProps.java (51%) rename libs/messaging/src/main/java/smecalculus/bezmen/configuration/{spec => }/ProtocolPropsCfg.java (77%) create mode 100644 libs/messaging/src/main/java/smecalculus/bezmen/configuration/ProtocolPropsEg.java create mode 100644 libs/messaging/src/main/java/smecalculus/bezmen/configuration/WebMode.java rename libs/messaging/src/main/java/smecalculus/bezmen/configuration/{spec => }/WebProps.java (62%) rename libs/messaging/src/main/java/smecalculus/bezmen/configuration/{spec => }/WebPropsCfg.java (51%) delete mode 100644 libs/messaging/src/main/java/smecalculus/bezmen/configuration/spec/MessagingProtocol.java delete mode 100644 libs/messaging/src/main/java/smecalculus/bezmen/configuration/spec/WebMode.java rename libs/messaging/src/main/java/smecalculus/bezmen/construction/{spec => }/ConditionalOnWebMode.java (80%) rename libs/messaging/src/main/java/smecalculus/bezmen/construction/{spec => }/MessagingBeans.java (84%) create mode 100644 libs/messaging/src/main/java/smecalculus/bezmen/construction/MessagingConfigBeans.java rename libs/messaging/src/main/java/smecalculus/bezmen/construction/{spec => }/WebModeCondition.java (79%) rename libs/messaging/src/main/java/smecalculus/bezmen/construction/{spec => }/WebSpringMvcBeans.java (68%) delete mode 100644 libs/messaging/src/main/java/smecalculus/bezmen/construction/spec/MessagingConfigBeans.java rename libs/{client/src/main/java/smecalculus/bezmen/messaging/impl => messaging/src/main/java/smecalculus/bezmen/messaging/client}/BezmenClientJavaHttp.java (89%) delete mode 100644 libs/messaging/src/test/java/smecalculus/bezmen/fixture/HttpPropsFixture.java delete mode 100644 libs/messaging/src/test/java/smecalculus/bezmen/fixture/MessagingPropsFixture.java delete mode 100644 libs/messaging/src/test/java/smecalculus/bezmen/fixture/MvcPropsFixture.java delete mode 100644 libs/messaging/src/test/java/smecalculus/bezmen/fixture/ProtocolPropsFixture.java create mode 100644 libs/signatures/pom.xml rename libs/{essentials/src/main/java/smecalculus/bezmen/configuration/spec => signatures/src/main/java/smecalculus/bezmen/configuration}/ConfigKeeper.java (62%) rename libs/{essentials/src/main/java/smecalculus/bezmen/domain/spec => signatures/src/main/java/smecalculus/bezmen/core}/Sepulka.java (78%) create mode 100644 libs/signatures/src/main/java/smecalculus/bezmen/core/SepulkaConverter.java create mode 100644 libs/signatures/src/main/java/smecalculus/bezmen/core/SepulkaEg.java rename libs/{essentials/src/main/java/smecalculus/bezmen/domain/spec => signatures/src/main/java/smecalculus/bezmen/core}/SepulkaService.java (60%) rename libs/{client/src/main/java/smecalculus/bezmen/messaging/spec => signatures/src/main/java/smecalculus/bezmen/messaging/client}/BezmenClient.java (53%) rename libs/{client/src/main/java/smecalculus/bezmen/messaging/spec => signatures/src/main/java/smecalculus/bezmen/messaging/client}/FooClient.java (60%) rename libs/{client/src/main/java/smecalculus/bezmen/messaging/spec => signatures/src/main/java/smecalculus/bezmen/messaging/client}/SepulkaClient.java (65%) rename libs/{client/src/main/java/smecalculus/bezmen/messaging/spec => signatures/src/main/java/smecalculus/bezmen/messaging/client}/SepulkaRegReq.java (63%) create mode 100644 libs/signatures/src/main/java/smecalculus/bezmen/messaging/client/SepulkaRegReqEg.java rename libs/{client/src/main/java/smecalculus/bezmen/messaging/spec => signatures/src/main/java/smecalculus/bezmen/messaging/client}/SepulkaRegRes.java (72%) create mode 100644 libs/signatures/src/main/java/smecalculus/bezmen/messaging/client/SepulkaRegResEg.java create mode 100644 libs/signatures/src/main/java/smecalculus/bezmen/validation/EdgeValidator.java rename libs/{data => storage}/README.adoc (100%) rename libs/{data => storage}/pom.xml (98%) rename libs/{data/src/main/java/smecalculus/bezmen/configuration/spec => storage/src/main/java/smecalculus/bezmen/configuration}/H2Props.java (80%) rename libs/{data/src/main/java/smecalculus/bezmen/configuration/spec => storage/src/main/java/smecalculus/bezmen/configuration}/H2PropsCfg.java (81%) rename libs/{data/src/main/java/smecalculus/bezmen/configuration/spec => storage/src/main/java/smecalculus/bezmen/configuration}/OrmMode.java (53%) rename libs/{data/src/main/java/smecalculus/bezmen/configuration/spec => storage/src/main/java/smecalculus/bezmen/configuration}/OrmProps.java (61%) rename libs/{data/src/main/java/smecalculus/bezmen/configuration/spec => storage/src/main/java/smecalculus/bezmen/configuration}/OrmPropsCfg.java (52%) create mode 100644 libs/storage/src/main/java/smecalculus/bezmen/configuration/OrmPropsEg.java rename libs/{data/src/main/java/smecalculus/bezmen/configuration/spec => storage/src/main/java/smecalculus/bezmen/configuration}/PostgresProps.java (81%) rename libs/{data/src/main/java/smecalculus/bezmen/configuration/spec => storage/src/main/java/smecalculus/bezmen/configuration}/PostgresPropsCfg.java (84%) rename libs/{data/src/main/java/smecalculus/bezmen/configuration/spec/DataCfgMapper.java => storage/src/main/java/smecalculus/bezmen/configuration/StorageCfgMapper.java} (81%) create mode 100644 libs/storage/src/main/java/smecalculus/bezmen/configuration/StorageConfig.java create mode 100644 libs/storage/src/main/java/smecalculus/bezmen/configuration/StorageConfigImpl.java create mode 100644 libs/storage/src/main/java/smecalculus/bezmen/configuration/StorageProps.java rename libs/{data/src/main/java/smecalculus/bezmen/configuration/spec/DataPropsCfg.java => storage/src/main/java/smecalculus/bezmen/configuration/StoragePropsCfg.java} (67%) create mode 100644 libs/storage/src/main/java/smecalculus/bezmen/configuration/StoragePropsEg.java rename libs/{data/src/main/java/smecalculus/bezmen/configuration/spec => storage/src/main/java/smecalculus/bezmen/configuration}/VendorMode.java (51%) rename libs/{data/src/main/java/smecalculus/bezmen/configuration/spec => storage/src/main/java/smecalculus/bezmen/configuration}/VendorProps.java (82%) rename libs/{data/src/main/java/smecalculus/bezmen/configuration/spec => storage/src/main/java/smecalculus/bezmen/configuration}/VendorPropsCfg.java (69%) create mode 100644 libs/storage/src/main/java/smecalculus/bezmen/configuration/VendorPropsEg.java rename libs/{data/src/main/java/smecalculus/bezmen/construction/spec => storage/src/main/java/smecalculus/bezmen/construction}/ConditionalOnOrmMode.java (80%) rename libs/{data/src/main/java/smecalculus/bezmen/construction/spec => storage/src/main/java/smecalculus/bezmen/construction}/OrmModeCondition.java (77%) rename libs/{data/src/main/java/smecalculus/bezmen/construction/spec => storage/src/main/java/smecalculus/bezmen/construction}/OrmMyBatisBeans.java (78%) rename libs/{data/src/main/java/smecalculus/bezmen/construction/spec => storage/src/main/java/smecalculus/bezmen/construction}/OrmSpringDataBeans.java (77%) rename libs/{data/src/main/java/smecalculus/bezmen/construction/spec/DataBeans.java => storage/src/main/java/smecalculus/bezmen/construction/StorageBeans.java} (70%) create mode 100644 libs/storage/src/main/java/smecalculus/bezmen/construction/StorageConfigBeans.java rename libs/{data => storage}/src/main/resources/reference.conf (94%) create mode 100644 libs/storage/src/test/java/smecalculus/bezmen/configuration/StorageConfigIT.java create mode 100644 libs/storage/src/test/java/smecalculus/bezmen/configuration/StorageConfigImplIT.java create mode 100644 libs/storage/src/test/java/smecalculus/bezmen/configuration/StorageConfigImplTest.java create mode 100644 libs/storage/src/test/java/smecalculus/bezmen/configuration/StorageConfigTest.java rename libs/{data => storage}/src/test/resources/logback-test.xml (100%) rename libs/testing/src/main/java/smecalculus/bezmen/construction/{spec => }/TestingBeans.java (94%) delete mode 100644 libs/testing/src/main/java/smecalculus/bezmen/fixture/SepulkaFixtures.java diff --git a/.dx/group_vars/all.yml b/.dx/group_vars/all.yml index 325ac3f2..83069f67 100644 --- a/.dx/group_vars/all.yml +++ b/.dx/group_vars/all.yml @@ -7,15 +7,15 @@ prefs: turing lib_cid: "{{ lookup('ansible.builtin.pipe', 'git write-tree --prefix=libs')[:7] }}" lib_cids: - client: "{{ lookup('ansible.builtin.pipe', 'git write-tree --prefix=libs/client')[:7] }}" + signatures: "{{ lookup('ansible.builtin.pipe', 'git write-tree --prefix=libs/signatures')[:7] }}" construction: "{{ lookup('ansible.builtin.pipe', 'git write-tree --prefix=libs/construction')[:7] }}" - data: "{{ lookup('ansible.builtin.pipe', 'git write-tree --prefix=libs/data')[:7] }}" + storage: "{{ lookup('ansible.builtin.pipe', 'git write-tree --prefix=libs/storage')[:7] }}" essentials: "{{ lookup('ansible.builtin.pipe', 'git write-tree --prefix=libs/essentials')[:7] }}" messaging: "{{ lookup('ansible.builtin.pipe', 'git write-tree --prefix=libs/messaging')[:7] }}" testing: "{{ lookup('ansible.builtin.pipe', 'git write-tree --prefix=libs/testing')[:7] }}" app_cid: "{{ lookup('ansible.builtin.pipe', 'git write-tree --prefix=apps')[:7] }}" app_cids: - foo: "{{ lookup('ansible.builtin.pipe', 'git rev-parse HEAD:apps/foo')[:7] }}" + foo: "{{ lookup('ansible.builtin.pipe', 'git write-tree --prefix=apps/foo')[:7] }}" schema_cid: "{{ lookup('ansible.builtin.pipe', 'git write-tree --prefix=schemas')[:7] }}" schema_cids: postgres: "{{ lookup('ansible.builtin.pipe', 'git write-tree --prefix=schemas/postgres')[:7] }}" @@ -52,4 +52,4 @@ stack_images: docker_entity: "{{ 'image' if image_repo == 'local' else 'manifest' }}" app_deps: - foo: [essentials, construction, client, messaging, data] + foo: [essentials, construction, signatures, messaging, storage] diff --git a/.github/dependabot.yml b/.github/dependabot.yml index f194b55d..d719fdae 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -11,7 +11,7 @@ updates: schedule: interval: "daily" groups: - SpringFramework: + spring-framework: patterns: - "org.springframework*" - package-ecosystem: "maven" diff --git a/.github/workflows/pipeline-sanity.yml b/.github/workflows/pipeline-sanity.yml index 5aacd859..f67cead4 100644 --- a/.github/workflows/pipeline-sanity.yml +++ b/.github/workflows/pipeline-sanity.yml @@ -7,9 +7,9 @@ on: - main paths: # waiting for https://github.com/actions/runner/issues/2324 - .dx/** - - tools/** - .environs/** - .github/** + - tools/** workflow_dispatch: jobs: diff --git a/apps/foo/Dockerfile b/apps/foo/Dockerfile index 942e3d26..073dd855 100644 --- a/apps/foo/Dockerfile +++ b/apps/foo/Dockerfile @@ -7,5 +7,5 @@ COPY app-foo*.jar foo/app.jar ENTRYPOINT [ \ "java", "-cp", "foo/app.jar:foo/libs/*", \ "-Dconfig.file=foo/application.conf", \ - "smecalculus.bezmen.construction.spec.App" \ + "smecalculus.bezmen.construction.App" \ ] diff --git a/apps/foo/pom.xml b/apps/foo/pom.xml index 684c7715..fc985115 100644 --- a/apps/foo/pom.xml +++ b/apps/foo/pom.xml @@ -21,18 +21,13 @@ ${project.groupId} construction - - ${project.groupId} - client - ${project.groupId} messaging - ${project.groupId} - data + storage diff --git a/apps/foo/src/main/java/smecalculus/bezmen/construction/spec/App.java b/apps/foo/src/main/java/smecalculus/bezmen/construction/App.java similarity index 73% rename from apps/foo/src/main/java/smecalculus/bezmen/construction/spec/App.java rename to apps/foo/src/main/java/smecalculus/bezmen/construction/App.java index 811d40ca..c144464d 100644 --- a/apps/foo/src/main/java/smecalculus/bezmen/construction/spec/App.java +++ b/apps/foo/src/main/java/smecalculus/bezmen/construction/App.java @@ -1,8 +1,8 @@ -package smecalculus.bezmen.construction.spec; +package smecalculus.bezmen.construction; -import static smecalculus.bezmen.configuration.spec.OrmMode.MY_BATIS; -import static smecalculus.bezmen.configuration.spec.OrmMode.SPRING_DATA; -import static smecalculus.bezmen.configuration.spec.WebMode.SPRING_MVC; +import static smecalculus.bezmen.configuration.OrmMode.MY_BATIS; +import static smecalculus.bezmen.configuration.OrmMode.SPRING_DATA; +import static smecalculus.bezmen.configuration.WebMode.SPRING_MVC; import org.springframework.boot.SpringApplication; import org.springframework.boot.actuate.autoconfigure.health.HealthContributorAutoConfiguration; @@ -24,25 +24,25 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; -import smecalculus.bezmen.data.impl.SepulkaDaoMyBatis; -import smecalculus.bezmen.data.impl.SepulkaDaoSpringData; -import smecalculus.bezmen.data.spec.SepulkaDao; -import smecalculus.bezmen.data.spec.SepulkaRecMapper; -import smecalculus.bezmen.data.spec.SepulkaRecMapperImpl; -import smecalculus.bezmen.data.spec.mybatis.SepulkaSqlMapper; -import smecalculus.bezmen.data.spec.springdata.SepulkaRepository; -import smecalculus.bezmen.domain.impl.SepulkaConverterImpl; -import smecalculus.bezmen.domain.impl.SepulkaServiceImpl; -import smecalculus.bezmen.domain.spec.SepulkaConverter; -import smecalculus.bezmen.domain.spec.SepulkaService; -import smecalculus.bezmen.messaging.impl.SepulkaClientImpl; -import smecalculus.bezmen.messaging.impl.springmvc.SepulkaController; -import smecalculus.bezmen.messaging.spec.SepulkaClient; -import smecalculus.bezmen.messaging.spec.SepulkaMsgMapper; -import smecalculus.bezmen.messaging.spec.SepulkaMsgMapperImpl; -import smecalculus.bezmen.validation.spec.BezmenValidator; +import smecalculus.bezmen.core.SepulkaConverter; +import smecalculus.bezmen.core.SepulkaConverterImpl; +import smecalculus.bezmen.core.SepulkaService; +import smecalculus.bezmen.core.SepulkaServiceImpl; +import smecalculus.bezmen.messaging.SepulkaClientImpl; +import smecalculus.bezmen.messaging.SepulkaMsgMapper; +import smecalculus.bezmen.messaging.SepulkaMsgMapperImpl; +import smecalculus.bezmen.messaging.client.SepulkaClient; +import smecalculus.bezmen.messaging.springmvc.SepulkaController; +import smecalculus.bezmen.storage.SepulkaDao; +import smecalculus.bezmen.storage.SepulkaDaoMyBatis; +import smecalculus.bezmen.storage.SepulkaDaoSpringData; +import smecalculus.bezmen.storage.SepulkaRecMapper; +import smecalculus.bezmen.storage.SepulkaRecMapperImpl; +import smecalculus.bezmen.storage.mybatis.SepulkaSqlMapper; +import smecalculus.bezmen.storage.springdata.SepulkaRepository; +import smecalculus.bezmen.validation.EdgeValidator; -@Import({ConfigBeans.class, ValidationBeans.class, MessagingBeans.class, DataBeans.class}) +@Import({ConfigBeans.class, ValidationBeans.class, MessagingBeans.class, StorageBeans.class}) @EnableAutoConfiguration( exclude = { LiquibaseAutoConfiguration.class, @@ -80,7 +80,7 @@ SepulkaMsgMapper sepulkaMsgMapper() { } @Bean - SepulkaClient sepulkaClient(BezmenValidator validator, SepulkaService service, SepulkaConverter converter) { + SepulkaClient sepulkaClient(EdgeValidator validator, SepulkaService service, SepulkaConverter converter) { return new SepulkaClientImpl(validator, service, converter); } diff --git a/apps/foo/src/main/java/smecalculus/bezmen/core/SepulkaConverterImpl.java b/apps/foo/src/main/java/smecalculus/bezmen/core/SepulkaConverterImpl.java new file mode 100644 index 00000000..e54756a9 --- /dev/null +++ b/apps/foo/src/main/java/smecalculus/bezmen/core/SepulkaConverterImpl.java @@ -0,0 +1,9 @@ +package smecalculus.bezmen.core; + +import smecalculus.bezmen.messaging.client.SepulkaRegRes; + +public class SepulkaConverterImpl implements SepulkaConverter { + public SepulkaRegRes toRegRes(Sepulka sepulka) { + return new SepulkaRegRes(sepulka.id(), sepulka.name()); + } +} diff --git a/apps/foo/src/main/java/smecalculus/bezmen/domain/impl/SepulkaServiceImpl.java b/apps/foo/src/main/java/smecalculus/bezmen/core/SepulkaServiceImpl.java similarity index 68% rename from apps/foo/src/main/java/smecalculus/bezmen/domain/impl/SepulkaServiceImpl.java rename to apps/foo/src/main/java/smecalculus/bezmen/core/SepulkaServiceImpl.java index 07e7b3d8..896560db 100644 --- a/apps/foo/src/main/java/smecalculus/bezmen/domain/impl/SepulkaServiceImpl.java +++ b/apps/foo/src/main/java/smecalculus/bezmen/core/SepulkaServiceImpl.java @@ -1,13 +1,11 @@ -package smecalculus.bezmen.domain.impl; +package smecalculus.bezmen.core; import static java.util.UUID.randomUUID; import java.util.List; import lombok.NonNull; -import smecalculus.bezmen.data.spec.SepulkaDao; -import smecalculus.bezmen.domain.spec.Sepulka; -import smecalculus.bezmen.domain.spec.SepulkaService; -import smecalculus.bezmen.messaging.spec.SepulkaRegReq; +import smecalculus.bezmen.messaging.client.SepulkaRegReq; +import smecalculus.bezmen.storage.SepulkaDao; public record SepulkaServiceImpl(@NonNull SepulkaDao sepulkaDao) implements SepulkaService { diff --git a/apps/foo/src/main/java/smecalculus/bezmen/domain/impl/SepulkaConverterImpl.java b/apps/foo/src/main/java/smecalculus/bezmen/domain/impl/SepulkaConverterImpl.java deleted file mode 100644 index 4e78bc0d..00000000 --- a/apps/foo/src/main/java/smecalculus/bezmen/domain/impl/SepulkaConverterImpl.java +++ /dev/null @@ -1,11 +0,0 @@ -package smecalculus.bezmen.domain.impl; - -import smecalculus.bezmen.domain.spec.Sepulka; -import smecalculus.bezmen.domain.spec.SepulkaConverter; -import smecalculus.bezmen.messaging.spec.SepulkaRegRes; - -public class SepulkaConverterImpl implements SepulkaConverter { - public SepulkaRegRes toRegRes(Sepulka sepulka) { - return new SepulkaRegRes(sepulka.id(), sepulka.name()); - } -} diff --git a/apps/foo/src/main/java/smecalculus/bezmen/messaging/SepulkaClientImpl.java b/apps/foo/src/main/java/smecalculus/bezmen/messaging/SepulkaClientImpl.java new file mode 100644 index 00000000..78d51b9e --- /dev/null +++ b/apps/foo/src/main/java/smecalculus/bezmen/messaging/SepulkaClientImpl.java @@ -0,0 +1,22 @@ +package smecalculus.bezmen.messaging; + +import lombok.NonNull; +import smecalculus.bezmen.core.Sepulka; +import smecalculus.bezmen.core.SepulkaConverter; +import smecalculus.bezmen.core.SepulkaService; +import smecalculus.bezmen.messaging.client.SepulkaClient; +import smecalculus.bezmen.messaging.client.SepulkaRegReq; +import smecalculus.bezmen.messaging.client.SepulkaRegRes; +import smecalculus.bezmen.validation.EdgeValidator; + +public record SepulkaClientImpl( + @NonNull EdgeValidator validator, @NonNull SepulkaService service, @NonNull SepulkaConverter converter) + implements SepulkaClient { + + @Override + public SepulkaRegRes register(SepulkaRegReq request) { + validator.validate(request); + Sepulka sepulka = service.register(request); + return converter.toRegRes(sepulka); + } +} diff --git a/apps/foo/src/main/java/smecalculus/bezmen/messaging/spec/SepulkaMsgMapper.java b/apps/foo/src/main/java/smecalculus/bezmen/messaging/SepulkaMsgMapper.java similarity index 67% rename from apps/foo/src/main/java/smecalculus/bezmen/messaging/spec/SepulkaMsgMapper.java rename to apps/foo/src/main/java/smecalculus/bezmen/messaging/SepulkaMsgMapper.java index ef7c827a..11fb59bd 100644 --- a/apps/foo/src/main/java/smecalculus/bezmen/messaging/spec/SepulkaMsgMapper.java +++ b/apps/foo/src/main/java/smecalculus/bezmen/messaging/SepulkaMsgMapper.java @@ -1,6 +1,8 @@ -package smecalculus.bezmen.messaging.spec; +package smecalculus.bezmen.messaging; import org.mapstruct.Mapper; +import smecalculus.bezmen.messaging.client.SepulkaRegReq; +import smecalculus.bezmen.messaging.client.SepulkaRegRes; @Mapper public interface SepulkaMsgMapper { diff --git a/apps/foo/src/main/java/smecalculus/bezmen/messaging/spec/SepulkaRegReqMsg.java b/apps/foo/src/main/java/smecalculus/bezmen/messaging/SepulkaRegReqMsg.java similarity index 66% rename from apps/foo/src/main/java/smecalculus/bezmen/messaging/spec/SepulkaRegReqMsg.java rename to apps/foo/src/main/java/smecalculus/bezmen/messaging/SepulkaRegReqMsg.java index 2f313be4..3b89a838 100644 --- a/apps/foo/src/main/java/smecalculus/bezmen/messaging/spec/SepulkaRegReqMsg.java +++ b/apps/foo/src/main/java/smecalculus/bezmen/messaging/SepulkaRegReqMsg.java @@ -1,4 +1,4 @@ -package smecalculus.bezmen.messaging.spec; +package smecalculus.bezmen.messaging; import lombok.Data; diff --git a/apps/foo/src/main/java/smecalculus/bezmen/messaging/spec/SepulkaRegResMsg.java b/apps/foo/src/main/java/smecalculus/bezmen/messaging/SepulkaRegResMsg.java similarity index 71% rename from apps/foo/src/main/java/smecalculus/bezmen/messaging/spec/SepulkaRegResMsg.java rename to apps/foo/src/main/java/smecalculus/bezmen/messaging/SepulkaRegResMsg.java index 0629a364..7cc8b032 100644 --- a/apps/foo/src/main/java/smecalculus/bezmen/messaging/spec/SepulkaRegResMsg.java +++ b/apps/foo/src/main/java/smecalculus/bezmen/messaging/SepulkaRegResMsg.java @@ -1,4 +1,4 @@ -package smecalculus.bezmen.messaging.spec; +package smecalculus.bezmen.messaging; import lombok.Data; diff --git a/apps/foo/src/main/java/smecalculus/bezmen/messaging/impl/SepulkaClientImpl.java b/apps/foo/src/main/java/smecalculus/bezmen/messaging/impl/SepulkaClientImpl.java deleted file mode 100644 index 2b288ed7..00000000 --- a/apps/foo/src/main/java/smecalculus/bezmen/messaging/impl/SepulkaClientImpl.java +++ /dev/null @@ -1,22 +0,0 @@ -package smecalculus.bezmen.messaging.impl; - -import lombok.NonNull; -import smecalculus.bezmen.domain.spec.Sepulka; -import smecalculus.bezmen.domain.spec.SepulkaConverter; -import smecalculus.bezmen.domain.spec.SepulkaService; -import smecalculus.bezmen.messaging.spec.SepulkaClient; -import smecalculus.bezmen.messaging.spec.SepulkaRegReq; -import smecalculus.bezmen.messaging.spec.SepulkaRegRes; -import smecalculus.bezmen.validation.spec.BezmenValidator; - -public record SepulkaClientImpl( - @NonNull BezmenValidator validator, @NonNull SepulkaService service, @NonNull SepulkaConverter converter) - implements SepulkaClient { - - @Override - public SepulkaRegRes register(SepulkaRegReq request) { - validator.validate(request); - Sepulka sepulka = service.register(request); - return converter.toRegRes(sepulka); - } -} diff --git a/apps/foo/src/main/java/smecalculus/bezmen/messaging/impl/springmvc/SepulkaController.java b/apps/foo/src/main/java/smecalculus/bezmen/messaging/springmvc/SepulkaController.java similarity index 67% rename from apps/foo/src/main/java/smecalculus/bezmen/messaging/impl/springmvc/SepulkaController.java rename to apps/foo/src/main/java/smecalculus/bezmen/messaging/springmvc/SepulkaController.java index 2ea379ac..786a97f9 100644 --- a/apps/foo/src/main/java/smecalculus/bezmen/messaging/impl/springmvc/SepulkaController.java +++ b/apps/foo/src/main/java/smecalculus/bezmen/messaging/springmvc/SepulkaController.java @@ -1,4 +1,4 @@ -package smecalculus.bezmen.messaging.impl.springmvc; +package smecalculus.bezmen.messaging.springmvc; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; @@ -6,12 +6,12 @@ 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.spec.SepulkaClient; -import smecalculus.bezmen.messaging.spec.SepulkaMsgMapper; -import smecalculus.bezmen.messaging.spec.SepulkaRegReq; -import smecalculus.bezmen.messaging.spec.SepulkaRegReqMsg; -import smecalculus.bezmen.messaging.spec.SepulkaRegRes; -import smecalculus.bezmen.messaging.spec.SepulkaRegResMsg; +import smecalculus.bezmen.messaging.SepulkaMsgMapper; +import smecalculus.bezmen.messaging.SepulkaRegReqMsg; +import smecalculus.bezmen.messaging.SepulkaRegResMsg; +import smecalculus.bezmen.messaging.client.SepulkaClient; +import smecalculus.bezmen.messaging.client.SepulkaRegReq; +import smecalculus.bezmen.messaging.client.SepulkaRegRes; @RestController @RequestMapping("sepulkas") diff --git a/apps/foo/src/main/java/smecalculus/bezmen/data/spec/SepulkaDao.java b/apps/foo/src/main/java/smecalculus/bezmen/storage/SepulkaDao.java similarity index 68% rename from apps/foo/src/main/java/smecalculus/bezmen/data/spec/SepulkaDao.java rename to apps/foo/src/main/java/smecalculus/bezmen/storage/SepulkaDao.java index 3797a17a..32a13ccb 100644 --- a/apps/foo/src/main/java/smecalculus/bezmen/data/spec/SepulkaDao.java +++ b/apps/foo/src/main/java/smecalculus/bezmen/storage/SepulkaDao.java @@ -1,8 +1,8 @@ -package smecalculus.bezmen.data.spec; +package smecalculus.bezmen.storage; import java.util.List; import java.util.UUID; -import smecalculus.bezmen.domain.spec.Sepulka; +import smecalculus.bezmen.core.Sepulka; public interface SepulkaDao { diff --git a/apps/foo/src/main/java/smecalculus/bezmen/data/impl/SepulkaDaoMyBatis.java b/apps/foo/src/main/java/smecalculus/bezmen/storage/SepulkaDaoMyBatis.java similarity index 71% rename from apps/foo/src/main/java/smecalculus/bezmen/data/impl/SepulkaDaoMyBatis.java rename to apps/foo/src/main/java/smecalculus/bezmen/storage/SepulkaDaoMyBatis.java index d751e6ee..7f55a067 100644 --- a/apps/foo/src/main/java/smecalculus/bezmen/data/impl/SepulkaDaoMyBatis.java +++ b/apps/foo/src/main/java/smecalculus/bezmen/storage/SepulkaDaoMyBatis.java @@ -1,15 +1,12 @@ -package smecalculus.bezmen.data.impl; +package smecalculus.bezmen.storage; import static java.util.stream.Collectors.toList; import java.util.List; import java.util.UUID; import lombok.NonNull; -import smecalculus.bezmen.data.spec.SepulkaDao; -import smecalculus.bezmen.data.spec.SepulkaRec; -import smecalculus.bezmen.data.spec.SepulkaRecMapper; -import smecalculus.bezmen.data.spec.mybatis.SepulkaSqlMapper; -import smecalculus.bezmen.domain.spec.Sepulka; +import smecalculus.bezmen.core.Sepulka; +import smecalculus.bezmen.storage.mybatis.SepulkaSqlMapper; public record SepulkaDaoMyBatis(@NonNull SepulkaRecMapper recMapper, @NonNull SepulkaSqlMapper sqlMapper) implements SepulkaDao { diff --git a/apps/foo/src/main/java/smecalculus/bezmen/data/impl/SepulkaDaoSpringData.java b/apps/foo/src/main/java/smecalculus/bezmen/storage/SepulkaDaoSpringData.java similarity index 75% rename from apps/foo/src/main/java/smecalculus/bezmen/data/impl/SepulkaDaoSpringData.java rename to apps/foo/src/main/java/smecalculus/bezmen/storage/SepulkaDaoSpringData.java index 00f901d4..74a111bc 100644 --- a/apps/foo/src/main/java/smecalculus/bezmen/data/impl/SepulkaDaoSpringData.java +++ b/apps/foo/src/main/java/smecalculus/bezmen/storage/SepulkaDaoSpringData.java @@ -1,4 +1,4 @@ -package smecalculus.bezmen.data.impl; +package smecalculus.bezmen.storage; import static java.util.stream.Collectors.toList; import static java.util.stream.StreamSupport.stream; @@ -6,11 +6,8 @@ import java.util.List; import java.util.UUID; import lombok.NonNull; -import smecalculus.bezmen.data.spec.SepulkaDao; -import smecalculus.bezmen.data.spec.SepulkaRec; -import smecalculus.bezmen.data.spec.SepulkaRecMapper; -import smecalculus.bezmen.data.spec.springdata.SepulkaRepository; -import smecalculus.bezmen.domain.spec.Sepulka; +import smecalculus.bezmen.core.Sepulka; +import smecalculus.bezmen.storage.springdata.SepulkaRepository; public record SepulkaDaoSpringData(@NonNull SepulkaRecMapper mapper, @NonNull SepulkaRepository repository) implements SepulkaDao { diff --git a/apps/foo/src/main/java/smecalculus/bezmen/data/spec/SepulkaRec.java b/apps/foo/src/main/java/smecalculus/bezmen/storage/SepulkaRec.java similarity index 89% rename from apps/foo/src/main/java/smecalculus/bezmen/data/spec/SepulkaRec.java rename to apps/foo/src/main/java/smecalculus/bezmen/storage/SepulkaRec.java index d8047089..9a2400e1 100644 --- a/apps/foo/src/main/java/smecalculus/bezmen/data/spec/SepulkaRec.java +++ b/apps/foo/src/main/java/smecalculus/bezmen/storage/SepulkaRec.java @@ -1,4 +1,4 @@ -package smecalculus.bezmen.data.spec; +package smecalculus.bezmen.storage; import lombok.Data; import org.springframework.data.annotation.Id; diff --git a/apps/foo/src/main/java/smecalculus/bezmen/data/spec/SepulkaRecMapper.java b/apps/foo/src/main/java/smecalculus/bezmen/storage/SepulkaRecMapper.java similarity index 65% rename from apps/foo/src/main/java/smecalculus/bezmen/data/spec/SepulkaRecMapper.java rename to apps/foo/src/main/java/smecalculus/bezmen/storage/SepulkaRecMapper.java index 397bc5e7..3bc8ccf1 100644 --- a/apps/foo/src/main/java/smecalculus/bezmen/data/spec/SepulkaRecMapper.java +++ b/apps/foo/src/main/java/smecalculus/bezmen/storage/SepulkaRecMapper.java @@ -1,7 +1,7 @@ -package smecalculus.bezmen.data.spec; +package smecalculus.bezmen.storage; import org.mapstruct.Mapper; -import smecalculus.bezmen.domain.spec.Sepulka; +import smecalculus.bezmen.core.Sepulka; @Mapper public interface SepulkaRecMapper { diff --git a/apps/foo/src/main/java/smecalculus/bezmen/data/spec/mybatis/SepulkaSqlMapper.java b/apps/foo/src/main/java/smecalculus/bezmen/storage/mybatis/SepulkaSqlMapper.java similarity index 85% rename from apps/foo/src/main/java/smecalculus/bezmen/data/spec/mybatis/SepulkaSqlMapper.java rename to apps/foo/src/main/java/smecalculus/bezmen/storage/mybatis/SepulkaSqlMapper.java index b0900c7b..d617ecc4 100644 --- a/apps/foo/src/main/java/smecalculus/bezmen/data/spec/mybatis/SepulkaSqlMapper.java +++ b/apps/foo/src/main/java/smecalculus/bezmen/storage/mybatis/SepulkaSqlMapper.java @@ -1,11 +1,11 @@ -package smecalculus.bezmen.data.spec.mybatis; +package smecalculus.bezmen.storage.mybatis; import java.util.List; import java.util.Optional; import org.apache.ibatis.annotations.Insert; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Select; -import smecalculus.bezmen.data.spec.SepulkaRec; +import smecalculus.bezmen.storage.SepulkaRec; public interface SepulkaSqlMapper { diff --git a/apps/foo/src/main/java/smecalculus/bezmen/data/spec/springdata/SepulkaRepository.java b/apps/foo/src/main/java/smecalculus/bezmen/storage/springdata/SepulkaRepository.java similarity index 59% rename from apps/foo/src/main/java/smecalculus/bezmen/data/spec/springdata/SepulkaRepository.java rename to apps/foo/src/main/java/smecalculus/bezmen/storage/springdata/SepulkaRepository.java index cd052994..947734b8 100644 --- a/apps/foo/src/main/java/smecalculus/bezmen/data/spec/springdata/SepulkaRepository.java +++ b/apps/foo/src/main/java/smecalculus/bezmen/storage/springdata/SepulkaRepository.java @@ -1,6 +1,6 @@ -package smecalculus.bezmen.data.spec.springdata; +package smecalculus.bezmen.storage.springdata; import org.springframework.data.repository.CrudRepository; -import smecalculus.bezmen.data.spec.SepulkaRec; +import smecalculus.bezmen.storage.SepulkaRec; public interface SepulkaRepository extends CrudRepository {} diff --git a/apps/foo/src/test/java/smecalculus/bezmen/construction/spec/SepulkaClientBeans.java b/apps/foo/src/test/java/smecalculus/bezmen/construction/SepulkaClientBeans.java similarity index 58% rename from apps/foo/src/test/java/smecalculus/bezmen/construction/spec/SepulkaClientBeans.java rename to apps/foo/src/test/java/smecalculus/bezmen/construction/SepulkaClientBeans.java index b8cb1f9f..55c4a9dc 100644 --- a/apps/foo/src/test/java/smecalculus/bezmen/construction/spec/SepulkaClientBeans.java +++ b/apps/foo/src/test/java/smecalculus/bezmen/construction/SepulkaClientBeans.java @@ -1,4 +1,4 @@ -package smecalculus.bezmen.construction.spec; +package smecalculus.bezmen.construction; import static org.mockito.Mockito.mock; @@ -7,16 +7,16 @@ import org.springframework.context.annotation.Import; import org.springframework.test.web.reactive.server.WebTestClient; import org.springframework.test.web.servlet.client.MockMvcWebTestClient; -import smecalculus.bezmen.domain.impl.SepulkaConverterImpl; -import smecalculus.bezmen.domain.spec.SepulkaConverter; -import smecalculus.bezmen.domain.spec.SepulkaService; -import smecalculus.bezmen.messaging.impl.SepulkaClientImpl; -import smecalculus.bezmen.messaging.impl.SepulkaClientSpringWeb; -import smecalculus.bezmen.messaging.impl.springmvc.SepulkaController; -import smecalculus.bezmen.messaging.spec.SepulkaClient; -import smecalculus.bezmen.messaging.spec.SepulkaMsgMapper; -import smecalculus.bezmen.messaging.spec.SepulkaMsgMapperImpl; -import smecalculus.bezmen.validation.spec.BezmenValidator; +import smecalculus.bezmen.core.SepulkaConverter; +import smecalculus.bezmen.core.SepulkaConverterImpl; +import smecalculus.bezmen.core.SepulkaService; +import smecalculus.bezmen.messaging.SepulkaClientImpl; +import smecalculus.bezmen.messaging.SepulkaClientSpringWeb; +import smecalculus.bezmen.messaging.SepulkaMsgMapper; +import smecalculus.bezmen.messaging.SepulkaMsgMapperImpl; +import smecalculus.bezmen.messaging.client.SepulkaClient; +import smecalculus.bezmen.messaging.springmvc.SepulkaController; +import smecalculus.bezmen.validation.EdgeValidator; @Import(ValidationBeans.class) @Configuration(proxyBeanMethods = false) @@ -33,7 +33,7 @@ SepulkaConverter sepulkaConverter() { } @Bean - SepulkaClient internalClient(BezmenValidator validator, SepulkaService service, SepulkaConverterImpl converter) { + SepulkaClient internalClient(EdgeValidator validator, SepulkaService service, SepulkaConverterImpl converter) { return new SepulkaClientImpl(validator, service, converter); } diff --git a/apps/foo/src/test/java/smecalculus/bezmen/construction/spec/SepulkaDaoBeans.java b/apps/foo/src/test/java/smecalculus/bezmen/construction/SepulkaDaoBeans.java similarity index 68% rename from apps/foo/src/test/java/smecalculus/bezmen/construction/spec/SepulkaDaoBeans.java rename to apps/foo/src/test/java/smecalculus/bezmen/construction/SepulkaDaoBeans.java index 341fc5d8..313ff598 100644 --- a/apps/foo/src/test/java/smecalculus/bezmen/construction/spec/SepulkaDaoBeans.java +++ b/apps/foo/src/test/java/smecalculus/bezmen/construction/SepulkaDaoBeans.java @@ -1,9 +1,9 @@ -package smecalculus.bezmen.construction.spec; +package smecalculus.bezmen.construction; import static java.util.stream.Collectors.joining; -import static smecalculus.bezmen.configuration.spec.OrmMode.MY_BATIS; -import static smecalculus.bezmen.configuration.spec.OrmMode.SPRING_DATA; -import static smecalculus.bezmen.configuration.spec.VendorMode.POSTGRES; +import static smecalculus.bezmen.configuration.OrmMode.MY_BATIS; +import static smecalculus.bezmen.configuration.OrmMode.SPRING_DATA; +import static smecalculus.bezmen.configuration.VendorMode.POSTGRES; import java.util.Collection; import java.util.List; @@ -13,16 +13,16 @@ import org.springframework.context.annotation.Configuration; import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder; import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType; -import smecalculus.bezmen.configuration.spec.DataProps; -import smecalculus.bezmen.configuration.spec.OrmProps; -import smecalculus.bezmen.configuration.spec.VendorProps; -import smecalculus.bezmen.data.impl.SepulkaDaoMyBatis; -import smecalculus.bezmen.data.impl.SepulkaDaoSpringData; -import smecalculus.bezmen.data.spec.SepulkaDao; -import smecalculus.bezmen.data.spec.SepulkaRecMapper; -import smecalculus.bezmen.data.spec.SepulkaRecMapperImpl; -import smecalculus.bezmen.data.spec.mybatis.SepulkaSqlMapper; -import smecalculus.bezmen.data.spec.springdata.SepulkaRepository; +import smecalculus.bezmen.configuration.OrmProps; +import smecalculus.bezmen.configuration.StorageProps; +import smecalculus.bezmen.configuration.VendorProps; +import smecalculus.bezmen.storage.SepulkaDao; +import smecalculus.bezmen.storage.SepulkaDaoMyBatis; +import smecalculus.bezmen.storage.SepulkaDaoSpringData; +import smecalculus.bezmen.storage.SepulkaRecMapper; +import smecalculus.bezmen.storage.SepulkaRecMapperImpl; +import smecalculus.bezmen.storage.mybatis.SepulkaSqlMapper; +import smecalculus.bezmen.storage.springdata.SepulkaRepository; @Configuration(proxyBeanMethods = false) public class SepulkaDaoBeans { @@ -30,10 +30,10 @@ public class SepulkaDaoBeans { public static final String DB = "testdb"; @Bean - public DataSource dataSource(DataProps dataProps) { + public DataSource dataSource(StorageProps storageProps) { List common = List.of("DB_CLOSE_DELAY=-1"); List specific = - switch (dataProps.vendorProps().mode()) { + switch (storageProps.vendorProps().mode()) { case H2 -> List.of("MODE=STRICT"); case POSTGRES -> List.of("MODE=PostgreSQL", "DATABASE_TO_LOWER=TRUE", "DEFAULT_NULL_ORDERING=HIGH"); }; @@ -62,8 +62,8 @@ public SepulkaDao underTest(SepulkaRecMapper recMapper, SepulkaRepository reposi } @Bean - public DataProps dataProps() { - return DataProps.builder() + public StorageProps storageProps() { + return StorageProps.builder() .ormProps(OrmProps.builder().mode(SPRING_DATA).build()) .vendorProps(VendorProps.builder().mode(POSTGRES).build()) .build(); @@ -79,8 +79,8 @@ public SepulkaDao underTest(SepulkaRecMapper recMapper, SepulkaSqlMapper sqlMapp } @Bean - public DataProps dataProps() { - return DataProps.builder() + public StorageProps storageProps() { + return StorageProps.builder() .ormProps(OrmProps.builder().mode(MY_BATIS).build()) .vendorProps(VendorProps.builder().mode(POSTGRES).build()) .build(); diff --git a/apps/foo/src/test/java/smecalculus/bezmen/messaging/impl/SepulkaClientIT.java b/apps/foo/src/test/java/smecalculus/bezmen/messaging/SepulkaClientIT.java similarity index 63% rename from apps/foo/src/test/java/smecalculus/bezmen/messaging/impl/SepulkaClientIT.java rename to apps/foo/src/test/java/smecalculus/bezmen/messaging/SepulkaClientIT.java index fb1dc7df..d6d71b71 100644 --- a/apps/foo/src/test/java/smecalculus/bezmen/messaging/impl/SepulkaClientIT.java +++ b/apps/foo/src/test/java/smecalculus/bezmen/messaging/SepulkaClientIT.java @@ -1,11 +1,11 @@ -package smecalculus.bezmen.messaging.impl; +package smecalculus.bezmen.messaging; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.when; -import static smecalculus.bezmen.fixture.SepulkaFixtures.sepulkaPojo; -import static smecalculus.bezmen.fixture.SepulkaFixtures.sepulkaRegReqPojo; -import static smecalculus.bezmen.fixture.SepulkaFixtures.sepulkaRegResPojo; +import static smecalculus.bezmen.core.SepulkaEg.Pojos.sepulka; +import static smecalculus.bezmen.messaging.client.SepulkaRegReqEg.Pojos.sepulkaRegReq; +import static smecalculus.bezmen.messaging.client.SepulkaRegResEg.Pojos.sepulkaRegRes; import java.util.UUID; import org.junit.jupiter.api.Test; @@ -13,11 +13,11 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit.jupiter.SpringExtension; -import smecalculus.bezmen.construction.spec.SepulkaClientBeans; -import smecalculus.bezmen.domain.spec.SepulkaService; -import smecalculus.bezmen.messaging.spec.SepulkaClient; -import smecalculus.bezmen.messaging.spec.SepulkaRegReq; -import smecalculus.bezmen.messaging.spec.SepulkaRegRes; +import smecalculus.bezmen.construction.SepulkaClientBeans; +import smecalculus.bezmen.core.SepulkaService; +import smecalculus.bezmen.messaging.client.SepulkaClient; +import smecalculus.bezmen.messaging.client.SepulkaRegReq; +import smecalculus.bezmen.messaging.client.SepulkaRegRes; @ExtendWith(SpringExtension.class) @ContextConfiguration(classes = SepulkaClientBeans.class) @@ -34,11 +34,11 @@ void shouldRegisterSepulka() { // given UUID id = UUID.randomUUID(); // and - SepulkaRegReq request = sepulkaRegReqPojo(); + SepulkaRegReq request = sepulkaRegReq(); // and - when(serviceMock.register(any(SepulkaRegReq.class))).thenReturn(sepulkaPojo(id)); + when(serviceMock.register(any(SepulkaRegReq.class))).thenReturn(sepulka(id)); // and - SepulkaRegRes expectedResponse = sepulkaRegResPojo(id); + SepulkaRegRes expectedResponse = sepulkaRegRes(id); // when SepulkaRegRes actualResponse = externalClient.register(request); // then diff --git a/apps/foo/src/test/java/smecalculus/bezmen/messaging/impl/SepulkaClientSpringWeb.java b/apps/foo/src/test/java/smecalculus/bezmen/messaging/SepulkaClientSpringWeb.java similarity index 70% rename from apps/foo/src/test/java/smecalculus/bezmen/messaging/impl/SepulkaClientSpringWeb.java rename to apps/foo/src/test/java/smecalculus/bezmen/messaging/SepulkaClientSpringWeb.java index ba032995..105ba6f8 100644 --- a/apps/foo/src/test/java/smecalculus/bezmen/messaging/impl/SepulkaClientSpringWeb.java +++ b/apps/foo/src/test/java/smecalculus/bezmen/messaging/SepulkaClientSpringWeb.java @@ -1,13 +1,11 @@ -package smecalculus.bezmen.messaging.impl; +package smecalculus.bezmen.messaging; import lombok.NonNull; import org.springframework.http.MediaType; import org.springframework.test.web.reactive.server.WebTestClient; -import smecalculus.bezmen.messaging.spec.SepulkaClient; -import smecalculus.bezmen.messaging.spec.SepulkaMsgMapper; -import smecalculus.bezmen.messaging.spec.SepulkaRegReq; -import smecalculus.bezmen.messaging.spec.SepulkaRegRes; -import smecalculus.bezmen.messaging.spec.SepulkaRegResMsg; +import smecalculus.bezmen.messaging.client.SepulkaClient; +import smecalculus.bezmen.messaging.client.SepulkaRegReq; +import smecalculus.bezmen.messaging.client.SepulkaRegRes; public record SepulkaClientSpringWeb(@NonNull WebTestClient client, @NonNull SepulkaMsgMapper mapper) implements SepulkaClient { diff --git a/apps/foo/src/test/java/smecalculus/bezmen/messaging/impl/SepulkaClientSpringWebIT.java b/apps/foo/src/test/java/smecalculus/bezmen/messaging/SepulkaClientSpringWebIT.java similarity index 60% rename from apps/foo/src/test/java/smecalculus/bezmen/messaging/impl/SepulkaClientSpringWebIT.java rename to apps/foo/src/test/java/smecalculus/bezmen/messaging/SepulkaClientSpringWebIT.java index 143945c8..0859ae5b 100644 --- a/apps/foo/src/test/java/smecalculus/bezmen/messaging/impl/SepulkaClientSpringWebIT.java +++ b/apps/foo/src/test/java/smecalculus/bezmen/messaging/SepulkaClientSpringWebIT.java @@ -1,3 +1,3 @@ -package smecalculus.bezmen.messaging.impl; +package smecalculus.bezmen.messaging; public class SepulkaClientSpringWebIT extends SepulkaClientIT {} diff --git a/apps/foo/src/test/java/smecalculus/bezmen/data/impl/SepulkaDaoIT.java b/apps/foo/src/test/java/smecalculus/bezmen/storage/SepulkaDaoIT.java similarity index 75% rename from apps/foo/src/test/java/smecalculus/bezmen/data/impl/SepulkaDaoIT.java rename to apps/foo/src/test/java/smecalculus/bezmen/storage/SepulkaDaoIT.java index 775d2cd6..511bbae8 100644 --- a/apps/foo/src/test/java/smecalculus/bezmen/data/impl/SepulkaDaoIT.java +++ b/apps/foo/src/test/java/smecalculus/bezmen/storage/SepulkaDaoIT.java @@ -1,7 +1,7 @@ -package smecalculus.bezmen.data.impl; +package smecalculus.bezmen.storage; import static org.assertj.core.api.Assertions.assertThat; -import static smecalculus.bezmen.fixture.SepulkaFixtures.sepulkaBuilder; +import static smecalculus.bezmen.core.SepulkaEg.Pojos.sepulka; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; @@ -9,9 +9,8 @@ import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.jdbc.Sql; import org.springframework.test.context.junit.jupiter.SpringExtension; -import smecalculus.bezmen.construction.spec.SepulkaDaoBeans; -import smecalculus.bezmen.data.spec.SepulkaDao; -import smecalculus.bezmen.domain.spec.Sepulka; +import smecalculus.bezmen.construction.SepulkaDaoBeans; +import smecalculus.bezmen.core.Sepulka; @ExtendWith(SpringExtension.class) @ContextConfiguration(classes = SepulkaDaoBeans.class) @@ -24,7 +23,7 @@ abstract class SepulkaDaoIT { @Test void shouldSaveOneSepulka() { // given - Sepulka expectedSepulka = sepulkaBuilder().build(); + Sepulka expectedSepulka = sepulka(); // when Sepulka actualSepulka1 = sepulkaDao.save(expectedSepulka); // and diff --git a/apps/foo/src/test/java/smecalculus/bezmen/data/impl/SepulkaDaoMyBatisPostgresIT.java b/apps/foo/src/test/java/smecalculus/bezmen/storage/SepulkaDaoMyBatisPostgresIT.java similarity index 58% rename from apps/foo/src/test/java/smecalculus/bezmen/data/impl/SepulkaDaoMyBatisPostgresIT.java rename to apps/foo/src/test/java/smecalculus/bezmen/storage/SepulkaDaoMyBatisPostgresIT.java index 346c42c9..02de52d7 100644 --- a/apps/foo/src/test/java/smecalculus/bezmen/data/impl/SepulkaDaoMyBatisPostgresIT.java +++ b/apps/foo/src/test/java/smecalculus/bezmen/storage/SepulkaDaoMyBatisPostgresIT.java @@ -1,8 +1,8 @@ -package smecalculus.bezmen.data.impl; +package smecalculus.bezmen.storage; import org.springframework.test.context.ContextConfiguration; -import smecalculus.bezmen.construction.spec.OrmMyBatisBeans; -import smecalculus.bezmen.construction.spec.SepulkaDaoBeans; +import smecalculus.bezmen.construction.OrmMyBatisBeans; +import smecalculus.bezmen.construction.SepulkaDaoBeans; @ContextConfiguration(classes = {SepulkaDaoBeans.MyBatisPostgres.class, OrmMyBatisBeans.class}) public class SepulkaDaoMyBatisPostgresIT extends SepulkaDaoIT {} diff --git a/apps/foo/src/test/java/smecalculus/bezmen/data/impl/SepulkaDaoMyBatisTest.java b/apps/foo/src/test/java/smecalculus/bezmen/storage/SepulkaDaoMyBatisTest.java similarity index 72% rename from apps/foo/src/test/java/smecalculus/bezmen/data/impl/SepulkaDaoMyBatisTest.java rename to apps/foo/src/test/java/smecalculus/bezmen/storage/SepulkaDaoMyBatisTest.java index 9e40a23b..3536c60f 100644 --- a/apps/foo/src/test/java/smecalculus/bezmen/data/impl/SepulkaDaoMyBatisTest.java +++ b/apps/foo/src/test/java/smecalculus/bezmen/storage/SepulkaDaoMyBatisTest.java @@ -1,4 +1,4 @@ -package smecalculus.bezmen.data.impl; +package smecalculus.bezmen.storage; import org.junit.jupiter.api.Test; diff --git a/apps/foo/src/test/java/smecalculus/bezmen/data/impl/SepulkaDaoSpringDataPostgresIT.java b/apps/foo/src/test/java/smecalculus/bezmen/storage/SepulkaDaoSpringDataPostgresIT.java similarity index 58% rename from apps/foo/src/test/java/smecalculus/bezmen/data/impl/SepulkaDaoSpringDataPostgresIT.java rename to apps/foo/src/test/java/smecalculus/bezmen/storage/SepulkaDaoSpringDataPostgresIT.java index 7d73d151..d711c009 100644 --- a/apps/foo/src/test/java/smecalculus/bezmen/data/impl/SepulkaDaoSpringDataPostgresIT.java +++ b/apps/foo/src/test/java/smecalculus/bezmen/storage/SepulkaDaoSpringDataPostgresIT.java @@ -1,8 +1,8 @@ -package smecalculus.bezmen.data.impl; +package smecalculus.bezmen.storage; import org.springframework.test.context.ContextConfiguration; -import smecalculus.bezmen.construction.spec.OrmSpringDataBeans; -import smecalculus.bezmen.construction.spec.SepulkaDaoBeans; +import smecalculus.bezmen.construction.OrmSpringDataBeans; +import smecalculus.bezmen.construction.SepulkaDaoBeans; @ContextConfiguration(classes = {SepulkaDaoBeans.SpringDataPostgres.class, OrmSpringDataBeans.class}) public class SepulkaDaoSpringDataPostgresIT extends SepulkaDaoIT {} diff --git a/apps/pom.xml b/apps/pom.xml index d124961d..73385e19 100644 --- a/apps/pom.xml +++ b/apps/pom.xml @@ -23,19 +23,17 @@ UTF-8 - - - github - https://maven.pkg.github.com/smecalculus/bezmen - - - org.projectlombok lombok provided + + org.mapstruct + mapstruct + provided + @@ -53,30 +51,27 @@ - maven-install-plugin - - - maven-deploy-plugin + com.diffplug.spotless + spotless-maven-plugin + org.apache.maven.plugins maven-surefire-plugin - - maven-failsafe-plugin - - - com.diffplug.spotless - spotless-maven-plugin - org.jacoco jacoco-maven-plugin + + org.apache.maven.plugins + maven-failsafe-plugin + + org.apache.maven.plugins maven-enforcer-plugin 3.4.1 @@ -84,6 +79,7 @@ + org.apache.maven.plugins maven-compiler-plugin 3.11.0 @@ -105,6 +101,7 @@ + org.apache.maven.plugins maven-surefire-plugin 3.1.2 @@ -112,6 +109,7 @@ + org.apache.maven.plugins maven-failsafe-plugin 3.1.2 @@ -124,6 +122,21 @@ + org.apache.maven.plugins + maven-assembly-plugin + 3.6.0 + + + make-assembly + package + + single + + + + + + org.apache.maven.plugins maven-install-plugin 3.1.1 @@ -131,25 +144,13 @@ + org.apache.maven.plugins maven-deploy-plugin 3.1.1 true - - maven-assembly-plugin - 3.6.0 - - - make-assembly - package - - single - - - - com.diffplug.spotless spotless-maven-plugin diff --git a/libs/README.adoc b/libs/README.adoc index 2bc7bf33..89114f27 100644 --- a/libs/README.adoc +++ b/libs/README.adoc @@ -18,7 +18,7 @@ include::messaging/README.adoc[] === Data -include::data/README.adoc[] +include::storage/README.adoc[] === Testing diff --git a/libs/client/README.adoc b/libs/client/README.adoc deleted file mode 100644 index 563230ff..00000000 --- a/libs/client/README.adoc +++ /dev/null @@ -1 +0,0 @@ -Публичная клиентская обвязка diff --git a/libs/client/pom.xml b/libs/client/pom.xml deleted file mode 100644 index 202c2092..00000000 --- a/libs/client/pom.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - 4.0.0 - - - smecalculus.bezmen - libs - ${revision} - - - client - - - - com.fasterxml.jackson.core - jackson-core - - - com.fasterxml.jackson.core - jackson-databind - - - jakarta.servlet - jakarta.servlet-api - - - diff --git a/libs/data/src/main/java/smecalculus/bezmen/configuration/impl/DataConfigImpl.java b/libs/data/src/main/java/smecalculus/bezmen/configuration/impl/DataConfigImpl.java deleted file mode 100644 index e0c635ad..00000000 --- a/libs/data/src/main/java/smecalculus/bezmen/configuration/impl/DataConfigImpl.java +++ /dev/null @@ -1,26 +0,0 @@ -package smecalculus.bezmen.configuration.impl; - -import lombok.NonNull; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import smecalculus.bezmen.configuration.spec.ConfigKeeper; -import smecalculus.bezmen.configuration.spec.DataCfgMapper; -import smecalculus.bezmen.configuration.spec.DataConfig; -import smecalculus.bezmen.configuration.spec.DataProps; -import smecalculus.bezmen.configuration.spec.DataPropsCfg; -import smecalculus.bezmen.validation.spec.BezmenValidator; - -public record DataConfigImpl( - @NonNull ConfigKeeper configKeeper, @NonNull BezmenValidator validator, @NonNull DataCfgMapper mapper) - implements DataConfig { - - private static final Logger LOG = LoggerFactory.getLogger(DataConfigImpl.class); - - @Override - public DataProps getDataProps() { - DataPropsCfg propsCfg = configKeeper.read("bezmen.data", DataPropsCfg.class); - validator.validate(propsCfg); - LOG.info("Read {}", propsCfg); - return mapper.toDomain(propsCfg); - } -} diff --git a/libs/data/src/main/java/smecalculus/bezmen/configuration/spec/DataConfig.java b/libs/data/src/main/java/smecalculus/bezmen/configuration/spec/DataConfig.java deleted file mode 100644 index e4af401a..00000000 --- a/libs/data/src/main/java/smecalculus/bezmen/configuration/spec/DataConfig.java +++ /dev/null @@ -1,5 +0,0 @@ -package smecalculus.bezmen.configuration.spec; - -public interface DataConfig { - DataProps getDataProps(); -} diff --git a/libs/data/src/main/java/smecalculus/bezmen/configuration/spec/DataProps.java b/libs/data/src/main/java/smecalculus/bezmen/configuration/spec/DataProps.java deleted file mode 100644 index b5f7c7be..00000000 --- a/libs/data/src/main/java/smecalculus/bezmen/configuration/spec/DataProps.java +++ /dev/null @@ -1,7 +0,0 @@ -package smecalculus.bezmen.configuration.spec; - -import lombok.Builder; -import lombok.NonNull; - -@Builder -public record DataProps(@NonNull VendorProps vendorProps, @NonNull OrmProps ormProps) {} diff --git a/libs/data/src/main/java/smecalculus/bezmen/construction/spec/DataConfigBeans.java b/libs/data/src/main/java/smecalculus/bezmen/construction/spec/DataConfigBeans.java deleted file mode 100644 index 9acb10f9..00000000 --- a/libs/data/src/main/java/smecalculus/bezmen/construction/spec/DataConfigBeans.java +++ /dev/null @@ -1,30 +0,0 @@ -package smecalculus.bezmen.construction.spec; - -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import smecalculus.bezmen.configuration.impl.DataConfigImpl; -import smecalculus.bezmen.configuration.spec.ConfigKeeper; -import smecalculus.bezmen.configuration.spec.DataCfgMapper; -import smecalculus.bezmen.configuration.spec.DataCfgMapperImpl; -import smecalculus.bezmen.configuration.spec.DataConfig; -import smecalculus.bezmen.configuration.spec.DataProps; -import smecalculus.bezmen.validation.spec.BezmenValidator; - -@Configuration(proxyBeanMethods = false) -public class DataConfigBeans { - - @Bean - DataCfgMapper dataCfgMapper() { - return new DataCfgMapperImpl(); - } - - @Bean - DataConfig dataConfig(ConfigKeeper keeper, BezmenValidator validator, DataCfgMapper mapper) { - return new DataConfigImpl(keeper, validator, mapper); - } - - @Bean - DataProps dataProps(DataConfig config) { - return config.getDataProps(); - } -} diff --git a/libs/data/src/test/java/smecalculus/bezmen/configuration/DataConfigIT.java b/libs/data/src/test/java/smecalculus/bezmen/configuration/DataConfigIT.java deleted file mode 100644 index 8eb51944..00000000 --- a/libs/data/src/test/java/smecalculus/bezmen/configuration/DataConfigIT.java +++ /dev/null @@ -1,33 +0,0 @@ -package smecalculus.bezmen.configuration; - -import static org.assertj.core.api.Assertions.assertThat; -import static smecalculus.bezmen.fixture.DataPropsFixture.dataProps; - -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.spec.DataConfig; -import smecalculus.bezmen.configuration.spec.DataProps; -import smecalculus.bezmen.construction.spec.ConfigBeans; -import smecalculus.bezmen.construction.spec.DataConfigBeans; -import smecalculus.bezmen.construction.spec.ValidationBeans; - -@ExtendWith(SpringExtension.class) -@ContextConfiguration(classes = {ConfigBeans.class, ValidationBeans.class, DataConfigBeans.class}) -abstract class DataConfigIT { - - @Autowired - DataConfig dataConfig; - - @Test - void defaultConfShouldBeBackwardCompatible() { - // given - DataProps expectedDataProps = dataProps().build(); - // when - DataProps actualDataProps = dataConfig.getDataProps(); - // then - assertThat(actualDataProps).isEqualTo(expectedDataProps); - } -} diff --git a/libs/data/src/test/java/smecalculus/bezmen/configuration/DataConfigImplIT.java b/libs/data/src/test/java/smecalculus/bezmen/configuration/DataConfigImplIT.java deleted file mode 100644 index 0cbbc07c..00000000 --- a/libs/data/src/test/java/smecalculus/bezmen/configuration/DataConfigImplIT.java +++ /dev/null @@ -1,3 +0,0 @@ -package smecalculus.bezmen.configuration; - -class DataConfigImplIT extends DataConfigIT {} diff --git a/libs/data/src/test/java/smecalculus/bezmen/configuration/DataConfigImplTest.java b/libs/data/src/test/java/smecalculus/bezmen/configuration/DataConfigImplTest.java deleted file mode 100644 index 0cc4422d..00000000 --- a/libs/data/src/test/java/smecalculus/bezmen/configuration/DataConfigImplTest.java +++ /dev/null @@ -1,3 +0,0 @@ -package smecalculus.bezmen.configuration; - -class DataConfigImplTest extends DataConfigTest {} diff --git a/libs/data/src/test/java/smecalculus/bezmen/configuration/DataConfigTest.java b/libs/data/src/test/java/smecalculus/bezmen/configuration/DataConfigTest.java deleted file mode 100644 index 19253e7a..00000000 --- a/libs/data/src/test/java/smecalculus/bezmen/configuration/DataConfigTest.java +++ /dev/null @@ -1,41 +0,0 @@ -package smecalculus.bezmen.configuration; - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; -import static smecalculus.bezmen.fixture.DataPropsFixture.dataPropsCfg; - -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import smecalculus.bezmen.configuration.impl.DataConfigImpl; -import smecalculus.bezmen.configuration.spec.ConfigKeeper; -import smecalculus.bezmen.configuration.spec.DataCfgMapperImpl; -import smecalculus.bezmen.configuration.spec.DataConfig; -import smecalculus.bezmen.configuration.spec.DataPropsCfg; -import smecalculus.bezmen.validation.spec.BezmenValidator; - -abstract class DataConfigTest { - - private DataConfig dataConfig; - private BezmenValidator validatorMock; - private ConfigKeeper keeperMock; - - @BeforeEach - void setUp() { - validatorMock = mock(BezmenValidator.class); - keeperMock = mock(ConfigKeeper.class); - dataConfig = new DataConfigImpl(keeperMock, validatorMock, new DataCfgMapperImpl()); - } - - @Test - void shouldValidateConf() { - // given - DataPropsCfg expectedDataProps = dataPropsCfg(); - // and - when(keeperMock.read("bezmen.data", DataPropsCfg.class)).thenReturn(expectedDataProps); - // when - dataConfig.getDataProps(); - // then - verify(validatorMock).validate(expectedDataProps); - } -} diff --git a/libs/data/src/test/java/smecalculus/bezmen/fixture/DataPropsFixture.java b/libs/data/src/test/java/smecalculus/bezmen/fixture/DataPropsFixture.java deleted file mode 100644 index 5b3335c6..00000000 --- a/libs/data/src/test/java/smecalculus/bezmen/fixture/DataPropsFixture.java +++ /dev/null @@ -1,25 +0,0 @@ -package smecalculus.bezmen.fixture; - -import static smecalculus.bezmen.fixture.OrmPropsFixture.ormProps; -import static smecalculus.bezmen.fixture.OrmPropsFixture.ormPropsCfg; -import static smecalculus.bezmen.fixture.VendorPropsFixture.vendorProps; -import static smecalculus.bezmen.fixture.VendorPropsFixture.vendorPropsCfg; - -import smecalculus.bezmen.configuration.spec.DataProps; -import smecalculus.bezmen.configuration.spec.DataPropsCfg; - -public class DataPropsFixture { - - public static DataProps.Builder dataProps() { - return DataProps.builder() - .vendorProps(vendorProps().build()) - .ormProps(ormProps().build()); - } - - public static DataPropsCfg dataPropsCfg() { - DataPropsCfg dataPropsCfg = new DataPropsCfg(); - dataPropsCfg.setVendor(vendorPropsCfg()); - dataPropsCfg.setOrm(ormPropsCfg()); - return dataPropsCfg; - } -} diff --git a/libs/data/src/test/java/smecalculus/bezmen/fixture/OrmPropsFixture.java b/libs/data/src/test/java/smecalculus/bezmen/fixture/OrmPropsFixture.java deleted file mode 100644 index c297de7a..00000000 --- a/libs/data/src/test/java/smecalculus/bezmen/fixture/OrmPropsFixture.java +++ /dev/null @@ -1,19 +0,0 @@ -package smecalculus.bezmen.fixture; - -import static smecalculus.bezmen.configuration.spec.OrmMode.SPRING_DATA; - -import smecalculus.bezmen.configuration.spec.OrmProps; -import smecalculus.bezmen.configuration.spec.OrmPropsCfg; - -public class OrmPropsFixture { - - public static OrmProps.Builder ormProps() { - return OrmProps.builder().mode(SPRING_DATA); - } - - public static OrmPropsCfg ormPropsCfg() { - OrmPropsCfg ormPropsCfg = new OrmPropsCfg(); - ormPropsCfg.setMode(SPRING_DATA.name()); - return ormPropsCfg; - } -} diff --git a/libs/data/src/test/java/smecalculus/bezmen/fixture/VendorPropsFixture.java b/libs/data/src/test/java/smecalculus/bezmen/fixture/VendorPropsFixture.java deleted file mode 100644 index d6af7869..00000000 --- a/libs/data/src/test/java/smecalculus/bezmen/fixture/VendorPropsFixture.java +++ /dev/null @@ -1,25 +0,0 @@ -package smecalculus.bezmen.fixture; - -import smecalculus.bezmen.configuration.spec.H2Props; -import smecalculus.bezmen.configuration.spec.VendorMode; -import smecalculus.bezmen.configuration.spec.VendorProps; -import smecalculus.bezmen.configuration.spec.VendorPropsCfg; - -public class VendorPropsFixture { - public static VendorProps.Builder vendorProps() { - return VendorProps.builder() - .mode(VendorMode.H2) - .h2Props(H2Props.builder() - .url("jdbc:h2:mem:db;DB_CLOSE_DELAY=-1") - .username("sa") - .password("sa") - .build()) - .postgresProps(null); - } - - public static VendorPropsCfg vendorPropsCfg() { - VendorPropsCfg vendorPropsCfg = new VendorPropsCfg(); - vendorPropsCfg.setMode(VendorMode.H2.name()); - return vendorPropsCfg; - } -} diff --git a/libs/essentials/pom.xml b/libs/essentials/pom.xml index 0e925e16..7328c38d 100644 --- a/libs/essentials/pom.xml +++ b/libs/essentials/pom.xml @@ -15,22 +15,20 @@ ${project.groupId} - client - - - - jakarta.validation - jakarta.validation-api + signatures + org.hibernate.validator hibernate-validator + runtime org.glassfish.expressly expressly + runtime - + com.typesafe config diff --git a/libs/essentials/src/main/java/smecalculus/bezmen/configuration/impl/ConfigKeeperLightbendConfig.java b/libs/essentials/src/main/java/smecalculus/bezmen/configuration/ConfigKeeperLightbendConfig.java similarity index 74% rename from libs/essentials/src/main/java/smecalculus/bezmen/configuration/impl/ConfigKeeperLightbendConfig.java rename to libs/essentials/src/main/java/smecalculus/bezmen/configuration/ConfigKeeperLightbendConfig.java index 74fe2e2a..7f90d7f2 100644 --- a/libs/essentials/src/main/java/smecalculus/bezmen/configuration/impl/ConfigKeeperLightbendConfig.java +++ b/libs/essentials/src/main/java/smecalculus/bezmen/configuration/ConfigKeeperLightbendConfig.java @@ -1,8 +1,7 @@ -package smecalculus.bezmen.configuration.impl; +package smecalculus.bezmen.configuration; import com.typesafe.config.Config; import com.typesafe.config.ConfigBeanFactory; -import smecalculus.bezmen.configuration.spec.ConfigKeeper; public record ConfigKeeperLightbendConfig(Config config) implements ConfigKeeper { diff --git a/libs/essentials/src/main/java/smecalculus/bezmen/configuration/ConfigMode.java b/libs/essentials/src/main/java/smecalculus/bezmen/configuration/ConfigMode.java new file mode 100644 index 00000000..99106a20 --- /dev/null +++ b/libs/essentials/src/main/java/smecalculus/bezmen/configuration/ConfigMode.java @@ -0,0 +1,5 @@ +package smecalculus.bezmen.configuration; + +public enum ConfigMode { + FILE_SYSTEM +} diff --git a/libs/essentials/src/main/java/smecalculus/bezmen/configuration/spec/ConfigMode.java b/libs/essentials/src/main/java/smecalculus/bezmen/configuration/spec/ConfigMode.java deleted file mode 100644 index a2f4513e..00000000 --- a/libs/essentials/src/main/java/smecalculus/bezmen/configuration/spec/ConfigMode.java +++ /dev/null @@ -1,5 +0,0 @@ -package smecalculus.bezmen.configuration.spec; - -public enum ConfigMode { - FILE_SYSTEM -} diff --git a/libs/essentials/src/main/java/smecalculus/bezmen/construction/spec/ConfigBeans.java b/libs/essentials/src/main/java/smecalculus/bezmen/construction/ConfigBeans.java similarity index 69% rename from libs/essentials/src/main/java/smecalculus/bezmen/construction/spec/ConfigBeans.java rename to libs/essentials/src/main/java/smecalculus/bezmen/construction/ConfigBeans.java index c338a12d..abec626a 100644 --- a/libs/essentials/src/main/java/smecalculus/bezmen/construction/spec/ConfigBeans.java +++ b/libs/essentials/src/main/java/smecalculus/bezmen/construction/ConfigBeans.java @@ -1,11 +1,11 @@ -package smecalculus.bezmen.construction.spec; +package smecalculus.bezmen.construction; import com.typesafe.config.ConfigFactory; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import smecalculus.bezmen.configuration.impl.ConfigKeeperLightbendConfig; -import smecalculus.bezmen.configuration.spec.ConfigKeeper; -import smecalculus.bezmen.configuration.spec.ConfigMode; +import smecalculus.bezmen.configuration.ConfigKeeper; +import smecalculus.bezmen.configuration.ConfigKeeperLightbendConfig; +import smecalculus.bezmen.configuration.ConfigMode; @Configuration(proxyBeanMethods = false) public class ConfigBeans { diff --git a/libs/essentials/src/main/java/smecalculus/bezmen/construction/spec/ValidationBeans.java b/libs/essentials/src/main/java/smecalculus/bezmen/construction/ValidationBeans.java similarity index 55% rename from libs/essentials/src/main/java/smecalculus/bezmen/construction/spec/ValidationBeans.java rename to libs/essentials/src/main/java/smecalculus/bezmen/construction/ValidationBeans.java index 27b65444..34631c1f 100644 --- a/libs/essentials/src/main/java/smecalculus/bezmen/construction/spec/ValidationBeans.java +++ b/libs/essentials/src/main/java/smecalculus/bezmen/construction/ValidationBeans.java @@ -1,18 +1,18 @@ -package smecalculus.bezmen.construction.spec; +package smecalculus.bezmen.construction; import jakarta.validation.Validation; import jakarta.validation.ValidatorFactory; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import smecalculus.bezmen.validation.impl.BezmenValidatorHibernateValidator; -import smecalculus.bezmen.validation.spec.BezmenValidator; +import smecalculus.bezmen.validation.EdgeValidator; +import smecalculus.bezmen.validation.EdgeValidatorHibernateValidator; @Configuration(proxyBeanMethods = false) public class ValidationBeans { @Bean - BezmenValidator validator() { + EdgeValidator validator() { ValidatorFactory factory = Validation.buildDefaultValidatorFactory(); - return new BezmenValidatorHibernateValidator(factory.getValidator()); + return new EdgeValidatorHibernateValidator(factory.getValidator()); } } diff --git a/libs/essentials/src/main/java/smecalculus/bezmen/domain/spec/SepulkaConverter.java b/libs/essentials/src/main/java/smecalculus/bezmen/domain/spec/SepulkaConverter.java deleted file mode 100644 index 87cd4008..00000000 --- a/libs/essentials/src/main/java/smecalculus/bezmen/domain/spec/SepulkaConverter.java +++ /dev/null @@ -1,7 +0,0 @@ -package smecalculus.bezmen.domain.spec; - -import smecalculus.bezmen.messaging.spec.SepulkaRegRes; - -public interface SepulkaConverter { - SepulkaRegRes toRegRes(Sepulka sepulka); -} diff --git a/libs/essentials/src/main/java/smecalculus/bezmen/validation/impl/BezmenValidatorHibernateValidator.java b/libs/essentials/src/main/java/smecalculus/bezmen/validation/EdgeValidatorHibernateValidator.java similarity index 68% rename from libs/essentials/src/main/java/smecalculus/bezmen/validation/impl/BezmenValidatorHibernateValidator.java rename to libs/essentials/src/main/java/smecalculus/bezmen/validation/EdgeValidatorHibernateValidator.java index deb6cc3a..ff4b5576 100644 --- a/libs/essentials/src/main/java/smecalculus/bezmen/validation/impl/BezmenValidatorHibernateValidator.java +++ b/libs/essentials/src/main/java/smecalculus/bezmen/validation/EdgeValidatorHibernateValidator.java @@ -1,13 +1,12 @@ -package smecalculus.bezmen.validation.impl; +package smecalculus.bezmen.validation; import jakarta.validation.ConstraintViolation; import jakarta.validation.ConstraintViolationException; import jakarta.validation.Validator; import java.util.Set; import lombok.NonNull; -import smecalculus.bezmen.validation.spec.BezmenValidator; -public record BezmenValidatorHibernateValidator(@NonNull Validator validator) implements BezmenValidator { +public record EdgeValidatorHibernateValidator(@NonNull Validator validator) implements EdgeValidator { @Override public void validate(T object, Class... groups) { diff --git a/libs/essentials/src/main/java/smecalculus/bezmen/validation/spec/ValueOfEnum.java b/libs/essentials/src/main/java/smecalculus/bezmen/validation/ValueOfEnum.java similarity index 85% rename from libs/essentials/src/main/java/smecalculus/bezmen/validation/spec/ValueOfEnum.java rename to libs/essentials/src/main/java/smecalculus/bezmen/validation/ValueOfEnum.java index 2e95e7d1..b9d0a614 100644 --- a/libs/essentials/src/main/java/smecalculus/bezmen/validation/spec/ValueOfEnum.java +++ b/libs/essentials/src/main/java/smecalculus/bezmen/validation/ValueOfEnum.java @@ -1,4 +1,4 @@ -package smecalculus.bezmen.validation.spec; +package smecalculus.bezmen.validation; import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.TYPE_USE; @@ -8,7 +8,6 @@ import jakarta.validation.Payload; import java.lang.annotation.Retention; import java.lang.annotation.Target; -import smecalculus.bezmen.validation.impl.ValueOfEnumValidator; @Target({FIELD, TYPE_USE}) @Retention(RUNTIME) diff --git a/libs/essentials/src/main/java/smecalculus/bezmen/validation/impl/ValueOfEnumValidator.java b/libs/essentials/src/main/java/smecalculus/bezmen/validation/ValueOfEnumValidator.java similarity index 91% rename from libs/essentials/src/main/java/smecalculus/bezmen/validation/impl/ValueOfEnumValidator.java rename to libs/essentials/src/main/java/smecalculus/bezmen/validation/ValueOfEnumValidator.java index d7d60f18..bff80fd6 100644 --- a/libs/essentials/src/main/java/smecalculus/bezmen/validation/impl/ValueOfEnumValidator.java +++ b/libs/essentials/src/main/java/smecalculus/bezmen/validation/ValueOfEnumValidator.java @@ -1,4 +1,4 @@ -package smecalculus.bezmen.validation.impl; +package smecalculus.bezmen.validation; import static java.lang.String.format; import static java.util.stream.Collectors.toSet; @@ -7,7 +7,6 @@ import jakarta.validation.ConstraintValidatorContext; import java.util.Set; import java.util.stream.Stream; -import smecalculus.bezmen.validation.spec.ValueOfEnum; public class ValueOfEnumValidator implements ConstraintValidator { private Set allowedValues; diff --git a/libs/essentials/src/main/java/smecalculus/bezmen/validation/spec/BezmenValidator.java b/libs/essentials/src/main/java/smecalculus/bezmen/validation/spec/BezmenValidator.java deleted file mode 100644 index 550ca09b..00000000 --- a/libs/essentials/src/main/java/smecalculus/bezmen/validation/spec/BezmenValidator.java +++ /dev/null @@ -1,5 +0,0 @@ -package smecalculus.bezmen.validation.spec; - -public interface BezmenValidator { - void validate(T object, Class... groups); -} diff --git a/libs/messaging/pom.xml b/libs/messaging/pom.xml index f4756516..6d2ec08d 100644 --- a/libs/messaging/pom.xml +++ b/libs/messaging/pom.xml @@ -12,11 +12,31 @@ messaging + + false + + ${project.groupId} essentials + + com.typesafe + config + + + com.fasterxml.jackson.core + jackson-core + + + com.fasterxml.jackson.core + jackson-databind + + + jakarta.servlet + jakarta.servlet-api + org.springframework @@ -42,13 +62,41 @@ com.fasterxml.jackson.datatype jackson-datatype-jsr310 + + org.springframework.boot + spring-boot-autoconfigure + - + ${project.groupId} testing test + + + + + org.apache.maven.plugins + maven-jar-plugin + 3.3.0 + + + client + + jar + + + client + + **/messaging/client/** + + + + + + + diff --git a/libs/messaging/src/main/java/smecalculus/bezmen/configuration/spec/HttpProps.java b/libs/messaging/src/main/java/smecalculus/bezmen/configuration/HttpProps.java similarity index 70% rename from libs/messaging/src/main/java/smecalculus/bezmen/configuration/spec/HttpProps.java rename to libs/messaging/src/main/java/smecalculus/bezmen/configuration/HttpProps.java index ae4a09c7..e2d2ce5a 100644 --- a/libs/messaging/src/main/java/smecalculus/bezmen/configuration/spec/HttpProps.java +++ b/libs/messaging/src/main/java/smecalculus/bezmen/configuration/HttpProps.java @@ -1,4 +1,4 @@ -package smecalculus.bezmen.configuration.spec; +package smecalculus.bezmen.configuration; import lombok.Builder; import lombok.NonNull; diff --git a/libs/messaging/src/main/java/smecalculus/bezmen/configuration/spec/HttpPropsCfg.java b/libs/messaging/src/main/java/smecalculus/bezmen/configuration/HttpPropsCfg.java similarity index 74% rename from libs/messaging/src/main/java/smecalculus/bezmen/configuration/spec/HttpPropsCfg.java rename to libs/messaging/src/main/java/smecalculus/bezmen/configuration/HttpPropsCfg.java index a7394218..4503363e 100644 --- a/libs/messaging/src/main/java/smecalculus/bezmen/configuration/spec/HttpPropsCfg.java +++ b/libs/messaging/src/main/java/smecalculus/bezmen/configuration/HttpPropsCfg.java @@ -1,4 +1,4 @@ -package smecalculus.bezmen.configuration.spec; +package smecalculus.bezmen.configuration; import jakarta.validation.constraints.NotNull; import lombok.Data; diff --git a/libs/messaging/src/main/java/smecalculus/bezmen/configuration/HttpPropsEg.java b/libs/messaging/src/main/java/smecalculus/bezmen/configuration/HttpPropsEg.java new file mode 100644 index 00000000..a280e77f --- /dev/null +++ b/libs/messaging/src/main/java/smecalculus/bezmen/configuration/HttpPropsEg.java @@ -0,0 +1,11 @@ +package smecalculus.bezmen.configuration; + +import static smecalculus.bezmen.configuration.MvcPropsEg.Builders.mvcProps; + +public class HttpPropsEg { + public static class Builders { + public static HttpProps.Builder httpProps() { + return HttpProps.builder().webProps(mvcProps().build()); + } + } +} diff --git a/libs/messaging/src/main/java/smecalculus/bezmen/configuration/spec/MessagingCfgMapper.java b/libs/messaging/src/main/java/smecalculus/bezmen/configuration/MessagingCfgMapper.java similarity index 94% rename from libs/messaging/src/main/java/smecalculus/bezmen/configuration/spec/MessagingCfgMapper.java rename to libs/messaging/src/main/java/smecalculus/bezmen/configuration/MessagingCfgMapper.java index 80fd324f..108347f8 100644 --- a/libs/messaging/src/main/java/smecalculus/bezmen/configuration/spec/MessagingCfgMapper.java +++ b/libs/messaging/src/main/java/smecalculus/bezmen/configuration/MessagingCfgMapper.java @@ -1,4 +1,4 @@ -package smecalculus.bezmen.configuration.spec; +package smecalculus.bezmen.configuration; import org.mapstruct.Mapper; import org.mapstruct.Mapping; diff --git a/libs/messaging/src/main/java/smecalculus/bezmen/configuration/spec/MessagingConfig.java b/libs/messaging/src/main/java/smecalculus/bezmen/configuration/MessagingConfig.java similarity index 62% rename from libs/messaging/src/main/java/smecalculus/bezmen/configuration/spec/MessagingConfig.java rename to libs/messaging/src/main/java/smecalculus/bezmen/configuration/MessagingConfig.java index 7680cdb3..78354377 100644 --- a/libs/messaging/src/main/java/smecalculus/bezmen/configuration/spec/MessagingConfig.java +++ b/libs/messaging/src/main/java/smecalculus/bezmen/configuration/MessagingConfig.java @@ -1,4 +1,4 @@ -package smecalculus.bezmen.configuration.spec; +package smecalculus.bezmen.configuration; public interface MessagingConfig { MessagingProps getMessagingProps(); diff --git a/libs/messaging/src/main/java/smecalculus/bezmen/configuration/impl/MessagingConfigImpl.java b/libs/messaging/src/main/java/smecalculus/bezmen/configuration/MessagingConfigImpl.java similarity index 50% rename from libs/messaging/src/main/java/smecalculus/bezmen/configuration/impl/MessagingConfigImpl.java rename to libs/messaging/src/main/java/smecalculus/bezmen/configuration/MessagingConfigImpl.java index 5013641f..a806286c 100644 --- a/libs/messaging/src/main/java/smecalculus/bezmen/configuration/impl/MessagingConfigImpl.java +++ b/libs/messaging/src/main/java/smecalculus/bezmen/configuration/MessagingConfigImpl.java @@ -1,17 +1,12 @@ -package smecalculus.bezmen.configuration.impl; +package smecalculus.bezmen.configuration; import lombok.NonNull; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import smecalculus.bezmen.configuration.spec.ConfigKeeper; -import smecalculus.bezmen.configuration.spec.MessagingCfgMapper; -import smecalculus.bezmen.configuration.spec.MessagingConfig; -import smecalculus.bezmen.configuration.spec.MessagingProps; -import smecalculus.bezmen.configuration.spec.MessagingPropsCfg; -import smecalculus.bezmen.validation.spec.BezmenValidator; +import smecalculus.bezmen.validation.EdgeValidator; public record MessagingConfigImpl( - @NonNull ConfigKeeper keeper, @NonNull BezmenValidator validator, @NonNull MessagingCfgMapper mapper) + @NonNull ConfigKeeper keeper, @NonNull EdgeValidator validator, @NonNull MessagingCfgMapper mapper) implements MessagingConfig { private static final Logger LOG = LoggerFactory.getLogger(MessagingConfigImpl.class); diff --git a/libs/messaging/src/main/java/smecalculus/bezmen/configuration/spec/MessagingProps.java b/libs/messaging/src/main/java/smecalculus/bezmen/configuration/MessagingProps.java similarity index 72% rename from libs/messaging/src/main/java/smecalculus/bezmen/configuration/spec/MessagingProps.java rename to libs/messaging/src/main/java/smecalculus/bezmen/configuration/MessagingProps.java index 56cadd1d..38a6234e 100644 --- a/libs/messaging/src/main/java/smecalculus/bezmen/configuration/spec/MessagingProps.java +++ b/libs/messaging/src/main/java/smecalculus/bezmen/configuration/MessagingProps.java @@ -1,4 +1,4 @@ -package smecalculus.bezmen.configuration.spec; +package smecalculus.bezmen.configuration; import lombok.Builder; import lombok.NonNull; diff --git a/libs/messaging/src/main/java/smecalculus/bezmen/configuration/spec/MessagingPropsCfg.java b/libs/messaging/src/main/java/smecalculus/bezmen/configuration/MessagingPropsCfg.java similarity index 76% rename from libs/messaging/src/main/java/smecalculus/bezmen/configuration/spec/MessagingPropsCfg.java rename to libs/messaging/src/main/java/smecalculus/bezmen/configuration/MessagingPropsCfg.java index e2e3ba0e..298e7076 100644 --- a/libs/messaging/src/main/java/smecalculus/bezmen/configuration/spec/MessagingPropsCfg.java +++ b/libs/messaging/src/main/java/smecalculus/bezmen/configuration/MessagingPropsCfg.java @@ -1,4 +1,4 @@ -package smecalculus.bezmen.configuration.spec; +package smecalculus.bezmen.configuration; import jakarta.validation.constraints.NotNull; import lombok.Data; diff --git a/libs/messaging/src/main/java/smecalculus/bezmen/configuration/MessagingPropsEg.java b/libs/messaging/src/main/java/smecalculus/bezmen/configuration/MessagingPropsEg.java new file mode 100644 index 00000000..18fc531b --- /dev/null +++ b/libs/messaging/src/main/java/smecalculus/bezmen/configuration/MessagingPropsEg.java @@ -0,0 +1,11 @@ +package smecalculus.bezmen.configuration; + +import static smecalculus.bezmen.configuration.ProtocolPropsEg.Builders.protocolProps; + +public class MessagingPropsEg { + public static class Builders { + public static MessagingProps.Builder messagingProps() { + return MessagingProps.builder().protocolProps(protocolProps().build()); + } + } +} diff --git a/libs/messaging/src/main/java/smecalculus/bezmen/configuration/MessagingProtocol.java b/libs/messaging/src/main/java/smecalculus/bezmen/configuration/MessagingProtocol.java new file mode 100644 index 00000000..5a27373b --- /dev/null +++ b/libs/messaging/src/main/java/smecalculus/bezmen/configuration/MessagingProtocol.java @@ -0,0 +1,5 @@ +package smecalculus.bezmen.configuration; + +public enum MessagingProtocol { + HTTP +} diff --git a/libs/messaging/src/main/java/smecalculus/bezmen/configuration/MvcPropsEg.java b/libs/messaging/src/main/java/smecalculus/bezmen/configuration/MvcPropsEg.java new file mode 100644 index 00000000..e7f427c1 --- /dev/null +++ b/libs/messaging/src/main/java/smecalculus/bezmen/configuration/MvcPropsEg.java @@ -0,0 +1,11 @@ +package smecalculus.bezmen.configuration; + +import static smecalculus.bezmen.configuration.WebMode.SPRING_MVC; + +public class MvcPropsEg { + public static class Builders { + public static WebProps.Builder mvcProps() { + return WebProps.builder().webMode(SPRING_MVC); + } + } +} diff --git a/libs/messaging/src/main/java/smecalculus/bezmen/configuration/spec/ProtocolProps.java b/libs/messaging/src/main/java/smecalculus/bezmen/configuration/ProtocolProps.java similarity index 51% rename from libs/messaging/src/main/java/smecalculus/bezmen/configuration/spec/ProtocolProps.java rename to libs/messaging/src/main/java/smecalculus/bezmen/configuration/ProtocolProps.java index a75f0c77..c287920d 100644 --- a/libs/messaging/src/main/java/smecalculus/bezmen/configuration/spec/ProtocolProps.java +++ b/libs/messaging/src/main/java/smecalculus/bezmen/configuration/ProtocolProps.java @@ -1,9 +1,8 @@ -package smecalculus.bezmen.configuration.spec; +package smecalculus.bezmen.configuration; -import edu.umd.cs.findbugs.annotations.Nullable; import java.util.Set; import lombok.Builder; import lombok.NonNull; @Builder -public record ProtocolProps(@NonNull Set types, @Nullable HttpProps httpProps) {} +public record ProtocolProps(@NonNull Set types, HttpProps httpProps) {} diff --git a/libs/messaging/src/main/java/smecalculus/bezmen/configuration/spec/ProtocolPropsCfg.java b/libs/messaging/src/main/java/smecalculus/bezmen/configuration/ProtocolPropsCfg.java similarity index 77% rename from libs/messaging/src/main/java/smecalculus/bezmen/configuration/spec/ProtocolPropsCfg.java rename to libs/messaging/src/main/java/smecalculus/bezmen/configuration/ProtocolPropsCfg.java index c1c81222..9d0a6f51 100644 --- a/libs/messaging/src/main/java/smecalculus/bezmen/configuration/spec/ProtocolPropsCfg.java +++ b/libs/messaging/src/main/java/smecalculus/bezmen/configuration/ProtocolPropsCfg.java @@ -1,11 +1,11 @@ -package smecalculus.bezmen.configuration.spec; +package smecalculus.bezmen.configuration; import com.typesafe.config.Optional; import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.Size; import java.util.Set; import lombok.Data; -import smecalculus.bezmen.validation.spec.ValueOfEnum; +import smecalculus.bezmen.validation.ValueOfEnum; @Data public class ProtocolPropsCfg { diff --git a/libs/messaging/src/main/java/smecalculus/bezmen/configuration/ProtocolPropsEg.java b/libs/messaging/src/main/java/smecalculus/bezmen/configuration/ProtocolPropsEg.java new file mode 100644 index 00000000..220724cd --- /dev/null +++ b/libs/messaging/src/main/java/smecalculus/bezmen/configuration/ProtocolPropsEg.java @@ -0,0 +1,16 @@ +package smecalculus.bezmen.configuration; + +import static smecalculus.bezmen.configuration.HttpPropsEg.Builders.httpProps; +import static smecalculus.bezmen.configuration.MessagingProtocol.HTTP; + +import java.util.Set; + +public class ProtocolPropsEg { + public static class Builders { + public static ProtocolProps.Builder protocolProps() { + return ProtocolProps.builder() + .types(Set.of(HTTP)) + .httpProps(httpProps().build()); + } + } +} diff --git a/libs/messaging/src/main/java/smecalculus/bezmen/configuration/WebMode.java b/libs/messaging/src/main/java/smecalculus/bezmen/configuration/WebMode.java new file mode 100644 index 00000000..71a9df21 --- /dev/null +++ b/libs/messaging/src/main/java/smecalculus/bezmen/configuration/WebMode.java @@ -0,0 +1,5 @@ +package smecalculus.bezmen.configuration; + +public enum WebMode { + SPRING_MVC +} diff --git a/libs/messaging/src/main/java/smecalculus/bezmen/configuration/spec/WebProps.java b/libs/messaging/src/main/java/smecalculus/bezmen/configuration/WebProps.java similarity index 62% rename from libs/messaging/src/main/java/smecalculus/bezmen/configuration/spec/WebProps.java rename to libs/messaging/src/main/java/smecalculus/bezmen/configuration/WebProps.java index aa4f2d55..1c69c120 100644 --- a/libs/messaging/src/main/java/smecalculus/bezmen/configuration/spec/WebProps.java +++ b/libs/messaging/src/main/java/smecalculus/bezmen/configuration/WebProps.java @@ -1,4 +1,4 @@ -package smecalculus.bezmen.configuration.spec; +package smecalculus.bezmen.configuration; import lombok.Builder; diff --git a/libs/messaging/src/main/java/smecalculus/bezmen/configuration/spec/WebPropsCfg.java b/libs/messaging/src/main/java/smecalculus/bezmen/configuration/WebPropsCfg.java similarity index 51% rename from libs/messaging/src/main/java/smecalculus/bezmen/configuration/spec/WebPropsCfg.java rename to libs/messaging/src/main/java/smecalculus/bezmen/configuration/WebPropsCfg.java index 79338587..b01f6041 100644 --- a/libs/messaging/src/main/java/smecalculus/bezmen/configuration/spec/WebPropsCfg.java +++ b/libs/messaging/src/main/java/smecalculus/bezmen/configuration/WebPropsCfg.java @@ -1,7 +1,7 @@ -package smecalculus.bezmen.configuration.spec; +package smecalculus.bezmen.configuration; import lombok.Data; -import smecalculus.bezmen.validation.spec.ValueOfEnum; +import smecalculus.bezmen.validation.ValueOfEnum; @Data public class WebPropsCfg { diff --git a/libs/messaging/src/main/java/smecalculus/bezmen/configuration/spec/MessagingProtocol.java b/libs/messaging/src/main/java/smecalculus/bezmen/configuration/spec/MessagingProtocol.java deleted file mode 100644 index 4545819a..00000000 --- a/libs/messaging/src/main/java/smecalculus/bezmen/configuration/spec/MessagingProtocol.java +++ /dev/null @@ -1,5 +0,0 @@ -package smecalculus.bezmen.configuration.spec; - -public enum MessagingProtocol { - HTTP -} diff --git a/libs/messaging/src/main/java/smecalculus/bezmen/configuration/spec/WebMode.java b/libs/messaging/src/main/java/smecalculus/bezmen/configuration/spec/WebMode.java deleted file mode 100644 index 7f885417..00000000 --- a/libs/messaging/src/main/java/smecalculus/bezmen/configuration/spec/WebMode.java +++ /dev/null @@ -1,5 +0,0 @@ -package smecalculus.bezmen.configuration.spec; - -public enum WebMode { - SPRING_MVC -} diff --git a/libs/messaging/src/main/java/smecalculus/bezmen/construction/spec/ConditionalOnWebMode.java b/libs/messaging/src/main/java/smecalculus/bezmen/construction/ConditionalOnWebMode.java similarity index 80% rename from libs/messaging/src/main/java/smecalculus/bezmen/construction/spec/ConditionalOnWebMode.java rename to libs/messaging/src/main/java/smecalculus/bezmen/construction/ConditionalOnWebMode.java index 64953740..a4544043 100644 --- a/libs/messaging/src/main/java/smecalculus/bezmen/construction/spec/ConditionalOnWebMode.java +++ b/libs/messaging/src/main/java/smecalculus/bezmen/construction/ConditionalOnWebMode.java @@ -1,11 +1,11 @@ -package smecalculus.bezmen.construction.spec; +package smecalculus.bezmen.construction; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import org.springframework.context.annotation.Conditional; -import smecalculus.bezmen.configuration.spec.WebMode; +import smecalculus.bezmen.configuration.WebMode; @Target({ElementType.TYPE, ElementType.METHOD}) @Retention(RetentionPolicy.RUNTIME) diff --git a/libs/messaging/src/main/java/smecalculus/bezmen/construction/spec/MessagingBeans.java b/libs/messaging/src/main/java/smecalculus/bezmen/construction/MessagingBeans.java similarity index 84% rename from libs/messaging/src/main/java/smecalculus/bezmen/construction/spec/MessagingBeans.java rename to libs/messaging/src/main/java/smecalculus/bezmen/construction/MessagingBeans.java index 1b74cc86..7228a635 100644 --- a/libs/messaging/src/main/java/smecalculus/bezmen/construction/spec/MessagingBeans.java +++ b/libs/messaging/src/main/java/smecalculus/bezmen/construction/MessagingBeans.java @@ -1,4 +1,4 @@ -package smecalculus.bezmen.construction.spec; +package smecalculus.bezmen.construction; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; diff --git a/libs/messaging/src/main/java/smecalculus/bezmen/construction/MessagingConfigBeans.java b/libs/messaging/src/main/java/smecalculus/bezmen/construction/MessagingConfigBeans.java new file mode 100644 index 00000000..520139c1 --- /dev/null +++ b/libs/messaging/src/main/java/smecalculus/bezmen/construction/MessagingConfigBeans.java @@ -0,0 +1,30 @@ +package smecalculus.bezmen.construction; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import smecalculus.bezmen.configuration.ConfigKeeper; +import smecalculus.bezmen.configuration.MessagingCfgMapper; +import smecalculus.bezmen.configuration.MessagingCfgMapperImpl; +import smecalculus.bezmen.configuration.MessagingConfig; +import smecalculus.bezmen.configuration.MessagingConfigImpl; +import smecalculus.bezmen.configuration.MessagingProps; +import smecalculus.bezmen.validation.EdgeValidator; + +@Configuration(proxyBeanMethods = false) +public class MessagingConfigBeans { + + @Bean + MessagingCfgMapper messagingCfgMapper() { + return new MessagingCfgMapperImpl(); + } + + @Bean + MessagingConfig messagingConfig(ConfigKeeper keeper, EdgeValidator validator, MessagingCfgMapper mapper) { + return new MessagingConfigImpl(keeper, validator, mapper); + } + + @Bean + MessagingProps messagingProps(MessagingConfig config) { + return config.getMessagingProps(); + } +} diff --git a/libs/messaging/src/main/java/smecalculus/bezmen/construction/spec/WebModeCondition.java b/libs/messaging/src/main/java/smecalculus/bezmen/construction/WebModeCondition.java similarity index 79% rename from libs/messaging/src/main/java/smecalculus/bezmen/construction/spec/WebModeCondition.java rename to libs/messaging/src/main/java/smecalculus/bezmen/construction/WebModeCondition.java index 93c95e3f..49e8b517 100644 --- a/libs/messaging/src/main/java/smecalculus/bezmen/construction/spec/WebModeCondition.java +++ b/libs/messaging/src/main/java/smecalculus/bezmen/construction/WebModeCondition.java @@ -1,16 +1,16 @@ -package smecalculus.bezmen.construction.spec; +package smecalculus.bezmen.construction; import static java.util.Objects.nonNull; import static org.springframework.context.annotation.ConfigurationCondition.ConfigurationPhase.REGISTER_BEAN; -import static smecalculus.bezmen.configuration.spec.MessagingProtocol.HTTP; +import static smecalculus.bezmen.configuration.MessagingProtocol.HTTP; import java.util.Map; import org.springframework.context.annotation.ConditionContext; import org.springframework.context.annotation.ConfigurationCondition; import org.springframework.core.type.AnnotatedTypeMetadata; -import smecalculus.bezmen.configuration.spec.HttpProps; -import smecalculus.bezmen.configuration.spec.MessagingProps; -import smecalculus.bezmen.configuration.spec.WebMode; +import smecalculus.bezmen.configuration.HttpProps; +import smecalculus.bezmen.configuration.MessagingProps; +import smecalculus.bezmen.configuration.WebMode; class WebModeCondition implements ConfigurationCondition { diff --git a/libs/messaging/src/main/java/smecalculus/bezmen/construction/spec/WebSpringMvcBeans.java b/libs/messaging/src/main/java/smecalculus/bezmen/construction/WebSpringMvcBeans.java similarity index 68% rename from libs/messaging/src/main/java/smecalculus/bezmen/construction/spec/WebSpringMvcBeans.java rename to libs/messaging/src/main/java/smecalculus/bezmen/construction/WebSpringMvcBeans.java index 56c104b5..fbd2c7e7 100644 --- a/libs/messaging/src/main/java/smecalculus/bezmen/construction/spec/WebSpringMvcBeans.java +++ b/libs/messaging/src/main/java/smecalculus/bezmen/construction/WebSpringMvcBeans.java @@ -1,6 +1,6 @@ -package smecalculus.bezmen.construction.spec; +package smecalculus.bezmen.construction; -import static smecalculus.bezmen.configuration.spec.WebMode.SPRING_MVC; +import static smecalculus.bezmen.configuration.WebMode.SPRING_MVC; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.EnableWebMvc; diff --git a/libs/messaging/src/main/java/smecalculus/bezmen/construction/spec/MessagingConfigBeans.java b/libs/messaging/src/main/java/smecalculus/bezmen/construction/spec/MessagingConfigBeans.java deleted file mode 100644 index ab754e24..00000000 --- a/libs/messaging/src/main/java/smecalculus/bezmen/construction/spec/MessagingConfigBeans.java +++ /dev/null @@ -1,30 +0,0 @@ -package smecalculus.bezmen.construction.spec; - -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import smecalculus.bezmen.configuration.impl.MessagingConfigImpl; -import smecalculus.bezmen.configuration.spec.ConfigKeeper; -import smecalculus.bezmen.configuration.spec.MessagingCfgMapper; -import smecalculus.bezmen.configuration.spec.MessagingCfgMapperImpl; -import smecalculus.bezmen.configuration.spec.MessagingConfig; -import smecalculus.bezmen.configuration.spec.MessagingProps; -import smecalculus.bezmen.validation.spec.BezmenValidator; - -@Configuration(proxyBeanMethods = false) -public class MessagingConfigBeans { - - @Bean - MessagingCfgMapper messagingCfgMapper() { - return new MessagingCfgMapperImpl(); - } - - @Bean - MessagingConfig messagingConfig(ConfigKeeper keeper, BezmenValidator validator, MessagingCfgMapper mapper) { - return new MessagingConfigImpl(keeper, validator, mapper); - } - - @Bean - MessagingProps messagingProps(MessagingConfig config) { - return config.getMessagingProps(); - } -} diff --git a/libs/client/src/main/java/smecalculus/bezmen/messaging/impl/BezmenClientJavaHttp.java b/libs/messaging/src/main/java/smecalculus/bezmen/messaging/client/BezmenClientJavaHttp.java similarity index 89% rename from libs/client/src/main/java/smecalculus/bezmen/messaging/impl/BezmenClientJavaHttp.java rename to libs/messaging/src/main/java/smecalculus/bezmen/messaging/client/BezmenClientJavaHttp.java index ade5d268..1e639212 100644 --- a/libs/client/src/main/java/smecalculus/bezmen/messaging/impl/BezmenClientJavaHttp.java +++ b/libs/messaging/src/main/java/smecalculus/bezmen/messaging/client/BezmenClientJavaHttp.java @@ -1,4 +1,4 @@ -package smecalculus.bezmen.messaging.impl; +package smecalculus.bezmen.messaging.client; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; @@ -9,9 +9,6 @@ import java.net.http.HttpRequest.BodyPublishers; import java.net.http.HttpResponse; import java.net.http.HttpResponse.BodyHandlers; -import smecalculus.bezmen.messaging.spec.BezmenClient; -import smecalculus.bezmen.messaging.spec.SepulkaRegReq; -import smecalculus.bezmen.messaging.spec.SepulkaRegRes; public record BezmenClientJavaHttp(ObjectMapper mapper, HttpClient client) implements BezmenClient { diff --git a/libs/messaging/src/test/java/smecalculus/bezmen/configuration/MessagingConfigIT.java b/libs/messaging/src/test/java/smecalculus/bezmen/configuration/MessagingConfigIT.java index 8bee8678..12ae4ab2 100644 --- a/libs/messaging/src/test/java/smecalculus/bezmen/configuration/MessagingConfigIT.java +++ b/libs/messaging/src/test/java/smecalculus/bezmen/configuration/MessagingConfigIT.java @@ -1,18 +1,16 @@ package smecalculus.bezmen.configuration; import static org.assertj.core.api.Assertions.assertThat; -import static smecalculus.bezmen.fixture.MessagingPropsFixture.messagingProps; +import static smecalculus.bezmen.configuration.MessagingPropsEg.Builders.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.spec.MessagingConfig; -import smecalculus.bezmen.configuration.spec.MessagingProps; -import smecalculus.bezmen.construction.spec.ConfigBeans; -import smecalculus.bezmen.construction.spec.MessagingConfigBeans; -import smecalculus.bezmen.construction.spec.ValidationBeans; +import smecalculus.bezmen.construction.ConfigBeans; +import smecalculus.bezmen.construction.MessagingConfigBeans; +import smecalculus.bezmen.construction.ValidationBeans; @ExtendWith(SpringExtension.class) @ContextConfiguration(classes = {ConfigBeans.class, ValidationBeans.class, MessagingConfigBeans.class}) diff --git a/libs/messaging/src/test/java/smecalculus/bezmen/fixture/HttpPropsFixture.java b/libs/messaging/src/test/java/smecalculus/bezmen/fixture/HttpPropsFixture.java deleted file mode 100644 index 53611f32..00000000 --- a/libs/messaging/src/test/java/smecalculus/bezmen/fixture/HttpPropsFixture.java +++ /dev/null @@ -1,11 +0,0 @@ -package smecalculus.bezmen.fixture; - -import static smecalculus.bezmen.fixture.MvcPropsFixture.mvcProps; - -import smecalculus.bezmen.configuration.spec.HttpProps; - -public class HttpPropsFixture { - public static HttpProps.Builder httpProps() { - return HttpProps.builder().webProps(mvcProps().build()); - } -} diff --git a/libs/messaging/src/test/java/smecalculus/bezmen/fixture/MessagingPropsFixture.java b/libs/messaging/src/test/java/smecalculus/bezmen/fixture/MessagingPropsFixture.java deleted file mode 100644 index 1744b5f6..00000000 --- a/libs/messaging/src/test/java/smecalculus/bezmen/fixture/MessagingPropsFixture.java +++ /dev/null @@ -1,11 +0,0 @@ -package smecalculus.bezmen.fixture; - -import static smecalculus.bezmen.fixture.ProtocolPropsFixture.protocolProps; - -import smecalculus.bezmen.configuration.spec.MessagingProps; - -public class MessagingPropsFixture { - public static MessagingProps.Builder messagingProps() { - return MessagingProps.builder().protocolProps(protocolProps().build()); - } -} diff --git a/libs/messaging/src/test/java/smecalculus/bezmen/fixture/MvcPropsFixture.java b/libs/messaging/src/test/java/smecalculus/bezmen/fixture/MvcPropsFixture.java deleted file mode 100644 index 70f18c6f..00000000 --- a/libs/messaging/src/test/java/smecalculus/bezmen/fixture/MvcPropsFixture.java +++ /dev/null @@ -1,11 +0,0 @@ -package smecalculus.bezmen.fixture; - -import static smecalculus.bezmen.configuration.spec.WebMode.SPRING_MVC; - -import smecalculus.bezmen.configuration.spec.WebProps; - -public class MvcPropsFixture { - public static WebProps.Builder mvcProps() { - return WebProps.builder().webMode(SPRING_MVC); - } -} diff --git a/libs/messaging/src/test/java/smecalculus/bezmen/fixture/ProtocolPropsFixture.java b/libs/messaging/src/test/java/smecalculus/bezmen/fixture/ProtocolPropsFixture.java deleted file mode 100644 index f2334bde..00000000 --- a/libs/messaging/src/test/java/smecalculus/bezmen/fixture/ProtocolPropsFixture.java +++ /dev/null @@ -1,13 +0,0 @@ -package smecalculus.bezmen.fixture; - -import static smecalculus.bezmen.configuration.spec.MessagingProtocol.HTTP; -import static smecalculus.bezmen.fixture.HttpPropsFixture.httpProps; - -import java.util.Set; -import smecalculus.bezmen.configuration.spec.ProtocolProps; - -public class ProtocolPropsFixture { - public static ProtocolProps.Builder protocolProps() { - return ProtocolProps.builder().types(Set.of(HTTP)).httpProps(httpProps().build()); - } -} diff --git a/libs/pom.xml b/libs/pom.xml index 46ceb394..e3f401ad 100644 --- a/libs/pom.xml +++ b/libs/pom.xml @@ -11,11 +11,11 @@ ${revision} + signatures essentials construction messaging - client - data + storage testing @@ -32,6 +32,7 @@ 5.5.0 false ${skipTests} + true UTF-8 @@ -48,6 +49,11 @@ lombok provided + + org.mapstruct + mapstruct + provided + @@ -57,6 +63,17 @@ construction ${project.version} + + ${project.groupId} + signatures + ${project.version} + + + ${project.groupId} + signatures + ${project.version} + client + ${project.groupId} essentials @@ -64,17 +81,18 @@ ${project.groupId} - client + messaging ${project.version} ${project.groupId} messaging ${project.version} + client ${project.groupId} - data + storage ${project.version} @@ -306,22 +324,21 @@ - - maven-surefire-plugin - org.codehaus.mojo flatten-maven-plugin - maven-dependency-plugin + org.apache.maven.plugins + maven-enforcer-plugin com.diffplug.spotless spotless-maven-plugin - maven-enforcer-plugin + org.apache.maven.plugins + maven-surefire-plugin org.jacoco @@ -350,6 +367,7 @@ + org.apache.maven.plugins maven-compiler-plugin 3.11.0 @@ -377,10 +395,12 @@ ${kotlin.version} + org.apache.maven.plugins maven-resources-plugin 3.3.1 + org.apache.maven.plugins maven-surefire-plugin 3.1.2 @@ -388,6 +408,7 @@ + org.apache.maven.plugins maven-failsafe-plugin 3.1.2 @@ -426,28 +447,6 @@ - - maven-dependency-plugin - 3.6.0 - - - reset - clean - - purge-local-repository - - - true - false - false - artifactId - - ${project.groupId}:${project.artifactId} - - - - - com.diffplug.spotless spotless-maven-plugin @@ -482,6 +481,7 @@ + org.apache.maven.plugins maven-enforcer-plugin 3.4.1 @@ -490,8 +490,12 @@ + + + smecalculus.bezmen + + - smecalculus.bezmen @@ -530,6 +534,22 @@ + + org.apache.maven.plugins + maven-install-plugin + 3.1.1 + + ${isPrivate} + + + + org.apache.maven.plugins + maven-deploy-plugin + 3.1.1 + + ${isPrivate} + + diff --git a/libs/signatures/pom.xml b/libs/signatures/pom.xml new file mode 100644 index 00000000..cf531994 --- /dev/null +++ b/libs/signatures/pom.xml @@ -0,0 +1,49 @@ + + + 4.0.0 + + + smecalculus.bezmen + libs + ${revision} + + + signatures + + + false + + + + + jakarta.validation + jakarta.validation-api + + + + + + + org.apache.maven.plugins + maven-jar-plugin + 3.3.0 + + + client + + jar + + + client + + **/messaging/client/** + + + + + + + + diff --git a/libs/essentials/src/main/java/smecalculus/bezmen/configuration/spec/ConfigKeeper.java b/libs/signatures/src/main/java/smecalculus/bezmen/configuration/ConfigKeeper.java similarity index 62% rename from libs/essentials/src/main/java/smecalculus/bezmen/configuration/spec/ConfigKeeper.java rename to libs/signatures/src/main/java/smecalculus/bezmen/configuration/ConfigKeeper.java index 6a8c4b07..cdb202e1 100644 --- a/libs/essentials/src/main/java/smecalculus/bezmen/configuration/spec/ConfigKeeper.java +++ b/libs/signatures/src/main/java/smecalculus/bezmen/configuration/ConfigKeeper.java @@ -1,4 +1,4 @@ -package smecalculus.bezmen.configuration.spec; +package smecalculus.bezmen.configuration; public interface ConfigKeeper { T read(String key, Class type); diff --git a/libs/essentials/src/main/java/smecalculus/bezmen/domain/spec/Sepulka.java b/libs/signatures/src/main/java/smecalculus/bezmen/core/Sepulka.java similarity index 78% rename from libs/essentials/src/main/java/smecalculus/bezmen/domain/spec/Sepulka.java rename to libs/signatures/src/main/java/smecalculus/bezmen/core/Sepulka.java index 72e246b8..c292edc3 100644 --- a/libs/essentials/src/main/java/smecalculus/bezmen/domain/spec/Sepulka.java +++ b/libs/signatures/src/main/java/smecalculus/bezmen/core/Sepulka.java @@ -1,4 +1,4 @@ -package smecalculus.bezmen.domain.spec; +package smecalculus.bezmen.core; import java.util.UUID; import lombok.Builder; diff --git a/libs/signatures/src/main/java/smecalculus/bezmen/core/SepulkaConverter.java b/libs/signatures/src/main/java/smecalculus/bezmen/core/SepulkaConverter.java new file mode 100644 index 00000000..3595cac8 --- /dev/null +++ b/libs/signatures/src/main/java/smecalculus/bezmen/core/SepulkaConverter.java @@ -0,0 +1,7 @@ +package smecalculus.bezmen.core; + +import smecalculus.bezmen.messaging.client.SepulkaRegRes; + +public interface SepulkaConverter { + SepulkaRegRes toRegRes(Sepulka sepulka); +} diff --git a/libs/signatures/src/main/java/smecalculus/bezmen/core/SepulkaEg.java b/libs/signatures/src/main/java/smecalculus/bezmen/core/SepulkaEg.java new file mode 100644 index 00000000..ae853ae8 --- /dev/null +++ b/libs/signatures/src/main/java/smecalculus/bezmen/core/SepulkaEg.java @@ -0,0 +1,27 @@ +package smecalculus.bezmen.core; + +import java.util.UUID; + +public class SepulkaEg { + public static final String NAME = "foo"; + + public static class Pojos { + public static Sepulka sepulka() { + return Builders.sepulka().build(); + } + + public static Sepulka sepulka(UUID id) { + return Builders.sepulka(id).build(); + } + } + + public static class Builders { + public static Sepulka.Builder sepulka() { + return Sepulka.builder().id(UUID.randomUUID()).name(NAME); + } + + public static Sepulka.Builder sepulka(UUID id) { + return sepulka().id(id); + } + } +} diff --git a/libs/essentials/src/main/java/smecalculus/bezmen/domain/spec/SepulkaService.java b/libs/signatures/src/main/java/smecalculus/bezmen/core/SepulkaService.java similarity index 60% rename from libs/essentials/src/main/java/smecalculus/bezmen/domain/spec/SepulkaService.java rename to libs/signatures/src/main/java/smecalculus/bezmen/core/SepulkaService.java index 0e7462f5..4da8a350 100644 --- a/libs/essentials/src/main/java/smecalculus/bezmen/domain/spec/SepulkaService.java +++ b/libs/signatures/src/main/java/smecalculus/bezmen/core/SepulkaService.java @@ -1,7 +1,7 @@ -package smecalculus.bezmen.domain.spec; +package smecalculus.bezmen.core; import java.util.List; -import smecalculus.bezmen.messaging.spec.SepulkaRegReq; +import smecalculus.bezmen.messaging.client.SepulkaRegReq; public interface SepulkaService { Sepulka register(SepulkaRegReq sepulkaRegReq); diff --git a/libs/client/src/main/java/smecalculus/bezmen/messaging/spec/BezmenClient.java b/libs/signatures/src/main/java/smecalculus/bezmen/messaging/client/BezmenClient.java similarity index 53% rename from libs/client/src/main/java/smecalculus/bezmen/messaging/spec/BezmenClient.java rename to libs/signatures/src/main/java/smecalculus/bezmen/messaging/client/BezmenClient.java index 38582db0..d9defd2a 100644 --- a/libs/client/src/main/java/smecalculus/bezmen/messaging/spec/BezmenClient.java +++ b/libs/signatures/src/main/java/smecalculus/bezmen/messaging/client/BezmenClient.java @@ -1,3 +1,3 @@ -package smecalculus.bezmen.messaging.spec; +package smecalculus.bezmen.messaging.client; public interface BezmenClient extends FooClient {} diff --git a/libs/client/src/main/java/smecalculus/bezmen/messaging/spec/FooClient.java b/libs/signatures/src/main/java/smecalculus/bezmen/messaging/client/FooClient.java similarity index 60% rename from libs/client/src/main/java/smecalculus/bezmen/messaging/spec/FooClient.java rename to libs/signatures/src/main/java/smecalculus/bezmen/messaging/client/FooClient.java index ae186410..040e344d 100644 --- a/libs/client/src/main/java/smecalculus/bezmen/messaging/spec/FooClient.java +++ b/libs/signatures/src/main/java/smecalculus/bezmen/messaging/client/FooClient.java @@ -1,4 +1,4 @@ -package smecalculus.bezmen.messaging.spec; +package smecalculus.bezmen.messaging.client; interface FooClient extends SepulkaClient { boolean isReady(); diff --git a/libs/client/src/main/java/smecalculus/bezmen/messaging/spec/SepulkaClient.java b/libs/signatures/src/main/java/smecalculus/bezmen/messaging/client/SepulkaClient.java similarity index 65% rename from libs/client/src/main/java/smecalculus/bezmen/messaging/spec/SepulkaClient.java rename to libs/signatures/src/main/java/smecalculus/bezmen/messaging/client/SepulkaClient.java index 3be99567..abf3b4c0 100644 --- a/libs/client/src/main/java/smecalculus/bezmen/messaging/spec/SepulkaClient.java +++ b/libs/signatures/src/main/java/smecalculus/bezmen/messaging/client/SepulkaClient.java @@ -1,4 +1,4 @@ -package smecalculus.bezmen.messaging.spec; +package smecalculus.bezmen.messaging.client; public interface SepulkaClient { SepulkaRegRes register(SepulkaRegReq request); diff --git a/libs/client/src/main/java/smecalculus/bezmen/messaging/spec/SepulkaRegReq.java b/libs/signatures/src/main/java/smecalculus/bezmen/messaging/client/SepulkaRegReq.java similarity index 63% rename from libs/client/src/main/java/smecalculus/bezmen/messaging/spec/SepulkaRegReq.java rename to libs/signatures/src/main/java/smecalculus/bezmen/messaging/client/SepulkaRegReq.java index 44179186..cab34c34 100644 --- a/libs/client/src/main/java/smecalculus/bezmen/messaging/spec/SepulkaRegReq.java +++ b/libs/signatures/src/main/java/smecalculus/bezmen/messaging/client/SepulkaRegReq.java @@ -1,4 +1,4 @@ -package smecalculus.bezmen.messaging.spec; +package smecalculus.bezmen.messaging.client; import lombok.NonNull; diff --git a/libs/signatures/src/main/java/smecalculus/bezmen/messaging/client/SepulkaRegReqEg.java b/libs/signatures/src/main/java/smecalculus/bezmen/messaging/client/SepulkaRegReqEg.java new file mode 100644 index 00000000..3b91a719 --- /dev/null +++ b/libs/signatures/src/main/java/smecalculus/bezmen/messaging/client/SepulkaRegReqEg.java @@ -0,0 +1,11 @@ +package smecalculus.bezmen.messaging.client; + +public class SepulkaRegReqEg { + public static final String NAME = "foo"; + + public static class Pojos { + public static SepulkaRegReq sepulkaRegReq() { + return new SepulkaRegReq(NAME); + } + } +} diff --git a/libs/client/src/main/java/smecalculus/bezmen/messaging/spec/SepulkaRegRes.java b/libs/signatures/src/main/java/smecalculus/bezmen/messaging/client/SepulkaRegRes.java similarity index 72% rename from libs/client/src/main/java/smecalculus/bezmen/messaging/spec/SepulkaRegRes.java rename to libs/signatures/src/main/java/smecalculus/bezmen/messaging/client/SepulkaRegRes.java index aaadb70c..dfd805c1 100644 --- a/libs/client/src/main/java/smecalculus/bezmen/messaging/spec/SepulkaRegRes.java +++ b/libs/signatures/src/main/java/smecalculus/bezmen/messaging/client/SepulkaRegRes.java @@ -1,4 +1,4 @@ -package smecalculus.bezmen.messaging.spec; +package smecalculus.bezmen.messaging.client; import java.util.UUID; import lombok.NonNull; diff --git a/libs/signatures/src/main/java/smecalculus/bezmen/messaging/client/SepulkaRegResEg.java b/libs/signatures/src/main/java/smecalculus/bezmen/messaging/client/SepulkaRegResEg.java new file mode 100644 index 00000000..c386bff4 --- /dev/null +++ b/libs/signatures/src/main/java/smecalculus/bezmen/messaging/client/SepulkaRegResEg.java @@ -0,0 +1,21 @@ +package smecalculus.bezmen.messaging.client; + +import java.util.UUID; + +public class SepulkaRegResEg { + public static final String NAME = "foo"; + + public static class Pojos { + public static SepulkaRegRes sepulkaRegRes() { + return new SepulkaRegRes(UUID.randomUUID(), NAME); + } + + public static SepulkaRegRes sepulkaRegRes(String name) { + return new SepulkaRegRes(UUID.randomUUID(), name); + } + + public static SepulkaRegRes sepulkaRegRes(UUID id) { + return new SepulkaRegRes(id, NAME); + } + } +} diff --git a/libs/signatures/src/main/java/smecalculus/bezmen/validation/EdgeValidator.java b/libs/signatures/src/main/java/smecalculus/bezmen/validation/EdgeValidator.java new file mode 100644 index 00000000..eff4e408 --- /dev/null +++ b/libs/signatures/src/main/java/smecalculus/bezmen/validation/EdgeValidator.java @@ -0,0 +1,5 @@ +package smecalculus.bezmen.validation; + +public interface EdgeValidator { + void validate(T object, Class... groups); +} diff --git a/libs/data/README.adoc b/libs/storage/README.adoc similarity index 100% rename from libs/data/README.adoc rename to libs/storage/README.adoc diff --git a/libs/data/pom.xml b/libs/storage/pom.xml similarity index 98% rename from libs/data/pom.xml rename to libs/storage/pom.xml index 583fa19b..5f92b998 100644 --- a/libs/data/pom.xml +++ b/libs/storage/pom.xml @@ -10,7 +10,7 @@ ${revision} - data + storage diff --git a/libs/data/src/main/java/smecalculus/bezmen/configuration/spec/H2Props.java b/libs/storage/src/main/java/smecalculus/bezmen/configuration/H2Props.java similarity index 80% rename from libs/data/src/main/java/smecalculus/bezmen/configuration/spec/H2Props.java rename to libs/storage/src/main/java/smecalculus/bezmen/configuration/H2Props.java index a4086a88..a16d6945 100644 --- a/libs/data/src/main/java/smecalculus/bezmen/configuration/spec/H2Props.java +++ b/libs/storage/src/main/java/smecalculus/bezmen/configuration/H2Props.java @@ -1,4 +1,4 @@ -package smecalculus.bezmen.configuration.spec; +package smecalculus.bezmen.configuration; import lombok.Builder; import lombok.NonNull; diff --git a/libs/data/src/main/java/smecalculus/bezmen/configuration/spec/H2PropsCfg.java b/libs/storage/src/main/java/smecalculus/bezmen/configuration/H2PropsCfg.java similarity index 81% rename from libs/data/src/main/java/smecalculus/bezmen/configuration/spec/H2PropsCfg.java rename to libs/storage/src/main/java/smecalculus/bezmen/configuration/H2PropsCfg.java index 2a6ec10c..f7eaf189 100644 --- a/libs/data/src/main/java/smecalculus/bezmen/configuration/spec/H2PropsCfg.java +++ b/libs/storage/src/main/java/smecalculus/bezmen/configuration/H2PropsCfg.java @@ -1,4 +1,4 @@ -package smecalculus.bezmen.configuration.spec; +package smecalculus.bezmen.configuration; import jakarta.validation.constraints.NotBlank; import lombok.Data; diff --git a/libs/data/src/main/java/smecalculus/bezmen/configuration/spec/OrmMode.java b/libs/storage/src/main/java/smecalculus/bezmen/configuration/OrmMode.java similarity index 53% rename from libs/data/src/main/java/smecalculus/bezmen/configuration/spec/OrmMode.java rename to libs/storage/src/main/java/smecalculus/bezmen/configuration/OrmMode.java index 82cf8354..2004aee5 100644 --- a/libs/data/src/main/java/smecalculus/bezmen/configuration/spec/OrmMode.java +++ b/libs/storage/src/main/java/smecalculus/bezmen/configuration/OrmMode.java @@ -1,4 +1,4 @@ -package smecalculus.bezmen.configuration.spec; +package smecalculus.bezmen.configuration; public enum OrmMode { SPRING_DATA, diff --git a/libs/data/src/main/java/smecalculus/bezmen/configuration/spec/OrmProps.java b/libs/storage/src/main/java/smecalculus/bezmen/configuration/OrmProps.java similarity index 61% rename from libs/data/src/main/java/smecalculus/bezmen/configuration/spec/OrmProps.java rename to libs/storage/src/main/java/smecalculus/bezmen/configuration/OrmProps.java index 23abf5e0..9d6b4c68 100644 --- a/libs/data/src/main/java/smecalculus/bezmen/configuration/spec/OrmProps.java +++ b/libs/storage/src/main/java/smecalculus/bezmen/configuration/OrmProps.java @@ -1,4 +1,4 @@ -package smecalculus.bezmen.configuration.spec; +package smecalculus.bezmen.configuration; import lombok.Builder; diff --git a/libs/data/src/main/java/smecalculus/bezmen/configuration/spec/OrmPropsCfg.java b/libs/storage/src/main/java/smecalculus/bezmen/configuration/OrmPropsCfg.java similarity index 52% rename from libs/data/src/main/java/smecalculus/bezmen/configuration/spec/OrmPropsCfg.java rename to libs/storage/src/main/java/smecalculus/bezmen/configuration/OrmPropsCfg.java index 0952e13b..b878848a 100644 --- a/libs/data/src/main/java/smecalculus/bezmen/configuration/spec/OrmPropsCfg.java +++ b/libs/storage/src/main/java/smecalculus/bezmen/configuration/OrmPropsCfg.java @@ -1,7 +1,7 @@ -package smecalculus.bezmen.configuration.spec; +package smecalculus.bezmen.configuration; import lombok.Data; -import smecalculus.bezmen.validation.spec.ValueOfEnum; +import smecalculus.bezmen.validation.ValueOfEnum; @Data public class OrmPropsCfg { diff --git a/libs/storage/src/main/java/smecalculus/bezmen/configuration/OrmPropsEg.java b/libs/storage/src/main/java/smecalculus/bezmen/configuration/OrmPropsEg.java new file mode 100644 index 00000000..ba39bb55 --- /dev/null +++ b/libs/storage/src/main/java/smecalculus/bezmen/configuration/OrmPropsEg.java @@ -0,0 +1,19 @@ +package smecalculus.bezmen.configuration; + +import static smecalculus.bezmen.configuration.OrmMode.SPRING_DATA; + +public class OrmPropsEg { + public static class Pojos { + public static OrmPropsCfg ormPropsCfg() { + OrmPropsCfg ormPropsCfg = new OrmPropsCfg(); + ormPropsCfg.setMode(SPRING_DATA.name()); + return ormPropsCfg; + } + } + + public static class Builders { + public static OrmProps.Builder ormProps() { + return OrmProps.builder().mode(SPRING_DATA); + } + } +} diff --git a/libs/data/src/main/java/smecalculus/bezmen/configuration/spec/PostgresProps.java b/libs/storage/src/main/java/smecalculus/bezmen/configuration/PostgresProps.java similarity index 81% rename from libs/data/src/main/java/smecalculus/bezmen/configuration/spec/PostgresProps.java rename to libs/storage/src/main/java/smecalculus/bezmen/configuration/PostgresProps.java index ba372e79..b80f1901 100644 --- a/libs/data/src/main/java/smecalculus/bezmen/configuration/spec/PostgresProps.java +++ b/libs/storage/src/main/java/smecalculus/bezmen/configuration/PostgresProps.java @@ -1,4 +1,4 @@ -package smecalculus.bezmen.configuration.spec; +package smecalculus.bezmen.configuration; import lombok.Builder; import lombok.NonNull; diff --git a/libs/data/src/main/java/smecalculus/bezmen/configuration/spec/PostgresPropsCfg.java b/libs/storage/src/main/java/smecalculus/bezmen/configuration/PostgresPropsCfg.java similarity index 84% rename from libs/data/src/main/java/smecalculus/bezmen/configuration/spec/PostgresPropsCfg.java rename to libs/storage/src/main/java/smecalculus/bezmen/configuration/PostgresPropsCfg.java index e02c3f34..d0839893 100644 --- a/libs/data/src/main/java/smecalculus/bezmen/configuration/spec/PostgresPropsCfg.java +++ b/libs/storage/src/main/java/smecalculus/bezmen/configuration/PostgresPropsCfg.java @@ -1,4 +1,4 @@ -package smecalculus.bezmen.configuration.spec; +package smecalculus.bezmen.configuration; import jakarta.validation.constraints.NotBlank; import lombok.Data; diff --git a/libs/data/src/main/java/smecalculus/bezmen/configuration/spec/DataCfgMapper.java b/libs/storage/src/main/java/smecalculus/bezmen/configuration/StorageCfgMapper.java similarity index 81% rename from libs/data/src/main/java/smecalculus/bezmen/configuration/spec/DataCfgMapper.java rename to libs/storage/src/main/java/smecalculus/bezmen/configuration/StorageCfgMapper.java index 249e6c8c..32eacb99 100644 --- a/libs/data/src/main/java/smecalculus/bezmen/configuration/spec/DataCfgMapper.java +++ b/libs/storage/src/main/java/smecalculus/bezmen/configuration/StorageCfgMapper.java @@ -1,14 +1,14 @@ -package smecalculus.bezmen.configuration.spec; +package smecalculus.bezmen.configuration; import org.mapstruct.Mapper; import org.mapstruct.Mapping; @Mapper -public interface DataCfgMapper { +public interface StorageCfgMapper { @Mapping(source = "vendor", target = "vendorProps") @Mapping(source = "orm", target = "ormProps") - DataProps toDomain(DataPropsCfg dataPropsCfg); + StorageProps toDomain(StoragePropsCfg storagePropsCfg); @Mapping(source = "h2", target = "h2Props") @Mapping(source = "postgres", target = "postgresProps") diff --git a/libs/storage/src/main/java/smecalculus/bezmen/configuration/StorageConfig.java b/libs/storage/src/main/java/smecalculus/bezmen/configuration/StorageConfig.java new file mode 100644 index 00000000..159b41fb --- /dev/null +++ b/libs/storage/src/main/java/smecalculus/bezmen/configuration/StorageConfig.java @@ -0,0 +1,5 @@ +package smecalculus.bezmen.configuration; + +public interface StorageConfig { + StorageProps getStorageProps(); +} diff --git a/libs/storage/src/main/java/smecalculus/bezmen/configuration/StorageConfigImpl.java b/libs/storage/src/main/java/smecalculus/bezmen/configuration/StorageConfigImpl.java new file mode 100644 index 00000000..1ec3263b --- /dev/null +++ b/libs/storage/src/main/java/smecalculus/bezmen/configuration/StorageConfigImpl.java @@ -0,0 +1,21 @@ +package smecalculus.bezmen.configuration; + +import lombok.NonNull; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import smecalculus.bezmen.validation.EdgeValidator; + +public record StorageConfigImpl( + @NonNull ConfigKeeper configKeeper, @NonNull EdgeValidator validator, @NonNull StorageCfgMapper mapper) + implements StorageConfig { + + private static final Logger LOG = LoggerFactory.getLogger(StorageConfigImpl.class); + + @Override + public StorageProps getStorageProps() { + StoragePropsCfg propsCfg = configKeeper.read("bezmen.storage", StoragePropsCfg.class); + validator.validate(propsCfg); + LOG.info("Read {}", propsCfg); + return mapper.toDomain(propsCfg); + } +} diff --git a/libs/storage/src/main/java/smecalculus/bezmen/configuration/StorageProps.java b/libs/storage/src/main/java/smecalculus/bezmen/configuration/StorageProps.java new file mode 100644 index 00000000..4ad9d78e --- /dev/null +++ b/libs/storage/src/main/java/smecalculus/bezmen/configuration/StorageProps.java @@ -0,0 +1,7 @@ +package smecalculus.bezmen.configuration; + +import lombok.Builder; +import lombok.NonNull; + +@Builder +public record StorageProps(@NonNull VendorProps vendorProps, @NonNull OrmProps ormProps) {} diff --git a/libs/data/src/main/java/smecalculus/bezmen/configuration/spec/DataPropsCfg.java b/libs/storage/src/main/java/smecalculus/bezmen/configuration/StoragePropsCfg.java similarity index 67% rename from libs/data/src/main/java/smecalculus/bezmen/configuration/spec/DataPropsCfg.java rename to libs/storage/src/main/java/smecalculus/bezmen/configuration/StoragePropsCfg.java index d77140a2..e350d492 100644 --- a/libs/data/src/main/java/smecalculus/bezmen/configuration/spec/DataPropsCfg.java +++ b/libs/storage/src/main/java/smecalculus/bezmen/configuration/StoragePropsCfg.java @@ -1,10 +1,10 @@ -package smecalculus.bezmen.configuration.spec; +package smecalculus.bezmen.configuration; import jakarta.validation.constraints.NotNull; import lombok.Data; @Data -public class DataPropsCfg { +public class StoragePropsCfg { @NotNull VendorPropsCfg vendor; diff --git a/libs/storage/src/main/java/smecalculus/bezmen/configuration/StoragePropsEg.java b/libs/storage/src/main/java/smecalculus/bezmen/configuration/StoragePropsEg.java new file mode 100644 index 00000000..07904dfc --- /dev/null +++ b/libs/storage/src/main/java/smecalculus/bezmen/configuration/StoragePropsEg.java @@ -0,0 +1,25 @@ +package smecalculus.bezmen.configuration; + +import static smecalculus.bezmen.configuration.OrmPropsEg.Builders.ormProps; +import static smecalculus.bezmen.configuration.OrmPropsEg.Pojos.ormPropsCfg; +import static smecalculus.bezmen.configuration.VendorPropsEg.Builders.vendorProps; +import static smecalculus.bezmen.configuration.VendorPropsEg.Pojos.vendorPropsCfg; + +public class StoragePropsEg { + public static class Pojos { + public static StoragePropsCfg storagePropsCfg() { + StoragePropsCfg storagePropsCfg = new StoragePropsCfg(); + storagePropsCfg.setVendor(vendorPropsCfg()); + storagePropsCfg.setOrm(ormPropsCfg()); + return storagePropsCfg; + } + } + + public static class Builders { + public static StorageProps.Builder storageProps() { + return StorageProps.builder() + .vendorProps(vendorProps().build()) + .ormProps(ormProps().build()); + } + } +} diff --git a/libs/data/src/main/java/smecalculus/bezmen/configuration/spec/VendorMode.java b/libs/storage/src/main/java/smecalculus/bezmen/configuration/VendorMode.java similarity index 51% rename from libs/data/src/main/java/smecalculus/bezmen/configuration/spec/VendorMode.java rename to libs/storage/src/main/java/smecalculus/bezmen/configuration/VendorMode.java index eaa2de28..88e8f04b 100644 --- a/libs/data/src/main/java/smecalculus/bezmen/configuration/spec/VendorMode.java +++ b/libs/storage/src/main/java/smecalculus/bezmen/configuration/VendorMode.java @@ -1,4 +1,4 @@ -package smecalculus.bezmen.configuration.spec; +package smecalculus.bezmen.configuration; public enum VendorMode { H2, diff --git a/libs/data/src/main/java/smecalculus/bezmen/configuration/spec/VendorProps.java b/libs/storage/src/main/java/smecalculus/bezmen/configuration/VendorProps.java similarity index 82% rename from libs/data/src/main/java/smecalculus/bezmen/configuration/spec/VendorProps.java rename to libs/storage/src/main/java/smecalculus/bezmen/configuration/VendorProps.java index 5fd9ead4..1f9d18bd 100644 --- a/libs/data/src/main/java/smecalculus/bezmen/configuration/spec/VendorProps.java +++ b/libs/storage/src/main/java/smecalculus/bezmen/configuration/VendorProps.java @@ -1,4 +1,4 @@ -package smecalculus.bezmen.configuration.spec; +package smecalculus.bezmen.configuration; import edu.umd.cs.findbugs.annotations.Nullable; import lombok.Builder; diff --git a/libs/data/src/main/java/smecalculus/bezmen/configuration/spec/VendorPropsCfg.java b/libs/storage/src/main/java/smecalculus/bezmen/configuration/VendorPropsCfg.java similarity index 69% rename from libs/data/src/main/java/smecalculus/bezmen/configuration/spec/VendorPropsCfg.java rename to libs/storage/src/main/java/smecalculus/bezmen/configuration/VendorPropsCfg.java index eb461b73..a89299fa 100644 --- a/libs/data/src/main/java/smecalculus/bezmen/configuration/spec/VendorPropsCfg.java +++ b/libs/storage/src/main/java/smecalculus/bezmen/configuration/VendorPropsCfg.java @@ -1,8 +1,8 @@ -package smecalculus.bezmen.configuration.spec; +package smecalculus.bezmen.configuration; import com.typesafe.config.Optional; import lombok.Data; -import smecalculus.bezmen.validation.spec.ValueOfEnum; +import smecalculus.bezmen.validation.ValueOfEnum; @Data public class VendorPropsCfg { diff --git a/libs/storage/src/main/java/smecalculus/bezmen/configuration/VendorPropsEg.java b/libs/storage/src/main/java/smecalculus/bezmen/configuration/VendorPropsEg.java new file mode 100644 index 00000000..63741585 --- /dev/null +++ b/libs/storage/src/main/java/smecalculus/bezmen/configuration/VendorPropsEg.java @@ -0,0 +1,24 @@ +package smecalculus.bezmen.configuration; + +public class VendorPropsEg { + public static class Pojos { + public static VendorPropsCfg vendorPropsCfg() { + VendorPropsCfg vendorPropsCfg = new VendorPropsCfg(); + vendorPropsCfg.setMode(VendorMode.H2.name()); + return vendorPropsCfg; + } + } + + public static class Builders { + public static VendorProps.Builder vendorProps() { + return VendorProps.builder() + .mode(VendorMode.H2) + .h2Props(H2Props.builder() + .url("jdbc:h2:mem:db;DB_CLOSE_DELAY=-1") + .username("sa") + .password("sa") + .build()) + .postgresProps(null); + } + } +} diff --git a/libs/data/src/main/java/smecalculus/bezmen/construction/spec/ConditionalOnOrmMode.java b/libs/storage/src/main/java/smecalculus/bezmen/construction/ConditionalOnOrmMode.java similarity index 80% rename from libs/data/src/main/java/smecalculus/bezmen/construction/spec/ConditionalOnOrmMode.java rename to libs/storage/src/main/java/smecalculus/bezmen/construction/ConditionalOnOrmMode.java index e7d41a17..05b00715 100644 --- a/libs/data/src/main/java/smecalculus/bezmen/construction/spec/ConditionalOnOrmMode.java +++ b/libs/storage/src/main/java/smecalculus/bezmen/construction/ConditionalOnOrmMode.java @@ -1,11 +1,11 @@ -package smecalculus.bezmen.construction.spec; +package smecalculus.bezmen.construction; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import org.springframework.context.annotation.Conditional; -import smecalculus.bezmen.configuration.spec.OrmMode; +import smecalculus.bezmen.configuration.OrmMode; @Target({ElementType.TYPE, ElementType.METHOD}) @Retention(RetentionPolicy.RUNTIME) diff --git a/libs/data/src/main/java/smecalculus/bezmen/construction/spec/OrmModeCondition.java b/libs/storage/src/main/java/smecalculus/bezmen/construction/OrmModeCondition.java similarity index 77% rename from libs/data/src/main/java/smecalculus/bezmen/construction/spec/OrmModeCondition.java rename to libs/storage/src/main/java/smecalculus/bezmen/construction/OrmModeCondition.java index 8969f668..085303fe 100644 --- a/libs/data/src/main/java/smecalculus/bezmen/construction/spec/OrmModeCondition.java +++ b/libs/storage/src/main/java/smecalculus/bezmen/construction/OrmModeCondition.java @@ -1,4 +1,4 @@ -package smecalculus.bezmen.construction.spec; +package smecalculus.bezmen.construction; import static org.springframework.context.annotation.ConfigurationCondition.ConfigurationPhase.REGISTER_BEAN; @@ -6,8 +6,8 @@ import org.springframework.context.annotation.ConditionContext; import org.springframework.context.annotation.ConfigurationCondition; import org.springframework.core.type.AnnotatedTypeMetadata; -import smecalculus.bezmen.configuration.spec.DataProps; -import smecalculus.bezmen.configuration.spec.OrmMode; +import smecalculus.bezmen.configuration.OrmMode; +import smecalculus.bezmen.configuration.StorageProps; class OrmModeCondition implements ConfigurationCondition { @@ -15,7 +15,7 @@ class OrmModeCondition implements ConfigurationCondition { public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) { Map attributes = metadata.getAnnotationAttributes(ConditionalOnOrmMode.class.getName()); OrmMode mode = (OrmMode) attributes.get("value"); - DataProps props = context.getBeanFactory().getBean(DataProps.class); + StorageProps props = context.getBeanFactory().getBean(StorageProps.class); return mode == props.ormProps().mode(); } diff --git a/libs/data/src/main/java/smecalculus/bezmen/construction/spec/OrmMyBatisBeans.java b/libs/storage/src/main/java/smecalculus/bezmen/construction/OrmMyBatisBeans.java similarity index 78% rename from libs/data/src/main/java/smecalculus/bezmen/construction/spec/OrmMyBatisBeans.java rename to libs/storage/src/main/java/smecalculus/bezmen/construction/OrmMyBatisBeans.java index 9389961e..4b2516b5 100644 --- a/libs/data/src/main/java/smecalculus/bezmen/construction/spec/OrmMyBatisBeans.java +++ b/libs/storage/src/main/java/smecalculus/bezmen/construction/OrmMyBatisBeans.java @@ -1,6 +1,6 @@ -package smecalculus.bezmen.construction.spec; +package smecalculus.bezmen.construction; -import static smecalculus.bezmen.configuration.spec.OrmMode.MY_BATIS; +import static smecalculus.bezmen.configuration.OrmMode.MY_BATIS; import javax.sql.DataSource; import org.apache.ibatis.session.SqlSessionFactory; @@ -11,7 +11,7 @@ @Configuration(proxyBeanMethods = false) @ConditionalOnOrmMode(MY_BATIS) -@MapperScan(basePackages = "smecalculus.bezmen.data.spec.mybatis") +@MapperScan(basePackages = "smecalculus.bezmen.storage.mybatis") public class OrmMyBatisBeans { @Bean diff --git a/libs/data/src/main/java/smecalculus/bezmen/construction/spec/OrmSpringDataBeans.java b/libs/storage/src/main/java/smecalculus/bezmen/construction/OrmSpringDataBeans.java similarity index 77% rename from libs/data/src/main/java/smecalculus/bezmen/construction/spec/OrmSpringDataBeans.java rename to libs/storage/src/main/java/smecalculus/bezmen/construction/OrmSpringDataBeans.java index 1d9c5dd5..f6fb61ab 100644 --- a/libs/data/src/main/java/smecalculus/bezmen/construction/spec/OrmSpringDataBeans.java +++ b/libs/storage/src/main/java/smecalculus/bezmen/construction/OrmSpringDataBeans.java @@ -1,6 +1,6 @@ -package smecalculus.bezmen.construction.spec; +package smecalculus.bezmen.construction; -import static smecalculus.bezmen.configuration.spec.OrmMode.SPRING_DATA; +import static smecalculus.bezmen.configuration.OrmMode.SPRING_DATA; import javax.sql.DataSource; import org.springframework.context.annotation.Bean; @@ -13,12 +13,12 @@ import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; import org.springframework.jdbc.datasource.DataSourceTransactionManager; import org.springframework.transaction.PlatformTransactionManager; -import smecalculus.bezmen.configuration.spec.DataProps; -import smecalculus.bezmen.configuration.spec.VendorProps; +import smecalculus.bezmen.configuration.StorageProps; +import smecalculus.bezmen.configuration.VendorProps; @Configuration(proxyBeanMethods = false) @ConditionalOnOrmMode(SPRING_DATA) -@EnableJdbcRepositories("smecalculus.bezmen.data.spec.springdata") +@EnableJdbcRepositories("smecalculus.bezmen.storage.springdata") public class OrmSpringDataBeans extends AbstractJdbcConfiguration { @Bean @@ -32,8 +32,8 @@ public PlatformTransactionManager transactionManager(DataSource dataSource) { } @Bean - public Dialect dialect(DataProps dataProps) { - VendorProps vendorProps = dataProps.vendorProps(); + public Dialect dialect(StorageProps storageProps) { + VendorProps vendorProps = storageProps.vendorProps(); return switch (vendorProps.mode()) { case H2 -> H2Dialect.INSTANCE; case POSTGRES -> PostgresDialect.INSTANCE; diff --git a/libs/data/src/main/java/smecalculus/bezmen/construction/spec/DataBeans.java b/libs/storage/src/main/java/smecalculus/bezmen/construction/StorageBeans.java similarity index 70% rename from libs/data/src/main/java/smecalculus/bezmen/construction/spec/DataBeans.java rename to libs/storage/src/main/java/smecalculus/bezmen/construction/StorageBeans.java index 5b71668f..ec9e2d52 100644 --- a/libs/data/src/main/java/smecalculus/bezmen/construction/spec/DataBeans.java +++ b/libs/storage/src/main/java/smecalculus/bezmen/construction/StorageBeans.java @@ -1,23 +1,23 @@ -package smecalculus.bezmen.construction.spec; +package smecalculus.bezmen.construction; import javax.sql.DataSource; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; import org.springframework.jdbc.datasource.DriverManagerDataSource; -import smecalculus.bezmen.configuration.spec.DataProps; -import smecalculus.bezmen.configuration.spec.H2Props; -import smecalculus.bezmen.configuration.spec.PostgresProps; -import smecalculus.bezmen.configuration.spec.VendorProps; +import smecalculus.bezmen.configuration.H2Props; +import smecalculus.bezmen.configuration.PostgresProps; +import smecalculus.bezmen.configuration.StorageProps; +import smecalculus.bezmen.configuration.VendorProps; @Configuration(proxyBeanMethods = false) -@Import({DataConfigBeans.class, OrmMyBatisBeans.class, OrmSpringDataBeans.class}) -public class DataBeans { +@Import({StorageConfigBeans.class, OrmMyBatisBeans.class, OrmSpringDataBeans.class}) +public class StorageBeans { @Bean - public DataSource dataSource(DataProps dataProps) { + public DataSource dataSource(StorageProps storageProps) { DriverManagerDataSource dataSource = new DriverManagerDataSource(); - VendorProps vendorProps = dataProps.vendorProps(); + VendorProps vendorProps = storageProps.vendorProps(); switch (vendorProps.mode()) { case H2 -> configure(dataSource, vendorProps.h2Props()); case POSTGRES -> configure(dataSource, vendorProps.postgresProps()); diff --git a/libs/storage/src/main/java/smecalculus/bezmen/construction/StorageConfigBeans.java b/libs/storage/src/main/java/smecalculus/bezmen/construction/StorageConfigBeans.java new file mode 100644 index 00000000..9c5ddde8 --- /dev/null +++ b/libs/storage/src/main/java/smecalculus/bezmen/construction/StorageConfigBeans.java @@ -0,0 +1,30 @@ +package smecalculus.bezmen.construction; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import smecalculus.bezmen.configuration.ConfigKeeper; +import smecalculus.bezmen.configuration.StorageCfgMapper; +import smecalculus.bezmen.configuration.StorageCfgMapperImpl; +import smecalculus.bezmen.configuration.StorageConfig; +import smecalculus.bezmen.configuration.StorageConfigImpl; +import smecalculus.bezmen.configuration.StorageProps; +import smecalculus.bezmen.validation.EdgeValidator; + +@Configuration(proxyBeanMethods = false) +public class StorageConfigBeans { + + @Bean + StorageCfgMapper storageCfgMapper() { + return new StorageCfgMapperImpl(); + } + + @Bean + StorageConfig storageConfig(ConfigKeeper keeper, EdgeValidator validator, StorageCfgMapper mapper) { + return new StorageConfigImpl(keeper, validator, mapper); + } + + @Bean + StorageProps storageProps(StorageConfig config) { + return config.getStorageProps(); + } +} diff --git a/libs/data/src/main/resources/reference.conf b/libs/storage/src/main/resources/reference.conf similarity index 94% rename from libs/data/src/main/resources/reference.conf rename to libs/storage/src/main/resources/reference.conf index d617b41f..f1764fd6 100644 --- a/libs/data/src/main/resources/reference.conf +++ b/libs/storage/src/main/resources/reference.conf @@ -1,5 +1,5 @@ bezmen { - data { + storage { vendor { mode = h2 h2 { diff --git a/libs/storage/src/test/java/smecalculus/bezmen/configuration/StorageConfigIT.java b/libs/storage/src/test/java/smecalculus/bezmen/configuration/StorageConfigIT.java new file mode 100644 index 00000000..56478a46 --- /dev/null +++ b/libs/storage/src/test/java/smecalculus/bezmen/configuration/StorageConfigIT.java @@ -0,0 +1,31 @@ +package smecalculus.bezmen.configuration; + +import static org.assertj.core.api.Assertions.assertThat; +import static smecalculus.bezmen.configuration.StoragePropsEg.Builders.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.construction.ConfigBeans; +import smecalculus.bezmen.construction.StorageConfigBeans; +import smecalculus.bezmen.construction.ValidationBeans; + +@ExtendWith(SpringExtension.class) +@ContextConfiguration(classes = {ConfigBeans.class, ValidationBeans.class, StorageConfigBeans.class}) +abstract class StorageConfigIT { + + @Autowired + StorageConfig storageConfig; + + @Test + void defaultConfShouldBeBackwardCompatible() { + // given + StorageProps expectedStorageProps = storageProps().build(); + // when + StorageProps actualStorageProps = storageConfig.getStorageProps(); + // then + assertThat(actualStorageProps).isEqualTo(expectedStorageProps); + } +} diff --git a/libs/storage/src/test/java/smecalculus/bezmen/configuration/StorageConfigImplIT.java b/libs/storage/src/test/java/smecalculus/bezmen/configuration/StorageConfigImplIT.java new file mode 100644 index 00000000..89bd661d --- /dev/null +++ b/libs/storage/src/test/java/smecalculus/bezmen/configuration/StorageConfigImplIT.java @@ -0,0 +1,3 @@ +package smecalculus.bezmen.configuration; + +class StorageConfigImplIT extends StorageConfigIT {} diff --git a/libs/storage/src/test/java/smecalculus/bezmen/configuration/StorageConfigImplTest.java b/libs/storage/src/test/java/smecalculus/bezmen/configuration/StorageConfigImplTest.java new file mode 100644 index 00000000..ca8d40aa --- /dev/null +++ b/libs/storage/src/test/java/smecalculus/bezmen/configuration/StorageConfigImplTest.java @@ -0,0 +1,3 @@ +package smecalculus.bezmen.configuration; + +class StorageConfigImplTest extends StorageConfigTest {} diff --git a/libs/storage/src/test/java/smecalculus/bezmen/configuration/StorageConfigTest.java b/libs/storage/src/test/java/smecalculus/bezmen/configuration/StorageConfigTest.java new file mode 100644 index 00000000..5e2ac79d --- /dev/null +++ b/libs/storage/src/test/java/smecalculus/bezmen/configuration/StorageConfigTest.java @@ -0,0 +1,36 @@ +package smecalculus.bezmen.configuration; + +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; +import static smecalculus.bezmen.configuration.StoragePropsEg.Pojos.storagePropsCfg; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import smecalculus.bezmen.validation.EdgeValidator; + +abstract class StorageConfigTest { + + private StorageConfig storageConfig; + private EdgeValidator validatorMock; + private ConfigKeeper keeperMock; + + @BeforeEach + void setUp() { + validatorMock = mock(EdgeValidator.class); + keeperMock = mock(ConfigKeeper.class); + storageConfig = new StorageConfigImpl(keeperMock, validatorMock, new StorageCfgMapperImpl()); + } + + @Test + void shouldValidateConf() { + // given + StoragePropsCfg expectedStorageProps = storagePropsCfg(); + // and + when(keeperMock.read("bezmen.storage", StoragePropsCfg.class)).thenReturn(expectedStorageProps); + // when + storageConfig.getStorageProps(); + // then + verify(validatorMock).validate(expectedStorageProps); + } +} diff --git a/libs/data/src/test/resources/logback-test.xml b/libs/storage/src/test/resources/logback-test.xml similarity index 100% rename from libs/data/src/test/resources/logback-test.xml rename to libs/storage/src/test/resources/logback-test.xml diff --git a/libs/testing/pom.xml b/libs/testing/pom.xml index a4a4196c..f70a0076 100644 --- a/libs/testing/pom.xml +++ b/libs/testing/pom.xml @@ -15,11 +15,13 @@ ${project.groupId} - essentials + signatures + client + - ${project.groupId} - client + org.springframework + spring-context diff --git a/libs/testing/src/main/java/smecalculus/bezmen/construction/spec/TestingBeans.java b/libs/testing/src/main/java/smecalculus/bezmen/construction/TestingBeans.java similarity index 94% rename from libs/testing/src/main/java/smecalculus/bezmen/construction/spec/TestingBeans.java rename to libs/testing/src/main/java/smecalculus/bezmen/construction/TestingBeans.java index 59fdb287..0b2f1f5f 100644 --- a/libs/testing/src/main/java/smecalculus/bezmen/construction/spec/TestingBeans.java +++ b/libs/testing/src/main/java/smecalculus/bezmen/construction/TestingBeans.java @@ -1,4 +1,4 @@ -package smecalculus.bezmen.construction.spec; +package smecalculus.bezmen.construction; import static org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType.H2; diff --git a/libs/testing/src/main/java/smecalculus/bezmen/fixture/SepulkaFixtures.java b/libs/testing/src/main/java/smecalculus/bezmen/fixture/SepulkaFixtures.java deleted file mode 100644 index 6b3e5254..00000000 --- a/libs/testing/src/main/java/smecalculus/bezmen/fixture/SepulkaFixtures.java +++ /dev/null @@ -1,38 +0,0 @@ -package smecalculus.bezmen.fixture; - -import java.util.UUID; -import smecalculus.bezmen.domain.spec.Sepulka; -import smecalculus.bezmen.messaging.spec.SepulkaRegReq; -import smecalculus.bezmen.messaging.spec.SepulkaRegRes; - -public class SepulkaFixtures { - public static final String NAME = "foo"; - - public static SepulkaRegReq sepulkaRegReqPojo() { - return new SepulkaRegReq(NAME); - } - - public static Sepulka.Builder sepulkaBuilder() { - return Sepulka.builder().id(UUID.randomUUID()).name(NAME); - } - - public static Sepulka.Builder sepulkaBuilder(UUID id) { - return sepulkaBuilder().id(id); - } - - public static Sepulka sepulkaPojo(UUID id) { - return sepulkaBuilder(id).build(); - } - - public static SepulkaRegRes sepulkaRegResPojo() { - return new SepulkaRegRes(UUID.randomUUID(), NAME); - } - - public static SepulkaRegRes sepulkaRegResPojo(String name) { - return new SepulkaRegRes(UUID.randomUUID(), name); - } - - public static SepulkaRegRes sepulkaRegResPojo(UUID id) { - return new SepulkaRegRes(id, NAME); - } -} diff --git a/solutions/basis/church.conf b/solutions/basis/church.conf index 63696099..d2ac09c3 100644 --- a/solutions/basis/church.conf +++ b/solutions/basis/church.conf @@ -1,5 +1,5 @@ bezmen { - data { + storage { vendor { mode = postgres postgres { diff --git a/solutions/basis/turing.conf b/solutions/basis/turing.conf index d7c9ace0..a0a610d6 100644 --- a/solutions/basis/turing.conf +++ b/solutions/basis/turing.conf @@ -1,5 +1,5 @@ bezmen { - data { + storage { vendor { mode = postgres postgres { diff --git a/tests/e2e/pom.xml b/tests/e2e/pom.xml index eb2e6ad4..a7de022f 100644 --- a/tests/e2e/pom.xml +++ b/tests/e2e/pom.xml @@ -19,7 +19,8 @@ ${project.groupId} - client + messaging + client ${project.groupId} diff --git a/tests/e2e/src/main/java/smecalculus/bezmen/StandBeans.java b/tests/e2e/src/main/java/smecalculus/bezmen/StandBeans.java index 36822db5..6e3406fa 100644 --- a/tests/e2e/src/main/java/smecalculus/bezmen/StandBeans.java +++ b/tests/e2e/src/main/java/smecalculus/bezmen/StandBeans.java @@ -4,8 +4,8 @@ import java.net.http.HttpClient; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import smecalculus.bezmen.messaging.impl.BezmenClientJavaHttp; -import smecalculus.bezmen.messaging.spec.BezmenClient; +import smecalculus.bezmen.messaging.client.BezmenClient; +import smecalculus.bezmen.messaging.client.BezmenClientJavaHttp; @Configuration(proxyBeanMethods = false) public class StandBeans { 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 c5d03891..d1b3b79d 100644 --- a/tests/e2e/src/test/java/smecalculus/bezmen/registration/SepulkaTest.java +++ b/tests/e2e/src/test/java/smecalculus/bezmen/registration/SepulkaTest.java @@ -3,8 +3,8 @@ import static java.time.Duration.ofSeconds; import static org.assertj.core.api.Assertions.assertThat; import static org.awaitility.Awaitility.await; -import static smecalculus.bezmen.fixture.SepulkaFixtures.sepulkaRegReqPojo; -import static smecalculus.bezmen.fixture.SepulkaFixtures.sepulkaRegResPojo; +import static smecalculus.bezmen.messaging.client.SepulkaRegReqEg.Pojos.sepulkaRegReq; +import static smecalculus.bezmen.messaging.client.SepulkaRegResEg.Pojos.sepulkaRegRes; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Tag; @@ -15,9 +15,9 @@ import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit.jupiter.SpringExtension; import smecalculus.bezmen.StandBeans; -import smecalculus.bezmen.messaging.spec.BezmenClient; -import smecalculus.bezmen.messaging.spec.SepulkaRegReq; -import smecalculus.bezmen.messaging.spec.SepulkaRegRes; +import smecalculus.bezmen.messaging.client.BezmenClient; +import smecalculus.bezmen.messaging.client.SepulkaRegReq; +import smecalculus.bezmen.messaging.client.SepulkaRegRes; @ExtendWith(SpringExtension.class) @ContextConfiguration(classes = StandBeans.class) @@ -35,9 +35,9 @@ void beforeAll() { @Tag("smoke") void shouldRegisterSepulka() { // given - SepulkaRegReq request = sepulkaRegReqPojo(); + SepulkaRegReq request = sepulkaRegReq(); // and - SepulkaRegRes expectedResponse = sepulkaRegResPojo(); + SepulkaRegRes expectedResponse = sepulkaRegRes(); // when SepulkaRegRes actualResponse = bezmenClient.register(request); // then @@ -48,13 +48,13 @@ void shouldRegisterSepulka() { } @Test - @EnabledIfSystemProperty(named = "data.vendor.mode", matches = "postgres") + @EnabledIfSystemProperty(named = "storage.vendor.mode", matches = "postgres") void postgresSpecificTest() { // empty } @Test - @EnabledIfSystemProperty(named = "data.vendor.mode", matches = "sqlite") + @EnabledIfSystemProperty(named = "storage.vendor.mode", matches = "sqlite") void sqliteSpecificTest() { // empty } diff --git a/tests/prefs/church.properties b/tests/prefs/church.properties index 46084d78..20a59491 100644 --- a/tests/prefs/church.properties +++ b/tests/prefs/church.properties @@ -1,2 +1,2 @@ -data.vendor.mode=sqlite -data.orm.mode=my_batis +storage.vendor.mode=sqlite +storage.orm.mode=my_batis diff --git a/tests/prefs/turing.properties b/tests/prefs/turing.properties index faf5050a..832b8695 100644 --- a/tests/prefs/turing.properties +++ b/tests/prefs/turing.properties @@ -1,2 +1,2 @@ -data.vendor.mode=postgres -data.orm.mode=spring_data +storage.vendor.mode=postgres +storage.orm.mode=spring_data