Allow testing of platform version when building test node info (#2333)

This commit is contained in:
Anthony Keenan 2018-01-08 14:42:51 +00:00 committed by GitHub
parent c5149bab9f
commit 5df48e0f5e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -22,17 +22,17 @@ class TestNodeInfoBuilder {
}
}
fun build(serial: Long = 1): NodeInfo {
fun build(serial: Long = 1, platformVersion: Int = 1): NodeInfo {
return NodeInfo(
listOf(NetworkHostAndPort("my.${identitiesAndPrivateKeys[0].first.party.name.organisation}.com", 1234)),
identitiesAndPrivateKeys.map { it.first },
1,
platformVersion,
serial
)
}
fun buildWithSigned(serial: Long = 1): Pair<NodeInfo, SignedNodeInfo> {
val nodeInfo = build(serial)
fun buildWithSigned(serial: Long = 1, platformVersion: Int = 1): Pair<NodeInfo, SignedNodeInfo> {
val nodeInfo = build(serial, platformVersion)
val privateKeys = identitiesAndPrivateKeys.map { it.second }
return Pair(nodeInfo, nodeInfo.signWith(privateKeys))
}
@ -42,10 +42,10 @@ class TestNodeInfoBuilder {
}
}
fun createNodeInfoAndSigned(vararg names: CordaX500Name, serial: Long = 1): Pair<NodeInfo, SignedNodeInfo> {
fun createNodeInfoAndSigned(vararg names: CordaX500Name, serial: Long = 1, platformVersion: Int = 1): Pair<NodeInfo, SignedNodeInfo> {
val nodeInfoBuilder = TestNodeInfoBuilder()
names.forEach { nodeInfoBuilder.addIdentity(it) }
return nodeInfoBuilder.buildWithSigned(serial)
return nodeInfoBuilder.buildWithSigned(serial, platformVersion)
}
fun NodeInfo.signWith(keys: List<PrivateKey>): SignedNodeInfo {