Skip to content

Commit

Permalink
Merge branch 'master' into feat/tck_projection
Browse files Browse the repository at this point in the history
  • Loading branch information
ptitFicus authored Jul 26, 2021
2 parents 63a8c99 + 7265e57 commit 3b478dc
Show file tree
Hide file tree
Showing 29 changed files with 802 additions and 175 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ jobs:
- uses: actions/checkout@v2
with:
token: '${{ secrets.PERSONAL_ACCESS_TOKEN }}'
- name: Set up JDK 15
- name: Set up JDK 16
uses: actions/setup-java@v1
with:
java-version: 15
java-version: 16
- name: release sbt
run: |
git config --local user.email "thoth-github-actions@users.noreply.github.com"
Expand Down
10 changes: 7 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,22 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.2.0
- name: Set up JDK 15
- name: Set up JDK 16
uses: actions/setup-java@v1
with:
java-version: 15
java-version: 16
- name: Start docker
run: docker-compose -f docker-compose.test.yml up -d
- name: Build
id: build_server
run: sbt publishLocal
- name: Run test
id: test
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
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
- name: Stop docker
run: docker-compose -f docker-compose.test.yml down
- name: Run sample application test
run: sbt "project sample" test
- name: Publish Unit Test Results
uses: EnricoMi/publish-unit-test-result-action@v1
if: always()
Expand Down
37 changes: 22 additions & 15 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@ organization := "fr.maif"

resolvers ++= Seq(Resolver.jcenterRepo)

scalaVersion := "2.12.13"
crossScalaVersions := List("2.13.5", "2.12.13")
val mainScalaVersion = "2.12.13"
val scalaVersions = List("2.13.5", mainScalaVersion)

scalaVersion := mainScalaVersion
crossScalaVersions := scalaVersions

usePgpKeyHex("5B6BE1966878E3AE16B85BC975B8BA741462DEA9")
sonatypeRepository := "https://s01.oss.sonatype.org/service/local"
Expand Down Expand Up @@ -57,7 +60,11 @@ lazy val `thoth-tck` = project
.dependsOn(`thoth-core`)
.enablePlugins(TestNGPlugin)
.settings(
skip in publish := true
sonatypeRepository := "https://s01.oss.sonatype.org/service/local",
sonatypeCredentialHost := "s01.oss.sonatype.org",
scalaVersion := mainScalaVersion,
crossScalaVersions := scalaVersions,
crossPaths := true
)

lazy val `demo-postgres-kafka-reactive` =
Expand All @@ -71,16 +78,16 @@ lazy val `commons-events` = project
.settings(
sonatypeRepository := "https://s01.oss.sonatype.org/service/local",
sonatypeCredentialHost := "s01.oss.sonatype.org",
scalaVersion := "2.12.13",
scalaVersion := mainScalaVersion,
crossPaths := false
)

lazy val `thoth-kafka-goodies` = project
.settings(
sonatypeRepository := "https://s01.oss.sonatype.org/service/local",
sonatypeCredentialHost := "s01.oss.sonatype.org",
scalaVersion := "2.12.13",
crossScalaVersions := List("2.13.5", "2.12.13"),
scalaVersion := mainScalaVersion,
crossScalaVersions := scalaVersions,
crossPaths := true
)

Expand All @@ -89,8 +96,8 @@ lazy val `thoth-jooq-async` = project
.settings(
sonatypeRepository := "https://s01.oss.sonatype.org/service/local",
sonatypeCredentialHost := "s01.oss.sonatype.org",
scalaVersion := "2.12.13",
crossScalaVersions := List("2.13.5", "2.12.13"),
scalaVersion := mainScalaVersion,
crossScalaVersions := scalaVersions,
crossPaths := true
)

Expand All @@ -99,25 +106,25 @@ lazy val `thoth-core` = project
.settings(
sonatypeRepository := "https://s01.oss.sonatype.org/service/local",
sonatypeCredentialHost := "s01.oss.sonatype.org",
scalaVersion := "2.12.13",
crossScalaVersions := List("2.13.5", "2.12.13"),
scalaVersion := mainScalaVersion,
crossScalaVersions := scalaVersions,
crossPaths := true
)

lazy val `thoth-jooq` = project
.dependsOn(`thoth-core`, `thoth-tck`)
.dependsOn(`thoth-core`, `thoth-tck` % "compile->test")
.enablePlugins(TestNGPlugin)
.settings(
sonatypeRepository := "https://s01.oss.sonatype.org/service/local",
sonatypeCredentialHost := "s01.oss.sonatype.org",
scalaVersion := "2.12.13",
crossScalaVersions := List("2.13.5", "2.12.13"),
scalaVersion := mainScalaVersion,
crossScalaVersions := scalaVersions,
crossPaths := true
)

javacOptions in Compile ++= Seq(
"-source",
"15",
"16",
"-target",
"8",
"-Xlint:unchecked",
Expand All @@ -141,7 +148,7 @@ releaseProcess := Seq[ReleaseStep](
pushChanges
)

lazy val githubRepo = "maif/thoth"
lazy val githubRepo = "maif/thoth"

inThisBuild(
List(
Expand Down
2 changes: 1 addition & 1 deletion demo/demo-in-memory/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ name := "demo-in-memory"

scalaVersion := "2.12.12"

javacOptions in Compile ++= Seq("-source", "15", "-target", "15", "-Xlint:unchecked", "-Xlint:deprecation", "--enable-preview")
javacOptions in Compile ++= Seq("-source", "16", "-target", "16", "-Xlint:unchecked", "-Xlint:deprecation")
2 changes: 1 addition & 1 deletion demo/demo-postgres-kafka-reactive/buid.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ libraryDependencies ++= Seq(
"fr.maif" % "functional-json" % functionalJsonVersion
)

javacOptions in Compile ++= Seq("-source", "15", "-target", "15", "-Xlint:unchecked", "-Xlint:deprecation")
javacOptions in Compile ++= Seq("-source", "16", "-target", "16", "-Xlint:unchecked", "-Xlint:deprecation")
Original file line number Diff line number Diff line change
@@ -1,18 +1,35 @@
package com.example.demo;

import fr.maif.eventsourcing.State;
import lombok.Getter;
import lombok.ToString;

import java.math.BigDecimal;

@Getter
@ToString
public class Account implements State<Account> {
public String id;
public BigDecimal balance;
public long sequenceNum;

public String getId() {
return id;
}

public BigDecimal getBalance() {
return balance;
}

public long getSequenceNum() {
return sequenceNum;
}

@Override
public String toString() {
return "Account{" +
"id='" + id + '\'' +
", balance=" + balance +
", sequenceNum=" + sequenceNum +
'}';
}

@Override
public Long sequenceNum() {
return sequenceNum;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
import fr.maif.json.JsonFormat;
import fr.maif.json.JsonRead;
import io.vavr.API.Match.Pattern0;
import lombok.Builder;
import lombok.Value;

import java.math.BigDecimal;

Expand Down Expand Up @@ -55,13 +53,39 @@ public interface BankEvent extends Event {
)
);

@Builder
@Value
class MoneyWithdrawn implements BankEvent {

public final String accountId;
public final BigDecimal amount;

static class MoneyWithdrawnBuilder{
String accountId;
BigDecimal amount;

MoneyWithdrawnBuilder accountId(String accountId){
this.accountId = accountId;
return this;
}

MoneyWithdrawnBuilder amount(BigDecimal amount){
this.amount = amount;
return this;
}

MoneyWithdrawn build(){
return new MoneyWithdrawn(accountId,amount);
}

}

public MoneyWithdrawn(String accountId, BigDecimal amount) {
this.accountId = accountId;
this.amount = amount;
}

public static MoneyWithdrawnBuilder builder(){
return new MoneyWithdrawnBuilder();
}

@Override
public Type<MoneyWithdrawn> type() {
return MoneyWithdrawnV1;
Expand All @@ -84,11 +108,30 @@ public String entityId() {
);
}

@Builder
@Value
class AccountOpened implements BankEvent {
public final String accountId;

static class AccountOpenedBuilder{
String accountId;

AccountOpenedBuilder accountId(String accountId){
this.accountId = accountId;
return this;
}

AccountOpened build(){
return new AccountOpened(accountId);
}
}

public AccountOpened(String accountId) {
this.accountId = accountId;
}

public static AccountOpenedBuilder builder(){
return new AccountOpenedBuilder();
}

@Override
public Type<AccountOpened> type() {
return AccountOpenedV1;
Expand All @@ -109,12 +152,40 @@ public String entityId() {
);
}

@Builder
@Value

class MoneyDeposited implements BankEvent {
public final String accountId;
public final BigDecimal amount;

public MoneyDeposited(String accountId, BigDecimal amount) {
this.accountId = accountId;
this.amount = amount;
}

static class MoneyDepositedBuilder{
String accountId;
BigDecimal amount;

MoneyDepositedBuilder accountId(String accountId){
this.accountId = accountId;
return this;
}

MoneyDepositedBuilder amount(BigDecimal amount){
this.amount = amount;
return this;
}

MoneyDeposited build(){
return new MoneyDeposited(accountId,amount);
}

}

public static MoneyDepositedBuilder builder(){
return new MoneyDepositedBuilder();
}

@Override
public Type<MoneyDeposited> type() {
return MoneyDepositedV1;
Expand All @@ -137,11 +208,30 @@ public String entityId() {
);
}

@Builder
@Value
class AccountClosed implements BankEvent {
public final String accountId;

static class AccountClosedBuilder{
String accountId;

AccountClosedBuilder accountId(String accountId){
this.accountId = accountId;
return this;
}

AccountClosed build(){
return new AccountClosed(accountId);
}
}

public AccountClosed(String accountId) {
this.accountId = accountId;
}

public static AccountClosedBuilder builder(){
return new AccountClosedBuilder();
}

@Override
public Type<AccountClosed> type() {
return AccountClosedV1;
Expand Down
2 changes: 1 addition & 1 deletion demo/demo-postgres-kafka/buid.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ libraryDependencies ++= Seq(
"fr.maif" % "functional-json" % functionalJsonVersion
)

javacOptions in Compile ++= Seq("-source", "15", "-target", "15", "-Xlint:unchecked", "-Xlint:deprecation")
javacOptions in Compile ++= Seq("-source", "16", "-target", "16", "-Xlint:unchecked", "-Xlint:deprecation")
2 changes: 1 addition & 1 deletion project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ object Dependencies {
val vavrVersion = "0.10.3"
val jooqVersion = "3.14.3"
val jooqAsyncVersion = "1.1.2"
val functionalJsonVersion = "1.0.2"
val functionalJsonVersion = "1.0.3"
}
11 changes: 0 additions & 11 deletions project/Publish.scala

This file was deleted.

7 changes: 3 additions & 4 deletions sample/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,9 @@ libraryDependencies ++= Seq(

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

0 comments on commit 3b478dc

Please sign in to comment.