diff --git a/java-server/docker-microservices/build-and-test-all.sh b/java-server/_build-and-test-all.sh similarity index 53% rename from java-server/docker-microservices/build-and-test-all.sh rename to java-server/_build-and-test-all.sh index eeff07ec..5955b9e9 100755 --- a/java-server/docker-microservices/build-and-test-all.sh +++ b/java-server/_build-and-test-all.sh @@ -2,8 +2,30 @@ set -e +if [ -z "$DOCKER_HOST_IP" ] ; then + if [ -z "$DOCKER_HOST" ] ; then + export DOCKER_HOST_IP=`hostname` + else + echo using ${DOCKER_HOST?} + XX=${DOCKER_HOST%\:*} + export DOCKER_HOST_IP=${XX#tcp\:\/\/} + fi + echo set DOCKER_HOST_IP $DOCKER_HOST_IP +fi + +if [ -z "$SPRING_DATA_MONGODB_URI" ] ; then + export SPRING_DATA_MONGODB_URI=mongodb://${DOCKER_HOST_IP?}/mydb + echo Set SPRING_DATA_MONGODB_URI $SPRING_DATA_MONGODB_URI +fi + DOCKER_COMPOSE="docker-compose -p kanban-board" +if [ "$1" = "-f" ] ; then + shift; + DOCKER_COMPOSE="$DOCKER_COMPOSE -f ${1?}" + shift +fi + if [ "$1" = "--use-existing" ] ; then shift; else @@ -11,32 +33,29 @@ else ${DOCKER_COMPOSE?} rm -v --force fi -${DOCKER_COMPOSE?} up -d mongodb +NO_RM=false -if [ -z "$DOCKER_HOST_IP" ] ; then - export DOCKER_HOST_IP=$(docker-machine ip default) - echo set DOCKER_HOST_IP $DOCKER_HOST_IP +if [ "$1" = "--no-rm" ] ; then + NO_RM=true + shift fi -if [ -z "$SPRING_DATA_MONGODB_URI" ] ; then - export SPRING_DATA_MONGODB_URI=mongodb://${DOCKER_HOST_IP?}/mydb - echo Set SPRING_DATA_MONGODB_URI $SPRING_DATA_MONGODB_URI -fi + +${DOCKER_COMPOSE?} up -d mongodb $EXTRA_INFRASTRUCTURE_SERVICES export SERVICE_HOST=$DOCKER_HOST_IP export DOCKER_PORT=8080 -cd .. -./gradlew $* build -xe2e-test:test +./gradlew $* build -x :e2e-test:test -cd ./docker-microservices -if [ -z "$EVENTUATE_API_KEY_ID" -o -z "$EVENTUATE_API_KEY_SECRET" ] ; then +if [ -z "$EVENTUATE_LOCAL" ] && [ -z "$EVENTUATE_API_KEY_ID" -o -z "$EVENTUATE_API_KEY_SECRET" ] ; then echo You must set EVENTUATE_API_KEY_ID and EVENTUATE_API_KEY_SECRET exit -1 fi +${DOCKER_COMPOSE?} build ${DOCKER_COMPOSE?} up -d @@ -44,11 +63,10 @@ ${DOCKER_COMPOSE?} up -d set -e -cd .. - ./gradlew -P ignoreE2EFailures=false $* :e2e-test:cleanTest :e2e-test:test -cd ./docker-microservices -${DOCKER_COMPOSE?} stop -${DOCKER_COMPOSE?} rm -v --force +if [ $NO_RM = false ] ; then + ${DOCKER_COMPOSE?} stop + ${DOCKER_COMPOSE?} rm -v --force +fi diff --git a/java-server/api-gateway-service/Dockerfile b/java-server/api-gateway-service/Dockerfile new file mode 100644 index 00000000..199ae02c --- /dev/null +++ b/java-server/api-gateway-service/Dockerfile @@ -0,0 +1,3 @@ +FROM java:openjdk-8u91-jdk +CMD java ${JAVA_OPTS} -jar api-gateway-service.jar +COPY build/libs/api-gateway-service.jar . \ No newline at end of file diff --git a/java-server/api-gateway-service/build.gradle b/java-server/api-gateway-service/build.gradle index 039d9672..b5961b25 100755 --- a/java-server/api-gateway-service/build.gradle +++ b/java-server/api-gateway-service/build.gradle @@ -1,4 +1,6 @@ -apply plugin: 'java' +apply plugin: VerifyEventStoreEnvironmentPlugin +apply plugin: EventuateDependencyPlugin + apply plugin: 'spring-boot' dependencies { @@ -11,9 +13,6 @@ dependencies { compile "org.apache.httpcomponents:httpclient:4.5" compile "org.apache.httpcomponents:fluent-hc:4.5.1" - compile "io.eventuate.client.java:eventuate-client-java-spring:$eventuateClientVersion" - compile "io.eventuate.client.java:eventuate-client-java-http-stomp-spring:$eventuateClientVersion" - compile "org.springframework.boot:spring-boot-starter-web:$springBootVersion" compile "org.springframework.boot:spring-boot-starter-actuator:$springBootVersion" diff --git a/java-server/api-gateway-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/apigateway/ApiGatewayServiceConfiguration.java b/java-server/api-gateway-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/apigateway/ApiGatewayServiceConfiguration.java index a7ca9056..d6ebfa74 100755 --- a/java-server/api-gateway-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/apigateway/ApiGatewayServiceConfiguration.java +++ b/java-server/api-gateway-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/apigateway/ApiGatewayServiceConfiguration.java @@ -1,7 +1,7 @@ package net.chrisrichardson.eventstore.examples.kanban.apigateway; import com.fasterxml.jackson.databind.ObjectMapper; -import io.eventuate.javaclient.spring.httpstomp.EventuateHttpStompClientConfiguration; +import io.eventuate.javaclient.driver.EventuateDriverConfiguration; import net.chrisrichardson.eventstore.examples.kanban.commonauth.AuthConfiguration; import net.chrisrichardson.eventstore.examples.kanban.commonweb.WebConfiguration; import net.chrisrichardson.eventstore.examples.kanban.commonwebsocket.WebSocketConfig; @@ -26,29 +26,29 @@ @Configuration @ComponentScan -@Import({EventuateHttpStompClientConfiguration.class, WebConfiguration.class, AuthConfiguration.class, WebSocketConfig.class, WebSocketSecurityConfig.class}) +@Import({EventuateDriverConfiguration.class, WebConfiguration.class, AuthConfiguration.class, WebSocketConfig.class, WebSocketSecurityConfig.class}) @EnableConfigurationProperties({ApiGatewayProperties.class}) public class ApiGatewayServiceConfiguration { - @Bean - public WebsocketEventsTranslator websocketEventsTranslator(SimpMessagingTemplate template) { - return new WebsocketEventsTranslator(template); - } + @Bean + public WebsocketEventsTranslator websocketEventsTranslator(SimpMessagingTemplate template) { + return new WebsocketEventsTranslator(template); + } - @Bean - public RestTemplate restTemplate(HttpMessageConverters converters) { + @Bean + public RestTemplate restTemplate(HttpMessageConverters converters) { - // we have to define Apache HTTP client to use the PATCH verb - MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter(); - converter.setSupportedMediaTypes(MediaType.parseMediaTypes("application/json")); - converter.setObjectMapper(new ObjectMapper()); + // we have to define Apache HTTP client to use the PATCH verb + MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter(); + converter.setSupportedMediaTypes(MediaType.parseMediaTypes("application/json")); + converter.setObjectMapper(new ObjectMapper()); - HttpClient httpClient = HttpClients.createDefault(); - RestTemplate restTemplate = new RestTemplate(Collections.>singletonList(converter)); - restTemplate.setRequestFactory(new HttpComponentsClientHttpRequestFactory(httpClient)); + HttpClient httpClient = HttpClients.createDefault(); + RestTemplate restTemplate = new RestTemplate(Collections.>singletonList(converter)); + restTemplate.setRequestFactory(new HttpComponentsClientHttpRequestFactory(httpClient)); - restTemplate.setErrorHandler(new RestTemplateErrorHandler()); + restTemplate.setErrorHandler(new RestTemplateErrorHandler()); - return restTemplate; - } + return restTemplate; + } } diff --git a/java-server/api-gateway-service/src/main/resources/logback.xml b/java-server/api-gateway-service/src/main/resources/logback.xml index 2a03c9b2..84cbb835 100755 --- a/java-server/api-gateway-service/src/main/resources/logback.xml +++ b/java-server/api-gateway-service/src/main/resources/logback.xml @@ -16,4 +16,6 @@ + + \ No newline at end of file diff --git a/java-server/board-command-side-service/build.gradle b/java-server/board-command-side-service/build.gradle deleted file mode 100755 index 075be121..00000000 --- a/java-server/board-command-side-service/build.gradle +++ /dev/null @@ -1,14 +0,0 @@ -apply plugin: 'java' -apply plugin: 'spring-boot' - -dependencies { - compile project(":board-command-side") - compile project(":common-swagger") - compile project(":common-auth") - - 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-http-stomp-spring:$eventuateClientVersion" - testCompile "junit:junit:4.11" -} \ No newline at end of file diff --git a/java-server/board-command-side-service/pom.xml b/java-server/board-command-side-service/pom.xml deleted file mode 100755 index 2254c491..00000000 --- a/java-server/board-command-side-service/pom.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - net.chrisrichardson.eventstore.examples - kanban-app - 0.1.0-SNAPSHOT - - 4.0.0 - board-command-side-service - jar - board-command-side-service - - - - net.chrisrichardson.eventstore.examples - board-command-side - ${project.parent.version} - - - net.chrisrichardson.eventstore.examples - common-auth - ${project.parent.version} - - - net.chrisrichardson.eventstore.examples - common-swagger - ${project.parent.version} - - - - io.eventuate.client.java - eventuate-client-java-http-stomp-spring - - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - ${java.version} - ${java.version} - - - - - \ No newline at end of file diff --git a/java-server/board-command-side-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/boardcommandsideservice/BoardCommandSideServiceConfiguration.java b/java-server/board-command-side-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/boardcommandsideservice/BoardCommandSideServiceConfiguration.java deleted file mode 100755 index 0d48d3f1..00000000 --- a/java-server/board-command-side-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/boardcommandsideservice/BoardCommandSideServiceConfiguration.java +++ /dev/null @@ -1,19 +0,0 @@ -package net.chrisrichardson.eventstore.examples.kanban.boardcommandsideservice; - -import io.eventuate.javaclient.spring.httpstomp.EventuateHttpStompClientConfiguration; -import net.chrisrichardson.eventstore.examples.kanban.commonweb.WebConfiguration; -import net.chrisrichardson.eventstore.examples.kanban.commandside.board.BoardCommandSideConfiguration; -import net.chrisrichardson.eventstore.examples.kanban.commonswagger.CommonSwaggerConfiguration; -import org.springframework.boot.autoconfigure.EnableAutoConfiguration; -import net.chrisrichardson.eventstore.examples.kanban.commonauth.AuthConfiguration; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Import; - -@Configuration -@Import({BoardCommandSideConfiguration.class, EventuateHttpStompClientConfiguration.class, WebConfiguration.class, AuthConfiguration.class, CommonSwaggerConfiguration.class}) -@EnableAutoConfiguration -@ComponentScan -public class BoardCommandSideServiceConfiguration { - -} diff --git a/java-server/board-command-side-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/boardcommandsideservice/main/BoardCommandSideServiceMain.java b/java-server/board-command-side-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/boardcommandsideservice/main/BoardCommandSideServiceMain.java deleted file mode 100755 index 20c3fedb..00000000 --- a/java-server/board-command-side-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/boardcommandsideservice/main/BoardCommandSideServiceMain.java +++ /dev/null @@ -1,10 +0,0 @@ -package net.chrisrichardson.eventstore.examples.kanban.boardcommandsideservice.main; - -import net.chrisrichardson.eventstore.examples.kanban.boardcommandsideservice.BoardCommandSideServiceConfiguration; -import org.springframework.boot.SpringApplication; - -public class BoardCommandSideServiceMain { - public static void main(String[] args) { - SpringApplication.run(BoardCommandSideServiceConfiguration.class, args); - } -} diff --git a/java-server/board-command-side/build.gradle b/java-server/board-command-side/build.gradle deleted file mode 100755 index df224f43..00000000 --- a/java-server/board-command-side/build.gradle +++ /dev/null @@ -1,13 +0,0 @@ -apply plugin: 'java' - -dependencies { - compile project(":common-board") - compile project(":common-web") - - compile "io.eventuate.client.java:eventuate-client-java-spring:$eventuateClientVersion" - - compile "org.springframework.boot:spring-boot-starter-web:$springBootVersion" - compile "org.springframework.boot:spring-boot-starter-actuator:$springBootVersion" - - testCompile "junit:junit:4.11" -} diff --git a/java-server/board-command-side/pom.xml b/java-server/board-command-side/pom.xml deleted file mode 100755 index 56640de8..00000000 --- a/java-server/board-command-side/pom.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - net.chrisrichardson.eventstore.examples - kanban-app - 0.1.0-SNAPSHOT - - 4.0.0 - board-command-side - jar - board-command-side - - - - net.chrisrichardson.eventstore.examples - common-board - ${project.parent.version} - - - net.chrisrichardson.eventstore.examples - common-web - ${project.parent.version} - - - - org.springframework.boot - spring-boot-starter-actuator - ${springBootVersion} - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - ${java.version} - ${java.version} - - - - - \ No newline at end of file diff --git a/java-server/board-query-side-service/build.gradle b/java-server/board-query-side-service/build.gradle deleted file mode 100755 index b32d7aeb..00000000 --- a/java-server/board-query-side-service/build.gradle +++ /dev/null @@ -1,15 +0,0 @@ -apply plugin: 'java' -apply plugin: 'spring-boot' - -dependencies { - compile project(":board-query-side") - compile project(":common-swagger") - compile project(":common-auth") - - 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 "io.eventuate.client.java:eventuate-client-java-http-stomp-spring:$eventuateClientVersion" - testCompile "junit:junit:4.11" -} diff --git a/java-server/board-query-side-service/pom.xml b/java-server/board-query-side-service/pom.xml deleted file mode 100755 index ad7ccfed..00000000 --- a/java-server/board-query-side-service/pom.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - net.chrisrichardson.eventstore.examples - kanban-app - 0.1.0-SNAPSHOT - - 4.0.0 - board-query-side-service - jar - board-query-side-service - - - - net.chrisrichardson.eventstore.examples - board-query-side - ${project.parent.version} - - - net.chrisrichardson.eventstore.examples - common-auth - ${project.parent.version} - - - net.chrisrichardson.eventstore.examples - common-swagger - ${project.parent.version} - - - - io.eventuate.client.java - eventuate-client-java-http-stomp-spring - - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - ${java.version} - ${java.version} - - - - - \ No newline at end of file diff --git a/java-server/board-query-side-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/boardquerysideservice/BoardQuerySideServiceConfiguration.java b/java-server/board-query-side-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/boardquerysideservice/BoardQuerySideServiceConfiguration.java deleted file mode 100755 index 4186cf10..00000000 --- a/java-server/board-query-side-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/boardquerysideservice/BoardQuerySideServiceConfiguration.java +++ /dev/null @@ -1,18 +0,0 @@ -package net.chrisrichardson.eventstore.examples.kanban.boardquerysideservice; - -import io.eventuate.javaclient.spring.httpstomp.EventuateHttpStompClientConfiguration; -import net.chrisrichardson.eventstore.examples.kanban.commonweb.WebConfiguration; -import net.chrisrichardson.eventstore.examples.kanban.commonauth.AuthConfiguration; -import net.chrisrichardson.eventstore.examples.kanban.commonswagger.CommonSwaggerConfiguration; -import net.chrisrichardson.eventstore.examples.kanban.queryside.board.BoardQuerySideConfiguration; -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({BoardQuerySideConfiguration.class, EventuateHttpStompClientConfiguration.class, WebConfiguration.class, AuthConfiguration.class, CommonSwaggerConfiguration.class}) -@EnableAutoConfiguration -@ComponentScan -public class BoardQuerySideServiceConfiguration { -} diff --git a/java-server/board-query-side-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/boardquerysideservice/main/BoardQuerySideServiceMain.java b/java-server/board-query-side-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/boardquerysideservice/main/BoardQuerySideServiceMain.java deleted file mode 100755 index 854adb48..00000000 --- a/java-server/board-query-side-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/boardquerysideservice/main/BoardQuerySideServiceMain.java +++ /dev/null @@ -1,10 +0,0 @@ -package net.chrisrichardson.eventstore.examples.kanban.boardquerysideservice.main; - -import net.chrisrichardson.eventstore.examples.kanban.boardquerysideservice.BoardQuerySideServiceConfiguration; -import org.springframework.boot.SpringApplication; - -public class BoardQuerySideServiceMain { - public static void main(String[] args) { - SpringApplication.run(BoardQuerySideServiceConfiguration.class, args); - } -} diff --git a/java-server/board-query-side/pom.xml b/java-server/board-query-side/pom.xml deleted file mode 100755 index b888ff37..00000000 --- a/java-server/board-query-side/pom.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - net.chrisrichardson.eventstore.examples - kanban-app - 0.1.0-SNAPSHOT - - 4.0.0 - board-query-side - jar - board-query-side - - - - net.chrisrichardson.eventstore.examples - common-board - ${project.parent.version} - - - net.chrisrichardson.eventstore.examples - common-web - ${project.parent.version} - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - ${java.version} - ${java.version} - - - - - \ No newline at end of file diff --git a/java-server/board-query-side/src/main/java/net/chrisrichardson/eventstore/examples/kanban/queryside/board/BoardQuerySideConfiguration.java b/java-server/board-query-side/src/main/java/net/chrisrichardson/eventstore/examples/kanban/queryside/board/BoardQuerySideConfiguration.java deleted file mode 100755 index ebe096ec..00000000 --- a/java-server/board-query-side/src/main/java/net/chrisrichardson/eventstore/examples/kanban/queryside/board/BoardQuerySideConfiguration.java +++ /dev/null @@ -1,36 +0,0 @@ -package net.chrisrichardson.eventstore.examples.kanban.queryside.board; - - -import io.eventuate.javaclient.spring.EnableEventHandlers; -import org.springframework.boot.autoconfigure.EnableAutoConfiguration; -import org.springframework.boot.autoconfigure.web.HttpMessageConverters; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.Configuration; -import org.springframework.data.mongodb.repository.config.EnableMongoRepositories; -import org.springframework.http.converter.HttpMessageConverter; -import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; - -@Configuration -@EnableEventHandlers -@EnableAutoConfiguration -@ComponentScan -@EnableMongoRepositories -public class BoardQuerySideConfiguration { - - @Bean - public BoardQueryWorkflow boardQueryWorkflow(BoardUpdateService boardInfoUpdateService) { - return new BoardQueryWorkflow(boardInfoUpdateService); - } - - @Bean - public BoardUpdateService boardInfoUpdateService(BoardRepository boardRepository) { - return new BoardUpdateService(boardRepository); - } - - @Bean - public HttpMessageConverters customConverters() { - HttpMessageConverter additional = new MappingJackson2HttpMessageConverter(); - return new HttpMessageConverters(additional); - } -} diff --git a/java-server/board-service/Dockerfile b/java-server/board-service/Dockerfile new file mode 100644 index 00000000..067217fb --- /dev/null +++ b/java-server/board-service/Dockerfile @@ -0,0 +1,4 @@ +FROM java:openjdk-8u91-jdk +CMD java -jar board-service.jar +EXPOSE 8081 +COPY build/libs/board-service.jar . \ No newline at end of file diff --git a/java-server/board-service/build.gradle b/java-server/board-service/build.gradle new file mode 100644 index 00000000..0f8a56e5 --- /dev/null +++ b/java-server/board-service/build.gradle @@ -0,0 +1,21 @@ +apply plugin: VerifyEventStoreEnvironmentPlugin +apply plugin: EventuateDependencyPlugin + +apply plugin: 'spring-boot' + +dependencies { + compile project(":common-board") + compile project(":common-web") + compile project(":common-websocket") + compile project(":common-swagger") + compile project(":common-auth") + + compile "io.eventuate.client.java:eventuate-client-java-spring:$eventuateClientVersion" + + compile "org.springframework.boot:spring-boot-starter-web:$springBootVersion" + compile "org.springframework.boot:spring-boot-starter-actuator:$springBootVersion" + + testCompile "org.springframework.boot:spring-boot-starter-test:$springBootVersion" + testCompile "io.eventuate.client.java:eventuate-client-java-test-util:$eventuateClientVersion" + testCompile "io.eventuate.client.java:eventuate-client-java-jdbc:$eventuateClientVersion" +} diff --git a/java-server/board-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/boardservice/BoardServiceMain.java b/java-server/board-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/boardservice/BoardServiceMain.java new file mode 100755 index 00000000..13aeb6a0 --- /dev/null +++ b/java-server/board-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/boardservice/BoardServiceMain.java @@ -0,0 +1,24 @@ +package net.chrisrichardson.eventstore.examples.kanban.boardservice; + +import io.eventuate.javaclient.driver.EventuateDriverConfiguration; +import net.chrisrichardson.eventstore.examples.kanban.boardservice.web.BoardWebConfiguration; +import net.chrisrichardson.eventstore.examples.kanban.commonauth.AuthConfiguration; +import net.chrisrichardson.eventstore.examples.kanban.commonswagger.CommonSwaggerConfiguration; +import net.chrisrichardson.eventstore.examples.kanban.commonweb.WebConfiguration; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Import; + +@Configuration +@Import({BoardWebConfiguration.class, + EventuateDriverConfiguration.class, + WebConfiguration.class, + AuthConfiguration.class, + CommonSwaggerConfiguration.class}) +@EnableAutoConfiguration +public class BoardServiceMain { + public static void main(String[] args) { + SpringApplication.run(BoardServiceMain.class, args); + } +} diff --git a/java-server/board-command-side/src/main/java/net/chrisrichardson/eventstore/examples/kanban/commandside/board/BoardAggregate.java b/java-server/board-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/boardservice/backend/BoardAggregate.java similarity index 94% rename from java-server/board-command-side/src/main/java/net/chrisrichardson/eventstore/examples/kanban/commandside/board/BoardAggregate.java rename to java-server/board-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/boardservice/backend/BoardAggregate.java index e2906df2..cdbdda82 100755 --- a/java-server/board-command-side/src/main/java/net/chrisrichardson/eventstore/examples/kanban/commandside/board/BoardAggregate.java +++ b/java-server/board-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/boardservice/backend/BoardAggregate.java @@ -1,10 +1,10 @@ -package net.chrisrichardson.eventstore.examples.kanban.commandside.board; +package net.chrisrichardson.eventstore.examples.kanban.boardservice.backend; import io.eventuate.Event; import io.eventuate.EventUtil; import io.eventuate.ReflectiveMutableCommandProcessingAggregate; -import net.chrisrichardson.eventstore.examples.kanban.common.board.event.BoardCreatedEvent; import net.chrisrichardson.eventstore.examples.kanban.common.board.BoardInfo; +import net.chrisrichardson.eventstore.examples.kanban.common.board.event.BoardCreatedEvent; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/java-server/board-command-side/src/main/java/net/chrisrichardson/eventstore/examples/kanban/commandside/board/BoardCommandSideConfiguration.java b/java-server/board-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/boardservice/backend/BoardBackendConfiguration.java similarity index 92% rename from java-server/board-command-side/src/main/java/net/chrisrichardson/eventstore/examples/kanban/commandside/board/BoardCommandSideConfiguration.java rename to java-server/board-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/boardservice/backend/BoardBackendConfiguration.java index 62673169..d43ebfe7 100755 --- a/java-server/board-command-side/src/main/java/net/chrisrichardson/eventstore/examples/kanban/commandside/board/BoardCommandSideConfiguration.java +++ b/java-server/board-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/boardservice/backend/BoardBackendConfiguration.java @@ -1,4 +1,4 @@ -package net.chrisrichardson.eventstore.examples.kanban.commandside.board; +package net.chrisrichardson.eventstore.examples.kanban.boardservice.backend; import io.eventuate.AggregateRepository; import io.eventuate.EventuateAggregateStore; @@ -16,7 +16,7 @@ @EnableEventHandlers @EnableAutoConfiguration(exclude = {MongoRepositoriesAutoConfiguration.class}) @ComponentScan -public class BoardCommandSideConfiguration { +public class BoardBackendConfiguration { @Bean public AggregateRepository boardAggregateRepository(EventuateAggregateStore eventStore) { diff --git a/java-server/board-command-side/src/main/java/net/chrisrichardson/eventstore/examples/kanban/commandside/board/BoardCommand.java b/java-server/board-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/boardservice/backend/BoardCommand.java similarity index 51% rename from java-server/board-command-side/src/main/java/net/chrisrichardson/eventstore/examples/kanban/commandside/board/BoardCommand.java rename to java-server/board-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/boardservice/backend/BoardCommand.java index 349b4082..435b84b6 100755 --- a/java-server/board-command-side/src/main/java/net/chrisrichardson/eventstore/examples/kanban/commandside/board/BoardCommand.java +++ b/java-server/board-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/boardservice/backend/BoardCommand.java @@ -1,4 +1,4 @@ -package net.chrisrichardson.eventstore.examples.kanban.commandside.board; +package net.chrisrichardson.eventstore.examples.kanban.boardservice.backend; import io.eventuate.Command; diff --git a/java-server/board-command-side/src/main/java/net/chrisrichardson/eventstore/examples/kanban/commandside/board/BoardService.java b/java-server/board-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/boardservice/backend/BoardService.java similarity index 91% rename from java-server/board-command-side/src/main/java/net/chrisrichardson/eventstore/examples/kanban/commandside/board/BoardService.java rename to java-server/board-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/boardservice/backend/BoardService.java index cfe6cbc5..444a6365 100755 --- a/java-server/board-command-side/src/main/java/net/chrisrichardson/eventstore/examples/kanban/commandside/board/BoardService.java +++ b/java-server/board-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/boardservice/backend/BoardService.java @@ -1,4 +1,4 @@ -package net.chrisrichardson.eventstore.examples.kanban.commandside.board; +package net.chrisrichardson.eventstore.examples.kanban.boardservice.backend; import io.eventuate.AggregateRepository; import io.eventuate.EntityWithIdAndVersion; diff --git a/java-server/board-command-side/src/main/java/net/chrisrichardson/eventstore/examples/kanban/commandside/board/CreateBoardCommand.java b/java-server/board-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/boardservice/backend/CreateBoardCommand.java similarity index 86% rename from java-server/board-command-side/src/main/java/net/chrisrichardson/eventstore/examples/kanban/commandside/board/CreateBoardCommand.java rename to java-server/board-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/boardservice/backend/CreateBoardCommand.java index 173ba87d..55b88a80 100755 --- a/java-server/board-command-side/src/main/java/net/chrisrichardson/eventstore/examples/kanban/commandside/board/CreateBoardCommand.java +++ b/java-server/board-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/boardservice/backend/CreateBoardCommand.java @@ -1,4 +1,4 @@ -package net.chrisrichardson.eventstore.examples.kanban.commandside.board; +package net.chrisrichardson.eventstore.examples.kanban.boardservice.backend; import net.chrisrichardson.eventstore.examples.kanban.common.board.BoardInfo; import org.apache.commons.lang.builder.ToStringBuilder; diff --git a/java-server/board-command-side/src/main/java/net/chrisrichardson/eventstore/examples/kanban/commandside/board/BoardCommandController.java b/java-server/board-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/boardservice/web/BoardController.java similarity index 79% rename from java-server/board-command-side/src/main/java/net/chrisrichardson/eventstore/examples/kanban/commandside/board/BoardCommandController.java rename to java-server/board-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/boardservice/web/BoardController.java index 14d2b1ca..ac08a4c7 100755 --- a/java-server/board-command-side/src/main/java/net/chrisrichardson/eventstore/examples/kanban/commandside/board/BoardCommandController.java +++ b/java-server/board-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/boardservice/web/BoardController.java @@ -1,6 +1,8 @@ -package net.chrisrichardson.eventstore.examples.kanban.commandside.board; +package net.chrisrichardson.eventstore.examples.kanban.boardservice.web; import io.eventuate.EntityWithIdAndVersion; +import net.chrisrichardson.eventstore.examples.kanban.boardservice.backend.BoardAggregate; +import net.chrisrichardson.eventstore.examples.kanban.boardservice.backend.BoardService; import net.chrisrichardson.eventstore.examples.kanban.common.board.BoardInfo; import net.chrisrichardson.eventstore.examples.kanban.common.board.model.BoardResponse; import org.slf4j.Logger; @@ -16,12 +18,12 @@ @RestController @RequestMapping(value = "/api") -public class BoardCommandController { +public class BoardController { @Autowired private BoardService boardService; - private static Logger log = LoggerFactory.getLogger(BoardCommandController.class); + private static Logger log = LoggerFactory.getLogger(BoardController.class); @RequestMapping(value = "/boards", method = POST) public CompletableFuture saveBoard(@RequestBody BoardInfo board) { diff --git a/java-server/board-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/boardservice/web/BoardWebConfiguration.java b/java-server/board-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/boardservice/web/BoardWebConfiguration.java new file mode 100644 index 00000000..15cfdf12 --- /dev/null +++ b/java-server/board-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/boardservice/web/BoardWebConfiguration.java @@ -0,0 +1,12 @@ +package net.chrisrichardson.eventstore.examples.kanban.boardservice.web; + +import net.chrisrichardson.eventstore.examples.kanban.boardservice.backend.BoardBackendConfiguration; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Import; + +@Configuration +@Import(BoardBackendConfiguration.class) +@ComponentScan +public class BoardWebConfiguration { +} diff --git a/java-server/board-service/src/main/resources/application.properties b/java-server/board-service/src/main/resources/application.properties new file mode 100644 index 00000000..96a5a590 --- /dev/null +++ b/java-server/board-service/src/main/resources/application.properties @@ -0,0 +1,2 @@ +spring.application.name=board-service +server.port=8081 \ No newline at end of file diff --git a/java-server/standalone-service/src/main/resources/logback.xml b/java-server/board-service/src/main/resources/logback.xml similarity index 88% rename from java-server/standalone-service/src/main/resources/logback.xml rename to java-server/board-service/src/main/resources/logback.xml index 2a03c9b2..84cbb835 100755 --- a/java-server/standalone-service/src/main/resources/logback.xml +++ b/java-server/board-service/src/main/resources/logback.xml @@ -16,4 +16,6 @@ + + \ No newline at end of file diff --git a/java-server/board-view-service/Dockerfile b/java-server/board-view-service/Dockerfile new file mode 100644 index 00000000..51da4f89 --- /dev/null +++ b/java-server/board-view-service/Dockerfile @@ -0,0 +1,4 @@ +FROM java:openjdk-8u91-jdk +CMD java -jar board-view-service.jar +EXPOSE 8083 +COPY build/libs/board-view-service.jar . \ No newline at end of file diff --git a/java-server/board-query-side/build.gradle b/java-server/board-view-service/build.gradle old mode 100755 new mode 100644 similarity index 61% rename from java-server/board-query-side/build.gradle rename to java-server/board-view-service/build.gradle index 1561b3db..38c20c70 --- a/java-server/board-query-side/build.gradle +++ b/java-server/board-view-service/build.gradle @@ -1,8 +1,15 @@ -apply plugin: 'java' +apply plugin: VerifyMongoDBConfigurationPlugin +apply plugin: VerifyEventStoreEnvironmentPlugin +apply plugin: EventuateDependencyPlugin + +apply plugin: 'spring-boot' dependencies { compile project(":common-board") compile project(":common-web") + compile project(":common-swagger") + compile project(":common-auth") + compile "org.springframework.boot:spring-boot-starter-data-mongodb:$springBootVersion" compile "org.springframework.boot:spring-boot-starter-web:$springBootVersion" diff --git a/java-server/board-view-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/boardviewservice/BoardViewServiceMain.java b/java-server/board-view-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/boardviewservice/BoardViewServiceMain.java new file mode 100755 index 00000000..6c4f9c31 --- /dev/null +++ b/java-server/board-view-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/boardviewservice/BoardViewServiceMain.java @@ -0,0 +1,24 @@ +package net.chrisrichardson.eventstore.examples.kanban.boardviewservice; + +import io.eventuate.javaclient.driver.EventuateDriverConfiguration; +import net.chrisrichardson.eventstore.examples.kanban.boardviewservice.web.BoardViewWebConfiguration; +import net.chrisrichardson.eventstore.examples.kanban.commonauth.AuthConfiguration; +import net.chrisrichardson.eventstore.examples.kanban.commonswagger.CommonSwaggerConfiguration; +import net.chrisrichardson.eventstore.examples.kanban.commonweb.WebConfiguration; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Import; + +@Configuration +@Import({BoardViewWebConfiguration.class, + EventuateDriverConfiguration.class, + WebConfiguration.class, + AuthConfiguration.class, + CommonSwaggerConfiguration.class}) +@EnableAutoConfiguration +public class BoardViewServiceMain { + public static void main(String[] args) { + SpringApplication.run(BoardViewServiceMain.class, args); + } +} diff --git a/java-server/board-query-side/src/main/java/net/chrisrichardson/eventstore/examples/kanban/queryside/board/BoardRepository.java b/java-server/board-view-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/boardviewservice/backend/BoardRepository.java similarity index 73% rename from java-server/board-query-side/src/main/java/net/chrisrichardson/eventstore/examples/kanban/queryside/board/BoardRepository.java rename to java-server/board-view-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/boardviewservice/backend/BoardRepository.java index 46f28318..3954bc17 100755 --- a/java-server/board-query-side/src/main/java/net/chrisrichardson/eventstore/examples/kanban/queryside/board/BoardRepository.java +++ b/java-server/board-view-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/boardviewservice/backend/BoardRepository.java @@ -1,4 +1,4 @@ -package net.chrisrichardson.eventstore.examples.kanban.queryside.board; +package net.chrisrichardson.eventstore.examples.kanban.boardviewservice.backend; import net.chrisrichardson.eventstore.examples.kanban.common.board.model.Board; import org.springframework.data.mongodb.repository.MongoRepository; diff --git a/java-server/board-query-side/src/main/java/net/chrisrichardson/eventstore/examples/kanban/queryside/board/BoardUpdateService.java b/java-server/board-view-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/boardviewservice/backend/BoardUpdateService.java similarity index 89% rename from java-server/board-query-side/src/main/java/net/chrisrichardson/eventstore/examples/kanban/queryside/board/BoardUpdateService.java rename to java-server/board-view-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/boardviewservice/backend/BoardUpdateService.java index b266fa60..7a9f5f28 100755 --- a/java-server/board-query-side/src/main/java/net/chrisrichardson/eventstore/examples/kanban/queryside/board/BoardUpdateService.java +++ b/java-server/board-view-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/boardviewservice/backend/BoardUpdateService.java @@ -1,4 +1,4 @@ -package net.chrisrichardson.eventstore.examples.kanban.queryside.board; +package net.chrisrichardson.eventstore.examples.kanban.boardviewservice.backend; import net.chrisrichardson.eventstore.examples.kanban.common.board.BoardInfo; import net.chrisrichardson.eventstore.examples.kanban.common.board.model.Board; diff --git a/java-server/board-view-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/boardviewservice/backend/BoardViewBackendConfiguration.java b/java-server/board-view-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/boardviewservice/backend/BoardViewBackendConfiguration.java new file mode 100755 index 00000000..4660c84a --- /dev/null +++ b/java-server/board-view-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/boardviewservice/backend/BoardViewBackendConfiguration.java @@ -0,0 +1,33 @@ +package net.chrisrichardson.eventstore.examples.kanban.boardviewservice.backend; + + +import io.eventuate.javaclient.spring.EnableEventHandlers; +import org.springframework.boot.autoconfigure.web.HttpMessageConverters; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; +import org.springframework.data.mongodb.repository.config.EnableMongoRepositories; +import org.springframework.http.converter.HttpMessageConverter; +import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; + +@Configuration +@EnableEventHandlers +@EnableMongoRepositories +public class BoardViewBackendConfiguration { + + @Bean + public BoardViewEventSubscriber boardViewEventSubscriber(BoardUpdateService boardInfoUpdateService) { + return new BoardViewEventSubscriber(boardInfoUpdateService); + } + + @Bean + public BoardUpdateService boardInfoUpdateService(BoardRepository boardRepository) { + return new BoardUpdateService(boardRepository); + } + + @Bean + public HttpMessageConverters customConverters() { + HttpMessageConverter additional = new MappingJackson2HttpMessageConverter(); + return new HttpMessageConverters(additional); + } +} diff --git a/java-server/board-query-side/src/main/java/net/chrisrichardson/eventstore/examples/kanban/queryside/board/BoardQueryWorkflow.java b/java-server/board-view-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/boardviewservice/backend/BoardViewEventSubscriber.java similarity index 64% rename from java-server/board-query-side/src/main/java/net/chrisrichardson/eventstore/examples/kanban/queryside/board/BoardQueryWorkflow.java rename to java-server/board-view-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/boardviewservice/backend/BoardViewEventSubscriber.java index f0886427..9af57f32 100755 --- a/java-server/board-query-side/src/main/java/net/chrisrichardson/eventstore/examples/kanban/queryside/board/BoardQueryWorkflow.java +++ b/java-server/board-view-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/boardviewservice/backend/BoardViewEventSubscriber.java @@ -1,4 +1,4 @@ -package net.chrisrichardson.eventstore.examples.kanban.queryside.board; +package net.chrisrichardson.eventstore.examples.kanban.boardviewservice.backend; import io.eventuate.DispatchedEvent; import io.eventuate.EventHandlerMethod; @@ -8,12 +8,12 @@ import org.slf4j.LoggerFactory; @EventSubscriber(id = "boardEventHandlers") -public class BoardQueryWorkflow{ +public class BoardViewEventSubscriber { private BoardUpdateService boardUpdateService; - private static Logger log = LoggerFactory.getLogger(BoardQueryWorkflow.class); + private static Logger log = LoggerFactory.getLogger(BoardViewEventSubscriber.class); - public BoardQueryWorkflow(BoardUpdateService boardInfoUpdateService) { + public BoardViewEventSubscriber(BoardUpdateService boardInfoUpdateService) { this.boardUpdateService = boardInfoUpdateService; } @@ -22,7 +22,7 @@ public void create(DispatchedEvent de) { BoardCreatedEvent event = de.getEvent(); String id = de.getEntityId(); - log.info("BoardQueryWorkflow got event : {}", de.getEvent()); + log.info("BoardViewEventSubscriber got event : {}", de.getEvent()); boardUpdateService.create(id, event.getBoardInfo()); } } \ No newline at end of file diff --git a/java-server/board-query-side/src/main/java/net/chrisrichardson/eventstore/examples/kanban/queryside/board/BoardQueryController.java b/java-server/board-view-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/boardviewservice/web/BoardViewController.java similarity index 86% rename from java-server/board-query-side/src/main/java/net/chrisrichardson/eventstore/examples/kanban/queryside/board/BoardQueryController.java rename to java-server/board-view-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/boardviewservice/web/BoardViewController.java index 89f47abe..dda7abce 100755 --- a/java-server/board-query-side/src/main/java/net/chrisrichardson/eventstore/examples/kanban/queryside/board/BoardQueryController.java +++ b/java-server/board-view-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/boardviewservice/web/BoardViewController.java @@ -1,5 +1,6 @@ -package net.chrisrichardson.eventstore.examples.kanban.queryside.board; +package net.chrisrichardson.eventstore.examples.kanban.boardviewservice.web; +import net.chrisrichardson.eventstore.examples.kanban.boardviewservice.backend.BoardRepository; import net.chrisrichardson.eventstore.examples.kanban.common.board.model.BoardQueryResponse; import net.chrisrichardson.eventstore.examples.kanban.common.board.model.BoardsQueryResponse; import org.springframework.beans.factory.annotation.Autowired; @@ -15,7 +16,7 @@ import static org.springframework.web.bind.annotation.RequestMethod.GET; @RestController -public class BoardQueryController { +public class BoardViewController { @Autowired private BoardRepository boardRepository; diff --git a/java-server/board-view-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/boardviewservice/web/BoardViewWebConfiguration.java b/java-server/board-view-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/boardviewservice/web/BoardViewWebConfiguration.java new file mode 100644 index 00000000..6c78856e --- /dev/null +++ b/java-server/board-view-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/boardviewservice/web/BoardViewWebConfiguration.java @@ -0,0 +1,12 @@ +package net.chrisrichardson.eventstore.examples.kanban.boardviewservice.web; + +import net.chrisrichardson.eventstore.examples.kanban.boardviewservice.backend.BoardViewBackendConfiguration; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Import; + +@Configuration +@Import(BoardViewBackendConfiguration.class) +@ComponentScan +public class BoardViewWebConfiguration { +} diff --git a/java-server/board-view-service/src/main/resources/application.properties b/java-server/board-view-service/src/main/resources/application.properties new file mode 100644 index 00000000..df2161d6 --- /dev/null +++ b/java-server/board-view-service/src/main/resources/application.properties @@ -0,0 +1,2 @@ +spring.application.name=board-view-service +server.port=8083 \ No newline at end of file diff --git a/java-server/board-command-side-service/src/main/resources/logback.xml b/java-server/board-view-service/src/main/resources/logback.xml similarity index 88% rename from java-server/board-command-side-service/src/main/resources/logback.xml rename to java-server/board-view-service/src/main/resources/logback.xml index 2a03c9b2..84cbb835 100755 --- a/java-server/board-command-side-service/src/main/resources/logback.xml +++ b/java-server/board-view-service/src/main/resources/logback.xml @@ -16,4 +16,6 @@ + + \ No newline at end of file diff --git a/java-server/build-and-run.sh b/java-server/build-and-run.sh deleted file mode 100755 index 5fe47462..00000000 --- a/java-server/build-and-run.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env bash - -if [ -z "$EVENTUATE_API_KEY_ID" -o -z "$EVENTUATE_API_KEY_SECRET" ] ; then - echo You must set EVENTUATE_API_KEY_ID and EVENTUATE_API_KEY_SECRET - exit -1 -fi - -echo "arguments" $* - -./gradlew $* clean build -xtest - -cd ./standalone-service - -echo "arguments" $* - -../gradlew $* clean copyAngularJS bootRun \ No newline at end of file diff --git a/java-server/build-and-test-all-eventuate-local.sh b/java-server/build-and-test-all-eventuate-local.sh new file mode 100755 index 00000000..eb629a81 --- /dev/null +++ b/java-server/build-and-test-all-eventuate-local.sh @@ -0,0 +1,6 @@ +#! /bin/bash + +export EXTRA_INFRASTRUCTURE_SERVICES=cdcservice +export EVENTUATE_LOCAL=yes + +./_build-and-test-all.sh -f docker-compose-eventuate-local.yml $* -P eventuateDriver=local diff --git a/java-server/build-and-test-all.sh b/java-server/build-and-test-all.sh new file mode 100755 index 00000000..569dd718 --- /dev/null +++ b/java-server/build-and-test-all.sh @@ -0,0 +1,3 @@ +#! /bin/bash + +./_build-and-test-all.sh $* diff --git a/java-server/buildSrc/src/main/groovy/EventuateDependencyPlugin.groovy b/java-server/buildSrc/src/main/groovy/EventuateDependencyPlugin.groovy new file mode 100644 index 00000000..d227f0fe --- /dev/null +++ b/java-server/buildSrc/src/main/groovy/EventuateDependencyPlugin.groovy @@ -0,0 +1,16 @@ +import org.gradle.api.Plugin +import org.gradle.api.Project + +class EventuateDependencyPlugin implements Plugin { + + @Override + void apply(Project project) { + project.dependencies { + if (project.hasProperty("eventuateDriver") && project.property("eventuateDriver") == "local") { + compile "io.eventuate.local.java:eventuate-local-java-jdbc:${project.eventuateLocalVersion}" + compile "io.eventuate.local.java:eventuate-local-java-embedded-cdc-autoconfigure:${project.eventuateLocalVersion}" + } else + compile "io.eventuate.client.java:eventuate-client-java-http-stomp-spring:${project.eventuateClientVersion}" + } + } +} diff --git a/java-server/buildSrc/src/main/groovy/VerifyEventStoreEnvironmentPlugin.groovy b/java-server/buildSrc/src/main/groovy/VerifyEventStoreEnvironmentPlugin.groovy new file mode 100644 index 00000000..0b029931 --- /dev/null +++ b/java-server/buildSrc/src/main/groovy/VerifyEventStoreEnvironmentPlugin.groovy @@ -0,0 +1,17 @@ +import org.gradle.api.* + + +class VerifyEventStoreEnvironmentPlugin implements Plugin { + void apply(Project project) { + project.test { + beforeSuite { x -> + if (x.parent == null) { + if (!project.hasProperty("eventuateDriver") || project.property("eventuateDriver") != "local") { + if (System.getenv("EVENTUATE_API_KEY_ID") == null && System.getenv("EVENTUATE_API_KEY_SECRET") == null) + logger.warn("\nPLEASE make sure that Eventuate-related environment variables EVENTUATE_API_KEY_ID and EVENTUATE_API_KEY_SECRET are set, see sample-set-remote-env.sh !!!!\n") + } + } + } + } + } +} diff --git a/java-server/buildSrc/src/main/groovy/VerifyMongoDBConfigurationPlugin.groovy b/java-server/buildSrc/src/main/groovy/VerifyMongoDBConfigurationPlugin.groovy new file mode 100644 index 00000000..1486a0d0 --- /dev/null +++ b/java-server/buildSrc/src/main/groovy/VerifyMongoDBConfigurationPlugin.groovy @@ -0,0 +1,15 @@ +import org.gradle.api.* + + +class VerifyMongoDBConfigurationPlugin implements Plugin { + void apply(Project project) { + project.test { + beforeSuite { x -> + if (x.parent == null) { + if (System.getenv("SPRING_DATA_MONGODB_URI") == null) + throw new RuntimeException("Please make sure that the environment variable SPRING_DATA_MONGODB_URI is set, e.g. export SPRING_DATA_MONGODB_URI=mongodb://192.168.59.103/mydb") + } + } + } + } +} \ No newline at end of file diff --git a/java-server/common-board/src/main/java/net/chrisrichardson/eventstore/examples/kanban/common/board/event/BoardEvent.java b/java-server/common-board/src/main/java/net/chrisrichardson/eventstore/examples/kanban/common/board/event/BoardEvent.java index 3a18fa3b..894064b7 100755 --- a/java-server/common-board/src/main/java/net/chrisrichardson/eventstore/examples/kanban/common/board/event/BoardEvent.java +++ b/java-server/common-board/src/main/java/net/chrisrichardson/eventstore/examples/kanban/common/board/event/BoardEvent.java @@ -4,6 +4,6 @@ import io.eventuate.Event; import io.eventuate.EventEntity; -@EventEntity(entity = "net.chrisrichardson.eventstore.examples.kanban.commandside.board.BoardAggregate") +@EventEntity(entity = "net.chrisrichardson.eventstore.examples.kanban.boardservice.backend.BoardAggregate") public class BoardEvent implements Event { } diff --git a/java-server/common-task/src/main/java/net/chrisrichardson/eventstore/examples/kanban/common/task/event/TaskEvent.java b/java-server/common-task/src/main/java/net/chrisrichardson/eventstore/examples/kanban/common/task/event/TaskEvent.java index 51ac3497..f78f8fdd 100755 --- a/java-server/common-task/src/main/java/net/chrisrichardson/eventstore/examples/kanban/common/task/event/TaskEvent.java +++ b/java-server/common-task/src/main/java/net/chrisrichardson/eventstore/examples/kanban/common/task/event/TaskEvent.java @@ -4,6 +4,6 @@ import io.eventuate.Event; import io.eventuate.EventEntity; -@EventEntity(entity="net.chrisrichardson.eventstore.examples.kanban.commandside.task.TaskAggregate") +@EventEntity(entity="net.chrisrichardson.eventstore.examples.kanban.taskservice.backend.TaskAggregate") public abstract class TaskEvent implements Event { } diff --git a/java-server/docker-compose-common.yml b/java-server/docker-compose-common.yml new file mode 100755 index 00000000..7933add8 --- /dev/null +++ b/java-server/docker-compose-common.yml @@ -0,0 +1,41 @@ +apigateway: + build: ./api-gateway-service + ports: + - "8080:8080" + environment: + BOARD_COMMANDSIDE_SERVICE_URL: http://boardcommandside:8081 + BOARD_QUERYSIDE_SERVICE_URL: http://boardqueryside:8083 + TASK_COMMANDSIDE_SERVICE_URL: http://taskcommandside:8082 + TASK_QUERYSIDE_SERVICE_URL: http://taskqueryside:8084 + + +boardcommandside: + build: ./board-service + ports: + - "8081:8081" + +taskcommandside: + build: ./task-service + ports: + - "8082:8082" + +boardqueryside: + build: ./board-view-service + ports: + - "8083:8083" + environment: + SPRING_DATA_MONGODB_URI: mongodb://mongodb/kanban + +taskqueryside: + build: ./task-view-service + ports: + - "8084:8084" + environment: + SPRING_DATA_MONGODB_URI: mongodb://mongodb/kanban + +mongodb: + image: mongo:3.0.4 + hostname: mongodb + command: mongod --smallfiles + ports: + - "27017:27017" \ No newline at end of file diff --git a/java-server/docker-compose-eventuate-local.yml b/java-server/docker-compose-eventuate-local.yml new file mode 100644 index 00000000..d1e6b385 --- /dev/null +++ b/java-server/docker-compose-eventuate-local.yml @@ -0,0 +1,148 @@ +zookeeper: + image: eventuateio/eventuateio-local-zookeeper:0.6.0 + ports: + - 2181:2181 + - 2888:2888 + - 3888:3888 + + +kafka: + image: eventuateio/eventuateio-local-kafka:0.6.0 + ports: + - 9092:9092 + links: + - zookeeper + environment: + - ADVERTISED_HOST_NAME=${DOCKER_HOST_IP} + - KAFKA_HEAP_OPTS=-Xmx320m -Xms320m + - ZOOKEEPER_SERVERS=zookeeper:2181 + +mysql: + image: eventuateio/eventuateio-local-mysql:0.6.0 + ports: + - 3306:3306 + environment: + - MYSQL_ROOT_PASSWORD=rootpassword + - MYSQL_USER=mysqluser + - MYSQL_PASSWORD=mysqlpw + + +cdcservice: + image: eventuateio/eventuateio-local-cdc-service:0.6.0 + ports: + - "8099:8080" + links: + - mysql + - kafka + - zookeeper + environment: + SPRING_DATASOURCE_URL: jdbc:mysql://mysql/eventuate + SPRING_DATASOURCE_USERNAME: mysqluser + SPRING_DATASOURCE_PASSWORD: mysqlpw + SPRING_DATASOURCE_DRIVER_CLASS_NAME: com.mysql.jdbc.Driver + EVENTUATELOCAL_KAFKA_BOOTSTRAP_SERVERS: kafka:9092 + EVENTUATELOCAL_ZOOKEEPER_CONNECTION_STRING: zookeeper:2181 + EVENTUATELOCAL_CDC_DB_USER_NAME: root + EVENTUATELOCAL_CDC_DB_PASSWORD: rootpassword + +mongodb: + extends: + file: docker-compose-common.yml + service: mongodb + +apigateway: + extends: + file: docker-compose-common.yml + service: apigateway + links: + - boardcommandside + - taskcommandside + - boardqueryside + - taskqueryside + - mysql + - kafka + - zookeeper + environment: + SPRING_DATASOURCE_URL: jdbc:mysql://mysql/eventuate + SPRING_DATASOURCE_USERNAME: mysqluser + SPRING_DATASOURCE_PASSWORD: mysqlpw + SPRING_DATASOURCE_DRIVER_CLASS_NAME: com.mysql.jdbc.Driver + EVENTUATELOCAL_KAFKA_BOOTSTRAP_SERVERS: kafka:9092 + EVENTUATELOCAL_ZOOKEEPER_CONNECTION_STRING: zookeeper:2181 + EVENTUATELOCAL_CDC_DB_USER_NAME: root + EVENTUATELOCAL_CDC_DB_PASSWORD: rootpassword + + +boardcommandside: + extends: + file: docker-compose-common.yml + service: boardcommandside + links: + - mysql + - kafka + - zookeeper + environment: + SPRING_DATASOURCE_URL: jdbc:mysql://mysql/eventuate + SPRING_DATASOURCE_USERNAME: mysqluser + SPRING_DATASOURCE_PASSWORD: mysqlpw + SPRING_DATASOURCE_DRIVER_CLASS_NAME: com.mysql.jdbc.Driver + EVENTUATELOCAL_KAFKA_BOOTSTRAP_SERVERS: kafka:9092 + EVENTUATELOCAL_ZOOKEEPER_CONNECTION_STRING: zookeeper:2181 + EVENTUATELOCAL_CDC_DB_USER_NAME: root + EVENTUATELOCAL_CDC_DB_PASSWORD: rootpassword + +taskcommandside: + extends: + file: docker-compose-common.yml + service: taskcommandside + links: + - mysql + - kafka + - zookeeper + environment: + SPRING_DATASOURCE_URL: jdbc:mysql://mysql/eventuate + SPRING_DATASOURCE_USERNAME: mysqluser + SPRING_DATASOURCE_PASSWORD: mysqlpw + SPRING_DATASOURCE_DRIVER_CLASS_NAME: com.mysql.jdbc.Driver + EVENTUATELOCAL_KAFKA_BOOTSTRAP_SERVERS: kafka:9092 + EVENTUATELOCAL_ZOOKEEPER_CONNECTION_STRING: zookeeper:2181 + EVENTUATELOCAL_CDC_DB_USER_NAME: root + EVENTUATELOCAL_CDC_DB_PASSWORD: rootpassword + +boardqueryside: + extends: + file: docker-compose-common.yml + service: boardqueryside + links: + - mongodb + - mysql + - kafka + - zookeeper + environment: + SPRING_DATASOURCE_URL: jdbc:mysql://mysql/eventuate + SPRING_DATASOURCE_USERNAME: mysqluser + SPRING_DATASOURCE_PASSWORD: mysqlpw + SPRING_DATASOURCE_DRIVER_CLASS_NAME: com.mysql.jdbc.Driver + EVENTUATELOCAL_KAFKA_BOOTSTRAP_SERVERS: kafka:9092 + EVENTUATELOCAL_ZOOKEEPER_CONNECTION_STRING: zookeeper:2181 + EVENTUATELOCAL_CDC_DB_USER_NAME: root + EVENTUATELOCAL_CDC_DB_PASSWORD: rootpassword + +taskqueryside: + extends: + file: docker-compose-common.yml + service: taskqueryside + links: + - mongodb + - mysql + - kafka + - zookeeper + environment: + SPRING_DATASOURCE_URL: jdbc:mysql://mysql/eventuate + SPRING_DATASOURCE_USERNAME: mysqluser + SPRING_DATASOURCE_PASSWORD: mysqlpw + SPRING_DATASOURCE_DRIVER_CLASS_NAME: com.mysql.jdbc.Driver + EVENTUATELOCAL_KAFKA_BOOTSTRAP_SERVERS: kafka:9092 + EVENTUATELOCAL_ZOOKEEPER_CONNECTION_STRING: zookeeper:2181 + EVENTUATELOCAL_CDC_DB_USER_NAME: root + EVENTUATELOCAL_CDC_DB_PASSWORD: rootpassword \ No newline at end of file diff --git a/java-server/docker-compose.yml b/java-server/docker-compose.yml new file mode 100755 index 00000000..c82e453c --- /dev/null +++ b/java-server/docker-compose.yml @@ -0,0 +1,53 @@ +apigateway: + extends: + file: docker-compose-common.yml + service: apigateway + links: + - boardcommandside + - taskcommandside + - boardqueryside + - taskqueryside + environment: + EVENTUATE_API_KEY_ID: ${EVENTUATE_API_KEY_ID} + EVENTUATE_API_KEY_SECRET: ${EVENTUATE_API_KEY_SECRET} + +boardcommandside: + extends: + file: docker-compose-common.yml + service: boardcommandside + environment: + EVENTUATE_API_KEY_ID: ${EVENTUATE_API_KEY_ID} + EVENTUATE_API_KEY_SECRET: ${EVENTUATE_API_KEY_SECRET} + +taskcommandside: + extends: + file: docker-compose-common.yml + service: taskcommandside + environment: + EVENTUATE_API_KEY_ID: ${EVENTUATE_API_KEY_ID} + EVENTUATE_API_KEY_SECRET: ${EVENTUATE_API_KEY_SECRET} + +boardqueryside: + extends: + file: docker-compose-common.yml + service: boardqueryside + links: + - mongodb + environment: + EVENTUATE_API_KEY_ID: ${EVENTUATE_API_KEY_ID} + EVENTUATE_API_KEY_SECRET: ${EVENTUATE_API_KEY_SECRET} + +taskqueryside: + extends: + file: docker-compose-common.yml + service: taskqueryside + links: + - mongodb + environment: + EVENTUATE_API_KEY_ID: ${EVENTUATE_API_KEY_ID} + EVENTUATE_API_KEY_SECRET: ${EVENTUATE_API_KEY_SECRET} + +mongodb: + extends: + file: docker-compose-common.yml + service: mongodb \ No newline at end of file diff --git a/java-server/docker-microservices/docker-compose.yml b/java-server/docker-microservices/docker-compose.yml deleted file mode 100755 index e212d913..00000000 --- a/java-server/docker-microservices/docker-compose.yml +++ /dev/null @@ -1,82 +0,0 @@ -apigateway: - image: java:openjdk-8u91-jdk - working_dir: /app - volumes: - - ../api-gateway-service/build/libs:/app - command: java -jar /app/api-gateway-service.jar - ports: - - "8080:8080" - links: - - boardcommandside - - taskcommandside - - boardqueryside - - taskqueryside - environment: - EVENTUATE_API_KEY_ID: - EVENTUATE_API_KEY_SECRET: - BOARD_COMMANDSIDE_SERVICE_URL: http://boardcommandside:8080 - BOARD_QUERYSIDE_SERVICE_URL: http://boardqueryside:8080 - TASK_COMMANDSIDE_SERVICE_URL: http://taskcommandside:8080 - TASK_QUERYSIDE_SERVICE_URL: http://taskqueryside:8080 - - -boardcommandside: - image: java:openjdk-8u91-jdk - working_dir: /app - volumes: - - ../board-command-side-service/build/libs:/app - command: java -jar /app/board-command-side-service.jar - ports: - - "8081:8080" - environment: - EVENTUATE_API_KEY_ID: - EVENTUATE_API_KEY_SECRET: - -taskcommandside: - image: java:openjdk-8u91-jdk - working_dir: /app - volumes: - - ../task-command-side-service/build/libs:/app - command: java -jar /app/task-command-side-service.jar - ports: - - "8082:8080" - environment: - EVENTUATE_API_KEY_ID: - EVENTUATE_API_KEY_SECRET: - -boardqueryside: - image: java:openjdk-8u91-jdk - working_dir: /app - volumes: - - ../board-query-side-service/build/libs:/app - command: java -jar /app/board-query-side-service.jar - ports: - - "8083:8080" - links: - - mongodb - environment: - EVENTUATE_API_KEY_ID: - EVENTUATE_API_KEY_SECRET: - SPRING_DATA_MONGODB_URI: mongodb://mongodb/kanban - -taskqueryside: - image: java:openjdk-8u91-jdk - working_dir: /app - volumes: - - ../task-query-side-service/build/libs:/app - command: java -jar /app/task-query-side-service.jar - ports: - - "8084:8080" - links: - - mongodb - environment: - EVENTUATE_API_KEY_ID: - EVENTUATE_API_KEY_SECRET: - SPRING_DATA_MONGODB_URI: mongodb://mongodb/kanban - -mongodb: - image: mongo:3.0.4 - hostname: mongodb - command: mongod --smallfiles - ports: - - "27017:27017" \ No newline at end of file diff --git a/java-server/docker-monolithic/build.sh b/java-server/docker-monolithic/build.sh deleted file mode 100755 index 49aca3ac..00000000 --- a/java-server/docker-monolithic/build.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash -set -e - -OD=$(pwd) - -docker-compose up -d mongodb - -cd .. -./gradlew :standalone-service:clean :standalone-service:assemble - -cd $OD - -docker-compose stop - -echo "Build successfuly completed" diff --git a/java-server/docker-monolithic/docker-compose.sh b/java-server/docker-monolithic/docker-compose.sh deleted file mode 100755 index 8b886bf5..00000000 --- a/java-server/docker-monolithic/docker-compose.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -set -e -./build.sh -docker-compose $* diff --git a/java-server/docker-monolithic/docker-compose.yml b/java-server/docker-monolithic/docker-compose.yml deleted file mode 100755 index cf47d070..00000000 --- a/java-server/docker-monolithic/docker-compose.yml +++ /dev/null @@ -1,20 +0,0 @@ -kanbanservice: - image: java:openjdk-8u91-jdk - working_dir: /app - volumes: - - ../standalone-service/build/libs:/app - command: java -jar /app/standalone-service.jar --spring.data.mongodb.uri=mongodb://mongodb:27017/kanban - ports: - - "8080:8080" - links: - - mongodb - environment: - EVENTUATE_API_KEY_ID: - EVENTUATE_API_KEY_SECRET: - -mongodb: - image: mongo:3.0.4 - hostname: mongodb - command: mongod --smallfiles - ports: - - "27017:27017" diff --git a/java-server/docker/Dockerfile b/java-server/docker/Dockerfile deleted file mode 100644 index 92fa48ee..00000000 --- a/java-server/docker/Dockerfile +++ /dev/null @@ -1,6 +0,0 @@ -FROM java:openjdk-8u91-jdk -MAINTAINER chris@chrisrichardson.net -EXPOSE 8080 -WORKDIR /app -CMD java -jar /app/*.jar -COPY *.jar . diff --git a/java-server/docker/_build.sh b/java-server/docker/_build.sh deleted file mode 100755 index 75899890..00000000 --- a/java-server/docker/_build.sh +++ /dev/null @@ -1,12 +0,0 @@ -#! /bin/bash -e - -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" - -echo $DIR - -cp ../libs/*.jar . - -cp $DIR/Dockerfile . - -docker build -t eventuate_kanban_${1?} . - diff --git a/java-server/docker/build-images.sh b/java-server/docker/build-images.sh deleted file mode 100755 index 8cf8180c..00000000 --- a/java-server/docker/build-images.sh +++ /dev/null @@ -1,18 +0,0 @@ -#! /bin/bash -e - -CURDIR=`pwd` - -for dir in api-gateway-service board-command-side-service task-command-side-service board-query-side-service \ - task-query-side-service standalone-service; do - -DOCKER_BUILD_DIR=$dir/build/docker - -mkdir -p ${DOCKER_BUILD_DIR?} - -cd ${DOCKER_BUILD_DIR?} - -../../../docker/_build.sh `echo $dir | sed -e 's/-/_/g'` - -cd ${CURDIR?} - -done diff --git a/java-server/docker/create-services.sh b/java-server/docker/create-services.sh deleted file mode 100644 index f5183eb1..00000000 --- a/java-server/docker/create-services.sh +++ /dev/null @@ -1,2 +0,0 @@ - -docker service create --name mongo mongo:3.0.4 \ No newline at end of file diff --git a/java-server/gradle.properties b/java-server/gradle.properties index c0104c20..078e09e4 100755 --- a/java-server/gradle.properties +++ b/java-server/gradle.properties @@ -2,5 +2,8 @@ org.gradle.jvmargs=-XX:MaxPermSize=512m eventuateMavenRepoUrl=http://mavenrepo.eventuate.io/release -eventuateClientVersion=0.10.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/java-server/rest-api-integration-tests/build.gradle b/java-server/rest-api-integration-tests/build.gradle index 4034ea48..6e9a3aa1 100755 --- a/java-server/rest-api-integration-tests/build.gradle +++ b/java-server/rest-api-integration-tests/build.gradle @@ -1,14 +1,16 @@ apply plugin: 'java' dependencies { - testCompile project(":board-command-side") - testCompile project(":board-query-side") - testCompile project(":task-command-side") - testCompile project(":task-query-side") + testCompile project(":board-service") + testCompile project(":board-view-service") + testCompile project(":task-service") + testCompile project(":task-view-service") testCompile project(":test-utils") + testCompile project(":common-auth-controller") testCompile "junit:junit:4.11" testCompile "org.springframework.boot:spring-boot-starter-test:$springBootVersion" + testCompile "io.eventuate.client.java:eventuate-client-java-test-util:$eventuateClientVersion" testCompile "io.eventuate.client.java:eventuate-client-java-jdbc:$eventuateClientVersion" } diff --git a/java-server/rest-api-integration-tests/src/test/java/net/chrisrichardson/eventstore/examples/kanban/integrationtests/RestAPITestConfiguration.java b/java-server/rest-api-integration-tests/src/test/java/net/chrisrichardson/eventstore/examples/kanban/integrationtests/RestAPITestConfiguration.java index 45516568..5e4aca49 100755 --- a/java-server/rest-api-integration-tests/src/test/java/net/chrisrichardson/eventstore/examples/kanban/integrationtests/RestAPITestConfiguration.java +++ b/java-server/rest-api-integration-tests/src/test/java/net/chrisrichardson/eventstore/examples/kanban/integrationtests/RestAPITestConfiguration.java @@ -1,15 +1,16 @@ package net.chrisrichardson.eventstore.examples.kanban.integrationtests; import com.fasterxml.jackson.databind.ObjectMapper; -import io.eventuate.javaclient.spring.jdbc.EventuateJdbcEventStoreConfiguration; -import net.chrisrichardson.eventstore.examples.kanban.commandside.board.BoardCommandSideConfiguration; -import net.chrisrichardson.eventstore.examples.kanban.commandside.task.TaskCommandSideConfiguration; +import io.eventuate.javaclient.spring.jdbc.EmbeddedTestAggregateStoreConfiguration; +import net.chrisrichardson.eventstore.examples.kanban.boardservice.web.BoardWebConfiguration; +import net.chrisrichardson.eventstore.examples.kanban.boardviewservice.web.BoardViewWebConfiguration; import net.chrisrichardson.eventstore.examples.kanban.commonwebsocket.WebsocketEventsTranslator; -import net.chrisrichardson.eventstore.examples.kanban.queryside.board.BoardQuerySideConfiguration; -import net.chrisrichardson.eventstore.examples.kanban.queryside.task.TaskQuerySideConfiguration; +import net.chrisrichardson.eventstore.examples.kanban.taskservice.web.TaskWebConfiguration; +import net.chrisrichardson.eventstore.examples.kanban.taskviewservice.web.TaskViewWebConfiguration; import net.chrisrichardson.eventstore.examples.kanban.testutil.BasicWebTestConfiguration; import org.apache.http.client.HttpClient; import org.apache.http.impl.client.HttpClients; +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; @@ -20,29 +21,35 @@ import org.springframework.messaging.simp.SimpMessagingTemplate; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; import org.springframework.web.client.RestTemplate; + import java.util.Collections; @Configuration @EnableWebSecurity -@Import({EventuateJdbcEventStoreConfiguration.class, BasicWebTestConfiguration.class, BoardQuerySideConfiguration.class, TaskQuerySideConfiguration.class, BoardCommandSideConfiguration.class, TaskCommandSideConfiguration.class}) +@Import({EmbeddedTestAggregateStoreConfiguration.class, + BasicWebTestConfiguration.class, + BoardWebConfiguration.class, + TaskViewWebConfiguration.class, + BoardViewWebConfiguration.class, + TaskWebConfiguration.class}) public class RestAPITestConfiguration { - @Bean - public WebsocketEventsTranslator websocketEventsTranslator(SimpMessagingTemplate template) { - return new WebsocketEventsTranslator(template); - } + @Bean + public WebsocketEventsTranslator websocketEventsTranslator(SimpMessagingTemplate template) { + return new WebsocketEventsTranslator(template); + } - @Bean - public RestTemplate restTemplate() { - // we have to define Apache HTTP client to use the PATCH verb - MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter(); - converter.setSupportedMediaTypes(MediaType.parseMediaTypes("application/json")); - converter.setObjectMapper(new ObjectMapper()); + @Bean + public RestTemplate restTemplate() { + // we have to define Apache HTTP client to use the PATCH verb + MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter(); + converter.setSupportedMediaTypes(MediaType.parseMediaTypes("application/json")); + converter.setObjectMapper(new ObjectMapper()); - HttpClient httpClient = HttpClients.createDefault(); - RestTemplate restTemplate = new RestTemplate(Collections.>singletonList(converter)); - restTemplate.setRequestFactory(new HttpComponentsClientHttpRequestFactory(httpClient)); + HttpClient httpClient = HttpClients.createDefault(); + RestTemplate restTemplate = new RestTemplate(Collections.>singletonList(converter)); + restTemplate.setRequestFactory(new HttpComponentsClientHttpRequestFactory(httpClient)); - return restTemplate; - } + return restTemplate; + } } diff --git a/java-server/rest-api-integration-tests/src/test/resources/logback.xml b/java-server/rest-api-integration-tests/src/test/resources/logback.xml index 55a8ed13..d51f08dc 100755 --- a/java-server/rest-api-integration-tests/src/test/resources/logback.xml +++ b/java-server/rest-api-integration-tests/src/test/resources/logback.xml @@ -9,9 +9,13 @@ - + + + + + \ No newline at end of file diff --git a/java-server/set-env.sh b/java-server/set-env.sh new file mode 100755 index 00000000..18b9de54 --- /dev/null +++ b/java-server/set-env.sh @@ -0,0 +1,20 @@ +if [ -z "$DOCKER_HOST_IP" ] ; then + if [ -z "$DOCKER_HOST" ] ; then + export DOCKER_HOST_IP=`hostname` + else + echo using ${DOCKER_HOST?} + XX=${DOCKER_HOST%\:*} + export DOCKER_HOST_IP=${XX#tcp\:\/\/} + fi +fi + +echo DOCKER_HOST_IP is $DOCKER_HOST_IP + +export SPRING_DATASOURCE_URL=jdbc:mysql://${DOCKER_HOST_IP}/eventuate +export SPRING_DATASOURCE_USERNAME=mysqluser +export SPRING_DATASOURCE_PASSWORD=mysqlpw +export SPRING_DATASOURCE_DRIVER_CLASS_NAME=com.mysql.jdbc.Driver +export EVENTUATELOCAL_KAFKA_BOOTSTRAP_SERVERS=$DOCKER_HOST_IP:9092 +export EVENTUATELOCAL_CDC_DB_USER_NAME=root +export EVENTUATELOCAL_CDC_DB_PASSWORD=rootpassword +export EVENTUATELOCAL_ZOOKEEPER_CONNECTION_STRING=$DOCKER_HOST_IP:2181 \ No newline at end of file diff --git a/java-server/settings.gradle b/java-server/settings.gradle index fd0520b4..f9994a6b 100755 --- a/java-server/settings.gradle +++ b/java-server/settings.gradle @@ -6,20 +6,14 @@ include 'common-task' include 'common-web' include 'common-swagger' -include 'board-command-side' -include 'task-command-side' -include 'board-query-side' -include 'task-query-side' +include 'board-service' +include 'board-view-service' +include 'task-service' +include 'task-view-service' -include 'standalone-service' include 'rest-api-integration-tests' include 'api-gateway-service' include 'common-auth' include 'common-websocket' -include 'board-command-side-service' -include 'board-query-side-service' -include 'task-command-side-service' -include 'task-query-side-service' include 'common-auth-controller' include 'e2e-test' - diff --git a/java-server/standalone-service/build.gradle b/java-server/standalone-service/build.gradle deleted file mode 100755 index 5a10c42b..00000000 --- a/java-server/standalone-service/build.gradle +++ /dev/null @@ -1,37 +0,0 @@ - -apply plugin: 'java' -apply plugin: 'spring-boot' - -dependencies { - compile project(":board-command-side") - compile project(":task-command-side") - compile project(":board-query-side") - compile project(":task-query-side") - compile project(":common-auth-controller") - compile project(":common-websocket") - compile project(":common-swagger") - - compile "io.eventuate.client.java:eventuate-client-java-spring:$eventuateClientVersion" - compile "io.eventuate.client.java:eventuate-client-java-http-stomp-spring:$eventuateClientVersion" - - compile "org.springframework.boot:spring-boot-starter-web:$springBootVersion" - compile "org.springframework.boot:spring-boot-starter-actuator:$springBootVersion" - - testCompile "junit:junit:4.11" - testCompile "org.springframework.boot:spring-boot-starter-test" -} - -test { - ignoreFailures true -} - -task copyAngularJS(type: Copy) { - from "../../prebuilt-angularjs-client" - into "build/resources/main/static" -} - -jar.dependsOn(copyAngularJS) - -bootRun { - systemProperties System.properties -} \ No newline at end of file diff --git a/java-server/standalone-service/pom.xml b/java-server/standalone-service/pom.xml deleted file mode 100755 index f7caea67..00000000 --- a/java-server/standalone-service/pom.xml +++ /dev/null @@ -1,94 +0,0 @@ - - - net.chrisrichardson.eventstore.examples - kanban-app - 0.1.0-SNAPSHOT - - 4.0.0 - standalone-service - jar - standalone-service - - - - net.chrisrichardson.eventstore.examples - board-command-side - ${project.parent.version} - - - net.chrisrichardson.eventstore.examples - task-command-side - ${project.parent.version} - - - net.chrisrichardson.eventstore.examples - board-query-side - ${project.parent.version} - - - net.chrisrichardson.eventstore.examples - task-query-side - ${project.parent.version} - - - net.chrisrichardson.eventstore.examples - common-auth-controller - ${project.parent.version} - - - net.chrisrichardson.eventstore.examples - common-websocket - ${project.parent.version} - - - net.chrisrichardson.eventstore.examples - common-swagger - ${project.parent.version} - - - - io.eventuate.client.java - eventuate-client-java-http-stomp-spring - - - - org.apache.httpcomponents - httpclient - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - ${java.version} - ${java.version} - - - - maven-resources-plugin - 2.7 - - - copy-resources - validate - - copy-resources - - - ${basedir}/target/classes/static - - - ../../prebuilt-angularjs-client - - - - - - - - - \ No newline at end of file diff --git a/java-server/standalone-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/standalone/StandaloneServiceConfiguration.java b/java-server/standalone-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/standalone/StandaloneServiceConfiguration.java deleted file mode 100755 index 5c88b837..00000000 --- a/java-server/standalone-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/standalone/StandaloneServiceConfiguration.java +++ /dev/null @@ -1,28 +0,0 @@ -package net.chrisrichardson.eventstore.examples.kanban.standalone; - -import io.eventuate.javaclient.spring.httpstomp.EventuateHttpStompClientConfiguration; -import net.chrisrichardson.eventstore.examples.kanban.commandside.board.BoardCommandSideConfiguration; -import net.chrisrichardson.eventstore.examples.kanban.commandside.task.TaskCommandSideConfiguration; -import net.chrisrichardson.eventstore.examples.kanban.commonauth.AuthConfiguration; -import net.chrisrichardson.eventstore.examples.kanban.commonswagger.CommonSwaggerConfiguration; -import net.chrisrichardson.eventstore.examples.kanban.commonweb.WebConfiguration; -import net.chrisrichardson.eventstore.examples.kanban.commonwebsocket.WebSocketConfig; -import net.chrisrichardson.eventstore.examples.kanban.commonwebsocket.WebSocketSecurityConfig; -import net.chrisrichardson.eventstore.examples.kanban.commonwebsocket.WebsocketEventsTranslator; -import net.chrisrichardson.eventstore.examples.kanban.queryside.board.BoardQuerySideConfiguration; -import net.chrisrichardson.eventstore.examples.kanban.queryside.task.TaskQuerySideConfiguration; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Import; -import org.springframework.messaging.simp.SimpMessagingTemplate; - -@Configuration -@Import({EventuateHttpStompClientConfiguration.class, WebConfiguration.class, AuthConfiguration.class, WebSocketConfig.class, WebSocketSecurityConfig.class, BoardQuerySideConfiguration.class, TaskQuerySideConfiguration.class, BoardCommandSideConfiguration.class, TaskCommandSideConfiguration.class, CommonSwaggerConfiguration.class}) -@ComponentScan -public class StandaloneServiceConfiguration { - @Bean - public WebsocketEventsTranslator websocketEventsTranslator(SimpMessagingTemplate template) { - return new WebsocketEventsTranslator(template); - } -} \ No newline at end of file diff --git a/java-server/standalone-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/standalone/main/StandaloneServiceMain.java b/java-server/standalone-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/standalone/main/StandaloneServiceMain.java deleted file mode 100755 index b9d4eb1a..00000000 --- a/java-server/standalone-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/standalone/main/StandaloneServiceMain.java +++ /dev/null @@ -1,11 +0,0 @@ -package net.chrisrichardson.eventstore.examples.kanban.standalone.main; - -import net.chrisrichardson.eventstore.examples.kanban.standalone.StandaloneServiceConfiguration; -import org.springframework.boot.SpringApplication; - -public class StandaloneServiceMain { - public static void main(String[] args) { - SpringApplication.run(StandaloneServiceConfiguration.class, args); - } - -} diff --git a/java-server/task-command-side-service/build.gradle b/java-server/task-command-side-service/build.gradle deleted file mode 100755 index e1a8b6c1..00000000 --- a/java-server/task-command-side-service/build.gradle +++ /dev/null @@ -1,14 +0,0 @@ -apply plugin: 'java' -apply plugin: 'spring-boot' - -dependencies { - compile project(":task-command-side") - compile project(":common-swagger") - compile project(":common-auth") - - 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-http-stomp-spring:$eventuateClientVersion" - testCompile "junit:junit:4.11" -} \ No newline at end of file diff --git a/java-server/task-command-side-service/pom.xml b/java-server/task-command-side-service/pom.xml deleted file mode 100755 index 44e73ffe..00000000 --- a/java-server/task-command-side-service/pom.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - net.chrisrichardson.eventstore.examples - kanban-app - 0.1.0-SNAPSHOT - - 4.0.0 - task-command-side-service - jar - task-command-side-service - - - - net.chrisrichardson.eventstore.examples - task-command-side - ${project.parent.version} - - - net.chrisrichardson.eventstore.examples - common-auth - ${project.parent.version} - - - net.chrisrichardson.eventstore.examples - common-swagger - ${project.parent.version} - - - - io.eventuate.client.java - eventuate-client-java-http-stomp-spring - - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - ${java.version} - ${java.version} - - - - - \ No newline at end of file diff --git a/java-server/task-command-side-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/taskcommandsideservice/TaskCommandSideServiceConfiguration.java b/java-server/task-command-side-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/taskcommandsideservice/TaskCommandSideServiceConfiguration.java deleted file mode 100755 index fd2357f5..00000000 --- a/java-server/task-command-side-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/taskcommandsideservice/TaskCommandSideServiceConfiguration.java +++ /dev/null @@ -1,19 +0,0 @@ -package net.chrisrichardson.eventstore.examples.kanban.taskcommandsideservice; - -import io.eventuate.javaclient.spring.httpstomp.EventuateHttpStompClientConfiguration; -import net.chrisrichardson.eventstore.examples.kanban.commonweb.WebConfiguration; -import net.chrisrichardson.eventstore.examples.kanban.commandside.task.TaskCommandSideConfiguration; -import net.chrisrichardson.eventstore.examples.kanban.commonauth.AuthConfiguration; -import net.chrisrichardson.eventstore.examples.kanban.commonswagger.CommonSwaggerConfiguration; -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({TaskCommandSideConfiguration.class, EventuateHttpStompClientConfiguration.class, WebConfiguration.class, AuthConfiguration.class, CommonSwaggerConfiguration.class}) -@EnableAutoConfiguration -@ComponentScan -public class TaskCommandSideServiceConfiguration { -} diff --git a/java-server/task-command-side-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/taskcommandsideservice/main/TaskCommandSideServiceMain.java b/java-server/task-command-side-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/taskcommandsideservice/main/TaskCommandSideServiceMain.java deleted file mode 100755 index 9827748c..00000000 --- a/java-server/task-command-side-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/taskcommandsideservice/main/TaskCommandSideServiceMain.java +++ /dev/null @@ -1,10 +0,0 @@ -package net.chrisrichardson.eventstore.examples.kanban.taskcommandsideservice.main; - -import net.chrisrichardson.eventstore.examples.kanban.taskcommandsideservice.TaskCommandSideServiceConfiguration; -import org.springframework.boot.SpringApplication; - -public class TaskCommandSideServiceMain { - public static void main(String[] args) { - SpringApplication.run(TaskCommandSideServiceConfiguration.class, args); - } -} diff --git a/java-server/task-command-side/pom.xml b/java-server/task-command-side/pom.xml deleted file mode 100755 index f9b31165..00000000 --- a/java-server/task-command-side/pom.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - net.chrisrichardson.eventstore.examples - kanban-app - 0.1.0-SNAPSHOT - - 4.0.0 - task-command-side - jar - task-command-side - - - - net.chrisrichardson.eventstore.examples - common-task - ${project.parent.version} - - - net.chrisrichardson.eventstore.examples - common-web - ${project.parent.version} - - - net.chrisrichardson.eventstore.examples - common-auth - ${project.parent.version} - - - - org.springframework.boot - spring-boot-starter-actuator - ${springBootVersion} - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - ${java.version} - ${java.version} - - - - - \ No newline at end of file diff --git a/java-server/task-query-side-service/build.gradle b/java-server/task-query-side-service/build.gradle deleted file mode 100755 index 2384a6c7..00000000 --- a/java-server/task-query-side-service/build.gradle +++ /dev/null @@ -1,15 +0,0 @@ -apply plugin: 'java' -apply plugin: 'spring-boot' - -dependencies { - compile project(":task-query-side") - compile project(":common-swagger") - compile project(":common-auth") - - 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 "io.eventuate.client.java:eventuate-client-java-http-stomp-spring:$eventuateClientVersion" - testCompile "junit:junit:4.11" -} diff --git a/java-server/task-query-side-service/pom.xml b/java-server/task-query-side-service/pom.xml deleted file mode 100755 index ee3c659d..00000000 --- a/java-server/task-query-side-service/pom.xml +++ /dev/null @@ -1,54 +0,0 @@ - - - net.chrisrichardson.eventstore.examples - kanban-app - 0.1.0-SNAPSHOT - - 4.0.0 - task-query-side-service - jar - task-query-side-service - - - - net.chrisrichardson.eventstore.examples - task-query-side - ${project.parent.version} - - - net.chrisrichardson.eventstore.examples - common-web - ${project.parent.version} - - - net.chrisrichardson.eventstore.examples - common-auth - ${project.parent.version} - - - net.chrisrichardson.eventstore.examples - common-swagger - ${project.parent.version} - - - - io.eventuate.client.java - eventuate-client-java-http-stomp-spring - - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - ${java.version} - ${java.version} - - - - - \ No newline at end of file diff --git a/java-server/task-query-side-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/taskquerysideservice/TaskQuerySideServiceConfiguration.java b/java-server/task-query-side-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/taskquerysideservice/TaskQuerySideServiceConfiguration.java deleted file mode 100755 index cc1e8460..00000000 --- a/java-server/task-query-side-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/taskquerysideservice/TaskQuerySideServiceConfiguration.java +++ /dev/null @@ -1,21 +0,0 @@ -package net.chrisrichardson.eventstore.examples.kanban.taskquerysideservice; - -import io.eventuate.javaclient.spring.httpstomp.EventuateHttpStompClientConfiguration; -import net.chrisrichardson.eventstore.examples.kanban.commonweb.WebConfiguration; -import net.chrisrichardson.eventstore.examples.kanban.commonauth.AuthConfiguration; -import net.chrisrichardson.eventstore.examples.kanban.commonswagger.CommonSwaggerConfiguration; -import net.chrisrichardson.eventstore.examples.kanban.queryside.task.TaskQuerySideConfiguration; -import org.springframework.boot.autoconfigure.EnableAutoConfiguration; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Import; - -/** - * Created by Main on 19.01.2016. - */ -@Configuration -@Import({TaskQuerySideConfiguration.class, EventuateHttpStompClientConfiguration.class, WebConfiguration.class, AuthConfiguration.class, CommonSwaggerConfiguration.class}) -@EnableAutoConfiguration -@ComponentScan -public class TaskQuerySideServiceConfiguration { -} diff --git a/java-server/task-query-side-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/taskquerysideservice/main/TaskQuerySideServiceMain.java b/java-server/task-query-side-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/taskquerysideservice/main/TaskQuerySideServiceMain.java deleted file mode 100755 index 4200c7a8..00000000 --- a/java-server/task-query-side-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/taskquerysideservice/main/TaskQuerySideServiceMain.java +++ /dev/null @@ -1,13 +0,0 @@ -package net.chrisrichardson.eventstore.examples.kanban.taskquerysideservice.main; - -import net.chrisrichardson.eventstore.examples.kanban.taskquerysideservice.TaskQuerySideServiceConfiguration; -import org.springframework.boot.SpringApplication; - -/** - * Created by Main on 19.01.2016. - */ -public class TaskQuerySideServiceMain { - public static void main(String[] args) { - SpringApplication.run(TaskQuerySideServiceConfiguration.class, args); - } -} diff --git a/java-server/task-query-side/pom.xml b/java-server/task-query-side/pom.xml deleted file mode 100755 index 01a8980e..00000000 --- a/java-server/task-query-side/pom.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - net.chrisrichardson.eventstore.examples - kanban-app - 0.1.0-SNAPSHOT - - 4.0.0 - task-query-side - jar - task-query-side - - - - net.chrisrichardson.eventstore.examples - common-task - ${project.parent.version} - - - net.chrisrichardson.eventstore.examples - common-web - ${project.parent.version} - - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - ${java.version} - ${java.version} - - - - - \ No newline at end of file diff --git a/java-server/task-service/Dockerfile b/java-server/task-service/Dockerfile new file mode 100644 index 00000000..5d1ada60 --- /dev/null +++ b/java-server/task-service/Dockerfile @@ -0,0 +1,4 @@ +FROM java:openjdk-8u91-jdk +CMD java -jar task-service.jar +EXPOSE 8082 +COPY build/libs/task-service.jar . \ No newline at end of file diff --git a/java-server/task-command-side/build.gradle b/java-server/task-service/build.gradle old mode 100755 new mode 100644 similarity index 72% rename from java-server/task-command-side/build.gradle rename to java-server/task-service/build.gradle index a53b3831..0fb3cce5 --- a/java-server/task-command-side/build.gradle +++ b/java-server/task-service/build.gradle @@ -1,9 +1,13 @@ -apply plugin: 'java' +apply plugin: VerifyEventStoreEnvironmentPlugin +apply plugin: EventuateDependencyPlugin + +apply plugin: 'spring-boot' dependencies { compile project(":common-task") compile project(":common-web") compile project(":common-auth") + compile project(":common-swagger") compile "io.eventuate.client.java:eventuate-client-java-spring:$eventuateClientVersion" @@ -11,4 +15,4 @@ dependencies { compile "org.springframework.boot:spring-boot-starter-actuator:$springBootVersion" testCompile "junit:junit:4.11" -} +} \ No newline at end of file diff --git a/java-server/task-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/taskservice/TaskServiceMain.java b/java-server/task-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/taskservice/TaskServiceMain.java new file mode 100755 index 00000000..243c24d6 --- /dev/null +++ b/java-server/task-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/taskservice/TaskServiceMain.java @@ -0,0 +1,24 @@ +package net.chrisrichardson.eventstore.examples.kanban.taskservice; + +import io.eventuate.javaclient.driver.EventuateDriverConfiguration; +import net.chrisrichardson.eventstore.examples.kanban.commonauth.AuthConfiguration; +import net.chrisrichardson.eventstore.examples.kanban.commonswagger.CommonSwaggerConfiguration; +import net.chrisrichardson.eventstore.examples.kanban.commonweb.WebConfiguration; +import net.chrisrichardson.eventstore.examples.kanban.taskservice.web.TaskWebConfiguration; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Import; + +@Configuration +@Import({TaskWebConfiguration.class, + EventuateDriverConfiguration.class, + WebConfiguration.class, + AuthConfiguration.class, + CommonSwaggerConfiguration.class}) +@EnableAutoConfiguration +public class TaskServiceMain { + public static void main(String[] args) { + SpringApplication.run(TaskServiceMain.class, args); + } +} diff --git a/java-server/task-command-side/src/main/java/net/chrisrichardson/eventstore/examples/kanban/commandside/task/CompleteTaskCommand.java b/java-server/task-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/taskservice/backend/CompleteTaskCommand.java similarity index 89% rename from java-server/task-command-side/src/main/java/net/chrisrichardson/eventstore/examples/kanban/commandside/task/CompleteTaskCommand.java rename to java-server/task-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/taskservice/backend/CompleteTaskCommand.java index f8af8344..52dd6d40 100755 --- a/java-server/task-command-side/src/main/java/net/chrisrichardson/eventstore/examples/kanban/commandside/task/CompleteTaskCommand.java +++ b/java-server/task-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/taskservice/backend/CompleteTaskCommand.java @@ -1,4 +1,4 @@ -package net.chrisrichardson.eventstore.examples.kanban.commandside.task; +package net.chrisrichardson.eventstore.examples.kanban.taskservice.backend; import net.chrisrichardson.eventstore.examples.kanban.common.model.AuditEntry; import org.apache.commons.lang.builder.ToStringBuilder; diff --git a/java-server/task-command-side/src/main/java/net/chrisrichardson/eventstore/examples/kanban/commandside/task/CreateTaskCommand.java b/java-server/task-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/taskservice/backend/CreateTaskCommand.java similarity index 86% rename from java-server/task-command-side/src/main/java/net/chrisrichardson/eventstore/examples/kanban/commandside/task/CreateTaskCommand.java rename to java-server/task-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/taskservice/backend/CreateTaskCommand.java index f8a670e1..636dbfde 100755 --- a/java-server/task-command-side/src/main/java/net/chrisrichardson/eventstore/examples/kanban/commandside/task/CreateTaskCommand.java +++ b/java-server/task-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/taskservice/backend/CreateTaskCommand.java @@ -1,4 +1,4 @@ -package net.chrisrichardson.eventstore.examples.kanban.commandside.task; +package net.chrisrichardson.eventstore.examples.kanban.taskservice.backend; import net.chrisrichardson.eventstore.examples.kanban.common.task.TaskInfo; import org.apache.commons.lang.builder.ToStringBuilder; diff --git a/java-server/task-command-side/src/main/java/net/chrisrichardson/eventstore/examples/kanban/commandside/task/DeleteTaskCommand.java b/java-server/task-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/taskservice/backend/DeleteTaskCommand.java similarity index 80% rename from java-server/task-command-side/src/main/java/net/chrisrichardson/eventstore/examples/kanban/commandside/task/DeleteTaskCommand.java rename to java-server/task-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/taskservice/backend/DeleteTaskCommand.java index e847ec7b..4e68c59a 100755 --- a/java-server/task-command-side/src/main/java/net/chrisrichardson/eventstore/examples/kanban/commandside/task/DeleteTaskCommand.java +++ b/java-server/task-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/taskservice/backend/DeleteTaskCommand.java @@ -1,4 +1,4 @@ -package net.chrisrichardson.eventstore.examples.kanban.commandside.task; +package net.chrisrichardson.eventstore.examples.kanban.taskservice.backend; import net.chrisrichardson.eventstore.examples.kanban.common.model.AuditEntry; diff --git a/java-server/task-command-side/src/main/java/net/chrisrichardson/eventstore/examples/kanban/commandside/task/MoveToBacklogTaskCommand.java b/java-server/task-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/taskservice/backend/MoveToBacklogTaskCommand.java similarity index 86% rename from java-server/task-command-side/src/main/java/net/chrisrichardson/eventstore/examples/kanban/commandside/task/MoveToBacklogTaskCommand.java rename to java-server/task-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/taskservice/backend/MoveToBacklogTaskCommand.java index 670c7b34..e7303924 100755 --- a/java-server/task-command-side/src/main/java/net/chrisrichardson/eventstore/examples/kanban/commandside/task/MoveToBacklogTaskCommand.java +++ b/java-server/task-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/taskservice/backend/MoveToBacklogTaskCommand.java @@ -1,4 +1,4 @@ -package net.chrisrichardson.eventstore.examples.kanban.commandside.task; +package net.chrisrichardson.eventstore.examples.kanban.taskservice.backend; import net.chrisrichardson.eventstore.examples.kanban.common.model.AuditEntry; import org.apache.commons.lang.builder.ToStringBuilder; diff --git a/java-server/task-command-side/src/main/java/net/chrisrichardson/eventstore/examples/kanban/commandside/task/ScheduleTaskCommand.java b/java-server/task-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/taskservice/backend/ScheduleTaskCommand.java similarity index 89% rename from java-server/task-command-side/src/main/java/net/chrisrichardson/eventstore/examples/kanban/commandside/task/ScheduleTaskCommand.java rename to java-server/task-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/taskservice/backend/ScheduleTaskCommand.java index a8ca4f6a..81c7123a 100755 --- a/java-server/task-command-side/src/main/java/net/chrisrichardson/eventstore/examples/kanban/commandside/task/ScheduleTaskCommand.java +++ b/java-server/task-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/taskservice/backend/ScheduleTaskCommand.java @@ -1,4 +1,4 @@ -package net.chrisrichardson.eventstore.examples.kanban.commandside.task; +package net.chrisrichardson.eventstore.examples.kanban.taskservice.backend; import net.chrisrichardson.eventstore.examples.kanban.common.model.AuditEntry; import org.apache.commons.lang.builder.ToStringBuilder; diff --git a/java-server/task-command-side/src/main/java/net/chrisrichardson/eventstore/examples/kanban/commandside/task/StartTaskCommand.java b/java-server/task-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/taskservice/backend/StartTaskCommand.java similarity index 89% rename from java-server/task-command-side/src/main/java/net/chrisrichardson/eventstore/examples/kanban/commandside/task/StartTaskCommand.java rename to java-server/task-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/taskservice/backend/StartTaskCommand.java index fb571200..5608e0f6 100755 --- a/java-server/task-command-side/src/main/java/net/chrisrichardson/eventstore/examples/kanban/commandside/task/StartTaskCommand.java +++ b/java-server/task-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/taskservice/backend/StartTaskCommand.java @@ -1,4 +1,4 @@ -package net.chrisrichardson.eventstore.examples.kanban.commandside.task; +package net.chrisrichardson.eventstore.examples.kanban.taskservice.backend; import net.chrisrichardson.eventstore.examples.kanban.common.model.AuditEntry; import org.apache.commons.lang.builder.ToStringBuilder; diff --git a/java-server/task-command-side/src/main/java/net/chrisrichardson/eventstore/examples/kanban/commandside/task/TaskAggregate.java b/java-server/task-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/taskservice/backend/TaskAggregate.java similarity index 96% rename from java-server/task-command-side/src/main/java/net/chrisrichardson/eventstore/examples/kanban/commandside/task/TaskAggregate.java rename to java-server/task-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/taskservice/backend/TaskAggregate.java index 86f3d8f0..beaef12f 100755 --- a/java-server/task-command-side/src/main/java/net/chrisrichardson/eventstore/examples/kanban/commandside/task/TaskAggregate.java +++ b/java-server/task-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/taskservice/backend/TaskAggregate.java @@ -1,9 +1,10 @@ -package net.chrisrichardson.eventstore.examples.kanban.commandside.task; +package net.chrisrichardson.eventstore.examples.kanban.taskservice.backend; import io.eventuate.Event; import io.eventuate.EventUtil; import io.eventuate.ReflectiveMutableCommandProcessingAggregate; -import net.chrisrichardson.eventstore.examples.kanban.common.task.*; +import net.chrisrichardson.eventstore.examples.kanban.common.task.TaskInfo; +import net.chrisrichardson.eventstore.examples.kanban.common.task.TaskStatus; import net.chrisrichardson.eventstore.examples.kanban.common.task.event.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/java-server/task-command-side/src/main/java/net/chrisrichardson/eventstore/examples/kanban/commandside/task/TaskCommandSideConfiguration.java b/java-server/task-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/taskservice/backend/TaskBackendConfiguration.java similarity index 93% rename from java-server/task-command-side/src/main/java/net/chrisrichardson/eventstore/examples/kanban/commandside/task/TaskCommandSideConfiguration.java rename to java-server/task-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/taskservice/backend/TaskBackendConfiguration.java index f5304f8b..e9bdeae8 100755 --- a/java-server/task-command-side/src/main/java/net/chrisrichardson/eventstore/examples/kanban/commandside/task/TaskCommandSideConfiguration.java +++ b/java-server/task-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/taskservice/backend/TaskBackendConfiguration.java @@ -1,4 +1,4 @@ -package net.chrisrichardson.eventstore.examples.kanban.commandside.task; +package net.chrisrichardson.eventstore.examples.kanban.taskservice.backend; import io.eventuate.AggregateRepository; import io.eventuate.EventuateAggregateStore; @@ -16,7 +16,7 @@ @EnableAutoConfiguration(exclude = {MongoRepositoriesAutoConfiguration.class}) @ComponentScan @EnableEventHandlers -public class TaskCommandSideConfiguration { +public class TaskBackendConfiguration { @Bean public AggregateRepository taskAggregateRepository(EventuateAggregateStore eventStore) { diff --git a/java-server/task-command-side/src/main/java/net/chrisrichardson/eventstore/examples/kanban/commandside/task/TaskCommand.java b/java-server/task-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/taskservice/backend/TaskCommand.java similarity index 51% rename from java-server/task-command-side/src/main/java/net/chrisrichardson/eventstore/examples/kanban/commandside/task/TaskCommand.java rename to java-server/task-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/taskservice/backend/TaskCommand.java index 03fc88e0..6cb757a8 100755 --- a/java-server/task-command-side/src/main/java/net/chrisrichardson/eventstore/examples/kanban/commandside/task/TaskCommand.java +++ b/java-server/task-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/taskservice/backend/TaskCommand.java @@ -1,4 +1,4 @@ -package net.chrisrichardson.eventstore.examples.kanban.commandside.task; +package net.chrisrichardson.eventstore.examples.kanban.taskservice.backend; import io.eventuate.Command; diff --git a/java-server/task-command-side/src/main/java/net/chrisrichardson/eventstore/examples/kanban/commandside/task/TaskHistoryService.java b/java-server/task-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/taskservice/backend/TaskHistoryService.java similarity index 86% rename from java-server/task-command-side/src/main/java/net/chrisrichardson/eventstore/examples/kanban/commandside/task/TaskHistoryService.java rename to java-server/task-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/taskservice/backend/TaskHistoryService.java index 35b526f8..6a1a670c 100755 --- a/java-server/task-command-side/src/main/java/net/chrisrichardson/eventstore/examples/kanban/commandside/task/TaskHistoryService.java +++ b/java-server/task-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/taskservice/backend/TaskHistoryService.java @@ -1,7 +1,8 @@ -package net.chrisrichardson.eventstore.examples.kanban.commandside.task; +package net.chrisrichardson.eventstore.examples.kanban.taskservice.backend; import io.eventuate.EntityWithMetadata; import io.eventuate.EventuateAggregateStore; + import java.util.concurrent.CompletableFuture; public class TaskHistoryService { diff --git a/java-server/task-command-side/src/main/java/net/chrisrichardson/eventstore/examples/kanban/commandside/task/TaskService.java b/java-server/task-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/taskservice/backend/TaskService.java similarity index 97% rename from java-server/task-command-side/src/main/java/net/chrisrichardson/eventstore/examples/kanban/commandside/task/TaskService.java rename to java-server/task-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/taskservice/backend/TaskService.java index 42f2b4f5..55b4eff2 100755 --- a/java-server/task-command-side/src/main/java/net/chrisrichardson/eventstore/examples/kanban/commandside/task/TaskService.java +++ b/java-server/task-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/taskservice/backend/TaskService.java @@ -1,4 +1,4 @@ -package net.chrisrichardson.eventstore.examples.kanban.commandside.task; +package net.chrisrichardson.eventstore.examples.kanban.taskservice.backend; import io.eventuate.AggregateRepository; import io.eventuate.EntityWithIdAndVersion; diff --git a/java-server/task-command-side/src/main/java/net/chrisrichardson/eventstore/examples/kanban/commandside/task/UpdateTaskCommand.java b/java-server/task-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/taskservice/backend/UpdateTaskCommand.java similarity index 90% rename from java-server/task-command-side/src/main/java/net/chrisrichardson/eventstore/examples/kanban/commandside/task/UpdateTaskCommand.java rename to java-server/task-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/taskservice/backend/UpdateTaskCommand.java index cd339d38..041baabf 100755 --- a/java-server/task-command-side/src/main/java/net/chrisrichardson/eventstore/examples/kanban/commandside/task/UpdateTaskCommand.java +++ b/java-server/task-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/taskservice/backend/UpdateTaskCommand.java @@ -1,4 +1,4 @@ -package net.chrisrichardson.eventstore.examples.kanban.commandside.task; +package net.chrisrichardson.eventstore.examples.kanban.taskservice.backend; import net.chrisrichardson.eventstore.examples.kanban.common.model.AuditEntry; import net.chrisrichardson.eventstore.examples.kanban.common.task.TaskDetails; diff --git a/java-server/task-command-side/src/main/java/net/chrisrichardson/eventstore/examples/kanban/commandside/task/TaskCommandController.java b/java-server/task-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/taskservice/web/TaskController.java similarity index 91% rename from java-server/task-command-side/src/main/java/net/chrisrichardson/eventstore/examples/kanban/commandside/task/TaskCommandController.java rename to java-server/task-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/taskservice/web/TaskController.java index bbc553a5..aa892f2e 100755 --- a/java-server/task-command-side/src/main/java/net/chrisrichardson/eventstore/examples/kanban/commandside/task/TaskCommandController.java +++ b/java-server/task-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/taskservice/web/TaskController.java @@ -1,4 +1,4 @@ -package net.chrisrichardson.eventstore.examples.kanban.commandside.task; +package net.chrisrichardson.eventstore.examples.kanban.taskservice.web; import io.eventuate.EntityWithIdAndVersion; import net.chrisrichardson.eventstore.examples.kanban.common.task.TaskDetails; @@ -7,6 +7,9 @@ import net.chrisrichardson.eventstore.examples.kanban.common.task.model.HistoryEvent; import net.chrisrichardson.eventstore.examples.kanban.common.task.model.HistoryResponse; import net.chrisrichardson.eventstore.examples.kanban.common.task.model.TaskResponse; +import net.chrisrichardson.eventstore.examples.kanban.taskservice.backend.TaskAggregate; +import net.chrisrichardson.eventstore.examples.kanban.taskservice.backend.TaskHistoryService; +import net.chrisrichardson.eventstore.examples.kanban.taskservice.backend.TaskService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -24,14 +27,14 @@ @RestController @RequestMapping(value = "/api") -public class TaskCommandController { +public class TaskController { @Autowired private TaskService taskService; @Autowired private TaskHistoryService taskHistoryService; - private static Logger log = LoggerFactory.getLogger(TaskCommandController.class); + private static Logger log = LoggerFactory.getLogger(TaskController.class); @RequestMapping(value = "/tasks", method = POST) public CompletableFuture saveTask(@RequestBody TaskInfo task) { diff --git a/java-server/task-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/taskservice/web/TaskWebConfiguration.java b/java-server/task-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/taskservice/web/TaskWebConfiguration.java new file mode 100644 index 00000000..bf4691e7 --- /dev/null +++ b/java-server/task-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/taskservice/web/TaskWebConfiguration.java @@ -0,0 +1,12 @@ +package net.chrisrichardson.eventstore.examples.kanban.taskservice.web; + +import net.chrisrichardson.eventstore.examples.kanban.taskservice.backend.TaskBackendConfiguration; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Import; + +@Configuration +@Import(TaskBackendConfiguration.class) +@ComponentScan +public class TaskWebConfiguration { +} diff --git a/java-server/task-service/src/main/resources/application.properties b/java-server/task-service/src/main/resources/application.properties new file mode 100644 index 00000000..f387448e --- /dev/null +++ b/java-server/task-service/src/main/resources/application.properties @@ -0,0 +1,2 @@ +spring.application.name=task-service +server.port=8082 \ No newline at end of file diff --git a/java-server/task-service/src/main/resources/logback.xml b/java-server/task-service/src/main/resources/logback.xml new file mode 100755 index 00000000..84cbb835 --- /dev/null +++ b/java-server/task-service/src/main/resources/logback.xml @@ -0,0 +1,21 @@ + + + + + + + + %d{HH:mm:ss.SSS} %-5level %logger{36} - %msg%n + + + + + + + + + + + + + \ No newline at end of file diff --git a/java-server/task-view-service/Dockerfile b/java-server/task-view-service/Dockerfile new file mode 100644 index 00000000..e708b421 --- /dev/null +++ b/java-server/task-view-service/Dockerfile @@ -0,0 +1,4 @@ +FROM java:openjdk-8u91-jdk +CMD java -jar task-view-service.jar +EXPOSE 8084 +COPY build/libs/task-view-service.jar . \ No newline at end of file diff --git a/java-server/task-query-side/build.gradle b/java-server/task-view-service/build.gradle old mode 100755 new mode 100644 similarity index 66% rename from java-server/task-query-side/build.gradle rename to java-server/task-view-service/build.gradle index d89675de..948d04a8 --- a/java-server/task-query-side/build.gradle +++ b/java-server/task-view-service/build.gradle @@ -1,8 +1,13 @@ -apply plugin: 'java' +apply plugin: VerifyEventStoreEnvironmentPlugin +apply plugin: EventuateDependencyPlugin + +apply plugin: 'spring-boot' dependencies { compile project(":common-task") compile project(":common-web") + compile project(":common-swagger") + compile project(":common-auth") compile "org.springframework.boot:spring-boot-starter-data-mongodb:$springBootVersion" compile "org.springframework.boot:spring-boot-starter-web:$springBootVersion" diff --git a/java-server/task-view-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/taskviewservice/TaskViewServiceMain.java b/java-server/task-view-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/taskviewservice/TaskViewServiceMain.java new file mode 100755 index 00000000..b85482d8 --- /dev/null +++ b/java-server/task-view-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/taskviewservice/TaskViewServiceMain.java @@ -0,0 +1,24 @@ +package net.chrisrichardson.eventstore.examples.kanban.taskviewservice; + +import io.eventuate.javaclient.driver.EventuateDriverConfiguration; +import net.chrisrichardson.eventstore.examples.kanban.commonauth.AuthConfiguration; +import net.chrisrichardson.eventstore.examples.kanban.commonswagger.CommonSwaggerConfiguration; +import net.chrisrichardson.eventstore.examples.kanban.commonweb.WebConfiguration; +import net.chrisrichardson.eventstore.examples.kanban.taskviewservice.web.TaskViewWebConfiguration; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Import; + +@Configuration +@Import({TaskViewWebConfiguration.class, + EventuateDriverConfiguration.class, + WebConfiguration.class, + AuthConfiguration.class, + CommonSwaggerConfiguration.class}) +@EnableAutoConfiguration +public class TaskViewServiceMain { + public static void main(String[] args) { + SpringApplication.run(TaskViewServiceMain.class, args); + } +} diff --git a/java-server/task-query-side/src/main/java/net/chrisrichardson/eventstore/examples/kanban/queryside/task/TaskRepository.java b/java-server/task-view-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/taskviewservice/backend/TaskRepository.java similarity index 86% rename from java-server/task-query-side/src/main/java/net/chrisrichardson/eventstore/examples/kanban/queryside/task/TaskRepository.java rename to java-server/task-view-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/taskviewservice/backend/TaskRepository.java index 5d7232e4..7ccd4f7f 100755 --- a/java-server/task-query-side/src/main/java/net/chrisrichardson/eventstore/examples/kanban/queryside/task/TaskRepository.java +++ b/java-server/task-view-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/taskviewservice/backend/TaskRepository.java @@ -1,4 +1,4 @@ -package net.chrisrichardson.eventstore.examples.kanban.queryside.task; +package net.chrisrichardson.eventstore.examples.kanban.taskviewservice.backend; import net.chrisrichardson.eventstore.examples.kanban.common.task.TaskStatus; import net.chrisrichardson.eventstore.examples.kanban.common.task.model.Task; diff --git a/java-server/task-query-side/src/main/java/net/chrisrichardson/eventstore/examples/kanban/queryside/task/TaskUpdateService.java b/java-server/task-view-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/taskviewservice/backend/TaskUpdateService.java similarity index 95% rename from java-server/task-query-side/src/main/java/net/chrisrichardson/eventstore/examples/kanban/queryside/task/TaskUpdateService.java rename to java-server/task-view-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/taskviewservice/backend/TaskUpdateService.java index ffe2f49f..45577d98 100755 --- a/java-server/task-query-side/src/main/java/net/chrisrichardson/eventstore/examples/kanban/queryside/task/TaskUpdateService.java +++ b/java-server/task-view-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/taskviewservice/backend/TaskUpdateService.java @@ -1,4 +1,4 @@ -package net.chrisrichardson.eventstore.examples.kanban.queryside.task; +package net.chrisrichardson.eventstore.examples.kanban.taskviewservice.backend; import net.chrisrichardson.eventstore.examples.kanban.common.task.TaskInfo; import net.chrisrichardson.eventstore.examples.kanban.common.task.model.Task; diff --git a/java-server/task-query-side/src/main/java/net/chrisrichardson/eventstore/examples/kanban/queryside/task/TaskQuerySideConfiguration.java b/java-server/task-view-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/taskviewservice/backend/TaskViewBackendConfiguration.java similarity index 87% rename from java-server/task-query-side/src/main/java/net/chrisrichardson/eventstore/examples/kanban/queryside/task/TaskQuerySideConfiguration.java rename to java-server/task-view-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/taskviewservice/backend/TaskViewBackendConfiguration.java index dbe96ef2..975ab22b 100755 --- a/java-server/task-query-side/src/main/java/net/chrisrichardson/eventstore/examples/kanban/queryside/task/TaskQuerySideConfiguration.java +++ b/java-server/task-view-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/taskviewservice/backend/TaskViewBackendConfiguration.java @@ -1,4 +1,4 @@ -package net.chrisrichardson.eventstore.examples.kanban.queryside.task; +package net.chrisrichardson.eventstore.examples.kanban.taskviewservice.backend; import io.eventuate.javaclient.spring.EnableEventHandlers; import org.springframework.beans.factory.BeanFactory; @@ -17,16 +17,14 @@ @Configuration -@EnableAutoConfiguration -@ComponentScan @EnableMongoRepositories @EnableEventHandlers -public class TaskQuerySideConfiguration { +public class TaskViewBackendConfiguration { @Bean - public TaskQueryWorkflow taskQueryWorkflow(TaskUpdateService taskUpdateService) { - return new TaskQueryWorkflow(taskUpdateService); + public TaskViewEventSubscriber taskViewEventSubscriber(TaskUpdateService taskUpdateService) { + return new TaskViewEventSubscriber(taskUpdateService); } @Bean diff --git a/java-server/task-query-side/src/main/java/net/chrisrichardson/eventstore/examples/kanban/queryside/task/TaskQueryWorkflow.java b/java-server/task-view-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/taskviewservice/backend/TaskViewEventSubscriber.java similarity index 83% rename from java-server/task-query-side/src/main/java/net/chrisrichardson/eventstore/examples/kanban/queryside/task/TaskQueryWorkflow.java rename to java-server/task-view-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/taskviewservice/backend/TaskViewEventSubscriber.java index 122ca0c2..3c722657 100755 --- a/java-server/task-query-side/src/main/java/net/chrisrichardson/eventstore/examples/kanban/queryside/task/TaskQueryWorkflow.java +++ b/java-server/task-view-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/taskviewservice/backend/TaskViewEventSubscriber.java @@ -1,4 +1,4 @@ -package net.chrisrichardson.eventstore.examples.kanban.queryside.task; +package net.chrisrichardson.eventstore.examples.kanban.taskviewservice.backend; import io.eventuate.DispatchedEvent; import io.eventuate.Event; @@ -11,15 +11,15 @@ import org.slf4j.LoggerFactory; @EventSubscriber(id = "taskEventHandlers") -public class TaskQueryWorkflow { +public class TaskViewEventSubscriber { private TaskUpdateService taskUpdateService; - public TaskQueryWorkflow(TaskUpdateService taskUpdateService) { + public TaskViewEventSubscriber(TaskUpdateService taskUpdateService) { this.taskUpdateService = taskUpdateService; } - private static Logger log = LoggerFactory.getLogger(TaskQueryWorkflow.class); + private static Logger log = LoggerFactory.getLogger(TaskViewEventSubscriber.class); @EventHandlerMethod public void create(DispatchedEvent de) { @@ -30,7 +30,7 @@ public void create(DispatchedEvent de) { @EventHandlerMethod public void update(DispatchedEvent de) { - log.info("TaskQueryWorkflow got event : {}", de.getEvent()); + log.info("TaskViewEventSubscriber got event : {}", de.getEvent()); TaskInfo taskInfo = new TaskInfo(); taskInfo.setTaskDetails(de.getEvent().getTaskDetails()); taskInfo.setUpdate(de.getEvent().getUpdate()); @@ -45,7 +45,7 @@ public void complete(DispatchedEvent de) { @EventHandlerMethod public void delete(DispatchedEvent de) { - log.info("TaskQueryWorkflow got event : {}", de.getEvent()); + log.info("TaskViewEventSubscriber got event : {}", de.getEvent()); taskUpdateService.delete(de.getEntityId()); } @@ -79,7 +79,7 @@ private void processChangeStatusEvent(DispatchedEvent de, TaskInfo taskInfo) { - log.info("TaskQueryWorkflow got event : {}", de.getEvent()); + log.info("TaskViewEventSubscriber got event : {}", de.getEvent()); taskUpdateService.update(de.getEntityId(), taskInfo); } } \ No newline at end of file diff --git a/java-server/task-query-side/src/main/java/net/chrisrichardson/eventstore/examples/kanban/queryside/task/TaskQueryController.java b/java-server/task-view-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/taskviewservice/web/TaskViewController.java similarity index 87% rename from java-server/task-query-side/src/main/java/net/chrisrichardson/eventstore/examples/kanban/queryside/task/TaskQueryController.java rename to java-server/task-view-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/taskviewservice/web/TaskViewController.java index 4c53d72e..68aa14f9 100755 --- a/java-server/task-query-side/src/main/java/net/chrisrichardson/eventstore/examples/kanban/queryside/task/TaskQueryController.java +++ b/java-server/task-view-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/taskviewservice/web/TaskViewController.java @@ -1,7 +1,8 @@ -package net.chrisrichardson.eventstore.examples.kanban.queryside.task; +package net.chrisrichardson.eventstore.examples.kanban.taskviewservice.web; import net.chrisrichardson.eventstore.examples.kanban.common.task.TaskStatus; import net.chrisrichardson.eventstore.examples.kanban.common.task.model.BacklogResponse; +import net.chrisrichardson.eventstore.examples.kanban.taskviewservice.backend.TaskRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.RequestMapping; @@ -15,7 +16,7 @@ import static org.springframework.web.bind.annotation.RequestMethod.GET; @RestController -public class TaskQueryController { +public class TaskViewController { @Autowired private TaskRepository taskRepository; diff --git a/java-server/task-view-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/taskviewservice/web/TaskViewWebConfiguration.java b/java-server/task-view-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/taskviewservice/web/TaskViewWebConfiguration.java new file mode 100644 index 00000000..669a3ccd --- /dev/null +++ b/java-server/task-view-service/src/main/java/net/chrisrichardson/eventstore/examples/kanban/taskviewservice/web/TaskViewWebConfiguration.java @@ -0,0 +1,12 @@ +package net.chrisrichardson.eventstore.examples.kanban.taskviewservice.web; + +import net.chrisrichardson.eventstore.examples.kanban.taskviewservice.backend.TaskViewBackendConfiguration; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Import; + +@Configuration +@Import(TaskViewBackendConfiguration.class) +@ComponentScan +public class TaskViewWebConfiguration { +} diff --git a/java-server/task-view-service/src/main/resources/application.properties b/java-server/task-view-service/src/main/resources/application.properties new file mode 100644 index 00000000..aaa3c53c --- /dev/null +++ b/java-server/task-view-service/src/main/resources/application.properties @@ -0,0 +1,2 @@ +spring.application.name=task-view-service +server.port=8084 \ No newline at end of file diff --git a/java-server/task-view-service/src/main/resources/logback.xml b/java-server/task-view-service/src/main/resources/logback.xml new file mode 100755 index 00000000..84cbb835 --- /dev/null +++ b/java-server/task-view-service/src/main/resources/logback.xml @@ -0,0 +1,21 @@ + + + + + + + + %d{HH:mm:ss.SSS} %-5level %logger{36} - %msg%n + + + + + + + + + + + + + \ No newline at end of file diff --git a/java-server/test-utils/src/main/java/net/chrisrichardson/eventstore/examples/kanban/testutil/BasicWebTestConfiguration.java b/java-server/test-utils/src/main/java/net/chrisrichardson/eventstore/examples/kanban/testutil/BasicWebTestConfiguration.java index 7269f450..cf716019 100755 --- a/java-server/test-utils/src/main/java/net/chrisrichardson/eventstore/examples/kanban/testutil/BasicWebTestConfiguration.java +++ b/java-server/test-utils/src/main/java/net/chrisrichardson/eventstore/examples/kanban/testutil/BasicWebTestConfiguration.java @@ -23,7 +23,10 @@ @Configuration @EnableWebSecurity -@Import({WebConfiguration.class, AuthConfiguration.class, WebSocketConfig.class, WebSocketSecurityConfig.class}) +@Import({WebConfiguration.class, + AuthConfiguration.class, + WebSocketConfig.class, + WebSocketSecurityConfig.class}) public class BasicWebTestConfiguration { @Bean diff --git a/java-server/docker-microservices/wait-for-services.sh b/java-server/wait-for-services.sh similarity index 100% rename from java-server/docker-microservices/wait-for-services.sh rename to java-server/wait-for-services.sh