diff --git a/.github/release-notes.yml b/.github/release-notes.yml
new file mode 100644
index 0000000..63ec6a6
--- /dev/null
+++ b/.github/release-notes.yml
@@ -0,0 +1,16 @@
+
+
+changelog:
+ sections:
+ - title: ":rocket: Enhancements & Features"
+ labels: [ "Type: enhancement", "Type: documentation", "Type: example" ]
+ - title: ":bug: Bug Fixes"
+ labels: [ "Type: bug" ]
+ - title: ":hammer_and_wrench: Chore"
+ labels: [ "Type: dependencies", "Type: build", "Type: codacy" ]
+ issues:
+ exclude:
+ labels: [ "Type: question" ]
+ contributors:
+ exclude:
+ names: [ "dependabot[bot]" ]
diff --git a/.github/workflows/release-notes.yml b/.github/workflows/release-notes.yml
index 8018c89..5e7360d 100644
--- a/.github/workflows/release-notes.yml
+++ b/.github/workflows/release-notes.yml
@@ -1,14 +1,33 @@
-changelog:
- sections:
- - title: ":rocket: Enhancements & Features"
- labels: [ "Type: enhancement", "Type: documentation", "Type: example" ]
- - title: ":bug: Bug Fixes"
- labels: [ "Type: bug" ]
- - title: ":hammer_and_wrench: Chore"
- labels: [ "Type: dependencies", "Type: build", "Type: codacy" ]
- issues:
- exclude:
- labels: [ "Type: question" ]
- contributors:
- exclude:
- names: [ "dependabot[bot]" ]
+# Trigger the workflow on milestone events
+on:
+ milestone:
+ types: [closed]
+name: Milestone Closure
+jobs:
+ create-release-notes:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@master
+ - name: Create Release Notes Markdown
+ uses: docker://decathlon/release-notes-generator-action:3.1.5
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
+ OUTPUT_FOLDER: temp_release_notes
+ USE_MILESTONE_TITLE: "true"
+ - name: Get the name of the created Release Notes file and extract Version
+ run: |
+ RELEASE_NOTES_FILE=$(ls temp_release_notes/*.md | head -n 1)
+ echo "RELEASE_NOTES_FILE=$RELEASE_NOTES_FILE" >> $GITHUB_ENV
+ VERSION=$(echo ${{ github.event.milestone.title }} | cut -d' ' -f2)
+ echo "VERSION=$VERSION" >> $GITHUB_ENV
+ - name: Create a Draft Release Notes on GitHub
+ id: create_release
+ uses: actions/create-release@v1
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
+ with:
+ tag_name: ${{ env.VERSION }}
+ release_name: ${{ env.VERSION }}
+ body_path: ${{ env.RELEASE_NOTES_FILE }}
+ draft: true
diff --git a/examples/bankaccount-jgiven-junit4/pom.xml b/examples/bankaccount-jgiven-junit4/pom.xml
index b8fbde5..6d200ea 100644
--- a/examples/bankaccount-jgiven-junit4/pom.xml
+++ b/examples/bankaccount-jgiven-junit4/pom.xml
@@ -6,7 +6,7 @@
io.holixon.axon.testing._
examples
- 0.3.0
+ 0.4.0
io.holixon.axon.testing.examples
@@ -27,7 +27,7 @@
io.toolisticon.testing
jgiven-kotlin
- 1.2.4.0
+ 1.2.5.0
test
@@ -38,19 +38,19 @@
org.slf4j
slf4j-simple
- 2.0.6
+ 2.0.7
test
org.assertj
assertj-core
- 3.24.1
+ 3.24.2
test
org.mockito
mockito-core
- 4.11.0
+ 5.3.1
test
diff --git a/examples/bankaccount-jgiven-junit5/pom.xml b/examples/bankaccount-jgiven-junit5/pom.xml
index b50e5c9..b741652 100644
--- a/examples/bankaccount-jgiven-junit5/pom.xml
+++ b/examples/bankaccount-jgiven-junit5/pom.xml
@@ -6,7 +6,7 @@
io.holixon.axon.testing._
examples
- 0.3.0
+ 0.4.0
io.holixon.axon.testing.examples
@@ -29,7 +29,7 @@
io.toolisticon.testing
jgiven-kotlin
- 1.2.4.0
+ 1.2.5.0
test
@@ -40,13 +40,13 @@
org.slf4j
slf4j-simple
- 2.0.6
+ 2.0.7
test
org.assertj
assertj-core
- 3.24.1
+ 3.24.2
test
diff --git a/examples/pom.xml b/examples/pom.xml
index 2fd447d..25f28be 100644
--- a/examples/pom.xml
+++ b/examples/pom.xml
@@ -6,7 +6,7 @@
io.holixon.axon.testing._
axon-testing_
- 0.3.0
+ 0.4.0
examples
diff --git a/extension/jgiven/core/pom.xml b/extension/jgiven/core/pom.xml
index 0cd2646..1425c73 100644
--- a/extension/jgiven/core/pom.xml
+++ b/extension/jgiven/core/pom.xml
@@ -7,7 +7,7 @@
io.holixon.axon.testing._
extension-jgiven
- 0.3.0
+ 0.4.0
io.holixon.axon.testing
@@ -40,7 +40,7 @@
io.github.microutils
kotlin-logging-jvm
- 3.0.4
+ 3.0.5
test
@@ -66,7 +66,7 @@
ch.qos.logback
logback-classic
- 1.4.5
+ 1.4.7
test
diff --git a/extension/jgiven/junit/pom.xml b/extension/jgiven/junit/pom.xml
index 77a2fb5..45aaefc 100644
--- a/extension/jgiven/junit/pom.xml
+++ b/extension/jgiven/junit/pom.xml
@@ -7,7 +7,7 @@
io.holixon.axon.testing._
extension-jgiven
- 0.3.0
+ 0.4.0
io.holixon.axon.testing
diff --git a/extension/jgiven/junit5/pom.xml b/extension/jgiven/junit5/pom.xml
index dec6382..2747397 100644
--- a/extension/jgiven/junit5/pom.xml
+++ b/extension/jgiven/junit5/pom.xml
@@ -7,7 +7,7 @@
io.holixon.axon.testing._
extension-jgiven
- 0.3.0
+ 0.4.0
io.holixon.axon.testing
@@ -27,7 +27,7 @@
io.toolisticon.testing
jgiven-kotlin
- 1.2.4.0
+ 1.2.5.0
test
@@ -40,7 +40,7 @@
ch.qos.logback
logback-classic
- 1.4.5
+ 1.4.7
test
diff --git a/extension/jgiven/pom.xml b/extension/jgiven/pom.xml
index d4e6e23..cdb51af 100644
--- a/extension/jgiven/pom.xml
+++ b/extension/jgiven/pom.xml
@@ -6,7 +6,7 @@
io.holixon.axon.testing._
extension
- 0.3.0
+ 0.4.0
extension-jgiven
diff --git a/extension/pom.xml b/extension/pom.xml
index 42978b8..e220727 100644
--- a/extension/pom.xml
+++ b/extension/pom.xml
@@ -6,7 +6,7 @@
io.holixon.axon.testing._
axon-testing_
- 0.3.0
+ 0.4.0
extension
diff --git a/extension/upcaster-test-core/pom.xml b/extension/upcaster-test-core/pom.xml
index e392892..eba89a4 100644
--- a/extension/upcaster-test-core/pom.xml
+++ b/extension/upcaster-test-core/pom.xml
@@ -7,7 +7,7 @@
io.holixon.axon.testing._
extension
- 0.3.0
+ 0.4.0
io.holixon.axon.testing
@@ -30,6 +30,7 @@
org.axonframework
axon-test
+
org.dom4j
dom4j
@@ -70,9 +71,8 @@
org.slf4j
slf4j-simple
- 2.0.6
+ test
+ 2.0.7
-
-
diff --git a/extension/upcaster-test-core/src/test/kotlin/AccountCreatedV0V1UpcasterTest.kt b/extension/upcaster-test-core/src/test/kotlin/AccountCreatedV0V1UpcasterTest.kt
new file mode 100644
index 0000000..7e06772
--- /dev/null
+++ b/extension/upcaster-test-core/src/test/kotlin/AccountCreatedV0V1UpcasterTest.kt
@@ -0,0 +1,84 @@
+package io.holixon.axon.testing.upcaster
+
+import com.fasterxml.jackson.databind.JsonNode
+import com.fasterxml.jackson.databind.node.ObjectNode
+import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
+import io.holixon.axon.testing.upcaster.UpcasterTestSupport.Companion.initialEvent
+import io.holixon.axon.testing.upcaster.UpcasterTestSupport.Companion.jsonTestEventData
+import org.assertj.core.api.Assertions.assertThat
+import org.axonframework.serialization.Revision
+import org.axonframework.serialization.SerializedObject
+import org.axonframework.serialization.SimpleSerializedType
+import org.axonframework.serialization.json.JacksonSerializer
+import org.axonframework.serialization.upcasting.event.EventUpcasterChain
+import org.axonframework.serialization.upcasting.event.IntermediateEventRepresentation
+import org.axonframework.serialization.upcasting.event.SingleEventUpcaster
+import org.junit.jupiter.api.Test
+import kotlin.streams.toList
+
+/**
+ * Let's assume we had a revision "0" of accountCreated which had different field names and one missing required field.
+ */
+class AccountCreatedV0V1UpcasterTest {
+ private val om = jacksonObjectMapper()
+ private val jsonSerializer = JacksonSerializer.builder().objectMapper(om).build()
+
+ @Test
+ fun `upcast v0 to v1`() {
+ // GIVEN: a new event with accountId and required field maximalBalance
+ @Revision("1")
+ data class AccountCreatedEvent(
+ val accountId: String,
+ val customerId: String,
+ val initialBalance: Int,
+ val maximalBalance: Int
+ )
+
+ val payloadType = AccountCreatedEvent::class.java.name
+ val targetRevision = AccountCreatedEvent::class.java.getAnnotation(Revision::class.java).value
+
+ // AND GIVEN: an old event with revision "0" with bankAccountId (has to be renamed to accountId), and maximalBalance is missing!
+ val eventData = jsonTestEventData(
+ payloadJson = """{"bankAccountId":"1","customerId":"3","initialBalance":0}""",
+ payloadTypeName = payloadType,
+ revisionNumber = "0"
+ )
+
+ // AND an upcaster we wrote for this usecase
+ val upcaster = upcaster(payloadType = payloadType, sourceRevision = eventData.payload.type.revision, targetRevision = targetRevision) {
+ (it as ObjectNode).apply {
+ put("accountId", get("bankAccountId").asText())
+ remove("bankAccountId")
+ put("maximalBalance", 1000)
+ }
+ }
+
+ // WHEN we run the upcaster chain on a stream with a single event
+ val serializedResult: SerializedObject<*> = EventUpcasterChain(upcaster)
+ .upcast(initialEvent(entry = eventData, serializer = jsonSerializer))
+ .toList()
+ .first().data
+
+ // AND deserialize to target data class
+ val revision1data: AccountCreatedEvent = jsonSerializer.deserialize(serializedResult)
+
+ // THEN the fields are renamed and set
+ assertThat(revision1data.accountId).isEqualTo("1")
+ assertThat(revision1data.customerId).isEqualTo("3")
+ assertThat(revision1data.initialBalance).isEqualTo(0)
+ assertThat(revision1data.maximalBalance).isEqualTo(1000)
+ }
+
+ private fun upcaster(payloadType: String, sourceRevision: String, targetRevision: String, upcastFunction: (JsonNode) -> JsonNode) =
+ object : SingleEventUpcaster() {
+ override fun canUpcast(representation: IntermediateEventRepresentation): Boolean =
+ representation.type.name == payloadType && representation.type.revision == sourceRevision
+
+ override fun doUpcast(intermediateRepresentation: IntermediateEventRepresentation): IntermediateEventRepresentation =
+ intermediateRepresentation.upcastPayload(
+ SimpleSerializedType(payloadType, targetRevision),
+ JsonNode::class.java,
+ upcastFunction
+ )
+ }
+}
diff --git a/lib/fixtures/bankaccount/pom.xml b/lib/fixtures/bankaccount/pom.xml
index 34c0583..0a8581d 100644
--- a/lib/fixtures/bankaccount/pom.xml
+++ b/lib/fixtures/bankaccount/pom.xml
@@ -6,7 +6,7 @@
io.holixon.axon.testing._
fixtures
- 0.3.0
+ 0.4.0
io.holixon.axon.testing.lib
diff --git a/lib/fixtures/giftcard/pom.xml b/lib/fixtures/giftcard/pom.xml
index 186bd41..6a2ee8c 100644
--- a/lib/fixtures/giftcard/pom.xml
+++ b/lib/fixtures/giftcard/pom.xml
@@ -6,7 +6,7 @@
io.holixon.axon.testing._
fixtures
- 0.3.0
+ 0.4.0
io.holixon.axon.testing.lib
diff --git a/lib/fixtures/pom.xml b/lib/fixtures/pom.xml
index d8187fa..c9b2333 100644
--- a/lib/fixtures/pom.xml
+++ b/lib/fixtures/pom.xml
@@ -6,7 +6,7 @@
io.holixon.axon.testing._
lib
- 0.3.0
+ 0.4.0
fixtures
@@ -38,7 +38,7 @@
org.projectlombok
lombok
- 1.18.24
+ 1.18.26
provided
diff --git a/lib/pom.xml b/lib/pom.xml
index 3b57dd1..29e9c62 100644
--- a/lib/pom.xml
+++ b/lib/pom.xml
@@ -6,7 +6,7 @@
io.holixon.axon.testing._
axon-testing_
- 0.3.0
+ 0.4.0
lib
diff --git a/pom.xml b/pom.xml
index dfd7335..d8a42eb 100644
--- a/pom.xml
+++ b/pom.xml
@@ -8,7 +8,7 @@
io.holixon.axon.testing._
axon-testing_
- 0.3.0
+ 0.4.0
pom
@@ -21,19 +21,19 @@
11
${java.version}
${java.version}
- 1.8.0
+ 1.8.21
4.6.3
- 1.2.4
- 1.2.4.0
+ 1.2.5
+ 1.2.5.0
- 2.14.1
+ 2.15.0
4.13.2
- 5.9.1
- 2.1.3
- 3.24.1
+ 5.9.3
+ 2.1.4
+ 3.24.2
UTF-8
@@ -142,7 +142,7 @@
org.apache.maven.plugins
maven-compiler-plugin
- 3.10.1
+ 3.11.0
${project.build.sourceEncoding}
@@ -182,7 +182,7 @@
maven-resources-plugin
- 3.3.0
+ 3.3.1
UTF-8
@@ -191,14 +191,14 @@
maven-install-plugin
- 3.1.0
+ 3.1.1
org.apache.maven.plugins
maven-assembly-plugin
- 3.4.2
+ 3.5.0
assembly
@@ -210,7 +210,7 @@
maven-release-plugin
- 2.5.3
+ 3.0.0
forked-path
true
@@ -222,7 +222,7 @@
org.jacoco
jacoco-maven-plugin
- 0.8.8
+ 0.8.10
pre-unit-test
@@ -242,7 +242,7 @@
maven-surefire-plugin
- 2.22.2
+ 3.0.0
false
kill
@@ -268,14 +268,14 @@
org.apache.maven.plugins
maven-failsafe-plugin
- 2.22.2
+ 3.0.0
org.jetbrains.dokka
dokka-maven-plugin
- 1.7.20
+ 1.8.10
${dokka.skip}
@@ -328,7 +328,7 @@
maven-enforcer-plugin
- 3.1.0
+ 3.3.0
enforce-java
@@ -399,7 +399,7 @@
maven-deploy-plugin
- 3.0.0
+ 3.1.1
true