diff --git a/restaurants-command-side-web/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/commandside/web/CreateRestaurantResponse.java b/common-restaurants/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/common/CreateRestaurantResponse.java similarity index 95% rename from restaurants-command-side-web/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/commandside/web/CreateRestaurantResponse.java rename to common-restaurants/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/common/CreateRestaurantResponse.java index 3e737aa..337b40d 100644 --- a/restaurants-command-side-web/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/commandside/web/CreateRestaurantResponse.java +++ b/common-restaurants/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/common/CreateRestaurantResponse.java @@ -1,4 +1,4 @@ -package net.chrisrichardson.eventstore.examples.management.restaurant.commandside.web; +package net.chrisrichardson.eventstore.examples.management.restaurant.common; public class CreateRestaurantResponse { diff --git a/restaurants-command-side-web/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/commandside/web/DeleteRestaurantResponse.java b/common-restaurants/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/common/DeleteRestaurantResponse.java similarity index 94% rename from restaurants-command-side-web/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/commandside/web/DeleteRestaurantResponse.java rename to common-restaurants/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/common/DeleteRestaurantResponse.java index 13a9a60..82a0e0a 100644 --- a/restaurants-command-side-web/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/commandside/web/DeleteRestaurantResponse.java +++ b/common-restaurants/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/common/DeleteRestaurantResponse.java @@ -1,4 +1,4 @@ -package net.chrisrichardson.eventstore.examples.management.restaurant.commandside.web; +package net.chrisrichardson.eventstore.examples.management.restaurant.common; public class DeleteRestaurantResponse { diff --git a/restaurants-query-side-web/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/queryside/web/FindAvailableRestaurantsRequest.java b/common-restaurants/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/common/FindAvailableRestaurantsRequest.java similarity index 86% rename from restaurants-query-side-web/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/queryside/web/FindAvailableRestaurantsRequest.java rename to common-restaurants/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/common/FindAvailableRestaurantsRequest.java index 698a82d..949a553 100644 --- a/restaurants-query-side-web/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/queryside/web/FindAvailableRestaurantsRequest.java +++ b/common-restaurants/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/common/FindAvailableRestaurantsRequest.java @@ -1,8 +1,6 @@ -package net.chrisrichardson.eventstore.examples.management.restaurant.queryside.web; +package net.chrisrichardson.eventstore.examples.management.restaurant.common; -import net.chrisrichardson.eventstore.examples.management.restaurant.common.Address; -import net.chrisrichardson.eventstore.examples.management.restaurant.common.DeliveryTime; import org.apache.commons.lang.builder.ToStringBuilder; public class FindAvailableRestaurantsRequest { diff --git a/restaurants-command-side-web/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/commandside/web/UpdateRestaurantResponse.java b/common-restaurants/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/common/UpdateRestaurantResponse.java similarity index 94% rename from restaurants-command-side-web/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/commandside/web/UpdateRestaurantResponse.java rename to common-restaurants/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/common/UpdateRestaurantResponse.java index 7a60eb6..1fb2b5c 100644 --- a/restaurants-command-side-web/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/commandside/web/UpdateRestaurantResponse.java +++ b/common-restaurants/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/common/UpdateRestaurantResponse.java @@ -1,4 +1,4 @@ -package net.chrisrichardson.eventstore.examples.management.restaurant.commandside.web; +package net.chrisrichardson.eventstore.examples.management.restaurant.common; public class UpdateRestaurantResponse { diff --git a/common-restaurants/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/common/event/RestaurantEvent.java b/common-restaurants/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/common/event/RestaurantEvent.java index e059d00..ddc21c0 100644 --- a/common-restaurants/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/common/event/RestaurantEvent.java +++ b/common-restaurants/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/common/event/RestaurantEvent.java @@ -4,6 +4,6 @@ import io.eventuate.Event; import io.eventuate.EventEntity; -@EventEntity(entity="net.chrisrichardson.eventstore.examples.management.restaurant.commandside.RestaurantAggregate") +@EventEntity(entity="net.chrisrichardson.eventstore.examples.management.restaurantsservice.backend.RestaurantAggregate") public abstract class RestaurantEvent implements Event { } \ No newline at end of file diff --git a/common-tests/build.gradle b/common-tests/build.gradle index 39e31e7..9793f43 100644 --- a/common-tests/build.gradle +++ b/common-tests/build.gradle @@ -1,8 +1,6 @@ dependencies { compile project(":testutil") compile project(":common-restaurants") - compile project(":restaurants-command-side-web") - compile project(":restaurants-query-side-web") compile "org.springframework.boot:spring-boot-starter-web:$springBootVersion" diff --git a/common-tests/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/integrationtests/AbstractRestaurantManagementIntegrationTest.java b/common-tests/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/integrationtests/AbstractRestaurantManagementIntegrationTest.java index 24af622..62fffc4 100644 --- a/common-tests/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/integrationtests/AbstractRestaurantManagementIntegrationTest.java +++ b/common-tests/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/integrationtests/AbstractRestaurantManagementIntegrationTest.java @@ -1,11 +1,6 @@ package net.chrisrichardson.eventstore.examples.management.restaurant.integrationtests; -import net.chrisrichardson.eventstore.examples.management.restaurant.commandside.web.CreateRestaurantResponse; -import net.chrisrichardson.eventstore.examples.management.restaurant.commandside.web.UpdateRestaurantResponse; -import net.chrisrichardson.eventstore.examples.management.restaurant.common.Address; -import net.chrisrichardson.eventstore.examples.management.restaurant.common.DeliveryTime; -import net.chrisrichardson.eventstore.examples.management.restaurant.common.RestaurantInfo; -import net.chrisrichardson.eventstore.examples.management.restaurant.queryside.web.FindAvailableRestaurantsRequest; +import net.chrisrichardson.eventstore.examples.management.restaurant.common.*; import net.chrisrichardson.eventstore.examples.management.restaurant.testutil.RestaurantMother; import net.chrisrichardson.eventstore.examples.management.restaurant.testutil.RestaurantTestData; import org.junit.Assert; diff --git a/docker-compose-common.yml b/docker-compose-common.yml index 80a10ef..763ddb4 100644 --- a/docker-compose-common.yml +++ b/docker-compose-common.yml @@ -4,13 +4,13 @@ redis: ports: - "6379:6379" -restaurantscommandside: - build: ./restaurants-command-side-service/ +restaurants: + build: ./restaurants-service/ ports: - "8081:8080" -restaurantsqueryside: - build: ./restaurants-query-side-service/ +restaurantsview: + build: ./restaurants-view-service/ ports: - "8082:8080" environment: diff --git a/docker-compose-eventuate-local.yml b/docker-compose-eventuate-local.yml index 95b3359..b36b915 100644 --- a/docker-compose-eventuate-local.yml +++ b/docker-compose-eventuate-local.yml @@ -50,12 +50,12 @@ redis: file: docker-compose-common.yml service: redis -restaurantscommandside: +restaurants: extends: file: docker-compose-common.yml - service: restaurantscommandside + service: restaurants volumes: - - ./restaurants-command-side-service/build/libs:/app + - ./restaurants-service/build/libs:/app links: - mysql - kafka @@ -70,12 +70,12 @@ restaurantscommandside: EVENTUATELOCAL_CDC_DB_USER_NAME: root EVENTUATELOCAL_CDC_DB_PASSWORD: rootpassword -restaurantsqueryside: +restaurantsview: extends: file: docker-compose-common.yml - service: restaurantsqueryside + service: restaurantsview volumes: - - ./restaurants-query-side-service/build/libs:/app + - ./restaurants-view-service/build/libs:/app links: - redis - mysql diff --git a/docker-compose.yml b/docker-compose.yml index 062a102..ade4aca 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,22 +3,22 @@ redis: file: docker-compose-common.yml service: redis -restaurantscommandside: +restaurants: extends: file: docker-compose-common.yml - service: restaurantscommandside + service: restaurants volumes: - - ./restaurants-command-side-service/build/libs:/app + - ./restaurants-service/build/libs:/app environment: EVENTUATE_API_KEY_ID: ${EVENTUATE_API_KEY_ID} EVENTUATE_API_KEY_SECRET: ${EVENTUATE_API_KEY_SECRET} -restaurantsqueryside: +restaurantsview: extends: file: docker-compose-common.yml - service: restaurantsqueryside + service: restaurantsview volumes: - - ./restaurants-query-side-service/build/libs:/app + - ./restaurants-view-service/build/libs:/app links: - redis environment: diff --git a/e2e-test/build.gradle b/e2e-test/build.gradle index b79a4dd..eefea84 100644 --- a/e2e-test/build.gradle +++ b/e2e-test/build.gradle @@ -1,5 +1,4 @@ dependencies { - testCompile project(":restaurants-command-side-web") testCompile project(":common-tests") testCompile "org.springframework.boot:spring-boot-starter-web:$springBootVersion" testCompile "org.springframework.boot:spring-boot-starter-test:$springBootVersion" diff --git a/gradle.properties b/gradle.properties index 61a5b59..0dc41bd 100755 --- a/gradle.properties +++ b/gradle.properties @@ -1,7 +1,7 @@ org.gradle.jvmargs=-XX:MaxPermSize=512m -eventuateClientVersion=0.10.0.RELEASE -eventuateLocalVersion=0.4.0.RELEASE - springBootVersion=1.3.5.RELEASE + +eventuateClientVersion=0.12.0.RELEASE +eventuateLocalVersion=0.6.0.RELEASE \ No newline at end of file diff --git a/monolithic-service/build.gradle b/monolithic-service/build.gradle deleted file mode 100644 index 7fd0ca7..0000000 --- a/monolithic-service/build.gradle +++ /dev/null @@ -1,17 +0,0 @@ -apply plugin: VerifyEventStoreEnvironmentPlugin -apply plugin: EventuateDependencyPlugin - -apply plugin: 'spring-boot' - -dependencies { - compile project(":restaurants-command-side-web") - compile project(":restaurants-query-side-web") - compile project(":common-swagger") - - compile "org.springframework.boot:spring-boot-starter-web" - compile "org.springframework.boot:spring-boot-starter-actuator" - - testCompile project(":common-tests") - testCompile "org.springframework.boot:spring-boot-starter-test" - testCompile "io.eventuate.client.java:eventuate-client-java-jdbc:$eventuateClientVersion" -} \ No newline at end of file diff --git a/monolithic-service/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/monolithic/RestaurantsConfiguration.java b/monolithic-service/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/monolithic/RestaurantsConfiguration.java deleted file mode 100644 index a9322c2..0000000 --- a/monolithic-service/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/monolithic/RestaurantsConfiguration.java +++ /dev/null @@ -1,18 +0,0 @@ -package net.chrisrichardson.eventstore.examples.management.restaurant.monolithic; - -import io.eventuate.javaclient.spring.httpstomp.EventuateHttpStompClientConfiguration; -import net.chrisrichardson.eventstore.examples.management.restaurant.commandside.RestaurantsCommandsideConfiguration; -import net.chrisrichardson.eventstore.examples.management.restaurant.commonswagger.CommonSwaggerConfiguration; -import net.chrisrichardson.eventstore.examples.management.restaurant.commonweb.WebConfiguration; -import net.chrisrichardson.eventstore.examples.management.restaurant.queryside.RestaurantsQuerysideConfiguration; -import org.springframework.boot.autoconfigure.EnableAutoConfiguration; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Import; - -@Configuration -@Import({RestaurantsQuerysideConfiguration.class, RestaurantsCommandsideConfiguration.class, EventuateHttpStompClientConfiguration.class, WebConfiguration.class, CommonSwaggerConfiguration.class}) -@EnableAutoConfiguration -@ComponentScan -public class RestaurantsConfiguration { -} diff --git a/monolithic-service/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/monolithic/main/RestaurantsMonolithicMain.java b/monolithic-service/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/monolithic/main/RestaurantsMonolithicMain.java deleted file mode 100644 index 2d35be1..0000000 --- a/monolithic-service/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/monolithic/main/RestaurantsMonolithicMain.java +++ /dev/null @@ -1,11 +0,0 @@ -package net.chrisrichardson.eventstore.examples.management.restaurant.monolithic.main; - -import net.chrisrichardson.eventstore.examples.management.restaurant.monolithic.RestaurantsConfiguration; -import org.springframework.boot.SpringApplication; - -public class RestaurantsMonolithicMain { - - public static void main(String[] args) { - SpringApplication.run(RestaurantsConfiguration.class, args); - } -} diff --git a/restaurants-command-side-service/Dockerfile b/restaurants-command-side-service/Dockerfile deleted file mode 100644 index c72439f..0000000 --- a/restaurants-command-side-service/Dockerfile +++ /dev/null @@ -1,3 +0,0 @@ -FROM java:openjdk-8u91-jdk -CMD java ${JAVA_OPTS} -jar restaurants-command-side-service.jar -COPY build/libs/restaurants-command-side-service.jar . \ No newline at end of file diff --git a/restaurants-command-side-service/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/commandside/main/RestaurantsCommandsideMain.java b/restaurants-command-side-service/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/commandside/main/RestaurantsCommandsideMain.java deleted file mode 100644 index 3fe4adb..0000000 --- a/restaurants-command-side-service/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/commandside/main/RestaurantsCommandsideMain.java +++ /dev/null @@ -1,11 +0,0 @@ -package net.chrisrichardson.eventstore.examples.management.restaurant.commandside.main; - -import net.chrisrichardson.eventstore.examples.management.restaurant.commandside.RestaurantsServiceCommandsideConfiguration; -import org.springframework.boot.SpringApplication; - -public class RestaurantsCommandsideMain { - - public static void main(String[] args) { - SpringApplication.run(RestaurantsServiceCommandsideConfiguration.class, args); - } -} diff --git a/restaurants-command-side-web/build.gradle b/restaurants-command-side-web/build.gradle deleted file mode 100644 index 8145878..0000000 --- a/restaurants-command-side-web/build.gradle +++ /dev/null @@ -1,13 +0,0 @@ - -dependencies { - compile project(":common-web") - compile project(":restaurants-command-side-backend") - - compile "org.springframework.boot:spring-boot-starter-web:$springBootVersion" - - testCompile project(":testutil") - testCompile "org.springframework.boot:spring-boot-starter-test:$springBootVersion" - testCompile "io.eventuate.client.java:eventuate-client-java-jdbc:$eventuateClientVersion" - - testCompile "junit:junit:4.11" -} diff --git a/restaurants-command-side-web/src/test/java/net/chrisrichardson/eventstore/examples/management/restaurant/commandside/web/RestaurantControllerIntegrationTestConfiguration.java b/restaurants-command-side-web/src/test/java/net/chrisrichardson/eventstore/examples/management/restaurant/commandside/web/RestaurantControllerIntegrationTestConfiguration.java deleted file mode 100644 index 2e897e2..0000000 --- a/restaurants-command-side-web/src/test/java/net/chrisrichardson/eventstore/examples/management/restaurant/commandside/web/RestaurantControllerIntegrationTestConfiguration.java +++ /dev/null @@ -1,15 +0,0 @@ -package net.chrisrichardson.eventstore.examples.management.restaurant.commandside.web; - -import io.eventuate.javaclient.spring.jdbc.EventuateJdbcEventStoreConfiguration; -import net.chrisrichardson.eventstore.examples.management.restaurant.commandside.RestaurantsCommandsideConfiguration; -import net.chrisrichardson.eventstore.examples.management.restaurant.commonweb.WebConfiguration; -import org.springframework.boot.autoconfigure.EnableAutoConfiguration; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Import; - -@Configuration -@Import({RestaurantsCommandsideConfiguration.class, EventuateJdbcEventStoreConfiguration.class, WebConfiguration.class}) -@EnableAutoConfiguration -public class RestaurantControllerIntegrationTestConfiguration { - -} diff --git a/restaurants-command-side-backend/build.gradle b/restaurants-integration-test/build.gradle similarity index 57% rename from restaurants-command-side-backend/build.gradle rename to restaurants-integration-test/build.gradle index a592024..157780f 100644 --- a/restaurants-command-side-backend/build.gradle +++ b/restaurants-integration-test/build.gradle @@ -1,8 +1,8 @@ dependencies { - compile project(":common-restaurants") + testCompile project(":common-tests") + testCompile project(":restaurants-service") + testCompile project(":restaurants-view-service") - testCompile project(":testutil") - testCompile "junit:junit:4.11" testCompile "org.springframework.boot:spring-boot-starter-test:$springBootVersion" testCompile "io.eventuate.client.java:eventuate-client-java-jdbc:$eventuateClientVersion" -} +} \ No newline at end of file diff --git a/monolithic-service/src/test/java/net/chrisrichardson/eventstore/examples/management/restaurant/monolithic/RestaurantsIntegrationTest.java b/restaurants-integration-test/src/test/java/net/chrisrichardson/eventstore/examples/management/restaurant/integrationTests/RestaurantsIntegrationTest.java similarity index 97% rename from monolithic-service/src/test/java/net/chrisrichardson/eventstore/examples/management/restaurant/monolithic/RestaurantsIntegrationTest.java rename to restaurants-integration-test/src/test/java/net/chrisrichardson/eventstore/examples/management/restaurant/integrationTests/RestaurantsIntegrationTest.java index 2aa3b61..c1daffd 100644 --- a/monolithic-service/src/test/java/net/chrisrichardson/eventstore/examples/management/restaurant/monolithic/RestaurantsIntegrationTest.java +++ b/restaurants-integration-test/src/test/java/net/chrisrichardson/eventstore/examples/management/restaurant/integrationTests/RestaurantsIntegrationTest.java @@ -1,4 +1,4 @@ -package net.chrisrichardson.eventstore.examples.management.restaurant.monolithic; +package net.chrisrichardson.eventstore.examples.management.restaurant.integrationTests; import net.chrisrichardson.eventstore.examples.management.restaurant.integrationtests.AbstractRestaurantManagementIntegrationTest; import org.junit.runner.RunWith; diff --git a/monolithic-service/src/test/java/net/chrisrichardson/eventstore/examples/management/restaurant/monolithic/RestaurantsIntegrationTestConfiguration.java b/restaurants-integration-test/src/test/java/net/chrisrichardson/eventstore/examples/management/restaurant/integrationTests/RestaurantsIntegrationTestConfiguration.java similarity index 77% rename from monolithic-service/src/test/java/net/chrisrichardson/eventstore/examples/management/restaurant/monolithic/RestaurantsIntegrationTestConfiguration.java rename to restaurants-integration-test/src/test/java/net/chrisrichardson/eventstore/examples/management/restaurant/integrationTests/RestaurantsIntegrationTestConfiguration.java index c991e78..4c7347e 100644 --- a/monolithic-service/src/test/java/net/chrisrichardson/eventstore/examples/management/restaurant/monolithic/RestaurantsIntegrationTestConfiguration.java +++ b/restaurants-integration-test/src/test/java/net/chrisrichardson/eventstore/examples/management/restaurant/integrationTests/RestaurantsIntegrationTestConfiguration.java @@ -1,9 +1,8 @@ -package net.chrisrichardson.eventstore.examples.management.restaurant.monolithic; +package net.chrisrichardson.eventstore.examples.management.restaurant.integrationTests; -import io.eventuate.javaclient.spring.jdbc.EventuateJdbcEventStoreConfiguration; -import net.chrisrichardson.eventstore.examples.management.restaurant.commandside.RestaurantsCommandsideConfiguration; -import net.chrisrichardson.eventstore.examples.management.restaurant.commonweb.WebConfiguration; -import net.chrisrichardson.eventstore.examples.management.restaurant.queryside.RestaurantsQuerysideConfiguration; +import io.eventuate.javaclient.spring.jdbc.EmbeddedTestAggregateStoreConfiguration; +import net.chrisrichardson.eventstore.examples.management.restaurantsservice.web.RestaurantsWebConfiguration; +import net.chrisrichardson.eventstore.examples.management.restaurantsviewservice.web.RestaurantsViewWebConfiguration; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.web.HttpMessageConverters; import org.springframework.context.annotation.Bean; @@ -19,7 +18,9 @@ import java.util.List; @Configuration -@Import({RestaurantsQuerysideConfiguration.class, RestaurantsCommandsideConfiguration.class, EventuateJdbcEventStoreConfiguration.class, WebConfiguration.class}) +@Import({RestaurantsViewWebConfiguration.class, + RestaurantsWebConfiguration.class, + EmbeddedTestAggregateStoreConfiguration.class}) @EnableAutoConfiguration public class RestaurantsIntegrationTestConfiguration { @Bean diff --git a/restaurants-query-side-service/Dockerfile b/restaurants-query-side-service/Dockerfile deleted file mode 100644 index 507c5f7..0000000 --- a/restaurants-query-side-service/Dockerfile +++ /dev/null @@ -1,3 +0,0 @@ -FROM java:openjdk-8u91-jdk -CMD java ${JAVA_OPTS} -jar restaurants-query-side-service.jar -COPY build/libs/restaurants-query-side-service.jar . \ No newline at end of file diff --git a/restaurants-query-side-service/build.gradle b/restaurants-query-side-service/build.gradle deleted file mode 100644 index 49037b8..0000000 --- a/restaurants-query-side-service/build.gradle +++ /dev/null @@ -1,16 +0,0 @@ -apply plugin: VerifyEventStoreEnvironmentPlugin -apply plugin: EventuateDependencyPlugin - -apply plugin: 'spring-boot' - -dependencies { - compile project(":restaurants-query-side-web") - compile project(":common-swagger") - - compile "org.springframework.boot:spring-boot-starter-web:$springBootVersion" - compile "org.springframework.boot:spring-boot-starter-actuator:$springBootVersion" - - testCompile project(":testutil") - testCompile "junit:junit:4.11" - testCompile "org.springframework.boot:spring-boot-starter-test" -} diff --git a/restaurants-query-side-service/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/queryside/main/RestaurantsQuerysideMain.java b/restaurants-query-side-service/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/queryside/main/RestaurantsQuerysideMain.java deleted file mode 100644 index 6f1faf9..0000000 --- a/restaurants-query-side-service/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/queryside/main/RestaurantsQuerysideMain.java +++ /dev/null @@ -1,11 +0,0 @@ -package net.chrisrichardson.eventstore.examples.management.restaurant.queryside.main; - -import net.chrisrichardson.eventstore.examples.management.restaurant.queryside.RestaurantsServiceQuerysideConfiguration; -import org.springframework.boot.SpringApplication; - -public class RestaurantsQuerysideMain { - - public static void main(String[] args) { - SpringApplication.run(RestaurantsServiceQuerysideConfiguration.class, args); - } -} diff --git a/restaurants-query-side-web/build.gradle b/restaurants-query-side-web/build.gradle deleted file mode 100644 index 3e0d385..0000000 --- a/restaurants-query-side-web/build.gradle +++ /dev/null @@ -1,15 +0,0 @@ - -dependencies { - compile project(":common-web") - compile project(":restaurants-query-side-backend") - - compile "org.springframework.boot:spring-boot-starter-web:$springBootVersion" - compile "org.springframework.boot:spring-boot-starter-redis:$springBootVersion" - - compile "org.springframework.boot:spring-boot-starter-actuator:$springBootVersion" - - testCompile project(":testutil") - testCompile project(":restaurants-command-side-backend") - testCompile "org.springframework.boot:spring-boot-starter-test:$springBootVersion" - testCompile "io.eventuate.client.java:eventuate-client-java-jdbc:$eventuateClientVersion" -} diff --git a/restaurants-query-side-web/src/test/java/net/chrisrichardson/eventstore/examples/management/restaurant/queryside/web/RestaurantQuerySideControllerIntegrationTestConfiguration.java b/restaurants-query-side-web/src/test/java/net/chrisrichardson/eventstore/examples/management/restaurant/queryside/web/RestaurantQuerySideControllerIntegrationTestConfiguration.java deleted file mode 100644 index 6544a95..0000000 --- a/restaurants-query-side-web/src/test/java/net/chrisrichardson/eventstore/examples/management/restaurant/queryside/web/RestaurantQuerySideControllerIntegrationTestConfiguration.java +++ /dev/null @@ -1,29 +0,0 @@ -package net.chrisrichardson.eventstore.examples.management.restaurant.queryside.web; - -import io.eventuate.AggregateRepository; -import io.eventuate.EventuateAggregateStore; -import io.eventuate.javaclient.spring.jdbc.EventuateJdbcEventStoreConfiguration; -import net.chrisrichardson.eventstore.examples.management.restaurant.commandside.RestaurantAggregate; -import net.chrisrichardson.eventstore.examples.management.restaurant.commandside.RestaurantCommand; -import net.chrisrichardson.eventstore.examples.management.restaurant.commandside.RestaurantService; -import net.chrisrichardson.eventstore.examples.management.restaurant.commandside.RestaurantsCommandsideConfiguration; -import net.chrisrichardson.eventstore.examples.management.restaurant.queryside.RestaurantsQuerysideConfiguration; -import org.springframework.boot.autoconfigure.EnableAutoConfiguration; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Import; - -@Configuration -@Import({RestaurantsQuerysideConfiguration.class, RestaurantsCommandsideConfiguration.class, EventuateJdbcEventStoreConfiguration.class}) -@EnableAutoConfiguration -public class RestaurantQuerySideControllerIntegrationTestConfiguration { - @Bean - public AggregateRepository restaurantAggregateRepository(EventuateAggregateStore eventStore) { - return new AggregateRepository<>(RestaurantAggregate.class, eventStore); - } - - @Bean - public RestaurantService restaurantService(AggregateRepository restaurantAggregateRepository) { - return new RestaurantService(restaurantAggregateRepository); - } -} diff --git a/restaurants-service/Dockerfile b/restaurants-service/Dockerfile new file mode 100644 index 0000000..cc34ffd --- /dev/null +++ b/restaurants-service/Dockerfile @@ -0,0 +1,3 @@ +FROM java:openjdk-8u91-jdk +CMD java ${JAVA_OPTS} -jar restaurants-service.jar +COPY build/libs/restaurants-service.jar . \ No newline at end of file diff --git a/restaurants-command-side-service/build.gradle b/restaurants-service/build.gradle similarity index 71% rename from restaurants-command-side-service/build.gradle rename to restaurants-service/build.gradle index d68c054..0fc0a12 100644 --- a/restaurants-command-side-service/build.gradle +++ b/restaurants-service/build.gradle @@ -4,13 +4,15 @@ apply plugin: EventuateDependencyPlugin apply plugin: 'spring-boot' dependencies { - compile project(":restaurants-command-side-web") + compile project(":common-restaurants") + compile project(":common-web") compile project(":common-swagger") compile "org.springframework.boot:spring-boot-starter-web:$springBootVersion" compile "org.springframework.boot:spring-boot-starter-actuator:$springBootVersion" - testCompile project(":testutil") testCompile "junit:junit:4.11" - testCompile "org.springframework.boot:spring-boot-starter-test" + testCompile project(":testutil") + testCompile "org.springframework.boot:spring-boot-starter-test:$springBootVersion" + testCompile "io.eventuate.client.java:eventuate-client-java-jdbc:$eventuateClientVersion" } diff --git a/restaurants-command-side-service/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/commandside/RestaurantsServiceCommandsideConfiguration.java b/restaurants-service/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurantsservice/RestaurantsServiceMain.java similarity index 54% rename from restaurants-command-side-service/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/commandside/RestaurantsServiceCommandsideConfiguration.java rename to restaurants-service/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurantsservice/RestaurantsServiceMain.java index 9eca962..2ef1ef9 100644 --- a/restaurants-command-side-service/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/commandside/RestaurantsServiceCommandsideConfiguration.java +++ b/restaurants-service/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurantsservice/RestaurantsServiceMain.java @@ -1,16 +1,23 @@ -package net.chrisrichardson.eventstore.examples.management.restaurant.commandside; +package net.chrisrichardson.eventstore.examples.management.restaurantsservice; -import io.eventuate.javaclient.spring.httpstomp.EventuateHttpStompClientConfiguration; +import io.eventuate.javaclient.driver.EventuateDriverConfiguration; import net.chrisrichardson.eventstore.examples.management.restaurant.commonswagger.CommonSwaggerConfiguration; -import net.chrisrichardson.eventstore.examples.management.restaurant.commonweb.WebConfiguration; +import net.chrisrichardson.eventstore.examples.management.restaurantsservice.web.RestaurantsWebConfiguration; +import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; @Configuration -@Import({RestaurantsCommandsideConfiguration.class, EventuateHttpStompClientConfiguration.class, WebConfiguration.class, CommonSwaggerConfiguration.class}) +@Import({RestaurantsWebConfiguration.class, + EventuateDriverConfiguration.class, + CommonSwaggerConfiguration.class}) @EnableAutoConfiguration @ComponentScan -public class RestaurantsServiceCommandsideConfiguration { +public class RestaurantsServiceMain { + + public static void main(String[] args) { + SpringApplication.run(RestaurantsServiceMain.class, args); + } } diff --git a/restaurants-command-side-backend/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/commandside/CreateRestaurantCommand.java b/restaurants-service/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurantsservice/backend/CreateRestaurantCommand.java similarity index 97% rename from restaurants-command-side-backend/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/commandside/CreateRestaurantCommand.java rename to restaurants-service/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurantsservice/backend/CreateRestaurantCommand.java index ed10140..156ed95 100644 --- a/restaurants-command-side-backend/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/commandside/CreateRestaurantCommand.java +++ b/restaurants-service/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurantsservice/backend/CreateRestaurantCommand.java @@ -1,4 +1,4 @@ -package net.chrisrichardson.eventstore.examples.management.restaurant.commandside; +package net.chrisrichardson.eventstore.examples.management.restaurantsservice.backend; import net.chrisrichardson.eventstore.examples.management.restaurant.common.RestaurantInfo; import org.apache.commons.lang.builder.ToStringBuilder; diff --git a/restaurants-command-side-backend/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/commandside/DeleteRestaurantCommand.java b/restaurants-service/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurantsservice/backend/DeleteRestaurantCommand.java similarity index 85% rename from restaurants-command-side-backend/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/commandside/DeleteRestaurantCommand.java rename to restaurants-service/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurantsservice/backend/DeleteRestaurantCommand.java index 71f3915..220c22c 100644 --- a/restaurants-command-side-backend/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/commandside/DeleteRestaurantCommand.java +++ b/restaurants-service/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurantsservice/backend/DeleteRestaurantCommand.java @@ -1,4 +1,4 @@ -package net.chrisrichardson.eventstore.examples.management.restaurant.commandside; +package net.chrisrichardson.eventstore.examples.management.restaurantsservice.backend; public class DeleteRestaurantCommand implements RestaurantCommand { } diff --git a/restaurants-command-side-backend/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/commandside/RestaurantAggregate.java b/restaurants-service/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurantsservice/backend/RestaurantAggregate.java similarity index 98% rename from restaurants-command-side-backend/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/commandside/RestaurantAggregate.java rename to restaurants-service/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurantsservice/backend/RestaurantAggregate.java index 6f34e4a..a3685cb 100644 --- a/restaurants-command-side-backend/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/commandside/RestaurantAggregate.java +++ b/restaurants-service/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurantsservice/backend/RestaurantAggregate.java @@ -1,4 +1,4 @@ -package net.chrisrichardson.eventstore.examples.management.restaurant.commandside; +package net.chrisrichardson.eventstore.examples.management.restaurantsservice.backend; import io.eventuate.Event; import io.eventuate.EventUtil; diff --git a/restaurants-command-side-backend/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/commandside/RestaurantCommand.java b/restaurants-service/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurantsservice/backend/RestaurantCommand.java similarity index 86% rename from restaurants-command-side-backend/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/commandside/RestaurantCommand.java rename to restaurants-service/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurantsservice/backend/RestaurantCommand.java index 1ea5382..b92c69b 100755 --- a/restaurants-command-side-backend/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/commandside/RestaurantCommand.java +++ b/restaurants-service/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurantsservice/backend/RestaurantCommand.java @@ -1,4 +1,4 @@ -package net.chrisrichardson.eventstore.examples.management.restaurant.commandside; +package net.chrisrichardson.eventstore.examples.management.restaurantsservice.backend; import io.eventuate.Command; diff --git a/restaurants-command-side-backend/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/commandside/RestaurantService.java b/restaurants-service/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurantsservice/backend/RestaurantService.java similarity index 98% rename from restaurants-command-side-backend/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/commandside/RestaurantService.java rename to restaurants-service/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurantsservice/backend/RestaurantService.java index 612f496..6473d79 100644 --- a/restaurants-command-side-backend/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/commandside/RestaurantService.java +++ b/restaurants-service/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurantsservice/backend/RestaurantService.java @@ -1,4 +1,4 @@ -package net.chrisrichardson.eventstore.examples.management.restaurant.commandside; +package net.chrisrichardson.eventstore.examples.management.restaurantsservice.backend; import io.eventuate.AggregateRepository; import io.eventuate.EntityWithIdAndVersion; diff --git a/restaurants-command-side-backend/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/commandside/RestaurantsCommandsideConfiguration.java b/restaurants-service/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurantsservice/backend/RestaurantsBackendConfiguration.java similarity index 92% rename from restaurants-command-side-backend/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/commandside/RestaurantsCommandsideConfiguration.java rename to restaurants-service/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurantsservice/backend/RestaurantsBackendConfiguration.java index c6971a4..481965d 100644 --- a/restaurants-command-side-backend/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/commandside/RestaurantsCommandsideConfiguration.java +++ b/restaurants-service/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurantsservice/backend/RestaurantsBackendConfiguration.java @@ -1,4 +1,4 @@ -package net.chrisrichardson.eventstore.examples.management.restaurant.commandside; +package net.chrisrichardson.eventstore.examples.management.restaurantsservice.backend; import io.eventuate.AggregateRepository; import io.eventuate.EventuateAggregateStore; @@ -8,7 +8,7 @@ @Configuration @ComponentScan -public class RestaurantsCommandsideConfiguration { +public class RestaurantsBackendConfiguration { @Bean public AggregateRepository restaurantAggregateRepository(EventuateAggregateStore eventStore) { diff --git a/restaurants-command-side-backend/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/commandside/UpdateRestaurantCommand.java b/restaurants-service/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurantsservice/backend/UpdateRestaurantCommand.java similarity index 97% rename from restaurants-command-side-backend/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/commandside/UpdateRestaurantCommand.java rename to restaurants-service/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurantsservice/backend/UpdateRestaurantCommand.java index d74c9ea..3b8834e 100644 --- a/restaurants-command-side-backend/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/commandside/UpdateRestaurantCommand.java +++ b/restaurants-service/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurantsservice/backend/UpdateRestaurantCommand.java @@ -1,4 +1,4 @@ -package net.chrisrichardson.eventstore.examples.management.restaurant.commandside; +package net.chrisrichardson.eventstore.examples.management.restaurantsservice.backend; import net.chrisrichardson.eventstore.examples.management.restaurant.common.RestaurantInfo; import org.apache.commons.lang.builder.ToStringBuilder; diff --git a/restaurants-command-side-web/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/commandside/web/RestaurantController.java b/restaurants-service/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurantsservice/web/RestaurantController.java similarity index 78% rename from restaurants-command-side-web/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/commandside/web/RestaurantController.java rename to restaurants-service/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurantsservice/web/RestaurantController.java index 23d539f..24850f9 100644 --- a/restaurants-command-side-web/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/commandside/web/RestaurantController.java +++ b/restaurants-service/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurantsservice/web/RestaurantController.java @@ -1,7 +1,10 @@ -package net.chrisrichardson.eventstore.examples.management.restaurant.commandside.web; +package net.chrisrichardson.eventstore.examples.management.restaurantsservice.web; -import net.chrisrichardson.eventstore.examples.management.restaurant.commandside.RestaurantService; +import net.chrisrichardson.eventstore.examples.management.restaurant.common.CreateRestaurantResponse; +import net.chrisrichardson.eventstore.examples.management.restaurant.common.DeleteRestaurantResponse; import net.chrisrichardson.eventstore.examples.management.restaurant.common.RestaurantInfo; +import net.chrisrichardson.eventstore.examples.management.restaurant.common.UpdateRestaurantResponse; +import net.chrisrichardson.eventstore.examples.management.restaurantsservice.backend.RestaurantService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -27,7 +30,7 @@ public CompletableFuture createRestaurant(@RequestBody @RequestMapping(value = "/{id}", method = RequestMethod.PUT) public CompletableFuture updateRestaurant(@PathVariable("id") String restaurantId, - @RequestBody @Valid RestaurantInfo request) { + @RequestBody @Valid RestaurantInfo request) { return restaurantService.updateRestaurant(restaurantId, request) .thenApply(entityAndEventInfo -> new UpdateRestaurantResponse(entityAndEventInfo.getEntityVersion().asString())); } diff --git a/restaurants-service/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurantsservice/web/RestaurantsWebConfiguration.java b/restaurants-service/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurantsservice/web/RestaurantsWebConfiguration.java new file mode 100644 index 0000000..f149ea0 --- /dev/null +++ b/restaurants-service/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurantsservice/web/RestaurantsWebConfiguration.java @@ -0,0 +1,13 @@ +package net.chrisrichardson.eventstore.examples.management.restaurantsservice.web; + +import net.chrisrichardson.eventstore.examples.management.restaurant.commonweb.WebConfiguration; +import net.chrisrichardson.eventstore.examples.management.restaurantsservice.backend.RestaurantsBackendConfiguration; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Import; + +@Configuration +@ComponentScan +@Import({RestaurantsBackendConfiguration.class, WebConfiguration.class}) +public class RestaurantsWebConfiguration { +} diff --git a/restaurants-command-side-backend/src/test/java/net/chrisrichardson/eventstore/examples/management/restaurant/commandside/RestaurantAggregateTest.java b/restaurants-service/src/test/java/net/chrisrichardson/eventstore/examples/management/restaurantsservice/RestaurantAggregateTest.java similarity index 81% rename from restaurants-command-side-backend/src/test/java/net/chrisrichardson/eventstore/examples/management/restaurant/commandside/RestaurantAggregateTest.java rename to restaurants-service/src/test/java/net/chrisrichardson/eventstore/examples/management/restaurantsservice/RestaurantAggregateTest.java index 889c914..7255566 100644 --- a/restaurants-command-side-backend/src/test/java/net/chrisrichardson/eventstore/examples/management/restaurant/commandside/RestaurantAggregateTest.java +++ b/restaurants-service/src/test/java/net/chrisrichardson/eventstore/examples/management/restaurantsservice/RestaurantAggregateTest.java @@ -1,10 +1,13 @@ -package net.chrisrichardson.eventstore.examples.management.restaurant.commandside; +package net.chrisrichardson.eventstore.examples.management.restaurantsservice; import io.eventuate.Event; import net.chrisrichardson.eventstore.examples.management.restaurant.common.RestaurantInfo; import net.chrisrichardson.eventstore.examples.management.restaurant.common.event.RestaurantCreatedEvent; import net.chrisrichardson.eventstore.examples.management.restaurant.common.event.RestaurantUpdatedEvent; import net.chrisrichardson.eventstore.examples.management.restaurant.testutil.RestaurantMother; +import net.chrisrichardson.eventstore.examples.management.restaurantsservice.backend.CreateRestaurantCommand; +import net.chrisrichardson.eventstore.examples.management.restaurantsservice.backend.RestaurantAggregate; +import net.chrisrichardson.eventstore.examples.management.restaurantsservice.backend.UpdateRestaurantCommand; import org.junit.Assert; import org.junit.Test; diff --git a/restaurants-command-side-web/src/test/java/net/chrisrichardson/eventstore/examples/management/restaurant/commandside/web/RestaurantControllerIntegrationTest.java b/restaurants-service/src/test/java/net/chrisrichardson/eventstore/examples/management/restaurantsservice/RestaurantControllerIntegrationTest.java similarity index 92% rename from restaurants-command-side-web/src/test/java/net/chrisrichardson/eventstore/examples/management/restaurant/commandside/web/RestaurantControllerIntegrationTest.java rename to restaurants-service/src/test/java/net/chrisrichardson/eventstore/examples/management/restaurantsservice/RestaurantControllerIntegrationTest.java index 0f9a277..dc05f3a 100644 --- a/restaurants-command-side-web/src/test/java/net/chrisrichardson/eventstore/examples/management/restaurant/commandside/web/RestaurantControllerIntegrationTest.java +++ b/restaurants-service/src/test/java/net/chrisrichardson/eventstore/examples/management/restaurantsservice/RestaurantControllerIntegrationTest.java @@ -1,6 +1,7 @@ -package net.chrisrichardson.eventstore.examples.management.restaurant.commandside.web; +package net.chrisrichardson.eventstore.examples.management.restaurantsservice; import com.fasterxml.jackson.databind.ObjectMapper; +import net.chrisrichardson.eventstore.examples.management.restaurant.common.CreateRestaurantResponse; import net.chrisrichardson.eventstore.examples.management.restaurant.testutil.RestaurantMother; import org.junit.Before; import org.junit.Test; @@ -21,7 +22,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; @RunWith(SpringJUnit4ClassRunner.class) -@SpringApplicationConfiguration(classes = RestaurantControllerIntegrationTestConfiguration.class) +@SpringApplicationConfiguration(classes = RestaurantServiceIntegrationTestConfiguration.class) @IntegrationTest @WebAppConfiguration public class RestaurantControllerIntegrationTest { diff --git a/restaurants-command-side-backend/src/test/java/net/chrisrichardson/eventstore/examples/management/restaurant/commandside/RestaurantEventTest.java b/restaurants-service/src/test/java/net/chrisrichardson/eventstore/examples/management/restaurantsservice/RestaurantEventTest.java similarity index 74% rename from restaurants-command-side-backend/src/test/java/net/chrisrichardson/eventstore/examples/management/restaurant/commandside/RestaurantEventTest.java rename to restaurants-service/src/test/java/net/chrisrichardson/eventstore/examples/management/restaurantsservice/RestaurantEventTest.java index ff58481..7301312 100644 --- a/restaurants-command-side-backend/src/test/java/net/chrisrichardson/eventstore/examples/management/restaurant/commandside/RestaurantEventTest.java +++ b/restaurants-service/src/test/java/net/chrisrichardson/eventstore/examples/management/restaurantsservice/RestaurantEventTest.java @@ -1,6 +1,7 @@ -package net.chrisrichardson.eventstore.examples.management.restaurant.commandside; +package net.chrisrichardson.eventstore.examples.management.restaurantsservice; import net.chrisrichardson.eventstore.examples.management.restaurant.testutil.AbstractEntityEventTest; +import net.chrisrichardson.eventstore.examples.management.restaurantsservice.backend.RestaurantAggregate; public class RestaurantEventTest extends AbstractEntityEventTest { diff --git a/restaurants-command-side-service/src/test/java/net/chrisrichardson/eventstore/examples/management/restaurant/commandside/RestaurantsCommandSideServiceTestConfiguration.java b/restaurants-service/src/test/java/net/chrisrichardson/eventstore/examples/management/restaurantsservice/RestaurantServiceIntegrationTestConfiguration.java similarity index 61% rename from restaurants-command-side-service/src/test/java/net/chrisrichardson/eventstore/examples/management/restaurant/commandside/RestaurantsCommandSideServiceTestConfiguration.java rename to restaurants-service/src/test/java/net/chrisrichardson/eventstore/examples/management/restaurantsservice/RestaurantServiceIntegrationTestConfiguration.java index 1fc222f..78faa36 100644 --- a/restaurants-command-side-service/src/test/java/net/chrisrichardson/eventstore/examples/management/restaurant/commandside/RestaurantsCommandSideServiceTestConfiguration.java +++ b/restaurants-service/src/test/java/net/chrisrichardson/eventstore/examples/management/restaurantsservice/RestaurantServiceIntegrationTestConfiguration.java @@ -1,6 +1,8 @@ -package net.chrisrichardson.eventstore.examples.management.restaurant.commandside; +package net.chrisrichardson.eventstore.examples.management.restaurantsservice; -import org.springframework.boot.autoconfigure.web.HttpMessageConverters; +import io.eventuate.javaclient.spring.jdbc.EmbeddedTestAggregateStoreConfiguration; +import net.chrisrichardson.eventstore.examples.management.restaurantsservice.web.RestaurantsWebConfiguration; +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; @@ -12,13 +14,14 @@ import java.util.List; @Configuration -@Import(RestaurantsServiceCommandsideConfiguration.class) -public class RestaurantsCommandSideServiceTestConfiguration { +@Import({RestaurantsWebConfiguration.class, + EmbeddedTestAggregateStoreConfiguration.class}) +@EnableAutoConfiguration +public class RestaurantServiceIntegrationTestConfiguration { @Bean - public RestTemplate restTemplate(HttpMessageConverters converters) { + public RestTemplate restTemplate() { RestTemplate restTemplate = new RestTemplate(); - HttpMessageConverter httpMessageConverter = converters.getConverters().get(0); List> httpMessageConverters = Arrays.asList(new MappingJackson2HttpMessageConverter()); restTemplate.setMessageConverters((List>) httpMessageConverters); return restTemplate; diff --git a/restaurants-command-side-service/src/test/java/net/chrisrichardson/eventstore/examples/management/restaurant/commandside/RestaurantsCommandSideServiceIntegrationTest.java b/restaurants-service/src/test/java/net/chrisrichardson/eventstore/examples/management/restaurantsservice/RestaurantsServiceIntegrationTest.java similarity index 88% rename from restaurants-command-side-service/src/test/java/net/chrisrichardson/eventstore/examples/management/restaurant/commandside/RestaurantsCommandSideServiceIntegrationTest.java rename to restaurants-service/src/test/java/net/chrisrichardson/eventstore/examples/management/restaurantsservice/RestaurantsServiceIntegrationTest.java index 3979a3a..38078c0 100644 --- a/restaurants-command-side-service/src/test/java/net/chrisrichardson/eventstore/examples/management/restaurant/commandside/RestaurantsCommandSideServiceIntegrationTest.java +++ b/restaurants-service/src/test/java/net/chrisrichardson/eventstore/examples/management/restaurantsservice/RestaurantsServiceIntegrationTest.java @@ -1,8 +1,8 @@ -package net.chrisrichardson.eventstore.examples.management.restaurant.commandside; +package net.chrisrichardson.eventstore.examples.management.restaurantsservice; -import net.chrisrichardson.eventstore.examples.management.restaurant.commandside.web.CreateRestaurantResponse; -import net.chrisrichardson.eventstore.examples.management.restaurant.commandside.web.UpdateRestaurantResponse; +import net.chrisrichardson.eventstore.examples.management.restaurant.common.CreateRestaurantResponse; import net.chrisrichardson.eventstore.examples.management.restaurant.common.RestaurantInfo; +import net.chrisrichardson.eventstore.examples.management.restaurant.common.UpdateRestaurantResponse; import net.chrisrichardson.eventstore.examples.management.restaurant.testutil.RestaurantMother; import org.junit.Assert; import org.junit.Test; @@ -20,10 +20,10 @@ import org.springframework.web.client.RestTemplate; @RunWith(SpringJUnit4ClassRunner.class) -@SpringApplicationConfiguration(classes = RestaurantsCommandSideServiceTestConfiguration.class) +@SpringApplicationConfiguration(classes = RestaurantServiceIntegrationTestConfiguration.class) @WebAppConfiguration @IntegrationTest({"server.port=0", "management.port=0"}) -public class RestaurantsCommandSideServiceIntegrationTest { +public class RestaurantsServiceIntegrationTest { @Value("${local.server.port}") private int port; diff --git a/restaurants-view-service/Dockerfile b/restaurants-view-service/Dockerfile new file mode 100644 index 0000000..3609835 --- /dev/null +++ b/restaurants-view-service/Dockerfile @@ -0,0 +1,3 @@ +FROM java:openjdk-8u91-jdk +CMD java ${JAVA_OPTS} -jar restaurants-view-service.jar +COPY build/libs/restaurants-view-service.jar . \ No newline at end of file diff --git a/restaurants-query-side-backend/build.gradle b/restaurants-view-service/build.gradle similarity index 63% rename from restaurants-query-side-backend/build.gradle rename to restaurants-view-service/build.gradle index 7f194d1..462ab40 100644 --- a/restaurants-query-side-backend/build.gradle +++ b/restaurants-view-service/build.gradle @@ -1,7 +1,15 @@ +apply plugin: VerifyEventStoreEnvironmentPlugin +apply plugin: EventuateDependencyPlugin + +apply plugin: 'spring-boot' dependencies { + compile project(":common-web") compile project(":common-restaurants") + compile project(":common-swagger") + compile "org.springframework.boot:spring-boot-starter-web:$springBootVersion" + compile "org.springframework.boot:spring-boot-starter-actuator:$springBootVersion" compile "io.eventuate.client.java:eventuate-client-java-spring:$eventuateClientVersion" compile "org.springframework.boot:spring-boot-starter-redis:$springBootVersion" diff --git a/restaurants-query-side-service/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/queryside/RestaurantsServiceQuerysideConfiguration.java b/restaurants-view-service/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurantsviewservice/RestaurantsViewServiceMain.java similarity index 52% rename from restaurants-query-side-service/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/queryside/RestaurantsServiceQuerysideConfiguration.java rename to restaurants-view-service/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurantsviewservice/RestaurantsViewServiceMain.java index 13802da..2f4c3f5 100644 --- a/restaurants-query-side-service/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/queryside/RestaurantsServiceQuerysideConfiguration.java +++ b/restaurants-view-service/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurantsviewservice/RestaurantsViewServiceMain.java @@ -1,16 +1,23 @@ -package net.chrisrichardson.eventstore.examples.management.restaurant.queryside; +package net.chrisrichardson.eventstore.examples.management.restaurantsviewservice; -import io.eventuate.javaclient.spring.httpstomp.EventuateHttpStompClientConfiguration; +import io.eventuate.javaclient.driver.EventuateDriverConfiguration; import net.chrisrichardson.eventstore.examples.management.restaurant.commonswagger.CommonSwaggerConfiguration; -import net.chrisrichardson.eventstore.examples.management.restaurant.commonweb.WebConfiguration; +import net.chrisrichardson.eventstore.examples.management.restaurantsviewservice.web.RestaurantsViewWebConfiguration; +import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; @Configuration -@Import({RestaurantsQuerysideConfiguration.class, EventuateHttpStompClientConfiguration.class, WebConfiguration.class, CommonSwaggerConfiguration.class}) +@Import({RestaurantsViewWebConfiguration.class, + EventuateDriverConfiguration.class, + CommonSwaggerConfiguration.class}) @EnableAutoConfiguration @ComponentScan -public class RestaurantsServiceQuerysideConfiguration { +public class RestaurantsViewServiceMain { + + public static void main(String[] args) { + SpringApplication.run(RestaurantsViewServiceMain.class, args); + } } diff --git a/restaurants-query-side-backend/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/queryside/JsonRedisRestaurantInfoSerializer.java b/restaurants-view-service/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurantsviewservice/backend/JsonRedisRestaurantInfoSerializer.java similarity index 97% rename from restaurants-query-side-backend/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/queryside/JsonRedisRestaurantInfoSerializer.java rename to restaurants-view-service/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurantsviewservice/backend/JsonRedisRestaurantInfoSerializer.java index 52438f0..6f3c3c9 100644 --- a/restaurants-query-side-backend/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/queryside/JsonRedisRestaurantInfoSerializer.java +++ b/restaurants-view-service/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurantsviewservice/backend/JsonRedisRestaurantInfoSerializer.java @@ -1,4 +1,4 @@ -package net.chrisrichardson.eventstore.examples.management.restaurant.queryside; +package net.chrisrichardson.eventstore.examples.management.restaurantsviewservice.backend; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; diff --git a/restaurants-query-side-backend/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/queryside/RestaurantQuerySideWorkflow.java b/restaurants-view-service/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurantsviewservice/backend/RestaurantViewEventSubscriber.java similarity index 88% rename from restaurants-query-side-backend/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/queryside/RestaurantQuerySideWorkflow.java rename to restaurants-view-service/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurantsviewservice/backend/RestaurantViewEventSubscriber.java index e4b7984..0df9201 100644 --- a/restaurants-query-side-backend/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/queryside/RestaurantQuerySideWorkflow.java +++ b/restaurants-view-service/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurantsviewservice/backend/RestaurantViewEventSubscriber.java @@ -1,4 +1,4 @@ -package net.chrisrichardson.eventstore.examples.management.restaurant.queryside; +package net.chrisrichardson.eventstore.examples.management.restaurantsviewservice.backend; import io.eventuate.DispatchedEvent; import io.eventuate.EventHandlerMethod; @@ -7,14 +7,14 @@ import net.chrisrichardson.eventstore.examples.management.restaurant.common.event.RestaurantCreatedEvent; import net.chrisrichardson.eventstore.examples.management.restaurant.common.event.RestaurantDeletedEvent; import net.chrisrichardson.eventstore.examples.management.restaurant.common.event.RestaurantUpdatedEvent; -import net.chrisrichardson.eventstore.examples.management.restaurant.queryside.redis.RestaurantQuerySideRedisService; +import net.chrisrichardson.eventstore.examples.management.restaurantsviewservice.backend.redis.RestaurantQuerySideRedisService; @EventSubscriber(id="restaurantQuerySideEventHandlers") -public class RestaurantQuerySideWorkflow { +public class RestaurantViewEventSubscriber { private RestaurantQuerySideRedisService restaurantQuerySideRedisService; - public RestaurantQuerySideWorkflow(RestaurantQuerySideRedisService restaurantQuerySideRedisService) { + public RestaurantViewEventSubscriber(RestaurantQuerySideRedisService restaurantQuerySideRedisService) { this.restaurantQuerySideRedisService = restaurantQuerySideRedisService; } diff --git a/restaurants-query-side-backend/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/queryside/RestaurantsQuerysideRedisConfiguration.java b/restaurants-view-service/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurantsviewservice/backend/RestaurantsQuerysideRedisConfiguration.java similarity index 94% rename from restaurants-query-side-backend/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/queryside/RestaurantsQuerysideRedisConfiguration.java rename to restaurants-view-service/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurantsviewservice/backend/RestaurantsQuerysideRedisConfiguration.java index 75fc3e9..5ffdedb 100644 --- a/restaurants-query-side-backend/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/queryside/RestaurantsQuerysideRedisConfiguration.java +++ b/restaurants-view-service/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurantsviewservice/backend/RestaurantsQuerysideRedisConfiguration.java @@ -1,7 +1,7 @@ -package net.chrisrichardson.eventstore.examples.management.restaurant.queryside; +package net.chrisrichardson.eventstore.examples.management.restaurantsviewservice.backend; import net.chrisrichardson.eventstore.examples.management.restaurant.common.RestaurantInfo; -import net.chrisrichardson.eventstore.examples.management.restaurant.queryside.redis.RestaurantQuerySideRedisService; +import net.chrisrichardson.eventstore.examples.management.restaurantsviewservice.backend.redis.RestaurantQuerySideRedisService; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.data.redis.connection.RedisConnectionFactory; diff --git a/restaurants-query-side-backend/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/queryside/RestaurantsQuerysideConfiguration.java b/restaurants-view-service/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurantsviewservice/backend/RestaurantsViewBackendConfiguration.java similarity index 60% rename from restaurants-query-side-backend/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/queryside/RestaurantsQuerysideConfiguration.java rename to restaurants-view-service/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurantsviewservice/backend/RestaurantsViewBackendConfiguration.java index fd13e35..7084466 100644 --- a/restaurants-query-side-backend/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/queryside/RestaurantsQuerysideConfiguration.java +++ b/restaurants-view-service/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurantsviewservice/backend/RestaurantsViewBackendConfiguration.java @@ -1,7 +1,7 @@ -package net.chrisrichardson.eventstore.examples.management.restaurant.queryside; +package net.chrisrichardson.eventstore.examples.management.restaurantsviewservice.backend; import io.eventuate.javaclient.spring.EnableEventHandlers; -import net.chrisrichardson.eventstore.examples.management.restaurant.queryside.redis.RestaurantQuerySideRedisService; +import net.chrisrichardson.eventstore.examples.management.restaurantsviewservice.backend.redis.RestaurantQuerySideRedisService; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; @@ -11,11 +11,11 @@ @Import({RestaurantsQuerysideRedisConfiguration.class}) @ComponentScan @EnableEventHandlers -public class RestaurantsQuerysideConfiguration { +public class RestaurantsViewBackendConfiguration { @Bean - public RestaurantQuerySideWorkflow restaurantQueryWorkflow(RestaurantQuerySideRedisService restaurantQuerySideRedisService) { - return new RestaurantQuerySideWorkflow(restaurantQuerySideRedisService); + public RestaurantViewEventSubscriber restaurantQueryWorkflow(RestaurantQuerySideRedisService restaurantQuerySideRedisService) { + return new RestaurantViewEventSubscriber(restaurantQuerySideRedisService); } } diff --git a/restaurants-query-side-backend/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/queryside/redis/RestaurantQuerySideRedisService.java b/restaurants-view-service/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurantsviewservice/backend/redis/RestaurantQuerySideRedisService.java similarity index 94% rename from restaurants-query-side-backend/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/queryside/redis/RestaurantQuerySideRedisService.java rename to restaurants-view-service/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurantsviewservice/backend/redis/RestaurantQuerySideRedisService.java index bc30669..4070406 100644 --- a/restaurants-query-side-backend/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/queryside/redis/RestaurantQuerySideRedisService.java +++ b/restaurants-view-service/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurantsviewservice/backend/redis/RestaurantQuerySideRedisService.java @@ -1,17 +1,15 @@ -package net.chrisrichardson.eventstore.examples.management.restaurant.queryside.redis; +package net.chrisrichardson.eventstore.examples.management.restaurantsviewservice.backend.redis; import net.chrisrichardson.eventstore.examples.management.restaurant.common.Address; import net.chrisrichardson.eventstore.examples.management.restaurant.common.DeliveryTime; import net.chrisrichardson.eventstore.examples.management.restaurant.common.RestaurantInfo; import net.chrisrichardson.eventstore.examples.management.restaurant.common.TimeRange; -import net.chrisrichardson.eventstore.examples.management.restaurant.queryside.common.RestaurantQuerySideService; -import net.chrisrichardson.eventstore.examples.management.restaurant.queryside.util.AvailableRestaurantKeys; -import net.chrisrichardson.eventstore.examples.management.restaurant.queryside.util.RedisEntityKeyFormatter; +import net.chrisrichardson.eventstore.examples.management.restaurantsviewservice.backend.util.AvailableRestaurantKeys; +import net.chrisrichardson.eventstore.examples.management.restaurantsviewservice.backend.util.RedisEntityKeyFormatter; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.StringRedisTemplate; import java.util.Collection; -import java.util.HashSet; import java.util.List; import java.util.Set; import java.util.stream.Collectors; diff --git a/restaurants-query-side-backend/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/queryside/common/RestaurantQuerySideService.java b/restaurants-view-service/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurantsviewservice/backend/redis/RestaurantQuerySideService.java similarity index 95% rename from restaurants-query-side-backend/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/queryside/common/RestaurantQuerySideService.java rename to restaurants-view-service/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurantsviewservice/backend/redis/RestaurantQuerySideService.java index c760012..976703d 100644 --- a/restaurants-query-side-backend/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/queryside/common/RestaurantQuerySideService.java +++ b/restaurants-view-service/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurantsviewservice/backend/redis/RestaurantQuerySideService.java @@ -1,4 +1,4 @@ -package net.chrisrichardson.eventstore.examples.management.restaurant.queryside.common; +package net.chrisrichardson.eventstore.examples.management.restaurantsviewservice.backend.redis; import net.chrisrichardson.eventstore.examples.management.restaurant.common.Address; import net.chrisrichardson.eventstore.examples.management.restaurant.common.DeliveryTime; diff --git a/restaurants-query-side-backend/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/queryside/util/AvailableRestaurantKeys.java b/restaurants-view-service/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurantsviewservice/backend/util/AvailableRestaurantKeys.java similarity index 88% rename from restaurants-query-side-backend/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/queryside/util/AvailableRestaurantKeys.java rename to restaurants-view-service/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurantsviewservice/backend/util/AvailableRestaurantKeys.java index c34648e..aed5560 100644 --- a/restaurants-query-side-backend/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/queryside/util/AvailableRestaurantKeys.java +++ b/restaurants-view-service/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurantsviewservice/backend/util/AvailableRestaurantKeys.java @@ -1,4 +1,4 @@ -package net.chrisrichardson.eventstore.examples.management.restaurant.queryside.util; +package net.chrisrichardson.eventstore.examples.management.restaurantsviewservice.backend.util; public class AvailableRestaurantKeys { diff --git a/restaurants-query-side-backend/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/queryside/util/RedisEntityKeyFormatter.java b/restaurants-view-service/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurantsviewservice/backend/util/RedisEntityKeyFormatter.java similarity index 94% rename from restaurants-query-side-backend/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/queryside/util/RedisEntityKeyFormatter.java rename to restaurants-view-service/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurantsviewservice/backend/util/RedisEntityKeyFormatter.java index 7a93bc3..3178584 100644 --- a/restaurants-query-side-backend/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/queryside/util/RedisEntityKeyFormatter.java +++ b/restaurants-view-service/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurantsviewservice/backend/util/RedisEntityKeyFormatter.java @@ -1,4 +1,4 @@ -package net.chrisrichardson.eventstore.examples.management.restaurant.queryside.util; +package net.chrisrichardson.eventstore.examples.management.restaurantsviewservice.backend.util; import java.util.ArrayList; import java.util.Collection; diff --git a/restaurants-query-side-backend/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/queryside/util/RedisUtil.java b/restaurants-view-service/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurantsviewservice/backend/util/RedisUtil.java similarity index 96% rename from restaurants-query-side-backend/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/queryside/util/RedisUtil.java rename to restaurants-view-service/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurantsviewservice/backend/util/RedisUtil.java index 0567718..32905e0 100644 --- a/restaurants-query-side-backend/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/queryside/util/RedisUtil.java +++ b/restaurants-view-service/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurantsviewservice/backend/util/RedisUtil.java @@ -1,4 +1,4 @@ -package net.chrisrichardson.eventstore.examples.management.restaurant.queryside.util; +package net.chrisrichardson.eventstore.examples.management.restaurantsviewservice.backend.util; import java.util.ArrayList; import java.util.Collection; diff --git a/restaurants-query-side-web/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/queryside/web/RestaurantQueryController.java b/restaurants-view-service/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurantsviewservice/web/RestaurantViewController.java similarity index 86% rename from restaurants-query-side-web/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/queryside/web/RestaurantQueryController.java rename to restaurants-view-service/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurantsviewservice/web/RestaurantViewController.java index 3ee0a46..51702d9 100644 --- a/restaurants-query-side-web/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurant/queryside/web/RestaurantQueryController.java +++ b/restaurants-view-service/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurantsviewservice/web/RestaurantViewController.java @@ -1,9 +1,10 @@ -package net.chrisrichardson.eventstore.examples.management.restaurant.queryside.web; +package net.chrisrichardson.eventstore.examples.management.restaurantsviewservice.web; import net.chrisrichardson.eventstore.examples.management.restaurant.common.Address; import net.chrisrichardson.eventstore.examples.management.restaurant.common.DeliveryTime; +import net.chrisrichardson.eventstore.examples.management.restaurant.common.FindAvailableRestaurantsRequest; import net.chrisrichardson.eventstore.examples.management.restaurant.common.RestaurantInfo; -import net.chrisrichardson.eventstore.examples.management.restaurant.queryside.redis.RestaurantQuerySideRedisService; +import net.chrisrichardson.eventstore.examples.management.restaurantsviewservice.backend.redis.RestaurantQuerySideRedisService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; @@ -13,7 +14,7 @@ @RestController @RequestMapping("/restaurants") -public class RestaurantQueryController { +public class RestaurantViewController { @Autowired private RestaurantQuerySideRedisService restaurantQuerySideRedisService; diff --git a/restaurants-view-service/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurantsviewservice/web/RestaurantsViewWebConfiguration.java b/restaurants-view-service/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurantsviewservice/web/RestaurantsViewWebConfiguration.java new file mode 100644 index 0000000..1ad68f4 --- /dev/null +++ b/restaurants-view-service/src/main/java/net/chrisrichardson/eventstore/examples/management/restaurantsviewservice/web/RestaurantsViewWebConfiguration.java @@ -0,0 +1,13 @@ +package net.chrisrichardson.eventstore.examples.management.restaurantsviewservice.web; + +import net.chrisrichardson.eventstore.examples.management.restaurant.commonweb.WebConfiguration; +import net.chrisrichardson.eventstore.examples.management.restaurantsviewservice.backend.RestaurantsViewBackendConfiguration; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Import; + +@Configuration +@ComponentScan +@Import({RestaurantsViewBackendConfiguration.class, WebConfiguration.class}) +public class RestaurantsViewWebConfiguration { +} diff --git a/restaurants-query-side-backend/src/test/java/net/chrisrichardson/eventstore/examples/management/restaurant/queryside/web/AvailableRestaurantManagementServiceIntegrationTest.java b/restaurants-view-service/src/test/java/net/chrisrichardson/eventstore/examples/management/restaurantsviewservice/AvailableRestaurantManagementServiceIntegrationTest.java similarity index 97% rename from restaurants-query-side-backend/src/test/java/net/chrisrichardson/eventstore/examples/management/restaurant/queryside/web/AvailableRestaurantManagementServiceIntegrationTest.java rename to restaurants-view-service/src/test/java/net/chrisrichardson/eventstore/examples/management/restaurantsviewservice/AvailableRestaurantManagementServiceIntegrationTest.java index fb2828e..21690c6 100644 --- a/restaurants-query-side-backend/src/test/java/net/chrisrichardson/eventstore/examples/management/restaurant/queryside/web/AvailableRestaurantManagementServiceIntegrationTest.java +++ b/restaurants-view-service/src/test/java/net/chrisrichardson/eventstore/examples/management/restaurantsviewservice/AvailableRestaurantManagementServiceIntegrationTest.java @@ -1,12 +1,12 @@ -package net.chrisrichardson.eventstore.examples.management.restaurant.queryside.web; +package net.chrisrichardson.eventstore.examples.management.restaurantsviewservice; import net.chrisrichardson.eventstore.examples.management.restaurant.common.Address; import net.chrisrichardson.eventstore.examples.management.restaurant.common.DeliveryTime; import net.chrisrichardson.eventstore.examples.management.restaurant.common.RestaurantInfo; -import net.chrisrichardson.eventstore.examples.management.restaurant.queryside.common.RestaurantQuerySideService; import net.chrisrichardson.eventstore.examples.management.restaurant.testutil.RestaurantMother; import net.chrisrichardson.eventstore.examples.management.restaurant.testutil.RestaurantTestData; import net.chrisrichardson.eventstore.examples.management.restaurant.testutil.TestUtil; +import net.chrisrichardson.eventstore.examples.management.restaurantsviewservice.backend.redis.RestaurantQuerySideService; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; @@ -14,7 +14,6 @@ import org.springframework.boot.test.IntegrationTest; import org.springframework.boot.test.SpringApplicationConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.web.WebAppConfiguration; import java.util.Calendar; import java.util.List; diff --git a/restaurants-query-side-backend/src/test/java/net/chrisrichardson/eventstore/examples/management/restaurant/queryside/web/AvailableRestaurantManagementServiceIntegrationTestConfiguration.java b/restaurants-view-service/src/test/java/net/chrisrichardson/eventstore/examples/management/restaurantsviewservice/AvailableRestaurantManagementServiceIntegrationTestConfiguration.java similarity index 61% rename from restaurants-query-side-backend/src/test/java/net/chrisrichardson/eventstore/examples/management/restaurant/queryside/web/AvailableRestaurantManagementServiceIntegrationTestConfiguration.java rename to restaurants-view-service/src/test/java/net/chrisrichardson/eventstore/examples/management/restaurantsviewservice/AvailableRestaurantManagementServiceIntegrationTestConfiguration.java index 907f7ac..ba42e8b 100644 --- a/restaurants-query-side-backend/src/test/java/net/chrisrichardson/eventstore/examples/management/restaurant/queryside/web/AvailableRestaurantManagementServiceIntegrationTestConfiguration.java +++ b/restaurants-view-service/src/test/java/net/chrisrichardson/eventstore/examples/management/restaurantsviewservice/AvailableRestaurantManagementServiceIntegrationTestConfiguration.java @@ -1,13 +1,14 @@ -package net.chrisrichardson.eventstore.examples.management.restaurant.queryside.web; +package net.chrisrichardson.eventstore.examples.management.restaurantsviewservice; -import io.eventuate.javaclient.spring.jdbc.EventuateJdbcEventStoreConfiguration; -import net.chrisrichardson.eventstore.examples.management.restaurant.queryside.RestaurantsQuerysideRedisConfiguration; +import io.eventuate.javaclient.spring.jdbc.EmbeddedTestAggregateStoreConfiguration; +import net.chrisrichardson.eventstore.examples.management.restaurantsviewservice.backend.RestaurantsQuerysideRedisConfiguration; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; @Configuration @EnableAutoConfiguration -@Import({RestaurantsQuerysideRedisConfiguration.class, EventuateJdbcEventStoreConfiguration.class}) +@Import({RestaurantsQuerysideRedisConfiguration.class, + EmbeddedTestAggregateStoreConfiguration.class}) public class AvailableRestaurantManagementServiceIntegrationTestConfiguration { } diff --git a/restaurants-query-side-web/src/test/java/net/chrisrichardson/eventstore/examples/management/restaurant/queryside/web/RestaurantQueryControllerTest.java b/restaurants-view-service/src/test/java/net/chrisrichardson/eventstore/examples/management/restaurantsviewservice/RestaurantViewControllerTest.java similarity index 89% rename from restaurants-query-side-web/src/test/java/net/chrisrichardson/eventstore/examples/management/restaurant/queryside/web/RestaurantQueryControllerTest.java rename to restaurants-view-service/src/test/java/net/chrisrichardson/eventstore/examples/management/restaurantsviewservice/RestaurantViewControllerTest.java index 3b56cb1..c2f2cc8 100644 --- a/restaurants-query-side-web/src/test/java/net/chrisrichardson/eventstore/examples/management/restaurant/queryside/web/RestaurantQueryControllerTest.java +++ b/restaurants-view-service/src/test/java/net/chrisrichardson/eventstore/examples/management/restaurantsviewservice/RestaurantViewControllerTest.java @@ -1,12 +1,14 @@ -package net.chrisrichardson.eventstore.examples.management.restaurant.queryside.web; +package net.chrisrichardson.eventstore.examples.management.restaurantsviewservice; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; import net.chrisrichardson.eventstore.examples.management.restaurant.common.Address; import net.chrisrichardson.eventstore.examples.management.restaurant.common.DeliveryTime; +import net.chrisrichardson.eventstore.examples.management.restaurant.common.FindAvailableRestaurantsRequest; import net.chrisrichardson.eventstore.examples.management.restaurant.common.RestaurantInfo; -import net.chrisrichardson.eventstore.examples.management.restaurant.queryside.redis.RestaurantQuerySideRedisService; import net.chrisrichardson.eventstore.examples.management.restaurant.testutil.RestaurantMother; +import net.chrisrichardson.eventstore.examples.management.restaurantsviewservice.backend.redis.RestaurantQuerySideRedisService; +import net.chrisrichardson.eventstore.examples.management.restaurantsviewservice.web.RestaurantViewController; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -22,22 +24,20 @@ import java.util.ArrayList; import java.util.List; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.Assert.*; import static org.mockito.Matchers.any; import static org.mockito.Mockito.when; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; @RunWith(MockitoJUnitRunner.class) -public class RestaurantQueryControllerTest { +public class RestaurantViewControllerTest { @Mock RestaurantQuerySideRedisService restaurantQuerySideRedisService; @InjectMocks - private RestaurantQueryController controller; + private RestaurantViewController controller; private MockMvc mockMvc; diff --git a/settings.gradle b/settings.gradle index 2fb10d0..60477e4 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,14 +1,10 @@ -include 'restaurants-command-side-backend' -include 'restaurants-command-side-web' -include 'restaurants-command-side-service' include 'common-restaurants' include 'common-web' +include 'restaurants-service' +include 'restaurants-view-service' include 'testutil' -include 'restaurants-query-side-backend' -include 'restaurants-query-side-web' -include 'restaurants-query-side-service' -include 'monolithic-service' -include 'e2e-test' include 'common-tests' +include 'restaurants-integration-test' +include 'e2e-test' include 'common-swagger' diff --git a/wait-for-services.sh b/wait-for-services.sh index 48b13e1..c0b6fb0 100755 --- a/wait-for-services.sh +++ b/wait-for-services.sh @@ -14,6 +14,7 @@ while [[ "$done" = false ]]; do done=true else done=false + break fi done if [[ "$done" = true ]]; then @@ -22,4 +23,4 @@ while [[ "$done" = false ]]; do fi echo -n . sleep 1 -done \ No newline at end of file +done