Skip to content

Commit

Permalink
Merge branch 'release/os/5.1' into jamesh/core-17359-mapper-scheduled…
Browse files Browse the repository at this point in the history
…-task
  • Loading branch information
JamesHR3 committed Oct 2, 2023
2 parents 458c420 + fdcddfa commit dd48bb1
Show file tree
Hide file tree
Showing 5 changed files with 85 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"type": "record",
"name": "CompletedCommandMetadata",
"namespace": "net.corda.data.membership.state",
"doc": "Metadata about a previously completed registration command.",
"fields": [
{
"name": "index",
"doc": "An index which can be used to determine the order of previously completed registration commands.",
"type": "int"
},
{
"name": "command",
"doc": "The name of the command which was completed.",
"type": "string"
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,15 @@
"name": "mgm",
"doc": "Holding identity of the MGM.",
"type": "net.corda.data.identity.HoldingIdentity"
},
{
"name": "previouslyCompletedCommands",
"doc": "A list of all the previously completed commands during registration. Can be used for idempotency in the case of message replays.",
"type": {
"type": "array",
"items": "net.corda.data.membership.state.CompletedCommandMetadata"
},
"default": []
}
]
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package net.corda.data.command.registration.mgm
package net.corda.data.membership.command.registration.mgm

import net.corda.data.membership.command.registration.mgm.DeclineRegistration
import org.apache.avro.Schema
import org.apache.avro.SchemaCompatibility
import org.junit.jupiter.api.Assertions
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
package net.corda.data.membership.state

import net.corda.data.identity.HoldingIdentity
import org.apache.avro.Schema
import org.apache.avro.SchemaCompatibility
import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.Test

class RegistrationStateTest {

@Test
fun `Changes in RegistrationState between Corda 5_0 and 5_1 are compatible`() {
val oldSchemaJson = """
{
"type": "record",
"name": "RegistrationState",
"namespace": "net.corda.data.membership.state",
"doc": "State for a registration.",
"fields": [
{
"name": "registrationId",
"doc": "UUID identifying this registration request",
"type": {
"type": "string",
"logicalType": "uuid"
}
},
{
"name": "registeringMember",
"doc": "Holding identity of the registering member as provided during P2P communication. Used to verify the registration request.",
"type": "net.corda.data.identity.HoldingIdentity"
},
{
"name": "mgm",
"doc": "Holding identity of the MGM.",
"type": "net.corda.data.identity.HoldingIdentity"
}
]
}
""".trimIndent()

val oldSchema = Schema.Parser()
.addTypes(mapOf(HoldingIdentity::class.java.name to HoldingIdentity.`SCHEMA$`))
.parse(oldSchemaJson)
val newSchema = RegistrationState.`SCHEMA$`

val compatibility = SchemaCompatibility.checkReaderWriterCompatibility(newSchema, oldSchema)

Assertions.assertEquals(
compatibility.type,
SchemaCompatibility.SchemaCompatibilityType.COMPATIBLE,
"Failed due to incompatible change. ${compatibility.description}"
)
}

}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ cordaProductVersion = 5.1.0
# NOTE: update this each time this module contains a breaking change
## NOTE: currently this is a top level revision, so all API versions will line up, but this could be moved to
## a per module property in which case module versions can change independently.
cordaApiRevision = 25
cordaApiRevision = 26

# Main
kotlinVersion = 1.8.21
Expand Down

0 comments on commit dd48bb1

Please sign in to comment.