diff --git a/README.md b/README.md index f543660..e1008b6 100644 --- a/README.md +++ b/README.md @@ -66,13 +66,16 @@ See this [wiki page](../../wiki/AboutTheEventStoreServer) for more details. # Building the application (and running the tests) -Both projects use Gradle. -To build a project, execute this command: +Both versions of the application use Gradle. +To build an application, execute this command in the application's top-level directory: ``` ./gradlew assemble ``` +Note: you do not need to install Gradle. +It will be automatically downloaded by `./gradlew`. + This will build a Spring Boot jar in each of the `*-service` directories. You can also run the tests using `gradle build`. diff --git a/_build-and-test-all.sh b/_build-and-test-all.sh new file mode 100755 index 0000000..497723d --- /dev/null +++ b/_build-and-test-all.sh @@ -0,0 +1,41 @@ +#! /bin/bash + +set -e + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +DOCKER_COMPOSE="docker-compose -p event-sourcing-examples" + +if [ "$1" = "--use-existing" ] ; then + shift; +else + ${DOCKER_COMPOSE?} stop + ${DOCKER_COMPOSE?} rm -v --force +fi + +${DOCKER_COMPOSE?} up -d mongodb + +if [ -z "$DOCKER_HOST_IP" ] ; then + export DOCKER_HOST_IP=$(docker-machine ip default) + 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 + +export SERVICE_HOST=$DOCKER_HOST_IP + +./gradlew $* build + +${DOCKER_COMPOSE?} up -d + +$DIR/wait-for-services.sh $DOCKER_HOST_IP + +set -e + +./gradlew $* :e2e-test:cleanTest :e2e-test:test + +${DOCKER_COMPOSE?} stop +${DOCKER_COMPOSE?} rm -v --force diff --git a/es-examples-docker/docker-compose.yml b/es-examples-docker/docker-compose.yml deleted file mode 100644 index 2b0b179..0000000 --- a/es-examples-docker/docker-compose.yml +++ /dev/null @@ -1,5 +0,0 @@ -mongodb: - image: dockerfile/mongodb - ports: - - "27017:27017" - diff --git a/es-examples-docker/mongodb-cli.sh b/es-examples-docker/mongodb-cli.sh deleted file mode 100755 index dcf4e6d..0000000 --- a/es-examples-docker/mongodb-cli.sh +++ /dev/null @@ -1,4 +0,0 @@ -#! /bin/bash - -docker run --link esexamplesdocker_mongodb_1:mongodb -i -t dockerfile/mongodb:latest /usr/bin/mongo --host mongodb - diff --git a/java-spring/accounts-command-side-backend/build.gradle b/java-spring/accounts-command-side-backend/build.gradle index decb30b..8e88a91 100644 --- a/java-spring/accounts-command-side-backend/build.gradle +++ b/java-spring/accounts-command-side-backend/build.gradle @@ -3,16 +3,12 @@ apply plugin: 'java' dependencies { compile project(":common-backend") - compile "net.chrisrichardson.eventstore.client:eventstore-java-client:$eventStoreClientVersion" - - compile 'com.fasterxml.jackson.core:jackson-core:2.4.3' - compile 'com.fasterxml.jackson.core:jackson-databind:2.4.3' - compile 'com.fasterxml.jackson.module:jackson-module-scala_2.10:2.4.3' + compile "net.chrisrichardson.eventstore.client:eventstore-java-client_2.10:$eventStoreClientVersion" testCompile project(":testutil") testCompile "junit:junit:4.11" testCompile "org.springframework.boot:spring-boot-starter-test:$springBootVersion" - testCompile "net.chrisrichardson.eventstore.client:eventstore-jdbc:$eventStoreClientVersion" + testCompile "net.chrisrichardson.eventstore.client:eventstore-jdbc_2.10:$eventStoreClientVersion" } diff --git a/java-spring/accounts-command-side-service/build.gradle b/java-spring/accounts-command-side-service/build.gradle index a206d74..e8d1116 100644 --- a/java-spring/accounts-command-side-service/build.gradle +++ b/java-spring/accounts-command-side-service/build.gradle @@ -9,7 +9,7 @@ dependencies { compile "org.springframework.boot:spring-boot-starter-web" compile "org.springframework.boot:spring-boot-starter-actuator" - compile "net.chrisrichardson.eventstore.client:eventstore-http-stomp-client:$eventStoreClientVersion" + compile "net.chrisrichardson.eventstore.client:eventstore-http-stomp-client_2.10:$eventStoreClientVersion" testCompile "org.springframework.boot:spring-boot-starter-test" diff --git a/java-spring/accounts-query-side-backend/build.gradle b/java-spring/accounts-query-side-backend/build.gradle index 14097a2..52fa014 100644 --- a/java-spring/accounts-query-side-backend/build.gradle +++ b/java-spring/accounts-query-side-backend/build.gradle @@ -3,7 +3,7 @@ apply plugin: 'java' dependencies { compile project(":common-backend") - compile "net.chrisrichardson.eventstore.client:eventstore-java-client:$eventStoreClientVersion" + compile "net.chrisrichardson.eventstore.client:eventstore-java-client_2.10:$eventStoreClientVersion" compile "org.springframework.boot:spring-boot-starter-data-mongodb:$springBootVersion" compile 'com.fasterxml.jackson.core:jackson-core:2.4.3' @@ -13,7 +13,7 @@ dependencies { testCompile project(":testutil") testCompile "junit:junit:4.11" testCompile "org.springframework.boot:spring-boot-starter-test:$springBootVersion" - testCompile "net.chrisrichardson.eventstore.client:eventstore-jdbc:$eventStoreClientVersion" + testCompile "net.chrisrichardson.eventstore.client:eventstore-jdbc_2.10:$eventStoreClientVersion" } diff --git a/java-spring/accounts-query-side-backend/src/main/java/net/chrisrichardson/eventstore/javaexamples/banking/backend/queryside/accounts/AccountQueryWorkflow.java b/java-spring/accounts-query-side-backend/src/main/java/net/chrisrichardson/eventstore/javaexamples/banking/backend/queryside/accounts/AccountQueryWorkflow.java index 408bb4f..1e40637 100644 --- a/java-spring/accounts-query-side-backend/src/main/java/net/chrisrichardson/eventstore/javaexamples/banking/backend/queryside/accounts/AccountQueryWorkflow.java +++ b/java-spring/accounts-query-side-backend/src/main/java/net/chrisrichardson/eventstore/javaexamples/banking/backend/queryside/accounts/AccountQueryWorkflow.java @@ -12,6 +12,8 @@ import net.chrisrichardson.eventstore.subscriptions.DispatchedEvent; import net.chrisrichardson.eventstore.subscriptions.EventHandlerMethod; import net.chrisrichardson.eventstore.subscriptions.EventSubscriber; import rx.Observable; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.math.BigDecimal; @@ -20,6 +22,8 @@ import static net.chrisrichardson.eventstore.javaexamples.banking.backend.querys @EventSubscriber(id="querySideEventHandlers") public class AccountQueryWorkflow implements CompoundEventHandler { + private Logger logger = LoggerFactory.getLogger(getClass()); + private AccountInfoUpdateService accountInfoUpdateService; public AccountQueryWorkflow(AccountInfoUpdateService accountInfoUpdateService) { @@ -31,7 +35,7 @@ public class AccountQueryWorkflow implements CompoundEventHandler { AccountOpenedEvent event = de.event(); String id = de.getEntityIdentifier().getId(); String eventId = de.eventId().asString(); - System.out.println("**************** account version=" + id + ", " + eventId); + logger.info("**************** account version=" + id + ", " + eventId); BigDecimal initialBalance = event.getInitialBalance(); accountInfoUpdateService.create(id, initialBalance, eventId); return Observable.just(null); @@ -43,8 +47,8 @@ public class AccountQueryWorkflow implements CompoundEventHandler { String moneyTransferId = de.getEntityIdentifier().getId(); String fromAccountId = de.event().getDetails().getFromAccountId().getId(); String toAccountId = de.event().getDetails().getToAccountId().getId(); - System.out.println("**************** account version=" + fromAccountId + ", " + de.eventId().asString()); - System.out.println("**************** account version=" + toAccountId + ", " + de.eventId().asString()); + logger.info("**************** account version=" + fromAccountId + ", " + de.eventId().asString()); + logger.info("**************** account version=" + toAccountId + ", " + de.eventId().asString()); AccountTransactionInfo ti = new AccountTransactionInfo(moneyTransferId, fromAccountId, toAccountId, toIntegerRepr(de.event().getDetails().getAmount())); @@ -74,7 +78,7 @@ public class AccountQueryWorkflow implements CompoundEventHandler { long balanceDelta = amount * delta; AccountChangeInfo ci = new AccountChangeInfo(changeId, transactionId, de.event().getClass().getSimpleName(), amount, balanceDelta); String accountId = de.getEntityIdentifier().getId(); - System.out.println("**************** account version=" + accountId + ", " + de.eventId().asString()); + logger.info("**************** account version=" + accountId + ", " + de.eventId().asString()); accountInfoUpdateService.updateBalance(accountId, changeId, balanceDelta, ci); diff --git a/java-spring/accounts-query-side-service/build.gradle b/java-spring/accounts-query-side-service/build.gradle index d2a4da9..7e8dad1 100644 --- a/java-spring/accounts-query-side-service/build.gradle +++ b/java-spring/accounts-query-side-service/build.gradle @@ -9,7 +9,7 @@ dependencies { compile "org.springframework.boot:spring-boot-starter-web" compile "org.springframework.boot:spring-boot-starter-actuator" - compile "net.chrisrichardson.eventstore.client:eventstore-http-stomp-client:$eventStoreClientVersion" + compile "net.chrisrichardson.eventstore.client:eventstore-http-stomp-client_2.10:$eventStoreClientVersion" testCompile project(":testutil") testCompile "org.springframework.boot:spring-boot-starter-test" diff --git a/java-spring/backend-integration-tests/build.gradle b/java-spring/backend-integration-tests/build.gradle index 54fa5a6..64a8f56 100644 --- a/java-spring/backend-integration-tests/build.gradle +++ b/java-spring/backend-integration-tests/build.gradle @@ -8,6 +8,6 @@ dependencies { testCompile project(":testutil") testCompile "junit:junit:4.11" testCompile "org.springframework.boot:spring-boot-starter-test:$springBootVersion" - testCompile "net.chrisrichardson.eventstore.client:eventstore-jdbc:$eventStoreClientVersion" + testCompile "net.chrisrichardson.eventstore.client:eventstore-jdbc_2.10:$eventStoreClientVersion" } diff --git a/java-spring/build-and-test-all.sh b/java-spring/build-and-test-all.sh new file mode 100755 index 0000000..5ea0a3b --- /dev/null +++ b/java-spring/build-and-test-all.sh @@ -0,0 +1,3 @@ +#! /bin/bash + +../_build-and-test-all.sh $* diff --git a/java-spring/build.gradle b/java-spring/build.gradle index 8ceba63..6253293 100644 --- a/java-spring/build.gradle +++ b/java-spring/build.gradle @@ -22,13 +22,7 @@ subprojects { targetCompatibility = 1.7 repositories { - if (project.hasProperty("localMavenRepoUrl")) { - project.localMavenRepoUrl.split(',').each { theUrl -> - maven { url theUrl } - } - } mavenCentral() - maven { url "https://06c59145-4e83-4f22-93ef-6a7eee7aebaa.repos.chrisrichardson.net.s3.amazonaws.com" } - + eventuateMavenRepoUrl.split(',').each { repoUrl -> maven { url repoUrl } } } } diff --git a/java-spring/buildSrc/src/main/groovy/VerifyEventStoreEnvironmentPlugin.groovy b/java-spring/buildSrc/src/main/groovy/VerifyEventStoreEnvironmentPlugin.groovy index 90e18ce..dcdba2c 100644 --- a/java-spring/buildSrc/src/main/groovy/VerifyEventStoreEnvironmentPlugin.groovy +++ b/java-spring/buildSrc/src/main/groovy/VerifyEventStoreEnvironmentPlugin.groovy @@ -6,11 +6,10 @@ class VerifyEventStoreEnvironmentPlugin implements Plugin { project.test { beforeSuite { x -> if (x.parent == null) { - if (System.getenv("EVENT_STORE_URL") == null) - logger.warn("\nPLEASE make sure that Event Store-related environment variables including EVENT_STORE_URL are set, see sample-set-remote-env.sh !!!!\n") + 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-spring/common-backend/build.gradle b/java-spring/common-backend/build.gradle index 7f63bdb..f63260a 100644 --- a/java-spring/common-backend/build.gradle +++ b/java-spring/common-backend/build.gradle @@ -1,14 +1,11 @@ apply plugin: 'java' dependencies { - compile "net.chrisrichardson.eventstore.client:eventstore-java-client:$eventStoreClientVersion" + compile "net.chrisrichardson.eventstore.client:eventstore-java-client_2.10:$eventStoreClientVersion" - compile 'com.fasterxml.jackson.core:jackson-core:2.4.3' - compile 'com.fasterxml.jackson.core:jackson-databind:2.4.3' - compile 'com.fasterxml.jackson.module:jackson-module-scala_2.10:2.4.3' testCompile "junit:junit:4.11" testCompile "org.springframework.boot:spring-boot-starter-test:$springBootVersion" - testCompile "net.chrisrichardson.eventstore.client:eventstore-jdbc:$eventStoreClientVersion" + testCompile "net.chrisrichardson.eventstore.client:eventstore-jdbc_2.10:$eventStoreClientVersion" } diff --git a/java-spring/monolithic-service/src/test/resources/logback.xml b/java-spring/common-backend/src/main/resources/logback.xml similarity index 69% rename from java-spring/monolithic-service/src/test/resources/logback.xml rename to java-spring/common-backend/src/main/resources/logback.xml index 627f846..d4123dc 100644 --- a/java-spring/monolithic-service/src/test/resources/logback.xml +++ b/java-spring/common-backend/src/main/resources/logback.xml @@ -8,10 +8,15 @@ %d{HH:mm:ss.SSS} %-5level %logger{36} - %msg%n - + - - - \ No newline at end of file + + + + + + + + diff --git a/java-spring/common-web/build.gradle b/java-spring/common-web/build.gradle index 9213602..bb58a5e 100644 --- a/java-spring/common-web/build.gradle +++ b/java-spring/common-web/build.gradle @@ -1,7 +1,7 @@ apply plugin: 'java' dependencies { - compile "net.chrisrichardson.eventstore.client:eventstore-java-client:$eventStoreClientVersion" + compile "net.chrisrichardson.eventstore.client:eventstore-java-client_2.10:$eventStoreClientVersion" compile "org.springframework.boot:spring-boot-starter-web:$springBootVersion" testCompile "junit:junit:4.11" diff --git a/java-spring/docker-compose.yml b/java-spring/docker-compose.yml index c70ce2d..0b1e916 100644 --- a/java-spring/docker-compose.yml +++ b/java-spring/docker-compose.yml @@ -7,11 +7,8 @@ accountscommandside: ports: - "8080:8080" environment: - EVENT_STORE_USER_ID: - EVENT_STORE_PASSWORD: - EVENT_STORE_URL: - EVENT_STORE_STOMP_SERVER_HOST: - EVENT_STORE_STOMP_SERVER_PORT: + EVENTUATE_API_KEY_ID: + EVENTUATE_API_KEY_SECRET: transactionscommandside: image: java:8 @@ -22,11 +19,8 @@ transactionscommandside: ports: - "8082:8080" environment: - EVENT_STORE_USER_ID: - EVENT_STORE_PASSWORD: - EVENT_STORE_URL: - EVENT_STORE_STOMP_SERVER_HOST: - EVENT_STORE_STOMP_SERVER_PORT: + EVENTUATE_API_KEY_ID: + EVENTUATE_API_KEY_SECRET: accountsqueryside: @@ -34,17 +28,14 @@ accountsqueryside: working_dir: /app volumes: - ./accounts-query-side-service/build/libs:/app - command: java -jar /app/accounts-query-side-service.jar --spring.data.mongodb_uri=mongodb://database/CQRS + command: java -jar /app/accounts-query-side-service.jar ports: - "8081:8080" links: - mongodb environment: - EVENT_STORE_USER_ID: - EVENT_STORE_PASSWORD: - EVENT_STORE_URL: - EVENT_STORE_STOMP_SERVER_HOST: - EVENT_STORE_STOMP_SERVER_PORT: + EVENTUATE_API_KEY_ID: + EVENTUATE_API_KEY_SECRET: SPRING_DATA_MONGODB_URI: mongodb://mongodb/mydb mongodb: diff --git a/java-spring/gradle.properties b/java-spring/gradle.properties index 633aefe..6ec43fa 100644 --- a/java-spring/gradle.properties +++ b/java-spring/gradle.properties @@ -1,9 +1,10 @@ org.gradle.jvmargs=-XX:MaxPermSize=512m +eventuateMavenRepoUrl=http://mavenrepo.eventuate.io/release + scalaTestDependency=org.scalatest:scalatest_2.10:2.0 -springBootVersion=1.2.5.RELEASE +springBootVersion=1.2.8.RELEASE -eventStoreClientVersion=0.7 -eventStoreCommonVersion=0.7 +eventStoreClientVersion=0.12 diff --git a/java-spring/monolithic-service/build.gradle b/java-spring/monolithic-service/build.gradle index 47f1922..71d9f26 100644 --- a/java-spring/monolithic-service/build.gradle +++ b/java-spring/monolithic-service/build.gradle @@ -10,7 +10,7 @@ dependencies { compile "org.springframework.boot:spring-boot-starter-web" compile "org.springframework.boot:spring-boot-starter-actuator" - compile "net.chrisrichardson.eventstore.client:eventstore-jdbc:$eventStoreClientVersion" + compile "net.chrisrichardson.eventstore.client:eventstore-jdbc_2.10:$eventStoreClientVersion" testCompile project(":testutil") testCompile "org.springframework.boot:spring-boot-starter-test" diff --git a/java-spring/testutil/build.gradle b/java-spring/testutil/build.gradle index 9740f4b..57ec392 100644 --- a/java-spring/testutil/build.gradle +++ b/java-spring/testutil/build.gradle @@ -1,7 +1,7 @@ apply plugin: 'java' dependencies { - compile "net.chrisrichardson.eventstore.client:eventstore-java-client:$eventStoreClientVersion" + compile "net.chrisrichardson.eventstore.client:eventstore-java-client_2.10:$eventStoreClientVersion" compile 'com.fasterxml.jackson.core:jackson-core:2.4.3' compile 'com.fasterxml.jackson.core:jackson-databind:2.4.3' @@ -9,7 +9,7 @@ dependencies { compile "junit:junit:4.11" testCompile "org.springframework.boot:spring-boot-starter-test:$springBootVersion" - testCompile "net.chrisrichardson.eventstore.client:eventstore-jdbc:$eventStoreClientVersion" + testCompile "net.chrisrichardson.eventstore.client:eventstore-jdbc_2.10:$eventStoreClientVersion" } diff --git a/java-spring/transactions-command-side-backend/build.gradle b/java-spring/transactions-command-side-backend/build.gradle index decb30b..8e88a91 100644 --- a/java-spring/transactions-command-side-backend/build.gradle +++ b/java-spring/transactions-command-side-backend/build.gradle @@ -3,16 +3,12 @@ apply plugin: 'java' dependencies { compile project(":common-backend") - compile "net.chrisrichardson.eventstore.client:eventstore-java-client:$eventStoreClientVersion" - - compile 'com.fasterxml.jackson.core:jackson-core:2.4.3' - compile 'com.fasterxml.jackson.core:jackson-databind:2.4.3' - compile 'com.fasterxml.jackson.module:jackson-module-scala_2.10:2.4.3' + compile "net.chrisrichardson.eventstore.client:eventstore-java-client_2.10:$eventStoreClientVersion" testCompile project(":testutil") testCompile "junit:junit:4.11" testCompile "org.springframework.boot:spring-boot-starter-test:$springBootVersion" - testCompile "net.chrisrichardson.eventstore.client:eventstore-jdbc:$eventStoreClientVersion" + testCompile "net.chrisrichardson.eventstore.client:eventstore-jdbc_2.10:$eventStoreClientVersion" } diff --git a/java-spring/transactions-command-side-service/build.gradle b/java-spring/transactions-command-side-service/build.gradle index 9524660..2580fc0 100644 --- a/java-spring/transactions-command-side-service/build.gradle +++ b/java-spring/transactions-command-side-service/build.gradle @@ -8,7 +8,7 @@ dependencies { compile "org.springframework.boot:spring-boot-starter-web" compile "org.springframework.boot:spring-boot-starter-actuator" - compile "net.chrisrichardson.eventstore.client:eventstore-http-stomp-client:$eventStoreClientVersion" + compile "net.chrisrichardson.eventstore.client:eventstore-http-stomp-client_2.10:$eventStoreClientVersion" testCompile "org.springframework.boot:spring-boot-starter-test" diff --git a/run-all-services.sh b/run-all-services.sh index 6372d1c..9051492 100755 --- a/run-all-services.sh +++ b/run-all-services.sh @@ -3,6 +3,8 @@ # Execute this script in the java-spring or scala-spring directory # Runs all of the services +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + if [[ -f account-cs.pid ]]; then echo pid file exists exit 1 @@ -19,13 +21,4 @@ echo $! > transfers-cs.pid echo -n waiting for services.... -while [[ true ]]; do - nc -z -w 4 localhost 8080 && nc -z -w 4 localhost 8081 && nc -z -w 4 localhost 8082 - if [[ "$?" -eq "0" ]]; then - echo connected - break - fi - echo -n . - sleep 1 -done - +$DIR/wait-for-services.sh localhost diff --git a/sample-set-server-env.sh b/sample-set-server-env.sh index 622abb9..5b37704 100755 --- a/sample-set-server-env.sh +++ b/sample-set-server-env.sh @@ -1,9 +1,6 @@ #! /bin/bash -e -export EVENT_STORE_USER_ID=Aladdin -export EVENT_STORE_PASSWORD="open sesame" -export EVENT_STORE_URL=serverUrl -export EVENT_STORE_STOMP_SERVER_HOST=serverhost -export EVENT_STORE_STOMP_SERVER_PORT=serverPort +export EVENTUATE_API_KEY_ID=Aladdin +export EVENTUATE_API_KEY_SECRET="open sesame" export SPRING_DATA_MONGODB_URI=mongodb://192.168.59.103/mydb diff --git a/scala-spring/accounts-command-side-backend/build.gradle b/scala-spring/accounts-command-side-backend/build.gradle index e4686a5..222d391 100644 --- a/scala-spring/accounts-command-side-backend/build.gradle +++ b/scala-spring/accounts-command-side-backend/build.gradle @@ -1,5 +1,5 @@ dependencies { compile "org.scala-lang:scala-library:2.10.2" compile project(":common-backend") - compile "net.chrisrichardson.eventstore.client:eventstore-client-event-handling:$eventStoreClientVersion" + compile "net.chrisrichardson.eventstore.client:eventstore-client-event-handling_2.10:$eventStoreClientVersion" } diff --git a/scala-spring/accounts-command-side-service/build.gradle b/scala-spring/accounts-command-side-service/build.gradle index 9326417..2ae2454 100644 --- a/scala-spring/accounts-command-side-service/build.gradle +++ b/scala-spring/accounts-command-side-service/build.gradle @@ -9,7 +9,7 @@ dependencies { compile "org.springframework.boot:spring-boot-starter-web" compile "org.springframework.boot:spring-boot-starter-actuator" - compile "net.chrisrichardson.eventstore.client:eventstore-http-stomp-client:$eventStoreClientVersion" + compile "net.chrisrichardson.eventstore.client:eventstore-http-stomp-client_2.10:$eventStoreClientVersion" testCompile "org.springframework.boot:spring-boot-starter-test" testCompile scalaTestDependency diff --git a/scala-spring/accounts-query-side-backend/build.gradle b/scala-spring/accounts-query-side-backend/build.gradle index 63704b1..7bc4f51 100644 --- a/scala-spring/accounts-query-side-backend/build.gradle +++ b/scala-spring/accounts-query-side-backend/build.gradle @@ -7,13 +7,10 @@ dependencies { compile "org.scala-lang:scala-library:2.10.2" compile "org.springframework.boot:spring-boot-starter-data-mongodb:$springBootVersion" - compile "net.chrisrichardson.eventstore.common:eventstore-common:$eventStoreCommonVersion" - compile "net.chrisrichardson.eventstore.client:eventstore-client-event-handling:$eventStoreClientVersion" + compile "net.chrisrichardson.eventstore.client:eventstore-java-client_2.10:$eventStoreClientVersion" testCompile scalaTestDependency testCompile "junit:junit:4.11" - testCompile "net.chrisrichardson.eventstore.client:eventstore-jdbc:$eventStoreClientVersion" + testCompile "net.chrisrichardson.eventstore.client:eventstore-jdbc_2.10:$eventStoreClientVersion" } - - diff --git a/scala-spring/accounts-query-side-service/build.gradle b/scala-spring/accounts-query-side-service/build.gradle index 8907076..c650557 100644 --- a/scala-spring/accounts-query-side-service/build.gradle +++ b/scala-spring/accounts-query-side-service/build.gradle @@ -10,7 +10,7 @@ dependencies { compile "org.springframework.boot:spring-boot-starter-web" compile "org.springframework.boot:spring-boot-starter-actuator" - compile "net.chrisrichardson.eventstore.client:eventstore-http-stomp-client:$eventStoreClientVersion" + compile "net.chrisrichardson.eventstore.client:eventstore-http-stomp-client_2.10:$eventStoreClientVersion" testCompile "org.springframework.boot:spring-boot-starter-test" testCompile scalaTestDependency diff --git a/scala-spring/backend-integration-tests/build.gradle b/scala-spring/backend-integration-tests/build.gradle index 87c60b3..15c4e5e 100644 --- a/scala-spring/backend-integration-tests/build.gradle +++ b/scala-spring/backend-integration-tests/build.gradle @@ -12,7 +12,7 @@ dependencies { testCompile scalaTestDependency testCompile "junit:junit:4.11" - testCompile "net.chrisrichardson.eventstore.client:eventstore-jdbc:$eventStoreClientVersion" + testCompile "net.chrisrichardson.eventstore.client:eventstore-jdbc_2.10:$eventStoreClientVersion" } diff --git a/scala-spring/build-and-test-all.sh b/scala-spring/build-and-test-all.sh new file mode 100755 index 0000000..5ea0a3b --- /dev/null +++ b/scala-spring/build-and-test-all.sh @@ -0,0 +1,3 @@ +#! /bin/bash + +../_build-and-test-all.sh $* diff --git a/scala-spring/build.gradle b/scala-spring/build.gradle index 9c716f0..d522a5a 100644 --- a/scala-spring/build.gradle +++ b/scala-spring/build.gradle @@ -23,13 +23,7 @@ subprojects { targetCompatibility = 1.7 repositories { - - if (project.hasProperty("localMavenRepoUrl")) { - project.localMavenRepoUrl.split(',').each { theUrl -> - maven { url theUrl } - } - } mavenCentral() - maven { url "https://06c59145-4e83-4f22-93ef-6a7eee7aebaa.repos.chrisrichardson.net.s3.amazonaws.com" } + eventuateMavenRepoUrl.split(',').each { repoUrl -> maven { url repoUrl } } } } diff --git a/scala-spring/buildSrc/src/main/groovy/VerifyEventStoreEnvironmentPlugin.groovy b/scala-spring/buildSrc/src/main/groovy/VerifyEventStoreEnvironmentPlugin.groovy index 90e18ce..030e0e1 100644 --- a/scala-spring/buildSrc/src/main/groovy/VerifyEventStoreEnvironmentPlugin.groovy +++ b/scala-spring/buildSrc/src/main/groovy/VerifyEventStoreEnvironmentPlugin.groovy @@ -6,11 +6,10 @@ class VerifyEventStoreEnvironmentPlugin implements Plugin { project.test { beforeSuite { x -> if (x.parent == null) { - if (System.getenv("EVENT_STORE_URL") == null) - logger.warn("\nPLEASE make sure that Event Store-related environment variables including EVENT_STORE_URL are set, see sample-set-remote-env.sh !!!!\n") + 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/scala-spring/common-backend/build.gradle b/scala-spring/common-backend/build.gradle index 11245d5..44619f0 100644 --- a/scala-spring/common-backend/build.gradle +++ b/scala-spring/common-backend/build.gradle @@ -2,11 +2,9 @@ apply plugin: 'scala' dependencies { compile "org.scala-lang:scala-library:2.10.2" - compile "net.chrisrichardson.eventstore.common:eventstore-common:$eventStoreCommonVersion" + compile "net.chrisrichardson.eventstore.client:eventstore-java-client_2.10:$eventStoreClientVersion" testCompile scalaTestDependency testCompile "junit:junit:4.11" } - - diff --git a/scala-spring/common-backend/src/main/resources/logback.xml b/scala-spring/common-backend/src/main/resources/logback.xml new file mode 100644 index 0000000..d4123dc --- /dev/null +++ b/scala-spring/common-backend/src/main/resources/logback.xml @@ -0,0 +1,22 @@ + + + + + + + + %d{HH:mm:ss.SSS} %-5level %logger{36} - %msg%n + + + + + + + + + + + + + + diff --git a/docker-compose.yml b/scala-spring/docker-compose.yml similarity index 60% rename from docker-compose.yml rename to scala-spring/docker-compose.yml index c70ce2d..c19a110 100644 --- a/docker-compose.yml +++ b/scala-spring/docker-compose.yml @@ -7,11 +7,8 @@ accountscommandside: ports: - "8080:8080" environment: - EVENT_STORE_USER_ID: - EVENT_STORE_PASSWORD: - EVENT_STORE_URL: - EVENT_STORE_STOMP_SERVER_HOST: - EVENT_STORE_STOMP_SERVER_PORT: + EVENTUATE_API_KEY_ID: + EVENTUATE_API_KEY_SECRET: transactionscommandside: image: java:8 @@ -22,11 +19,8 @@ transactionscommandside: ports: - "8082:8080" environment: - EVENT_STORE_USER_ID: - EVENT_STORE_PASSWORD: - EVENT_STORE_URL: - EVENT_STORE_STOMP_SERVER_HOST: - EVENT_STORE_STOMP_SERVER_PORT: + EVENTUATE_API_KEY_ID: + EVENTUATE_API_KEY_SECRET: accountsqueryside: @@ -34,17 +28,14 @@ accountsqueryside: working_dir: /app volumes: - ./accounts-query-side-service/build/libs:/app - command: java -jar /app/accounts-query-side-service.jar --spring.data.mongodb_uri=mongodb://database/CQRS + command: java -jar /app/accounts-query-side-service.jar ports: - "8081:8080" links: - mongodb environment: - EVENT_STORE_USER_ID: - EVENT_STORE_PASSWORD: - EVENT_STORE_URL: - EVENT_STORE_STOMP_SERVER_HOST: - EVENT_STORE_STOMP_SERVER_PORT: + EVENTUATE_API_KEY_ID: + EVENTUATE_API_KEY_SECRET: SPRING_DATA_MONGODB_URI: mongodb://mongodb/mydb mongodb: diff --git a/scala-spring/e2e-test/src/test/scala/net/chrisrichardson/eventstore/examples/bank/web/EndToEndTest.scala b/scala-spring/e2e-test/src/test/scala/net/chrisrichardson/eventstore/examples/bank/web/EndToEndTest.scala index c4650bd..fd3ae03 100644 --- a/scala-spring/e2e-test/src/test/scala/net/chrisrichardson/eventstore/examples/bank/web/EndToEndTest.scala +++ b/scala-spring/e2e-test/src/test/scala/net/chrisrichardson/eventstore/examples/bank/web/EndToEndTest.scala @@ -18,9 +18,10 @@ import scala.collection.JavaConversions._ @RunWith(classOf[JUnitRunner]) class EndToEndTest extends FlatSpec { - val accountsCommandSideBaseUrl = s"http://localhost:8080/" - val accountsQuerySideBaseUrl = s"http://localhost:8081/" - val transactionsCommandSideBaseUrl = s"http://localhost:8082/" + val serviceHost = Option(System.getenv("SERVICE_HOST")) getOrElse "localhost" + val accountsCommandSideBaseUrl = s"http://$serviceHost:8080/" + val accountsQuerySideBaseUrl = s"http://$serviceHost:8081/" + val transactionsCommandSideBaseUrl = s"http://$serviceHost:8082/" val restTemplate = new RestTemplate() restTemplate.getMessageConverters foreach { diff --git a/scala-spring/gradle.properties b/scala-spring/gradle.properties index 633aefe..6ec43fa 100644 --- a/scala-spring/gradle.properties +++ b/scala-spring/gradle.properties @@ -1,9 +1,10 @@ org.gradle.jvmargs=-XX:MaxPermSize=512m +eventuateMavenRepoUrl=http://mavenrepo.eventuate.io/release + scalaTestDependency=org.scalatest:scalatest_2.10:2.0 -springBootVersion=1.2.5.RELEASE +springBootVersion=1.2.8.RELEASE -eventStoreClientVersion=0.7 -eventStoreCommonVersion=0.7 +eventStoreClientVersion=0.12 diff --git a/scala-spring/monolithic-service/build.gradle b/scala-spring/monolithic-service/build.gradle index 30fb308..054ba23 100644 --- a/scala-spring/monolithic-service/build.gradle +++ b/scala-spring/monolithic-service/build.gradle @@ -11,7 +11,7 @@ dependencies { compile "org.springframework.boot:spring-boot-starter-web" compile "org.springframework.boot:spring-boot-starter-actuator" - compile "net.chrisrichardson.eventstore.client:eventstore-jdbc:$eventStoreClientVersion" + compile "net.chrisrichardson.eventstore.client:eventstore-jdbc_2.10:$eventStoreClientVersion" testCompile "org.springframework.boot:spring-boot-starter-test" testCompile scalaTestDependency diff --git a/scala-spring/transactions-command-side-backend/build.gradle b/scala-spring/transactions-command-side-backend/build.gradle index e4686a5..222d391 100644 --- a/scala-spring/transactions-command-side-backend/build.gradle +++ b/scala-spring/transactions-command-side-backend/build.gradle @@ -1,5 +1,5 @@ dependencies { compile "org.scala-lang:scala-library:2.10.2" compile project(":common-backend") - compile "net.chrisrichardson.eventstore.client:eventstore-client-event-handling:$eventStoreClientVersion" + compile "net.chrisrichardson.eventstore.client:eventstore-client-event-handling_2.10:$eventStoreClientVersion" } diff --git a/scala-spring/transactions-command-side-service/build.gradle b/scala-spring/transactions-command-side-service/build.gradle index 6cf86c0..033dc31 100644 --- a/scala-spring/transactions-command-side-service/build.gradle +++ b/scala-spring/transactions-command-side-service/build.gradle @@ -9,7 +9,7 @@ dependencies { compile "org.springframework.boot:spring-boot-starter-web" compile "org.springframework.boot:spring-boot-starter-actuator" - compile "net.chrisrichardson.eventstore.client:eventstore-http-stomp-client:$eventStoreClientVersion" + compile "net.chrisrichardson.eventstore.client:eventstore-http-stomp-client_2.10:$eventStoreClientVersion" testCompile "org.springframework.boot:spring-boot-starter-test" testCompile scalaTestDependency diff --git a/wait-for-services.sh b/wait-for-services.sh new file mode 100755 index 0000000..d5afa85 --- /dev/null +++ b/wait-for-services.sh @@ -0,0 +1,11 @@ +#! /bin/bash + +while [[ true ]]; do + nc -z -w 4 ${1?} 8080 && nc -z -w 4 ${1?} 8081 && nc -z -w 4 ${1?} 8082 + if [[ "$?" -eq "0" ]]; then + echo connected + break + fi + echo -n . + sleep 1 +done