Skip to content

Commit 3b478dc

Browse files
authored
Merge branch 'master' into feat/tck_projection
2 parents 63a8c99 + 7265e57 commit 3b478dc

29 files changed

Lines changed: 802 additions & 175 deletions

File tree

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ jobs:
1616
- uses: actions/checkout@v2
1717
with:
1818
token: '${{ secrets.PERSONAL_ACCESS_TOKEN }}'
19-
- name: Set up JDK 15
19+
- name: Set up JDK 16
2020
uses: actions/setup-java@v1
2121
with:
22-
java-version: 15
22+
java-version: 16
2323
- name: release sbt
2424
run: |
2525
git config --local user.email "thoth-github-actions@users.noreply.github.com"

.github/workflows/test.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,22 @@ jobs:
66
runs-on: ubuntu-latest
77
steps:
88
- uses: actions/checkout@v2.2.0
9-
- name: Set up JDK 15
9+
- name: Set up JDK 16
1010
uses: actions/setup-java@v1
1111
with:
12-
java-version: 15
12+
java-version: 16
1313
- name: Start docker
1414
run: docker-compose -f docker-compose.test.yml up -d
1515
- name: Build
1616
id: build_server
1717
run: sbt publishLocal
1818
- name: Run test
1919
id: test
20-
run: JAVA_OPTS="--enable-preview" sbt "project thoth-core" test && sbt "project thoth-jooq" test && sbt "project thoth-jooq-async" test && sbt "project thoth-kafka-goodies" test && sbt "project thoth-tck" test
20+
run: sbt "project thoth-core" test && sbt "project thoth-jooq" test && sbt "project thoth-jooq-async" test && sbt "project thoth-kafka-goodies" test && sbt "project thoth-tck" test
21+
- name: Stop docker
22+
run: docker-compose -f docker-compose.test.yml down
23+
- name: Run sample application test
24+
run: sbt "project sample" test
2125
- name: Publish Unit Test Results
2226
uses: EnricoMi/publish-unit-test-result-action@v1
2327
if: always()

build.sbt

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,11 @@ organization := "fr.maif"
55

66
resolvers ++= Seq(Resolver.jcenterRepo)
77

8-
scalaVersion := "2.12.13"
9-
crossScalaVersions := List("2.13.5", "2.12.13")
8+
val mainScalaVersion = "2.12.13"
9+
val scalaVersions = List("2.13.5", mainScalaVersion)
10+
11+
scalaVersion := mainScalaVersion
12+
crossScalaVersions := scalaVersions
1013

1114
usePgpKeyHex("5B6BE1966878E3AE16B85BC975B8BA741462DEA9")
1215
sonatypeRepository := "https://s01.oss.sonatype.org/service/local"
@@ -57,7 +60,11 @@ lazy val `thoth-tck` = project
5760
.dependsOn(`thoth-core`)
5861
.enablePlugins(TestNGPlugin)
5962
.settings(
60-
skip in publish := true
63+
sonatypeRepository := "https://s01.oss.sonatype.org/service/local",
64+
sonatypeCredentialHost := "s01.oss.sonatype.org",
65+
scalaVersion := mainScalaVersion,
66+
crossScalaVersions := scalaVersions,
67+
crossPaths := true
6168
)
6269

6370
lazy val `demo-postgres-kafka-reactive` =
@@ -71,16 +78,16 @@ lazy val `commons-events` = project
7178
.settings(
7279
sonatypeRepository := "https://s01.oss.sonatype.org/service/local",
7380
sonatypeCredentialHost := "s01.oss.sonatype.org",
74-
scalaVersion := "2.12.13",
81+
scalaVersion := mainScalaVersion,
7582
crossPaths := false
7683
)
7784

7885
lazy val `thoth-kafka-goodies` = project
7986
.settings(
8087
sonatypeRepository := "https://s01.oss.sonatype.org/service/local",
8188
sonatypeCredentialHost := "s01.oss.sonatype.org",
82-
scalaVersion := "2.12.13",
83-
crossScalaVersions := List("2.13.5", "2.12.13"),
89+
scalaVersion := mainScalaVersion,
90+
crossScalaVersions := scalaVersions,
8491
crossPaths := true
8592
)
8693

@@ -89,8 +96,8 @@ lazy val `thoth-jooq-async` = project
8996
.settings(
9097
sonatypeRepository := "https://s01.oss.sonatype.org/service/local",
9198
sonatypeCredentialHost := "s01.oss.sonatype.org",
92-
scalaVersion := "2.12.13",
93-
crossScalaVersions := List("2.13.5", "2.12.13"),
99+
scalaVersion := mainScalaVersion,
100+
crossScalaVersions := scalaVersions,
94101
crossPaths := true
95102
)
96103

@@ -99,25 +106,25 @@ lazy val `thoth-core` = project
99106
.settings(
100107
sonatypeRepository := "https://s01.oss.sonatype.org/service/local",
101108
sonatypeCredentialHost := "s01.oss.sonatype.org",
102-
scalaVersion := "2.12.13",
103-
crossScalaVersions := List("2.13.5", "2.12.13"),
109+
scalaVersion := mainScalaVersion,
110+
crossScalaVersions := scalaVersions,
104111
crossPaths := true
105112
)
106113

107114
lazy val `thoth-jooq` = project
108-
.dependsOn(`thoth-core`, `thoth-tck`)
115+
.dependsOn(`thoth-core`, `thoth-tck` % "compile->test")
109116
.enablePlugins(TestNGPlugin)
110117
.settings(
111118
sonatypeRepository := "https://s01.oss.sonatype.org/service/local",
112119
sonatypeCredentialHost := "s01.oss.sonatype.org",
113-
scalaVersion := "2.12.13",
114-
crossScalaVersions := List("2.13.5", "2.12.13"),
120+
scalaVersion := mainScalaVersion,
121+
crossScalaVersions := scalaVersions,
115122
crossPaths := true
116123
)
117124

118125
javacOptions in Compile ++= Seq(
119126
"-source",
120-
"15",
127+
"16",
121128
"-target",
122129
"8",
123130
"-Xlint:unchecked",
@@ -141,7 +148,7 @@ releaseProcess := Seq[ReleaseStep](
141148
pushChanges
142149
)
143150

144-
lazy val githubRepo = "maif/thoth"
151+
lazy val githubRepo = "maif/thoth"
145152

146153
inThisBuild(
147154
List(

demo/demo-in-memory/build.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ name := "demo-in-memory"
66

77
scalaVersion := "2.12.12"
88

9-
javacOptions in Compile ++= Seq("-source", "15", "-target", "15", "-Xlint:unchecked", "-Xlint:deprecation", "--enable-preview")
9+
javacOptions in Compile ++= Seq("-source", "16", "-target", "16", "-Xlint:unchecked", "-Xlint:deprecation")

demo/demo-postgres-kafka-reactive/buid.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ libraryDependencies ++= Seq(
1010
"fr.maif" % "functional-json" % functionalJsonVersion
1111
)
1212

13-
javacOptions in Compile ++= Seq("-source", "15", "-target", "15", "-Xlint:unchecked", "-Xlint:deprecation")
13+
javacOptions in Compile ++= Seq("-source", "16", "-target", "16", "-Xlint:unchecked", "-Xlint:deprecation")

demo/demo-postgres-kafka-reactive/src/main/java/com/example/demo/Account.java

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,35 @@
11
package com.example.demo;
22

33
import fr.maif.eventsourcing.State;
4-
import lombok.Getter;
5-
import lombok.ToString;
64

75
import java.math.BigDecimal;
86

9-
@Getter
10-
@ToString
117
public class Account implements State<Account> {
128
public String id;
139
public BigDecimal balance;
1410
public long sequenceNum;
1511

12+
public String getId() {
13+
return id;
14+
}
15+
16+
public BigDecimal getBalance() {
17+
return balance;
18+
}
19+
20+
public long getSequenceNum() {
21+
return sequenceNum;
22+
}
23+
24+
@Override
25+
public String toString() {
26+
return "Account{" +
27+
"id='" + id + '\'' +
28+
", balance=" + balance +
29+
", sequenceNum=" + sequenceNum +
30+
'}';
31+
}
32+
1633
@Override
1734
public Long sequenceNum() {
1835
return sequenceNum;

demo/demo-postgres-kafka-reactive/src/main/java/com/example/demo/BankEvent.java

Lines changed: 101 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
import fr.maif.json.JsonFormat;
77
import fr.maif.json.JsonRead;
88
import io.vavr.API.Match.Pattern0;
9-
import lombok.Builder;
10-
import lombok.Value;
119

1210
import java.math.BigDecimal;
1311

@@ -55,13 +53,39 @@ public interface BankEvent extends Event {
5553
)
5654
);
5755

58-
@Builder
59-
@Value
6056
class MoneyWithdrawn implements BankEvent {
61-
6257
public final String accountId;
6358
public final BigDecimal amount;
6459

60+
static class MoneyWithdrawnBuilder{
61+
String accountId;
62+
BigDecimal amount;
63+
64+
MoneyWithdrawnBuilder accountId(String accountId){
65+
this.accountId = accountId;
66+
return this;
67+
}
68+
69+
MoneyWithdrawnBuilder amount(BigDecimal amount){
70+
this.amount = amount;
71+
return this;
72+
}
73+
74+
MoneyWithdrawn build(){
75+
return new MoneyWithdrawn(accountId,amount);
76+
}
77+
78+
}
79+
80+
public MoneyWithdrawn(String accountId, BigDecimal amount) {
81+
this.accountId = accountId;
82+
this.amount = amount;
83+
}
84+
85+
public static MoneyWithdrawnBuilder builder(){
86+
return new MoneyWithdrawnBuilder();
87+
}
88+
6589
@Override
6690
public Type<MoneyWithdrawn> type() {
6791
return MoneyWithdrawnV1;
@@ -84,11 +108,30 @@ public String entityId() {
84108
);
85109
}
86110

87-
@Builder
88-
@Value
89111
class AccountOpened implements BankEvent {
90112
public final String accountId;
91113

114+
static class AccountOpenedBuilder{
115+
String accountId;
116+
117+
AccountOpenedBuilder accountId(String accountId){
118+
this.accountId = accountId;
119+
return this;
120+
}
121+
122+
AccountOpened build(){
123+
return new AccountOpened(accountId);
124+
}
125+
}
126+
127+
public AccountOpened(String accountId) {
128+
this.accountId = accountId;
129+
}
130+
131+
public static AccountOpenedBuilder builder(){
132+
return new AccountOpenedBuilder();
133+
}
134+
92135
@Override
93136
public Type<AccountOpened> type() {
94137
return AccountOpenedV1;
@@ -109,12 +152,40 @@ public String entityId() {
109152
);
110153
}
111154

112-
@Builder
113-
@Value
155+
114156
class MoneyDeposited implements BankEvent {
115157
public final String accountId;
116158
public final BigDecimal amount;
117159

160+
public MoneyDeposited(String accountId, BigDecimal amount) {
161+
this.accountId = accountId;
162+
this.amount = amount;
163+
}
164+
165+
static class MoneyDepositedBuilder{
166+
String accountId;
167+
BigDecimal amount;
168+
169+
MoneyDepositedBuilder accountId(String accountId){
170+
this.accountId = accountId;
171+
return this;
172+
}
173+
174+
MoneyDepositedBuilder amount(BigDecimal amount){
175+
this.amount = amount;
176+
return this;
177+
}
178+
179+
MoneyDeposited build(){
180+
return new MoneyDeposited(accountId,amount);
181+
}
182+
183+
}
184+
185+
public static MoneyDepositedBuilder builder(){
186+
return new MoneyDepositedBuilder();
187+
}
188+
118189
@Override
119190
public Type<MoneyDeposited> type() {
120191
return MoneyDepositedV1;
@@ -137,11 +208,30 @@ public String entityId() {
137208
);
138209
}
139210

140-
@Builder
141-
@Value
142211
class AccountClosed implements BankEvent {
143212
public final String accountId;
144213

214+
static class AccountClosedBuilder{
215+
String accountId;
216+
217+
AccountClosedBuilder accountId(String accountId){
218+
this.accountId = accountId;
219+
return this;
220+
}
221+
222+
AccountClosed build(){
223+
return new AccountClosed(accountId);
224+
}
225+
}
226+
227+
public AccountClosed(String accountId) {
228+
this.accountId = accountId;
229+
}
230+
231+
public static AccountClosedBuilder builder(){
232+
return new AccountClosedBuilder();
233+
}
234+
145235
@Override
146236
public Type<AccountClosed> type() {
147237
return AccountClosedV1;

demo/demo-postgres-kafka/buid.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ libraryDependencies ++= Seq(
1010
"fr.maif" % "functional-json" % functionalJsonVersion
1111
)
1212

13-
javacOptions in Compile ++= Seq("-source", "15", "-target", "15", "-Xlint:unchecked", "-Xlint:deprecation")
13+
javacOptions in Compile ++= Seq("-source", "16", "-target", "16", "-Xlint:unchecked", "-Xlint:deprecation")

project/Dependencies.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ object Dependencies {
55
val vavrVersion = "0.10.3"
66
val jooqVersion = "3.14.3"
77
val jooqAsyncVersion = "1.1.2"
8-
val functionalJsonVersion = "1.0.2"
8+
val functionalJsonVersion = "1.0.3"
99
}

project/Publish.scala

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)