Upgraded to latest version of client libraries.
This commit is contained in:
@@ -20,8 +20,13 @@ subprojects {
|
||||
apply plugin: 'java'
|
||||
sourceCompatibility = 1.7
|
||||
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" }
|
||||
|
||||
|
||||
55
java-spring/docker-compose.yml
Normal file
55
java-spring/docker-compose.yml
Normal file
@@ -0,0 +1,55 @@
|
||||
accountscommandside:
|
||||
image: java:8
|
||||
working_dir: /app
|
||||
volumes:
|
||||
- ./accounts-command-side-service/build/libs:/app
|
||||
command: java -jar /app/accounts-command-side-service.jar
|
||||
ports:
|
||||
- "8080:8080"
|
||||
environment:
|
||||
EVENT_STORE_USER_ID:
|
||||
EVENT_STORE_PASSWORD:
|
||||
EVENT_STORE_URL:
|
||||
EVENT_STORE_STOMP_SERVER_HOST:
|
||||
EVENT_STORE_STOMP_SERVER_PORT:
|
||||
|
||||
transactionscommandside:
|
||||
image: java:8
|
||||
working_dir: /app
|
||||
volumes:
|
||||
- ./transactions-command-side-service/build/libs:/app
|
||||
command: java -jar /app/transactions-command-side-service.jar
|
||||
ports:
|
||||
- "8082:8080"
|
||||
environment:
|
||||
EVENT_STORE_USER_ID:
|
||||
EVENT_STORE_PASSWORD:
|
||||
EVENT_STORE_URL:
|
||||
EVENT_STORE_STOMP_SERVER_HOST:
|
||||
EVENT_STORE_STOMP_SERVER_PORT:
|
||||
|
||||
|
||||
accountsqueryside:
|
||||
image: java:8
|
||||
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
|
||||
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:
|
||||
SPRING_DATA_MONGODB_URI: mongodb://mongodb/mydb
|
||||
|
||||
mongodb:
|
||||
image: mongo:3.0.4
|
||||
hostname: mongodb
|
||||
command: mongod --smallfiles
|
||||
ports:
|
||||
- "27017:27017"
|
||||
@@ -15,8 +15,5 @@ dependencies {
|
||||
}
|
||||
|
||||
test {
|
||||
ignoreFailures true
|
||||
ignoreFailures (!project.hasProperty("ignoreE2EFailures") || ignoreE2EFailures.toBoolean())
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -5,5 +5,5 @@ scalaTestDependency=org.scalatest:scalatest_2.10:2.0
|
||||
|
||||
springBootVersion=1.2.5.RELEASE
|
||||
|
||||
eventStoreClientVersion=0.6
|
||||
eventStoreCommonVersion=0.6
|
||||
eventStoreClientVersion=0.7
|
||||
eventStoreCommonVersion=0.7
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration>
|
||||
|
||||
<!-- [%thread] -->
|
||||
|
||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<layout class="ch.qos.logback.classic.PatternLayout">
|
||||
<Pattern>%d{HH:mm:ss.SSS} %-5level %logger{36} - %msg%n</Pattern>
|
||||
</layout>
|
||||
</appender>
|
||||
|
||||
<root level="error">
|
||||
<appender-ref ref="STDOUT" />
|
||||
</root>
|
||||
<logger name="org.springframework" level='debug'>
|
||||
</logger>
|
||||
</configuration>
|
||||
@@ -1,6 +1,5 @@
|
||||
#! /bin/bash -e
|
||||
|
||||
for dir in java-spring scala-spring; do
|
||||
(cd $dir ; ../run-e2e-test.sh)
|
||||
(cd $dir ; ../run-e2e-test.sh $*)
|
||||
done
|
||||
|
||||
|
||||
@@ -4,13 +4,12 @@
|
||||
|
||||
echo starting services
|
||||
|
||||
../run-all-services.sh
|
||||
../run-all-services.sh
|
||||
|
||||
echo running test
|
||||
|
||||
./gradlew :e2e-test:cleanTest :e2e-test:test
|
||||
./gradlew $* -P ignoreE2EFailures=false :e2e-test:cleanTest :e2e-test:test
|
||||
|
||||
echo killing services
|
||||
|
||||
../kill-all-services.sh
|
||||
|
||||
../kill-all-services.sh
|
||||
|
||||
@@ -2,8 +2,11 @@ package net.chrisrichardson.eventstore.examples.bank.web
|
||||
|
||||
import net.chrisrichardson.eventstore.client.config.EventStoreHttpClientConfiguration
|
||||
import net.chrisrichardson.eventstore.examples.bank.web.accounts.CommandSideWebAccountsConfiguration
|
||||
import net.chrisrichardson.eventstore.json.EventStoreCommonObjectMapping
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration
|
||||
import org.springframework.boot.autoconfigure.web.HttpMessageConverters
|
||||
import org.springframework.context.annotation._
|
||||
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter
|
||||
|
||||
@Configuration
|
||||
@EnableAutoConfiguration
|
||||
@@ -11,4 +14,12 @@ import org.springframework.context.annotation._
|
||||
@ComponentScan
|
||||
class AccountsCommandSideServiceConfiguration {
|
||||
|
||||
@Bean
|
||||
def scalaJSonConverter: HttpMessageConverters = {
|
||||
val additional = new MappingJackson2HttpMessageConverter
|
||||
additional.setObjectMapper(EventStoreCommonObjectMapping.getObjectMapper)
|
||||
new HttpMessageConverters(additional)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package net.chrisrichardson.eventstore.examples.bank.web
|
||||
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper
|
||||
import net.chrisrichardson.eventstore.json.EventStoreCommonObjectMapping
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration
|
||||
import org.springframework.context.annotation.{Bean, Import, Configuration}
|
||||
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter
|
||||
@@ -13,11 +14,11 @@ import scala.collection.JavaConversions._
|
||||
class AccountsCommandSideServiceTestConfiguration {
|
||||
|
||||
@Bean
|
||||
def restTemplate(scalaObjectMapper: ObjectMapper) = {
|
||||
def restTemplate() = {
|
||||
val restTemplate = new RestTemplate()
|
||||
restTemplate.getMessageConverters foreach {
|
||||
case mc: MappingJackson2HttpMessageConverter =>
|
||||
mc.setObjectMapper(scalaObjectMapper)
|
||||
mc.setObjectMapper(EventStoreCommonObjectMapping.getObjectMapper)
|
||||
case _ =>
|
||||
}
|
||||
restTemplate
|
||||
|
||||
@@ -2,8 +2,11 @@ package net.chrisrichardson.eventstore.examples.bank.web
|
||||
|
||||
import net.chrisrichardson.eventstore.client.config.EventStoreHttpClientConfiguration
|
||||
import net.chrisrichardson.eventstore.examples.bank.web.queryside.QuerySideWebConfiguration
|
||||
import net.chrisrichardson.eventstore.json.EventStoreCommonObjectMapping
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration
|
||||
import org.springframework.boot.autoconfigure.web.HttpMessageConverters
|
||||
import org.springframework.context.annotation._
|
||||
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter
|
||||
|
||||
@Configuration
|
||||
@EnableAutoConfiguration
|
||||
@@ -11,4 +14,11 @@ import org.springframework.context.annotation._
|
||||
@ComponentScan
|
||||
class AccountsQuerySideServiceConfiguration {
|
||||
|
||||
@Bean
|
||||
def scalaJSonConverter: HttpMessageConverters = {
|
||||
val additional = new MappingJackson2HttpMessageConverter
|
||||
additional.setObjectMapper(EventStoreCommonObjectMapping.getObjectMapper)
|
||||
new HttpMessageConverters(additional)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package net.chrisrichardson.eventstore.examples.bank.web
|
||||
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper
|
||||
import net.chrisrichardson.eventstore.json.EventStoreCommonObjectMapping
|
||||
import org.springframework.context.annotation.{Bean, Configuration, Import}
|
||||
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter
|
||||
import org.springframework.web.client.RestTemplate
|
||||
@@ -13,11 +14,11 @@ import scala.collection.JavaConversions._
|
||||
class AccountsQuerySideServiceTestConfiguration {
|
||||
|
||||
@Bean
|
||||
def restTemplate(scalaObjectMapper: ObjectMapper) = {
|
||||
def restTemplate() = {
|
||||
val restTemplate = new RestTemplate()
|
||||
restTemplate.getMessageConverters foreach {
|
||||
case mc: MappingJackson2HttpMessageConverter =>
|
||||
mc.setObjectMapper(scalaObjectMapper)
|
||||
mc.setObjectMapper(EventStoreCommonObjectMapping.getObjectMapper)
|
||||
case _ =>
|
||||
}
|
||||
restTemplate
|
||||
|
||||
@@ -21,8 +21,14 @@ subprojects {
|
||||
apply plugin: 'scala'
|
||||
sourceCompatibility = 1.7
|
||||
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" }
|
||||
}
|
||||
|
||||
@@ -15,6 +15,5 @@ dependencies {
|
||||
}
|
||||
|
||||
test {
|
||||
ignoreFailures true
|
||||
ignoreFailures (!project.hasProperty("ignoreE2EFailures") || ignoreE2EFailures.toBoolean())
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ org.gradle.jvmargs=-XX:MaxPermSize=512m
|
||||
|
||||
scalaTestDependency=org.scalatest:scalatest_2.10:2.0
|
||||
|
||||
springBootVersion=1.1.10.RELEASE
|
||||
springBootVersion=1.2.5.RELEASE
|
||||
|
||||
eventStoreClientVersion=0.5
|
||||
eventStoreCommonVersion=0.5
|
||||
eventStoreClientVersion=0.7
|
||||
eventStoreCommonVersion=0.7
|
||||
|
||||
@@ -7,8 +7,11 @@ import net.chrisrichardson.eventstore.examples.bank.transactions.TransactionConf
|
||||
import net.chrisrichardson.eventstore.examples.bank.web.accounts.CommandSideWebAccountsConfiguration
|
||||
import net.chrisrichardson.eventstore.examples.bank.web.queryside.QuerySideWebConfiguration
|
||||
import net.chrisrichardson.eventstore.examples.bank.web.transactions.CommandSideWebTransactionsConfiguration
|
||||
import net.chrisrichardson.eventstore.json.EventStoreCommonObjectMapping
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration
|
||||
import org.springframework.boot.autoconfigure.web.HttpMessageConverters
|
||||
import org.springframework.context.annotation._
|
||||
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter
|
||||
|
||||
@Configuration
|
||||
@EnableAutoConfiguration
|
||||
@@ -17,4 +20,12 @@ import org.springframework.context.annotation._
|
||||
@ComponentScan
|
||||
class BankingWebAppConfiguration {
|
||||
|
||||
|
||||
@Bean
|
||||
def scalaJSonConverter: HttpMessageConverters = {
|
||||
val additional = new MappingJackson2HttpMessageConverter
|
||||
additional.setObjectMapper(EventStoreCommonObjectMapping.getObjectMapper)
|
||||
new HttpMessageConverters(additional)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package net.chrisrichardson.eventstore.examples.bank.web
|
||||
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper
|
||||
import net.chrisrichardson.eventstore.json.EventStoreCommonObjectMapping
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration
|
||||
import org.springframework.context.annotation.{Bean, Import, Configuration}
|
||||
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter
|
||||
@@ -13,11 +14,11 @@ import scala.collection.JavaConversions._
|
||||
class BankingWebAppTestConfiguration {
|
||||
|
||||
@Bean
|
||||
def restTemplate(scalaObjectMapper: ObjectMapper) = {
|
||||
def restTemplate() = {
|
||||
val restTemplate = new RestTemplate()
|
||||
restTemplate.getMessageConverters foreach {
|
||||
case mc: MappingJackson2HttpMessageConverter =>
|
||||
mc.setObjectMapper(scalaObjectMapper)
|
||||
mc.setObjectMapper(EventStoreCommonObjectMapping.getObjectMapper)
|
||||
case _ =>
|
||||
}
|
||||
restTemplate
|
||||
|
||||
@@ -5,27 +5,30 @@ import net.chrisrichardson.eventstore.examples.bank.backend.common.accounts._
|
||||
import net.chrisrichardson.eventstore.examples.bank.transactions.MoneyTransferCommands.{RecordDebitFailedDueToInsufficientFundsCommand, RecordCreditCommand, RecordDebitCommand}
|
||||
import net.chrisrichardson.eventstore.subscriptions.{CompoundEventHandler, EventSubscriber}
|
||||
import net.chrisrichardson.eventstore.util.EventHandlingUtil._
|
||||
import net.chrisrichardson.eventstore.subscriptions.EventHandler
|
||||
|
||||
@EventSubscriber (id = "transactionEventHandlers")
|
||||
class MoneyTransferEventHandlers(implicit eventStore: EventStore)
|
||||
extends CompoundEventHandler {
|
||||
|
||||
@EventHandler
|
||||
val recordDebit =
|
||||
handlerForEvent[AccountDebitedEvent] { de =>
|
||||
existingEntity[MoneyTransfer](de.event.transactionId) <==
|
||||
RecordDebitCommand(de.entityId)
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
val recordCredit =
|
||||
handlerForEvent[AccountCreditedEvent] { de =>
|
||||
existingEntity[MoneyTransfer](de.event.transactionId) <==
|
||||
RecordCreditCommand(de.entityId)
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
val recordDebitFailed =
|
||||
handlerForEvent[AccountDebitFailedDueToInsufficientFundsEvent] { de =>
|
||||
existingEntity[MoneyTransfer](de.event.transactionId) <==
|
||||
RecordDebitFailedDueToInsufficientFundsCommand(de.entityId)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,8 +2,11 @@ package net.chrisrichardson.eventstore.examples.bank.web
|
||||
|
||||
import net.chrisrichardson.eventstore.client.config.EventStoreHttpClientConfiguration
|
||||
import net.chrisrichardson.eventstore.examples.bank.web.transactions.CommandSideWebTransactionsConfiguration
|
||||
import net.chrisrichardson.eventstore.json.EventStoreCommonObjectMapping
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration
|
||||
import org.springframework.boot.autoconfigure.web.HttpMessageConverters
|
||||
import org.springframework.context.annotation._
|
||||
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter
|
||||
|
||||
@Configuration
|
||||
@EnableAutoConfiguration
|
||||
@@ -11,4 +14,11 @@ import org.springframework.context.annotation._
|
||||
@ComponentScan
|
||||
class TransactionsCommandSideServiceConfiguration {
|
||||
|
||||
@Bean
|
||||
def scalaJSonConverter: HttpMessageConverters = {
|
||||
val additional = new MappingJackson2HttpMessageConverter
|
||||
additional.setObjectMapper(EventStoreCommonObjectMapping.getObjectMapper)
|
||||
new HttpMessageConverters(additional)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package net.chrisrichardson.eventstore.examples.bank.web
|
||||
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper
|
||||
import net.chrisrichardson.eventstore.json.EventStoreCommonObjectMapping
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration
|
||||
import org.springframework.context.annotation.{Bean, Import, Configuration}
|
||||
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter
|
||||
@@ -13,11 +14,11 @@ import scala.collection.JavaConversions._
|
||||
class TransactionsCommandSideServiceTestConfiguration {
|
||||
|
||||
@Bean
|
||||
def restTemplate(scalaObjectMapper: ObjectMapper) = {
|
||||
def restTemplate() = {
|
||||
val restTemplate = new RestTemplate()
|
||||
restTemplate.getMessageConverters foreach {
|
||||
case mc: MappingJackson2HttpMessageConverter =>
|
||||
mc.setObjectMapper(scalaObjectMapper)
|
||||
mc.setObjectMapper(EventStoreCommonObjectMapping.getObjectMapper)
|
||||
case _ =>
|
||||
}
|
||||
restTemplate
|
||||
|
||||
Reference in New Issue
Block a user