Fix API stability issue

This commit is contained in:
Matthijs van den Bos 2019-07-14 21:43:17 +02:00 committed by Mike Hearn
parent 164079e3a2
commit af44dfa309
2 changed files with 11 additions and 4 deletions

View File

@ -104,6 +104,7 @@ data class MockNetworkParameters(
fun withServicePeerAllocationStrategy(servicePeerAllocationStrategy: InMemoryMessagingNetwork.ServicePeerAllocationStrategy): MockNetworkParameters {
return copy(servicePeerAllocationStrategy = servicePeerAllocationStrategy)
}
fun withNotarySpecs(notarySpecs: List<MockNetworkNotarySpec>): MockNetworkParameters = copy(notarySpecs = notarySpecs)
fun withCordappsForAllNodes(cordappsForAllNodes: Collection<TestCordapp>): MockNetworkParameters = copy(cordappsForAllNodes = cordappsForAllNodes)
@ -125,7 +126,13 @@ data class MockNetworkParameters(
* @property validating Boolean for whether the notary is validating or non-validating.
* @property className String the optional name of a notary service class to load. If null, a builtin notary is loaded.
*/
data class MockNetworkNotarySpec @JvmOverloads constructor(val name: CordaX500Name, val validating: Boolean = true, val className: String? = null)
data class MockNetworkNotarySpec @JvmOverloads constructor(val name: CordaX500Name, val validating: Boolean = true) {
var className: String? = null
constructor(name: CordaX500Name, validating: Boolean = true, className: String? = null) : this(name, validating) {
this.className = className
}
}
/** A class that represents an unstarted mock node for testing. */
class UnstartedMockNode private constructor(private val node: InternalMockNetwork.MockNode) {

View File

@ -249,10 +249,10 @@ open class InternalMockNetwork(cordappPackages: List<String> = emptyList(),
@VisibleForTesting
internal open fun createNotaries(): List<TestStartedNode> {
return notarySpecs.map { (name, validating, className) ->
return notarySpecs.map { spec ->
createNode(InternalMockNodeParameters(
legalName = name,
configOverrides = { doReturn(NotaryConfig(validating, className = className)).whenever(it).notary }
legalName = spec.name,
configOverrides = { doReturn(NotaryConfig(spec.validating, className = spec.className)).whenever(it).notary }
))
}
}