From 0e0c50e467a2fb5d65a8f55dde08191b8aa99333 Mon Sep 17 00:00:00 2001 From: Oliver Drotbohm <odrotbohm@vmware.com> Date: Tue, 2 May 2023 14:36:57 +0200 Subject: [PATCH 1/9] GH-189 - Better artifact names for example projects. --- spring-modulith-examples/pom.xml | 6 +++--- .../pom.xml | 2 +- .../src/main/asciidoc/index.adoc | 0 .../src/main/java/example/Application.java | 0 .../main/java/example/inventory/InventoryManagement.java | 0 .../src/main/java/example/inventory/InventoryUpdated.java | 0 .../src/main/java/example/inventory/package-info.java | 0 .../src/main/java/example/order/OrderCompleted.java | 0 .../src/main/java/example/order/OrderManagement.java | 0 .../src/main/java/example/order/package-info.java | 0 .../src/main/resources/application.properties | 0 .../src/main/resources/logback.xml | 0 .../src/test/java/example/ApplicationIntegrationTests.java | 0 .../src/test/java/example/ModularityTests.java | 0 .../src/test/resources/logback.xml | 0 .../pom.xml | 2 +- .../src/main/asciidoc/index.adoc | 0 .../src/main/java/example/Application.java | 0 .../main/java/example/inventory/InventoryManagement.java | 0 .../src/main/java/example/inventory/InventoryUpdated.java | 0 .../src/main/java/example/inventory/package-info.java | 0 .../src/main/java/example/order/OrderCompleted.java | 0 .../src/main/java/example/order/OrderManagement.java | 0 .../src/main/java/example/order/package-info.java | 0 .../src/test/java/example/ApplicationIntegrationTests.java | 0 .../src/test/java/example/ModularityTests.java | 0 .../src/test/resources/logback.xml | 0 .../pom.xml | 2 +- .../src/main/asciidoc/index.adoc | 0 .../src/main/java/example/Application.java | 0 .../src/main/java/example/inventory/InventoryInternal.java | 0 .../main/java/example/inventory/InventoryManagement.java | 0 .../src/main/java/example/inventory/InventorySettings.java | 0 .../src/main/java/example/inventory/package-info.java | 0 .../src/main/java/example/order/Order.java | 0 .../src/main/java/example/order/OrderCompleted.java | 0 .../src/main/java/example/order/OrderManagement.java | 0 .../src/main/java/example/order/internal/OrderInternal.java | 0 .../src/main/java/example/order/package-info.java | 0 .../src/main/resources/application.properties | 0 .../src/main/resources/logback.xml | 0 .../src/test/java/example/ApplicationIntegrationTests.java | 0 .../src/test/java/example/ModularityTests.java | 0 .../java/example/order/EventPublicationRegistryTests.java | 0 .../src/test/java/example/order/OrderIntegrationTests.java | 0 45 files changed, 6 insertions(+), 6 deletions(-) rename spring-modulith-examples/{spring-modulith-examples-epr-jdbc => spring-modulith-example-epr-jdbc}/pom.xml (96%) rename spring-modulith-examples/{spring-modulith-examples-epr-jdbc => spring-modulith-example-epr-jdbc}/src/main/asciidoc/index.adoc (100%) rename spring-modulith-examples/{spring-modulith-examples-epr-jdbc => spring-modulith-example-epr-jdbc}/src/main/java/example/Application.java (100%) rename spring-modulith-examples/{spring-modulith-examples-epr-jdbc => spring-modulith-example-epr-jdbc}/src/main/java/example/inventory/InventoryManagement.java (100%) rename spring-modulith-examples/{spring-modulith-examples-epr-jdbc => spring-modulith-example-epr-jdbc}/src/main/java/example/inventory/InventoryUpdated.java (100%) rename spring-modulith-examples/{spring-modulith-examples-epr-jdbc => spring-modulith-example-epr-jdbc}/src/main/java/example/inventory/package-info.java (100%) rename spring-modulith-examples/{spring-modulith-examples-epr-jdbc => spring-modulith-example-epr-jdbc}/src/main/java/example/order/OrderCompleted.java (100%) rename spring-modulith-examples/{spring-modulith-examples-epr-jdbc => spring-modulith-example-epr-jdbc}/src/main/java/example/order/OrderManagement.java (100%) rename spring-modulith-examples/{spring-modulith-examples-epr-jdbc => spring-modulith-example-epr-jdbc}/src/main/java/example/order/package-info.java (100%) rename spring-modulith-examples/{spring-modulith-examples-epr-jdbc => spring-modulith-example-epr-jdbc}/src/main/resources/application.properties (100%) rename spring-modulith-examples/{spring-modulith-examples-epr-jdbc => spring-modulith-example-epr-jdbc}/src/main/resources/logback.xml (100%) rename spring-modulith-examples/{spring-modulith-examples-epr-jdbc => spring-modulith-example-epr-jdbc}/src/test/java/example/ApplicationIntegrationTests.java (100%) rename spring-modulith-examples/{spring-modulith-examples-epr-jdbc => spring-modulith-example-epr-jdbc}/src/test/java/example/ModularityTests.java (100%) rename spring-modulith-examples/{spring-modulith-examples-epr-jdbc => spring-modulith-example-epr-jdbc}/src/test/resources/logback.xml (100%) rename spring-modulith-examples/{spring-modulith-examples-epr-mongodb => spring-modulith-example-epr-mongodb}/pom.xml (95%) rename spring-modulith-examples/{spring-modulith-examples-epr-mongodb => spring-modulith-example-epr-mongodb}/src/main/asciidoc/index.adoc (100%) rename spring-modulith-examples/{spring-modulith-examples-epr-mongodb => spring-modulith-example-epr-mongodb}/src/main/java/example/Application.java (100%) rename spring-modulith-examples/{spring-modulith-examples-epr-mongodb => spring-modulith-example-epr-mongodb}/src/main/java/example/inventory/InventoryManagement.java (100%) rename spring-modulith-examples/{spring-modulith-examples-epr-mongodb => spring-modulith-example-epr-mongodb}/src/main/java/example/inventory/InventoryUpdated.java (100%) rename spring-modulith-examples/{spring-modulith-examples-epr-mongodb => spring-modulith-example-epr-mongodb}/src/main/java/example/inventory/package-info.java (100%) rename spring-modulith-examples/{spring-modulith-examples-epr-mongodb => spring-modulith-example-epr-mongodb}/src/main/java/example/order/OrderCompleted.java (100%) rename spring-modulith-examples/{spring-modulith-examples-epr-mongodb => spring-modulith-example-epr-mongodb}/src/main/java/example/order/OrderManagement.java (100%) rename spring-modulith-examples/{spring-modulith-examples-epr-mongodb => spring-modulith-example-epr-mongodb}/src/main/java/example/order/package-info.java (100%) rename spring-modulith-examples/{spring-modulith-examples-epr-mongodb => spring-modulith-example-epr-mongodb}/src/test/java/example/ApplicationIntegrationTests.java (100%) rename spring-modulith-examples/{spring-modulith-examples-epr-mongodb => spring-modulith-example-epr-mongodb}/src/test/java/example/ModularityTests.java (100%) rename spring-modulith-examples/{spring-modulith-examples-epr-mongodb => spring-modulith-example-epr-mongodb}/src/test/resources/logback.xml (100%) rename spring-modulith-examples/{spring-modulith-examples-full => spring-modulith-example-full}/pom.xml (96%) rename spring-modulith-examples/{spring-modulith-examples-full => spring-modulith-example-full}/src/main/asciidoc/index.adoc (100%) rename spring-modulith-examples/{spring-modulith-examples-full => spring-modulith-example-full}/src/main/java/example/Application.java (100%) rename spring-modulith-examples/{spring-modulith-examples-full => spring-modulith-example-full}/src/main/java/example/inventory/InventoryInternal.java (100%) rename spring-modulith-examples/{spring-modulith-examples-full => spring-modulith-example-full}/src/main/java/example/inventory/InventoryManagement.java (100%) rename spring-modulith-examples/{spring-modulith-examples-full => spring-modulith-example-full}/src/main/java/example/inventory/InventorySettings.java (100%) rename spring-modulith-examples/{spring-modulith-examples-full => spring-modulith-example-full}/src/main/java/example/inventory/package-info.java (100%) rename spring-modulith-examples/{spring-modulith-examples-full => spring-modulith-example-full}/src/main/java/example/order/Order.java (100%) rename spring-modulith-examples/{spring-modulith-examples-full => spring-modulith-example-full}/src/main/java/example/order/OrderCompleted.java (100%) rename spring-modulith-examples/{spring-modulith-examples-full => spring-modulith-example-full}/src/main/java/example/order/OrderManagement.java (100%) rename spring-modulith-examples/{spring-modulith-examples-full => spring-modulith-example-full}/src/main/java/example/order/internal/OrderInternal.java (100%) rename spring-modulith-examples/{spring-modulith-examples-full => spring-modulith-example-full}/src/main/java/example/order/package-info.java (100%) rename spring-modulith-examples/{spring-modulith-examples-full => spring-modulith-example-full}/src/main/resources/application.properties (100%) rename spring-modulith-examples/{spring-modulith-examples-full => spring-modulith-example-full}/src/main/resources/logback.xml (100%) rename spring-modulith-examples/{spring-modulith-examples-full => spring-modulith-example-full}/src/test/java/example/ApplicationIntegrationTests.java (100%) rename spring-modulith-examples/{spring-modulith-examples-full => spring-modulith-example-full}/src/test/java/example/ModularityTests.java (100%) rename spring-modulith-examples/{spring-modulith-examples-full => spring-modulith-example-full}/src/test/java/example/order/EventPublicationRegistryTests.java (100%) rename spring-modulith-examples/{spring-modulith-examples-full => spring-modulith-example-full}/src/test/java/example/order/OrderIntegrationTests.java (100%) diff --git a/spring-modulith-examples/pom.xml b/spring-modulith-examples/pom.xml index e3101338..9e244cc1 100644 --- a/spring-modulith-examples/pom.xml +++ b/spring-modulith-examples/pom.xml @@ -16,9 +16,9 @@ <name>Spring Modulith - Examples</name> <modules> - <module>spring-modulith-examples-epr-jdbc</module> - <module>spring-modulith-examples-epr-mongodb</module> - <module>spring-modulith-examples-full</module> + <module>spring-modulith-example-epr-jdbc</module> + <module>spring-modulith-example-epr-mongodb</module> + <module>spring-modulith-example-full</module> </modules> <properties> diff --git a/spring-modulith-examples/spring-modulith-examples-epr-jdbc/pom.xml b/spring-modulith-examples/spring-modulith-example-epr-jdbc/pom.xml similarity index 96% rename from spring-modulith-examples/spring-modulith-examples-epr-jdbc/pom.xml rename to spring-modulith-examples/spring-modulith-example-epr-jdbc/pom.xml index bc04a3f7..85d9d03c 100644 --- a/spring-modulith-examples/spring-modulith-examples-epr-jdbc/pom.xml +++ b/spring-modulith-examples/spring-modulith-example-epr-jdbc/pom.xml @@ -9,7 +9,7 @@ <relativePath>../pom.xml</relativePath> </parent> - <artifactId>spring-modulith-examples-epr-jdbc</artifactId> + <artifactId>spring-modulith-example-epr-jdbc</artifactId> <name>Spring Modulith - Examples - EPR JDBC Example</name> <dependencies> diff --git a/spring-modulith-examples/spring-modulith-examples-epr-jdbc/src/main/asciidoc/index.adoc b/spring-modulith-examples/spring-modulith-example-epr-jdbc/src/main/asciidoc/index.adoc similarity index 100% rename from spring-modulith-examples/spring-modulith-examples-epr-jdbc/src/main/asciidoc/index.adoc rename to spring-modulith-examples/spring-modulith-example-epr-jdbc/src/main/asciidoc/index.adoc diff --git a/spring-modulith-examples/spring-modulith-examples-epr-jdbc/src/main/java/example/Application.java b/spring-modulith-examples/spring-modulith-example-epr-jdbc/src/main/java/example/Application.java similarity index 100% rename from spring-modulith-examples/spring-modulith-examples-epr-jdbc/src/main/java/example/Application.java rename to spring-modulith-examples/spring-modulith-example-epr-jdbc/src/main/java/example/Application.java diff --git a/spring-modulith-examples/spring-modulith-examples-epr-jdbc/src/main/java/example/inventory/InventoryManagement.java b/spring-modulith-examples/spring-modulith-example-epr-jdbc/src/main/java/example/inventory/InventoryManagement.java similarity index 100% rename from spring-modulith-examples/spring-modulith-examples-epr-jdbc/src/main/java/example/inventory/InventoryManagement.java rename to spring-modulith-examples/spring-modulith-example-epr-jdbc/src/main/java/example/inventory/InventoryManagement.java diff --git a/spring-modulith-examples/spring-modulith-examples-epr-jdbc/src/main/java/example/inventory/InventoryUpdated.java b/spring-modulith-examples/spring-modulith-example-epr-jdbc/src/main/java/example/inventory/InventoryUpdated.java similarity index 100% rename from spring-modulith-examples/spring-modulith-examples-epr-jdbc/src/main/java/example/inventory/InventoryUpdated.java rename to spring-modulith-examples/spring-modulith-example-epr-jdbc/src/main/java/example/inventory/InventoryUpdated.java diff --git a/spring-modulith-examples/spring-modulith-examples-epr-jdbc/src/main/java/example/inventory/package-info.java b/spring-modulith-examples/spring-modulith-example-epr-jdbc/src/main/java/example/inventory/package-info.java similarity index 100% rename from spring-modulith-examples/spring-modulith-examples-epr-jdbc/src/main/java/example/inventory/package-info.java rename to spring-modulith-examples/spring-modulith-example-epr-jdbc/src/main/java/example/inventory/package-info.java diff --git a/spring-modulith-examples/spring-modulith-examples-epr-jdbc/src/main/java/example/order/OrderCompleted.java b/spring-modulith-examples/spring-modulith-example-epr-jdbc/src/main/java/example/order/OrderCompleted.java similarity index 100% rename from spring-modulith-examples/spring-modulith-examples-epr-jdbc/src/main/java/example/order/OrderCompleted.java rename to spring-modulith-examples/spring-modulith-example-epr-jdbc/src/main/java/example/order/OrderCompleted.java diff --git a/spring-modulith-examples/spring-modulith-examples-epr-jdbc/src/main/java/example/order/OrderManagement.java b/spring-modulith-examples/spring-modulith-example-epr-jdbc/src/main/java/example/order/OrderManagement.java similarity index 100% rename from spring-modulith-examples/spring-modulith-examples-epr-jdbc/src/main/java/example/order/OrderManagement.java rename to spring-modulith-examples/spring-modulith-example-epr-jdbc/src/main/java/example/order/OrderManagement.java diff --git a/spring-modulith-examples/spring-modulith-examples-epr-jdbc/src/main/java/example/order/package-info.java b/spring-modulith-examples/spring-modulith-example-epr-jdbc/src/main/java/example/order/package-info.java similarity index 100% rename from spring-modulith-examples/spring-modulith-examples-epr-jdbc/src/main/java/example/order/package-info.java rename to spring-modulith-examples/spring-modulith-example-epr-jdbc/src/main/java/example/order/package-info.java diff --git a/spring-modulith-examples/spring-modulith-examples-epr-jdbc/src/main/resources/application.properties b/spring-modulith-examples/spring-modulith-example-epr-jdbc/src/main/resources/application.properties similarity index 100% rename from spring-modulith-examples/spring-modulith-examples-epr-jdbc/src/main/resources/application.properties rename to spring-modulith-examples/spring-modulith-example-epr-jdbc/src/main/resources/application.properties diff --git a/spring-modulith-examples/spring-modulith-examples-epr-jdbc/src/main/resources/logback.xml b/spring-modulith-examples/spring-modulith-example-epr-jdbc/src/main/resources/logback.xml similarity index 100% rename from spring-modulith-examples/spring-modulith-examples-epr-jdbc/src/main/resources/logback.xml rename to spring-modulith-examples/spring-modulith-example-epr-jdbc/src/main/resources/logback.xml diff --git a/spring-modulith-examples/spring-modulith-examples-epr-jdbc/src/test/java/example/ApplicationIntegrationTests.java b/spring-modulith-examples/spring-modulith-example-epr-jdbc/src/test/java/example/ApplicationIntegrationTests.java similarity index 100% rename from spring-modulith-examples/spring-modulith-examples-epr-jdbc/src/test/java/example/ApplicationIntegrationTests.java rename to spring-modulith-examples/spring-modulith-example-epr-jdbc/src/test/java/example/ApplicationIntegrationTests.java diff --git a/spring-modulith-examples/spring-modulith-examples-epr-jdbc/src/test/java/example/ModularityTests.java b/spring-modulith-examples/spring-modulith-example-epr-jdbc/src/test/java/example/ModularityTests.java similarity index 100% rename from spring-modulith-examples/spring-modulith-examples-epr-jdbc/src/test/java/example/ModularityTests.java rename to spring-modulith-examples/spring-modulith-example-epr-jdbc/src/test/java/example/ModularityTests.java diff --git a/spring-modulith-examples/spring-modulith-examples-epr-jdbc/src/test/resources/logback.xml b/spring-modulith-examples/spring-modulith-example-epr-jdbc/src/test/resources/logback.xml similarity index 100% rename from spring-modulith-examples/spring-modulith-examples-epr-jdbc/src/test/resources/logback.xml rename to spring-modulith-examples/spring-modulith-example-epr-jdbc/src/test/resources/logback.xml diff --git a/spring-modulith-examples/spring-modulith-examples-epr-mongodb/pom.xml b/spring-modulith-examples/spring-modulith-example-epr-mongodb/pom.xml similarity index 95% rename from spring-modulith-examples/spring-modulith-examples-epr-mongodb/pom.xml rename to spring-modulith-examples/spring-modulith-example-epr-mongodb/pom.xml index 81daa033..2a5a9e95 100644 --- a/spring-modulith-examples/spring-modulith-examples-epr-mongodb/pom.xml +++ b/spring-modulith-examples/spring-modulith-example-epr-mongodb/pom.xml @@ -9,7 +9,7 @@ <relativePath>../pom.xml</relativePath> </parent> - <artifactId>spring-modulith-examples-epr-mongodb</artifactId> + <artifactId>spring-modulith-example-epr-mongodb</artifactId> <name>Spring Modulith - Examples - EPR MongoDB Example</name> <dependencies> diff --git a/spring-modulith-examples/spring-modulith-examples-epr-mongodb/src/main/asciidoc/index.adoc b/spring-modulith-examples/spring-modulith-example-epr-mongodb/src/main/asciidoc/index.adoc similarity index 100% rename from spring-modulith-examples/spring-modulith-examples-epr-mongodb/src/main/asciidoc/index.adoc rename to spring-modulith-examples/spring-modulith-example-epr-mongodb/src/main/asciidoc/index.adoc diff --git a/spring-modulith-examples/spring-modulith-examples-epr-mongodb/src/main/java/example/Application.java b/spring-modulith-examples/spring-modulith-example-epr-mongodb/src/main/java/example/Application.java similarity index 100% rename from spring-modulith-examples/spring-modulith-examples-epr-mongodb/src/main/java/example/Application.java rename to spring-modulith-examples/spring-modulith-example-epr-mongodb/src/main/java/example/Application.java diff --git a/spring-modulith-examples/spring-modulith-examples-epr-mongodb/src/main/java/example/inventory/InventoryManagement.java b/spring-modulith-examples/spring-modulith-example-epr-mongodb/src/main/java/example/inventory/InventoryManagement.java similarity index 100% rename from spring-modulith-examples/spring-modulith-examples-epr-mongodb/src/main/java/example/inventory/InventoryManagement.java rename to spring-modulith-examples/spring-modulith-example-epr-mongodb/src/main/java/example/inventory/InventoryManagement.java diff --git a/spring-modulith-examples/spring-modulith-examples-epr-mongodb/src/main/java/example/inventory/InventoryUpdated.java b/spring-modulith-examples/spring-modulith-example-epr-mongodb/src/main/java/example/inventory/InventoryUpdated.java similarity index 100% rename from spring-modulith-examples/spring-modulith-examples-epr-mongodb/src/main/java/example/inventory/InventoryUpdated.java rename to spring-modulith-examples/spring-modulith-example-epr-mongodb/src/main/java/example/inventory/InventoryUpdated.java diff --git a/spring-modulith-examples/spring-modulith-examples-epr-mongodb/src/main/java/example/inventory/package-info.java b/spring-modulith-examples/spring-modulith-example-epr-mongodb/src/main/java/example/inventory/package-info.java similarity index 100% rename from spring-modulith-examples/spring-modulith-examples-epr-mongodb/src/main/java/example/inventory/package-info.java rename to spring-modulith-examples/spring-modulith-example-epr-mongodb/src/main/java/example/inventory/package-info.java diff --git a/spring-modulith-examples/spring-modulith-examples-epr-mongodb/src/main/java/example/order/OrderCompleted.java b/spring-modulith-examples/spring-modulith-example-epr-mongodb/src/main/java/example/order/OrderCompleted.java similarity index 100% rename from spring-modulith-examples/spring-modulith-examples-epr-mongodb/src/main/java/example/order/OrderCompleted.java rename to spring-modulith-examples/spring-modulith-example-epr-mongodb/src/main/java/example/order/OrderCompleted.java diff --git a/spring-modulith-examples/spring-modulith-examples-epr-mongodb/src/main/java/example/order/OrderManagement.java b/spring-modulith-examples/spring-modulith-example-epr-mongodb/src/main/java/example/order/OrderManagement.java similarity index 100% rename from spring-modulith-examples/spring-modulith-examples-epr-mongodb/src/main/java/example/order/OrderManagement.java rename to spring-modulith-examples/spring-modulith-example-epr-mongodb/src/main/java/example/order/OrderManagement.java diff --git a/spring-modulith-examples/spring-modulith-examples-epr-mongodb/src/main/java/example/order/package-info.java b/spring-modulith-examples/spring-modulith-example-epr-mongodb/src/main/java/example/order/package-info.java similarity index 100% rename from spring-modulith-examples/spring-modulith-examples-epr-mongodb/src/main/java/example/order/package-info.java rename to spring-modulith-examples/spring-modulith-example-epr-mongodb/src/main/java/example/order/package-info.java diff --git a/spring-modulith-examples/spring-modulith-examples-epr-mongodb/src/test/java/example/ApplicationIntegrationTests.java b/spring-modulith-examples/spring-modulith-example-epr-mongodb/src/test/java/example/ApplicationIntegrationTests.java similarity index 100% rename from spring-modulith-examples/spring-modulith-examples-epr-mongodb/src/test/java/example/ApplicationIntegrationTests.java rename to spring-modulith-examples/spring-modulith-example-epr-mongodb/src/test/java/example/ApplicationIntegrationTests.java diff --git a/spring-modulith-examples/spring-modulith-examples-epr-mongodb/src/test/java/example/ModularityTests.java b/spring-modulith-examples/spring-modulith-example-epr-mongodb/src/test/java/example/ModularityTests.java similarity index 100% rename from spring-modulith-examples/spring-modulith-examples-epr-mongodb/src/test/java/example/ModularityTests.java rename to spring-modulith-examples/spring-modulith-example-epr-mongodb/src/test/java/example/ModularityTests.java diff --git a/spring-modulith-examples/spring-modulith-examples-epr-mongodb/src/test/resources/logback.xml b/spring-modulith-examples/spring-modulith-example-epr-mongodb/src/test/resources/logback.xml similarity index 100% rename from spring-modulith-examples/spring-modulith-examples-epr-mongodb/src/test/resources/logback.xml rename to spring-modulith-examples/spring-modulith-example-epr-mongodb/src/test/resources/logback.xml diff --git a/spring-modulith-examples/spring-modulith-examples-full/pom.xml b/spring-modulith-examples/spring-modulith-example-full/pom.xml similarity index 96% rename from spring-modulith-examples/spring-modulith-examples-full/pom.xml rename to spring-modulith-examples/spring-modulith-example-full/pom.xml index 32d03706..9275ae47 100644 --- a/spring-modulith-examples/spring-modulith-examples-full/pom.xml +++ b/spring-modulith-examples/spring-modulith-example-full/pom.xml @@ -9,7 +9,7 @@ <relativePath>../pom.xml</relativePath> </parent> - <artifactId>spring-modulith-examples-full</artifactId> + <artifactId>spring-modulith-example-full</artifactId> <name>Spring Modulith - Examples - Full Example</name> <dependencies> diff --git a/spring-modulith-examples/spring-modulith-examples-full/src/main/asciidoc/index.adoc b/spring-modulith-examples/spring-modulith-example-full/src/main/asciidoc/index.adoc similarity index 100% rename from spring-modulith-examples/spring-modulith-examples-full/src/main/asciidoc/index.adoc rename to spring-modulith-examples/spring-modulith-example-full/src/main/asciidoc/index.adoc diff --git a/spring-modulith-examples/spring-modulith-examples-full/src/main/java/example/Application.java b/spring-modulith-examples/spring-modulith-example-full/src/main/java/example/Application.java similarity index 100% rename from spring-modulith-examples/spring-modulith-examples-full/src/main/java/example/Application.java rename to spring-modulith-examples/spring-modulith-example-full/src/main/java/example/Application.java diff --git a/spring-modulith-examples/spring-modulith-examples-full/src/main/java/example/inventory/InventoryInternal.java b/spring-modulith-examples/spring-modulith-example-full/src/main/java/example/inventory/InventoryInternal.java similarity index 100% rename from spring-modulith-examples/spring-modulith-examples-full/src/main/java/example/inventory/InventoryInternal.java rename to spring-modulith-examples/spring-modulith-example-full/src/main/java/example/inventory/InventoryInternal.java diff --git a/spring-modulith-examples/spring-modulith-examples-full/src/main/java/example/inventory/InventoryManagement.java b/spring-modulith-examples/spring-modulith-example-full/src/main/java/example/inventory/InventoryManagement.java similarity index 100% rename from spring-modulith-examples/spring-modulith-examples-full/src/main/java/example/inventory/InventoryManagement.java rename to spring-modulith-examples/spring-modulith-example-full/src/main/java/example/inventory/InventoryManagement.java diff --git a/spring-modulith-examples/spring-modulith-examples-full/src/main/java/example/inventory/InventorySettings.java b/spring-modulith-examples/spring-modulith-example-full/src/main/java/example/inventory/InventorySettings.java similarity index 100% rename from spring-modulith-examples/spring-modulith-examples-full/src/main/java/example/inventory/InventorySettings.java rename to spring-modulith-examples/spring-modulith-example-full/src/main/java/example/inventory/InventorySettings.java diff --git a/spring-modulith-examples/spring-modulith-examples-full/src/main/java/example/inventory/package-info.java b/spring-modulith-examples/spring-modulith-example-full/src/main/java/example/inventory/package-info.java similarity index 100% rename from spring-modulith-examples/spring-modulith-examples-full/src/main/java/example/inventory/package-info.java rename to spring-modulith-examples/spring-modulith-example-full/src/main/java/example/inventory/package-info.java diff --git a/spring-modulith-examples/spring-modulith-examples-full/src/main/java/example/order/Order.java b/spring-modulith-examples/spring-modulith-example-full/src/main/java/example/order/Order.java similarity index 100% rename from spring-modulith-examples/spring-modulith-examples-full/src/main/java/example/order/Order.java rename to spring-modulith-examples/spring-modulith-example-full/src/main/java/example/order/Order.java diff --git a/spring-modulith-examples/spring-modulith-examples-full/src/main/java/example/order/OrderCompleted.java b/spring-modulith-examples/spring-modulith-example-full/src/main/java/example/order/OrderCompleted.java similarity index 100% rename from spring-modulith-examples/spring-modulith-examples-full/src/main/java/example/order/OrderCompleted.java rename to spring-modulith-examples/spring-modulith-example-full/src/main/java/example/order/OrderCompleted.java diff --git a/spring-modulith-examples/spring-modulith-examples-full/src/main/java/example/order/OrderManagement.java b/spring-modulith-examples/spring-modulith-example-full/src/main/java/example/order/OrderManagement.java similarity index 100% rename from spring-modulith-examples/spring-modulith-examples-full/src/main/java/example/order/OrderManagement.java rename to spring-modulith-examples/spring-modulith-example-full/src/main/java/example/order/OrderManagement.java diff --git a/spring-modulith-examples/spring-modulith-examples-full/src/main/java/example/order/internal/OrderInternal.java b/spring-modulith-examples/spring-modulith-example-full/src/main/java/example/order/internal/OrderInternal.java similarity index 100% rename from spring-modulith-examples/spring-modulith-examples-full/src/main/java/example/order/internal/OrderInternal.java rename to spring-modulith-examples/spring-modulith-example-full/src/main/java/example/order/internal/OrderInternal.java diff --git a/spring-modulith-examples/spring-modulith-examples-full/src/main/java/example/order/package-info.java b/spring-modulith-examples/spring-modulith-example-full/src/main/java/example/order/package-info.java similarity index 100% rename from spring-modulith-examples/spring-modulith-examples-full/src/main/java/example/order/package-info.java rename to spring-modulith-examples/spring-modulith-example-full/src/main/java/example/order/package-info.java diff --git a/spring-modulith-examples/spring-modulith-examples-full/src/main/resources/application.properties b/spring-modulith-examples/spring-modulith-example-full/src/main/resources/application.properties similarity index 100% rename from spring-modulith-examples/spring-modulith-examples-full/src/main/resources/application.properties rename to spring-modulith-examples/spring-modulith-example-full/src/main/resources/application.properties diff --git a/spring-modulith-examples/spring-modulith-examples-full/src/main/resources/logback.xml b/spring-modulith-examples/spring-modulith-example-full/src/main/resources/logback.xml similarity index 100% rename from spring-modulith-examples/spring-modulith-examples-full/src/main/resources/logback.xml rename to spring-modulith-examples/spring-modulith-example-full/src/main/resources/logback.xml diff --git a/spring-modulith-examples/spring-modulith-examples-full/src/test/java/example/ApplicationIntegrationTests.java b/spring-modulith-examples/spring-modulith-example-full/src/test/java/example/ApplicationIntegrationTests.java similarity index 100% rename from spring-modulith-examples/spring-modulith-examples-full/src/test/java/example/ApplicationIntegrationTests.java rename to spring-modulith-examples/spring-modulith-example-full/src/test/java/example/ApplicationIntegrationTests.java diff --git a/spring-modulith-examples/spring-modulith-examples-full/src/test/java/example/ModularityTests.java b/spring-modulith-examples/spring-modulith-example-full/src/test/java/example/ModularityTests.java similarity index 100% rename from spring-modulith-examples/spring-modulith-examples-full/src/test/java/example/ModularityTests.java rename to spring-modulith-examples/spring-modulith-example-full/src/test/java/example/ModularityTests.java diff --git a/spring-modulith-examples/spring-modulith-examples-full/src/test/java/example/order/EventPublicationRegistryTests.java b/spring-modulith-examples/spring-modulith-example-full/src/test/java/example/order/EventPublicationRegistryTests.java similarity index 100% rename from spring-modulith-examples/spring-modulith-examples-full/src/test/java/example/order/EventPublicationRegistryTests.java rename to spring-modulith-examples/spring-modulith-example-full/src/test/java/example/order/EventPublicationRegistryTests.java diff --git a/spring-modulith-examples/spring-modulith-examples-full/src/test/java/example/order/OrderIntegrationTests.java b/spring-modulith-examples/spring-modulith-example-full/src/test/java/example/order/OrderIntegrationTests.java similarity index 100% rename from spring-modulith-examples/spring-modulith-examples-full/src/test/java/example/order/OrderIntegrationTests.java rename to spring-modulith-examples/spring-modulith-example-full/src/test/java/example/order/OrderIntegrationTests.java From 9f871c6ea1a9d724b4e9e24e6ee8452298cabadc Mon Sep 17 00:00:00 2001 From: Oliver Drotbohm <odrotbohm@vmware.com> Date: Tue, 2 May 2023 15:32:25 +0200 Subject: [PATCH 2/9] GH-200 - Group starters under single build module. --- pom.xml | 7 +----- spring-modulith-starters/pom.xml | 25 +++++++++++++++++++ .../spring-modulith-starter-core}/pom.xml | 5 ++-- .../spring-modulith-starter-insight}/pom.xml | 5 ++-- .../spring-modulith-starter-jdbc}/pom.xml | 5 ++-- .../spring-modulith-starter-jpa}/pom.xml | 5 ++-- .../spring-modulith-starter-mongodb}/pom.xml | 5 ++-- .../spring-modulith-starter-test}/pom.xml | 5 ++-- 8 files changed, 44 insertions(+), 18 deletions(-) create mode 100644 spring-modulith-starters/pom.xml rename {spring-modulith-starter-core => spring-modulith-starters/spring-modulith-starter-core}/pom.xml (89%) rename {spring-modulith-starter-insight => spring-modulith-starters/spring-modulith-starter-insight}/pom.xml (88%) rename {spring-modulith-starter-jdbc => spring-modulith-starters/spring-modulith-starter-jdbc}/pom.xml (89%) rename {spring-modulith-starter-jpa => spring-modulith-starters/spring-modulith-starter-jpa}/pom.xml (89%) rename {spring-modulith-starter-mongodb => spring-modulith-starters/spring-modulith-starter-mongodb}/pom.xml (89%) rename {spring-modulith-starter-test => spring-modulith-starters/spring-modulith-starter-test}/pom.xml (88%) diff --git a/pom.xml b/pom.xml index 97eb6e3c..3919bd55 100644 --- a/pom.xml +++ b/pom.xml @@ -27,12 +27,7 @@ <module>spring-modulith-moments</module> <module>spring-modulith-observability</module> <module>spring-modulith-runtime</module> - <module>spring-modulith-starter-core</module> - <module>spring-modulith-starter-insight</module> - <module>spring-modulith-starter-jdbc</module> - <module>spring-modulith-starter-jpa</module> - <module>spring-modulith-starter-mongodb</module> - <module>spring-modulith-starter-test</module> + <module>spring-modulith-starters</module> <module>spring-modulith-test</module> </modules> diff --git a/spring-modulith-starters/pom.xml b/spring-modulith-starters/pom.xml new file mode 100644 index 00000000..0c49cb2c --- /dev/null +++ b/spring-modulith-starters/pom.xml @@ -0,0 +1,25 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.springframework.modulith</groupId> + <artifactId>spring-modulith</artifactId> + <version>1.0.0-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + + <artifactId>spring-modulith-starters</artifactId> + <packaging>pom</packaging> + + <name>Spring Modulith - Starters</name> + + <modules> + <module>spring-modulith-starter-core</module> + <module>spring-modulith-starter-insight</module> + <module>spring-modulith-starter-jdbc</module> + <module>spring-modulith-starter-jpa</module> + <module>spring-modulith-starter-mongodb</module> + <module>spring-modulith-starter-test</module> + </modules> + +</project> diff --git a/spring-modulith-starter-core/pom.xml b/spring-modulith-starters/spring-modulith-starter-core/pom.xml similarity index 89% rename from spring-modulith-starter-core/pom.xml rename to spring-modulith-starters/spring-modulith-starter-core/pom.xml index 2cb8991e..c0b6bed6 100644 --- a/spring-modulith-starter-core/pom.xml +++ b/spring-modulith-starters/spring-modulith-starter-core/pom.xml @@ -4,12 +4,13 @@ <parent> <groupId>org.springframework.modulith</groupId> - <artifactId>spring-modulith</artifactId> + <artifactId>spring-modulith-starters</artifactId> <version>1.0.0-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> </parent> <artifactId>spring-modulith-starter-core</artifactId> - <name>Spring Modulith - Starter Core</name> + <name>Spring Modulith - Starters - Starter Core</name> <properties> <module.name>org.springframework.modulith.starter.core</module.name> diff --git a/spring-modulith-starter-insight/pom.xml b/spring-modulith-starters/spring-modulith-starter-insight/pom.xml similarity index 88% rename from spring-modulith-starter-insight/pom.xml rename to spring-modulith-starters/spring-modulith-starter-insight/pom.xml index 6635a1d9..574fe5a6 100644 --- a/spring-modulith-starter-insight/pom.xml +++ b/spring-modulith-starters/spring-modulith-starter-insight/pom.xml @@ -4,12 +4,13 @@ <parent> <groupId>org.springframework.modulith</groupId> - <artifactId>spring-modulith</artifactId> + <artifactId>spring-modulith-starters</artifactId> <version>1.0.0-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> </parent> <artifactId>spring-modulith-starter-insight</artifactId> - <name>Spring Modulith - Starter Insight</name> + <name>Spring Modulith - Starters - Starter Insight</name> <properties> <module.name>org.springframework.modulith.starter.insight</module.name> diff --git a/spring-modulith-starter-jdbc/pom.xml b/spring-modulith-starters/spring-modulith-starter-jdbc/pom.xml similarity index 89% rename from spring-modulith-starter-jdbc/pom.xml rename to spring-modulith-starters/spring-modulith-starter-jdbc/pom.xml index a6ed7145..e6b5af34 100644 --- a/spring-modulith-starter-jdbc/pom.xml +++ b/spring-modulith-starters/spring-modulith-starter-jdbc/pom.xml @@ -4,12 +4,13 @@ <parent> <groupId>org.springframework.modulith</groupId> - <artifactId>spring-modulith</artifactId> + <artifactId>spring-modulith-starters</artifactId> <version>1.0.0-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> </parent> <artifactId>spring-modulith-starter-jdbc</artifactId> - <name>Spring Modulith - Starter JDBC</name> + <name>Spring Modulith - Starters - Starter JDBC</name> <properties> <module.name>org.springframework.modulith.starter.jdbc</module.name> diff --git a/spring-modulith-starter-jpa/pom.xml b/spring-modulith-starters/spring-modulith-starter-jpa/pom.xml similarity index 89% rename from spring-modulith-starter-jpa/pom.xml rename to spring-modulith-starters/spring-modulith-starter-jpa/pom.xml index f2672ce0..3d681bff 100644 --- a/spring-modulith-starter-jpa/pom.xml +++ b/spring-modulith-starters/spring-modulith-starter-jpa/pom.xml @@ -4,12 +4,13 @@ <parent> <groupId>org.springframework.modulith</groupId> - <artifactId>spring-modulith</artifactId> + <artifactId>spring-modulith-starters</artifactId> <version>1.0.0-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> </parent> <artifactId>spring-modulith-starter-jpa</artifactId> - <name>Spring Modulith - Starter JPA</name> + <name>Spring Modulith - Starters - Starter JPA</name> <properties> <module.name>org.springframework.modulith.starter.jpa</module.name> diff --git a/spring-modulith-starter-mongodb/pom.xml b/spring-modulith-starters/spring-modulith-starter-mongodb/pom.xml similarity index 89% rename from spring-modulith-starter-mongodb/pom.xml rename to spring-modulith-starters/spring-modulith-starter-mongodb/pom.xml index 3a88d3cb..c6d24ef6 100644 --- a/spring-modulith-starter-mongodb/pom.xml +++ b/spring-modulith-starters/spring-modulith-starter-mongodb/pom.xml @@ -4,12 +4,13 @@ <parent> <groupId>org.springframework.modulith</groupId> - <artifactId>spring-modulith</artifactId> + <artifactId>spring-modulith-starters</artifactId> <version>1.0.0-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> </parent> <artifactId>spring-modulith-starter-mongodb</artifactId> - <name>Spring Modulith - Starter MongoDB</name> + <name>Spring Modulith - Starters - Starter MongoDB</name> <properties> <module.name>org.springframework.modulith.starter.mongodb</module.name> diff --git a/spring-modulith-starter-test/pom.xml b/spring-modulith-starters/spring-modulith-starter-test/pom.xml similarity index 88% rename from spring-modulith-starter-test/pom.xml rename to spring-modulith-starters/spring-modulith-starter-test/pom.xml index 1a6fe30c..564ffc1a 100644 --- a/spring-modulith-starter-test/pom.xml +++ b/spring-modulith-starters/spring-modulith-starter-test/pom.xml @@ -3,12 +3,13 @@ <parent> <groupId>org.springframework.modulith</groupId> - <artifactId>spring-modulith</artifactId> + <artifactId>spring-modulith-starters</artifactId> <version>1.0.0-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> </parent> <artifactId>spring-modulith-starter-test</artifactId> - <name>Spring Modulith - Starter Test</name> + <name>Spring Modulith - Starters - Starter Test</name> <properties> <module.name>org.springframework.modulith.starter.test</module.name> From af9fca56e7802dc908248dc08365f9a839a63b74 Mon Sep 17 00:00:00 2001 From: Oliver Drotbohm <odrotbohm@vmware.com> Date: Tue, 2 May 2023 15:41:43 +0200 Subject: [PATCH 3/9] =?UTF-8?q?GH-195=20-=20Remove=20support=20for=20legac?= =?UTF-8?q?y=20spring.modulith.jdbc-=E2=80=A6=20namespace=20in=20JDBC-base?= =?UTF-8?q?d=20event=20support.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...JdbcEventPublicationAutoConfiguration.java | 40 +------------------ ...tionAutoConfigurationIntegrationTests.java | 2 +- 2 files changed, 3 insertions(+), 39 deletions(-) diff --git a/spring-modulith-events/spring-modulith-events-jdbc/src/main/java/org/springframework/modulith/events/jdbc/JdbcEventPublicationAutoConfiguration.java b/spring-modulith-events/spring-modulith-events-jdbc/src/main/java/org/springframework/modulith/events/jdbc/JdbcEventPublicationAutoConfiguration.java index 0329d240..03869937 100644 --- a/spring-modulith-events/spring-modulith-events-jdbc/src/main/java/org/springframework/modulith/events/jdbc/JdbcEventPublicationAutoConfiguration.java +++ b/spring-modulith-events/spring-modulith-events-jdbc/src/main/java/org/springframework/modulith/events/jdbc/JdbcEventPublicationAutoConfiguration.java @@ -15,20 +15,13 @@ */ package org.springframework.modulith.events.jdbc; -import java.util.List; - import javax.sql.DataSource; -import org.springframework.boot.autoconfigure.condition.ConditionOutcome; -import org.springframework.boot.autoconfigure.condition.SpringBootCondition; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.jdbc.DatabaseDriver; import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.ConditionContext; -import org.springframework.context.annotation.Conditional; import org.springframework.context.annotation.Configuration; -import org.springframework.core.env.Environment; import org.springframework.core.io.ResourceLoader; -import org.springframework.core.type.AnnotatedTypeMetadata; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.modulith.events.EventSerializer; import org.springframework.modulith.events.config.EventPublicationConfigurationExtension; @@ -54,39 +47,10 @@ JdbcEventPublicationRepository jdbcEventPublicationRepository(JdbcTemplate jdbcT } @Bean - @Conditional(SchemaInitializationEnabled.class) + @ConditionalOnProperty(name = "spring.modulith.events.jdbc.schema-initialization.enabled", havingValue = "true") DatabaseSchemaInitializer databaseSchemaInitializer(JdbcTemplate jdbcTemplate, ResourceLoader resourceLoader, DatabaseType databaseType) { return new DatabaseSchemaInitializer(jdbcTemplate, resourceLoader, databaseType); } - - /** - * Combined condition to support the legacy schema initialization property as well as the new one. - * - * @author Oliver Drotbohm - */ - static class SchemaInitializationEnabled extends SpringBootCondition { - - private static final String LEGACY = "spring.modulith.events.jdbc-schema-initialization.enabled"; - private static final String CURRENT = "spring.modulith.events.jdbc.schema-initialization.enabled"; - - /* - * (non-Javadoc) - * @see org.springframework.boot.autoconfigure.condition.SpringBootCondition#getMatchOutcome(org.springframework.context.annotation.ConditionContext, org.springframework.core.type.AnnotatedTypeMetadata) - */ - @Override - public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) { - - Environment environment = context.getEnvironment(); - - var enabled = List.of(CURRENT, LEGACY).stream() - .map(it -> environment.getProperty(it, Boolean.class)) - .anyMatch(Boolean.TRUE::equals); - - return enabled // - ? ConditionOutcome.match("Schema initialization explicitly enabled.") // - : ConditionOutcome.noMatch("Schema initialization disabled by default."); - } - } } diff --git a/spring-modulith-events/spring-modulith-events-jdbc/src/test/java/org/springframework/modulith/events/jdbc/JdbcEventPublicationAutoConfigurationIntegrationTests.java b/spring-modulith-events/spring-modulith-events-jdbc/src/test/java/org/springframework/modulith/events/jdbc/JdbcEventPublicationAutoConfigurationIntegrationTests.java index e1966db9..4bc9b698 100644 --- a/spring-modulith-events/spring-modulith-events-jdbc/src/test/java/org/springframework/modulith/events/jdbc/JdbcEventPublicationAutoConfigurationIntegrationTests.java +++ b/spring-modulith-events/spring-modulith-events-jdbc/src/test/java/org/springframework/modulith/events/jdbc/JdbcEventPublicationAutoConfigurationIntegrationTests.java @@ -33,7 +33,7 @@ */ @SpringBootTest( classes = TestApplication.class, - properties = "spring.modulith.events.jdbc-schema-initialization.enabled=true") + properties = "spring.modulith.events.jdbc.schema-initialization.enabled=true") class JdbcEventPublicationAutoConfigurationIntegrationTests { @Autowired ApplicationContext context; From 1e3eacd6be86d075cd0b85e266839437daf3af93 Mon Sep 17 00:00:00 2001 From: Oliver Drotbohm <odrotbohm@vmware.com> Date: Tue, 2 May 2023 16:19:45 +0200 Subject: [PATCH 4/9] GH-195 - Unnest test cases to make sure we run the right profiles. Remove the nesting of the test classes as they will be executed without profiles activated. --- ...PublicationRepositoryIntegrationTests.java | 186 ++++++++---------- .../src/test/resources/logback.xml | 16 ++ 2 files changed, 103 insertions(+), 99 deletions(-) create mode 100644 spring-modulith-events/spring-modulith-events-jdbc/src/test/resources/logback.xml diff --git a/spring-modulith-events/spring-modulith-events-jdbc/src/test/java/org/springframework/modulith/events/jdbc/JdbcEventPublicationRepositoryIntegrationTests.java b/spring-modulith-events/spring-modulith-events-jdbc/src/test/java/org/springframework/modulith/events/jdbc/JdbcEventPublicationRepositoryIntegrationTests.java index 790e1f31..17999dc4 100644 --- a/spring-modulith-events/spring-modulith-events-jdbc/src/test/java/org/springframework/modulith/events/jdbc/JdbcEventPublicationRepositoryIntegrationTests.java +++ b/spring-modulith-events/spring-modulith-events-jdbc/src/test/java/org/springframework/modulith/events/jdbc/JdbcEventPublicationRepositoryIntegrationTests.java @@ -54,7 +54,7 @@ class JdbcEventPublicationRepositoryIntegrationTests { static final PublicationTargetIdentifier TARGET_IDENTIFIER = PublicationTargetIdentifier.of("listener"); - @JdbcTest + @JdbcTest(properties = "spring.modulith.events.jdbc.schema-initialization.enabled=true") @Import(TestApplication.class) @Testcontainers(disabledWithoutDocker = true) @ContextConfiguration(classes = JdbcEventPublicationAutoConfiguration.class) @@ -126,144 +126,132 @@ private void createPublicationAt(LocalDateTime publicationDate) { repository.create(publication); } - @Nested - class Update { - - @Test // GH-3 - void shouldUpdateSingleEventPublication() { + @Test // GH-3 + void shouldUpdateSingleEventPublication() { - var testEvent1 = new TestEvent("id1"); - var testEvent2 = new TestEvent("id2"); - var serializedEvent1 = "{\"eventId\":\"id1\"}"; - var serializedEvent2 = "{\"eventId\":\"id2\"}"; + var testEvent1 = new TestEvent("id1"); + var testEvent2 = new TestEvent("id2"); + var serializedEvent1 = "{\"eventId\":\"id1\"}"; + var serializedEvent2 = "{\"eventId\":\"id2\"}"; - when(serializer.serialize(testEvent1)).thenReturn(serializedEvent1); - when(serializer.deserialize(serializedEvent1, TestEvent.class)).thenReturn(testEvent1); - when(serializer.serialize(testEvent2)).thenReturn(serializedEvent2); - when(serializer.deserialize(serializedEvent2, TestEvent.class)).thenReturn(testEvent2); + when(serializer.serialize(testEvent1)).thenReturn(serializedEvent1); + when(serializer.deserialize(serializedEvent1, TestEvent.class)).thenReturn(testEvent1); + when(serializer.serialize(testEvent2)).thenReturn(serializedEvent2); + when(serializer.deserialize(serializedEvent2, TestEvent.class)).thenReturn(testEvent2); - var publication1 = CompletableEventPublication.of(testEvent1, TARGET_IDENTIFIER); - var publication2 = CompletableEventPublication.of(testEvent2, TARGET_IDENTIFIER); + var publication1 = CompletableEventPublication.of(testEvent1, TARGET_IDENTIFIER); + var publication2 = CompletableEventPublication.of(testEvent2, TARGET_IDENTIFIER); - // Store publication - repository.create(publication1); - repository.create(publication2); + // Store publication + repository.create(publication1); + repository.create(publication2); - // Complete publication - repository.update(publication2.markCompleted()); + // Complete publication + repository.update(publication2.markCompleted()); - assertThat(repository.findIncompletePublications()).hasSize(1) - .element(0).extracting(EventPublication::getEvent).isEqualTo(testEvent1); - } + assertThat(repository.findIncompletePublications()).hasSize(1) + .element(0).extracting(EventPublication::getEvent).isEqualTo(testEvent1); } - @Nested - class FindByEventAndTargetIdentifier { - - @Test // GH-3 - void shouldTolerateEmptyResult() { + @Test // GH-3 + void shouldTolerateEmptyResult() { - var testEvent = new TestEvent("id"); - var serializedEvent = "{\"eventId\":\"id\"}"; + var testEvent = new TestEvent("id"); + var serializedEvent = "{\"eventId\":\"id\"}"; - when(serializer.serialize(testEvent)).thenReturn(serializedEvent); + when(serializer.serialize(testEvent)).thenReturn(serializedEvent); - assertThat(repository.findIncompletePublicationsByEventAndTargetIdentifier(testEvent, TARGET_IDENTIFIER)) - .isEmpty(); - } + assertThat(repository.findIncompletePublicationsByEventAndTargetIdentifier(testEvent, TARGET_IDENTIFIER)) + .isEmpty(); + } - @Test // GH-3 - void shouldNotReturnCompletedEvents() { + @Test // GH-3 + void shouldNotReturnCompletedEvents() { - var testEvent = new TestEvent("id1"); - var serializedEvent = "{\"eventId\":\"id1\"}"; + var testEvent = new TestEvent("id1"); + var serializedEvent = "{\"eventId\":\"id1\"}"; - when(serializer.serialize(testEvent)).thenReturn(serializedEvent); - when(serializer.deserialize(serializedEvent, TestEvent.class)).thenReturn(testEvent); + when(serializer.serialize(testEvent)).thenReturn(serializedEvent); + when(serializer.deserialize(serializedEvent, TestEvent.class)).thenReturn(testEvent); - var publication = CompletableEventPublication.of(testEvent, TARGET_IDENTIFIER); + var publication = CompletableEventPublication.of(testEvent, TARGET_IDENTIFIER); - repository.create(publication); - repository.update(publication.markCompleted()); + repository.create(publication); + repository.update(publication.markCompleted()); - var actual = repository.findIncompletePublicationsByEventAndTargetIdentifier(testEvent, TARGET_IDENTIFIER); + var actual = repository.findIncompletePublicationsByEventAndTargetIdentifier(testEvent, TARGET_IDENTIFIER); - assertThat(actual).isEmpty(); - } + assertThat(actual).isEmpty(); + } - @Test // GH-3 - void shouldReturnTheOldestEvent() throws Exception { + @Test // GH-3 + void shouldReturnTheOldestEvent() throws Exception { - var testEvent = new TestEvent("id"); - var serializedEvent = "{\"eventId\":\"id\"}"; + var testEvent = new TestEvent("id"); + var serializedEvent = "{\"eventId\":\"id\"}"; - when(serializer.serialize(testEvent)).thenReturn(serializedEvent); - when(serializer.deserialize(serializedEvent, TestEvent.class)).thenReturn(testEvent); + when(serializer.serialize(testEvent)).thenReturn(serializedEvent); + when(serializer.deserialize(serializedEvent, TestEvent.class)).thenReturn(testEvent); - var publicationOld = CompletableEventPublication.of(testEvent, TARGET_IDENTIFIER); - Thread.sleep(10); - var publicationNew = CompletableEventPublication.of(testEvent, TARGET_IDENTIFIER); + var publicationOld = CompletableEventPublication.of(testEvent, TARGET_IDENTIFIER); + Thread.sleep(10); + var publicationNew = CompletableEventPublication.of(testEvent, TARGET_IDENTIFIER); - repository.create(publicationNew); - repository.create(publicationOld); + repository.create(publicationNew); + repository.create(publicationOld); - var actual = repository.findIncompletePublicationsByEventAndTargetIdentifier(testEvent, TARGET_IDENTIFIER); + var actual = repository.findIncompletePublicationsByEventAndTargetIdentifier(testEvent, TARGET_IDENTIFIER); - assertThat(actual).hasValueSatisfying(it -> { - assertThat(it.getPublicationDate()) // - .isCloseTo(publicationOld.getPublicationDate(), within(1, ChronoUnit.MILLIS)); - }); - } + assertThat(actual).hasValueSatisfying(it -> { + assertThat(it.getPublicationDate()) // + .isCloseTo(publicationOld.getPublicationDate(), within(1, ChronoUnit.MILLIS)); + }); + } - @Test - // GH-3 - void shouldSilentlyIgnoreNotSerializableEvents() { + @Test + // GH-3 + void shouldSilentlyIgnoreNotSerializableEvents() { - var testEvent = new TestEvent("id"); - var serializedEvent = "{\"eventId\":\"id\"}"; + var testEvent = new TestEvent("id"); + var serializedEvent = "{\"eventId\":\"id\"}"; - when(serializer.serialize(testEvent)).thenReturn(serializedEvent); - when(serializer.deserialize(serializedEvent, TestEvent.class)).thenReturn(testEvent); + when(serializer.serialize(testEvent)).thenReturn(serializedEvent); + when(serializer.deserialize(serializedEvent, TestEvent.class)).thenReturn(testEvent); - // Store publication - repository.create(CompletableEventPublication.of(testEvent, TARGET_IDENTIFIER)); + // Store publication + repository.create(CompletableEventPublication.of(testEvent, TARGET_IDENTIFIER)); - operations.update("UPDATE EVENT_PUBLICATION SET EVENT_TYPE='abc'"); + operations.update("UPDATE EVENT_PUBLICATION SET EVENT_TYPE='abc'"); - assertThat(repository.findIncompletePublicationsByEventAndTargetIdentifier(testEvent, TARGET_IDENTIFIER)) - .isEmpty(); - } + assertThat(repository.findIncompletePublicationsByEventAndTargetIdentifier(testEvent, TARGET_IDENTIFIER)) + .isEmpty(); } - @Nested - class DeleteCompletedPublications { - - @Test // GH-20 - void shouldDeleteCompletedEvents() { + @Test // GH-20 + void shouldDeleteCompletedEvents() { - var testEvent1 = new TestEvent("abc"); - var serializedEvent1 = "{\"eventId\":\"abc\"}"; - var testEvent2 = new TestEvent("def"); - var serializedEvent2 = "{\"eventId\":\"def\"}"; + var testEvent1 = new TestEvent("abc"); + var serializedEvent1 = "{\"eventId\":\"abc\"}"; + var testEvent2 = new TestEvent("def"); + var serializedEvent2 = "{\"eventId\":\"def\"}"; - when(serializer.serialize(testEvent1)).thenReturn(serializedEvent1); - when(serializer.deserialize(serializedEvent1, TestEvent.class)).thenReturn(testEvent1); - when(serializer.serialize(testEvent2)).thenReturn(serializedEvent2); - when(serializer.deserialize(serializedEvent2, TestEvent.class)).thenReturn(testEvent2); + when(serializer.serialize(testEvent1)).thenReturn(serializedEvent1); + when(serializer.deserialize(serializedEvent1, TestEvent.class)).thenReturn(testEvent1); + when(serializer.serialize(testEvent2)).thenReturn(serializedEvent2); + when(serializer.deserialize(serializedEvent2, TestEvent.class)).thenReturn(testEvent2); - var publication1 = CompletableEventPublication.of(testEvent1, TARGET_IDENTIFIER); - var publication2 = CompletableEventPublication.of(testEvent2, TARGET_IDENTIFIER); + var publication1 = CompletableEventPublication.of(testEvent1, TARGET_IDENTIFIER); + var publication2 = CompletableEventPublication.of(testEvent2, TARGET_IDENTIFIER); - repository.create(publication1); - repository.create(publication2); + repository.create(publication1); + repository.create(publication2); - repository.update(publication1.markCompleted()); + repository.update(publication1.markCompleted()); - repository.deleteCompletedPublications(); + repository.deleteCompletedPublications(); - assertThat(operations.query("SELECT * FROM EVENT_PUBLICATION", (rs, __) -> rs.getString("SERIALIZED_EVENT"))) - .hasSize(1).element(0).isEqualTo(serializedEvent2); - } + assertThat(operations.query("SELECT * FROM EVENT_PUBLICATION", (rs, __) -> rs.getString("SERIALIZED_EVENT"))) + .hasSize(1).element(0).isEqualTo(serializedEvent2); } } diff --git a/spring-modulith-events/spring-modulith-events-jdbc/src/test/resources/logback.xml b/spring-modulith-events/spring-modulith-events-jdbc/src/test/resources/logback.xml new file mode 100644 index 00000000..878078aa --- /dev/null +++ b/spring-modulith-events/spring-modulith-events-jdbc/src/test/resources/logback.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<configuration> + + <appender name="console" class="ch.qos.logback.core.ConsoleAppender"> + <encoder> + <pattern>%d %5p %40.40c:%4L - %m%n</pattern> + </encoder> + </appender> + + <root level="error"> + <appender-ref ref="console" /> + </root> + + <!--<logger name="org.springframework.modulith" level="info" />--> + +</configuration> From 1985529e3feb3fb7a295df81bc32fb05495cf3fb Mon Sep 17 00:00:00 2001 From: Yossi Spektor <easpex@gmail.com> Date: Fri, 2 Jun 2023 17:08:01 +0300 Subject: [PATCH 5/9] Add readme. --- spring-modulith-examples/spring-modulith-example-full/README.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 spring-modulith-examples/spring-modulith-example-full/README.md diff --git a/spring-modulith-examples/spring-modulith-example-full/README.md b/spring-modulith-examples/spring-modulith-example-full/README.md new file mode 100644 index 00000000..e69de29b From 50eb22d195493739330d9f39db704af17373e852 Mon Sep 17 00:00:00 2001 From: Yossi Spektor <easpex@gmail.com> Date: Fri, 9 Jun 2023 20:03:12 +0300 Subject: [PATCH 6/9] Add explanation. --- src/docs/asciidoc/30-testing.adoc | 89 +++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) diff --git a/src/docs/asciidoc/30-testing.adoc b/src/docs/asciidoc/30-testing.adoc index b548f042..dc563c67 100644 --- a/src/docs/asciidoc/30-testing.adoc +++ b/src/docs/asciidoc/30-testing.adoc @@ -178,6 +178,95 @@ The `result` handed into the `….andVerify(…)` method will be the value retur By default, non-`null` values and non-empty ``Optional``s will be considered a conclusive state change. This can be tweaked by using the `….andWaitForStateChange(…, Predicate)` overload. +[[testing.efferent-dependencies.in.scenarios]] +=== Dealing with Efferent Dependencies In Scenarios + +Consider the following scenario: `order` module sends an event which is consumed by `inventory` module which in its turn sends another event: + +[source, java] +---- +@Service +@RequiredArgsConstructor +public class OrderManagement { + + private final @NonNull ApplicationEventPublisher events; + + @Transactional + public void complete(Order order) { + // ... + events.publishEvent(new OrderCompleted(order.getId())); + } +} +---- + +[source, java] +---- +@Service +@RequiredArgsConstructor +class InventoryManagement { + + private final ApplicationEventPublisher events; + + @ApplicationModuleListener + void on(OrderCompleted event) { + // ... + events.publishEvent(new InventoryUpdated(orderId)); + } +} + +---- + +If we were to write an integration test which checks that `InventoryUpdated` event is fired after `InventoryManagement` receives `OrderCompleted` under `order` test package, it could look as follows: + +[source, java] +---- +@ApplicationModuleTest(extraIncludes = "inventory") +@RequiredArgsConstructor +class OrderManagementTests { + + @Test + void inventoryUpdatedIsPublishedOnOrderCompleted(Scenario scenario) { + Order order = new Order(); + + scenario.publish(new OrderCompleted(order.getId())) + .andWaitForEventOfType(InventoryUpdated.class) + .toArrive(); + } +} + +---- + +Since `order` doesn't have a direct dependency on `inventory` module using `DIRECT_DEPENDENCIES` or `ALL_DEPENDENCIES` bootstrap modes will not import `inventory` module related logic, hence `InventoryUpdated` event will not be fired and the test will fail. +In such cases `ApplicationModuleTest` annotation provides `extraIncludes` parameter where extra dependencies may be specified. + +One could argue that the above test doesn't really belong to `order` test package but rather it's an application-wide integration test. It could probably be placed directly under the root test package: + +[source, java] +---- +@SpringBootTest +@EnableScenarios +class ApplicationIntegrationTests { + + @Test + void inventoryUpdatedIsPublishedOnOrderCompleted(Scenario scenario) { + Order order = new Order(); + + scenario.publish(new OrderCompleted(order.getId())) + .andWaitForEventOfType(InventoryUpdated.class) + .toArrive(); + } +} + +---- + +In such case the combination of `@SpringBootTest` and `@EnableScenarios` can be used (specifying `ApplicationModuleTest` will result in error since the root package is not part of any module). + +To summarize when writing integration tests for modules which interact via events instead of directly depending on another module (via Spring dependency injection mechanisms) Spring Modulith provides +two options to include dependencies: + +* Specifying the dependencies in `extraIncludes` parameter of `@ApplicationModuleTest` +* Using the combination of `@SpringBootTest` and `@EnableScenarios` + [[testing.scenarios.customize]] === Customizing Scenario Execution From 2cd8bae19c7035e0278b2737b750b3aa326b030a Mon Sep 17 00:00:00 2001 From: Yossi Spektor <easpex@gmail.com> Date: Fri, 9 Jun 2023 21:49:55 +0300 Subject: [PATCH 7/9] Improve wording. --- src/docs/asciidoc/30-testing.adoc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/docs/asciidoc/30-testing.adoc b/src/docs/asciidoc/30-testing.adoc index dc563c67..7e162212 100644 --- a/src/docs/asciidoc/30-testing.adoc +++ b/src/docs/asciidoc/30-testing.adoc @@ -179,9 +179,9 @@ By default, non-`null` values and non-empty ``Optional``s will be considered a c This can be tweaked by using the `….andWaitForStateChange(…, Predicate)` overload. [[testing.efferent-dependencies.in.scenarios]] -=== Dealing with Efferent Dependencies In Scenarios +=== Dealing with Efferent Dependencies In Integration Test Scenarios -Consider the following scenario: `order` module sends an event which is consumed by `inventory` module which in its turn sends another event: +Consider the following scenario: `order` module publishes an event which is consumed by `inventory` module which in its turn sends another event: [source, java] ---- @@ -216,7 +216,7 @@ class InventoryManagement { ---- -If we were to write an integration test which checks that `InventoryUpdated` event is fired after `InventoryManagement` receives `OrderCompleted` under `order` test package, it could look as follows: +If we were to write an integration test which checks that `InventoryUpdated` event is fired after `InventoryManagement` receives `OrderCompleted` in `order` test package, it could look as follows: [source, java] ---- @@ -236,7 +236,7 @@ class OrderManagementTests { ---- -Since `order` doesn't have a direct dependency on `inventory` module using `DIRECT_DEPENDENCIES` or `ALL_DEPENDENCIES` bootstrap modes will not import `inventory` module related logic, hence `InventoryUpdated` event will not be fired and the test will fail. +Since `order` doesn't have a direct dependency on `inventory` module using `DIRECT_DEPENDENCIES` or `ALL_DEPENDENCIES` bootstrap modes will not import `inventory` module related logic. As a result `InventoryUpdated` event will not be fired and the test will fail. In such cases `ApplicationModuleTest` annotation provides `extraIncludes` parameter where extra dependencies may be specified. One could argue that the above test doesn't really belong to `order` test package but rather it's an application-wide integration test. It could probably be placed directly under the root test package: @@ -261,7 +261,7 @@ class ApplicationIntegrationTests { In such case the combination of `@SpringBootTest` and `@EnableScenarios` can be used (specifying `ApplicationModuleTest` will result in error since the root package is not part of any module). -To summarize when writing integration tests for modules which interact via events instead of directly depending on another module (via Spring dependency injection mechanisms) Spring Modulith provides +To summarize when writing integration tests for application modules which interact via events instead of directly depending on another module (via Spring dependency injection mechanisms) Spring Modulith provides two options to include dependencies: * Specifying the dependencies in `extraIncludes` parameter of `@ApplicationModuleTest` From eabb8311fea594c16555b1d6f53d6675f557988b Mon Sep 17 00:00:00 2001 From: Yossi Spektor <easpex@gmail.com> Date: Fri, 9 Jun 2023 21:50:22 +0300 Subject: [PATCH 8/9] Revert "Add readme." This reverts commit 1985529e3feb3fb7a295df81bc32fb05495cf3fb. --- spring-modulith-examples/spring-modulith-example-full/README.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 spring-modulith-examples/spring-modulith-example-full/README.md diff --git a/spring-modulith-examples/spring-modulith-example-full/README.md b/spring-modulith-examples/spring-modulith-example-full/README.md deleted file mode 100644 index e69de29b..00000000 From 0e811fbcc0ee8989e6e7147cb5352c92f8808aa2 Mon Sep 17 00:00:00 2001 From: Yossi Spektor <easpex@gmail.com> Date: Fri, 9 Jun 2023 21:57:04 +0300 Subject: [PATCH 9/9] Use a better header. --- src/docs/asciidoc/30-testing.adoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/docs/asciidoc/30-testing.adoc b/src/docs/asciidoc/30-testing.adoc index 7e162212..796091fa 100644 --- a/src/docs/asciidoc/30-testing.adoc +++ b/src/docs/asciidoc/30-testing.adoc @@ -178,8 +178,8 @@ The `result` handed into the `….andVerify(…)` method will be the value retur By default, non-`null` values and non-empty ``Optional``s will be considered a conclusive state change. This can be tweaked by using the `….andWaitForStateChange(…, Predicate)` overload. -[[testing.efferent-dependencies.in.scenarios]] -=== Dealing with Efferent Dependencies In Integration Test Scenarios +[[testing.scenarios.of.event-driven-modules]] +=== Integration Test Scenarios of Event-Driven Modules Consider the following scenario: `order` module publishes an event which is consumed by `inventory` module which in its turn sends another event: