-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #45 from cafienne/extending-metadata
Allow subtyping of MetaData / CommandMetaData
- Loading branch information
Showing
6 changed files
with
73 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
bounded-test/src/test/scala/io/cafienne/bounded/test/TestMetaData.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* Copyright (C) 2016-2018 Cafienne B.V. <https://www.cafienne.io/bounded> | ||
*/ | ||
|
||
package io.cafienne.bounded.test | ||
|
||
import java.time.ZonedDateTime | ||
import java.util.UUID | ||
|
||
import io.cafienne.bounded.aggregate.{CommandMetaData, MetaData} | ||
import io.cafienne.bounded.{BuildInfo, RuntimeInfo, UserContext} | ||
|
||
case class TestCommandMetaData( | ||
timestamp: ZonedDateTime, | ||
val userContext: Option[UserContext], | ||
override val commandId: UUID = UUID.randomUUID() | ||
) extends CommandMetaData | ||
|
||
case class TestMetaData( | ||
timestamp: ZonedDateTime, | ||
userContext: Option[UserContext], | ||
causedByCommand: Option[UUID], | ||
buildInfo: BuildInfo, | ||
runTimeInfo: RuntimeInfo | ||
) extends MetaData | ||
|
||
object TestMetaData { | ||
def fromCommand( | ||
metadata: TestCommandMetaData | ||
)(implicit buildInfo: BuildInfo, runtimeInfo: RuntimeInfo): TestMetaData = { | ||
TestMetaData( | ||
metadata.timestamp, | ||
metadata.userContext, | ||
Some(metadata.commandId), | ||
buildInfo, | ||
runtimeInfo | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
|
||
version in ThisBuild := "0.1.1" | ||
version in ThisBuild := "0.1.2" |