-
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' of https://github.com/corda/corda-api i…
…nto nandor/CORE-14025/find-existing-tx-backchain
- Loading branch information
Showing
2 changed files
with
53 additions
and
0 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
47 changes: 47 additions & 0 deletions
47
...est/kotlin/net/corda/data/virtualnode/VirtualNodeUpgradeRequestSchemaCompatibilityTest.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,47 @@ | ||
package net.corda.data.virtualnode | ||
|
||
import org.apache.avro.Schema | ||
import org.apache.avro.SchemaCompatibility | ||
import org.junit.jupiter.api.Assertions | ||
import org.junit.jupiter.api.Test | ||
|
||
class VirtualNodeUpgradeRequestSchemaCompatibilityTest { | ||
|
||
@Test | ||
fun `VirtualNodeUpgradeRequest schema changes between Corda 5_0 and 5_1 are compatible`() { | ||
val schemaV50Json = """ | ||
{ | ||
"type": "record", | ||
"name": "VirtualNodeUpgradeRequest", | ||
"namespace": "net.corda.data.virtualnode", | ||
"fields": [ | ||
{ | ||
"name": "virtualNodeShortHash", | ||
"type": "string", | ||
"doc": "Short hash of the virtual node / holding identity." | ||
}, | ||
{ | ||
"name": "cpiFileChecksum", | ||
"type": "string", | ||
"doc": "The checksum of the CPI file." | ||
}, | ||
{ | ||
"name": "actor", | ||
"type": "string", | ||
"doc": "ID of RPC user that requested the virtual node creation." | ||
} | ||
] | ||
} | ||
""".trimIndent() | ||
|
||
val schemaV50 = Schema.Parser().parse(schemaV50Json) | ||
val schemaV51 = VirtualNodeUpgradeRequest.`SCHEMA$` | ||
|
||
val compatibility = SchemaCompatibility.checkReaderWriterCompatibility(schemaV51, schemaV50) | ||
Assertions.assertEquals( | ||
compatibility.type, | ||
SchemaCompatibility.SchemaCompatibilityType.COMPATIBLE, | ||
"Failed due to incompatible change. ${compatibility.description}" | ||
) | ||
} | ||
} |