-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'release/os/5.1' into jamesh/core-17359-mapper-scheduled…
…-task
- Loading branch information
Showing
5 changed files
with
85 additions
and
3 deletions.
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
...ema/src/main/resources/avro/net/corda/data/membership/state/CompletedCommandMetadata.avsc
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,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" | ||
} | ||
] | ||
} |
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
3 changes: 1 addition & 2 deletions
3
...m/DeclineRegistrationCompatibilityTest.kt → ...m/DeclineRegistrationCompatibilityTest.kt
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
56 changes: 56 additions & 0 deletions
56
data/avro-schema/src/test/kotlin/net/corda/data/membership/state/RegistrationStateTest.kt
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,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}" | ||
) | ||
} | ||
|
||
} |
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