mirror of
https://github.com/corda/corda.git
synced 2025-01-18 10:46:38 +00:00
INFRA-530: Start notary node in process (#6521)
This commit is contained in:
parent
c91dba83d3
commit
0bedbd8c75
@ -41,7 +41,7 @@ class AddressBindingFailureTests {
|
||||
|
||||
assertThatThrownBy {
|
||||
driver(DriverParameters(startNodesInProcess = false,
|
||||
notarySpecs = listOf(NotarySpec(notaryName)),
|
||||
notarySpecs = listOf(NotarySpec(notaryName, startInProcess = false)),
|
||||
notaryCustomOverrides = mapOf("p2pAddress" to address.toString()),
|
||||
portAllocation = portAllocation,
|
||||
cordappsForAllNodes = emptyList())
|
||||
|
@ -16,7 +16,9 @@ import net.corda.testing.common.internal.ProjectStructure.projectRootDir
|
||||
import net.corda.testing.core.BOB_NAME
|
||||
import net.corda.testing.core.DUMMY_BANK_A_NAME
|
||||
import net.corda.testing.core.DUMMY_BANK_B_NAME
|
||||
import net.corda.testing.core.DUMMY_NOTARY_NAME
|
||||
import net.corda.testing.http.HttpApi
|
||||
import net.corda.testing.node.NotarySpec
|
||||
import net.corda.testing.node.internal.addressMustBeBound
|
||||
import net.corda.testing.node.internal.addressMustNotBeBound
|
||||
import org.assertj.core.api.Assertions.assertThat
|
||||
@ -118,7 +120,7 @@ class DriverTests {
|
||||
fun `started node, which is not waited for in the driver, is shutdown when the driver exits`() {
|
||||
// First check that the process-id file is created by the node on startup, so that we can be sure our check that
|
||||
// it's deleted on shutdown isn't a false-positive.
|
||||
val baseDirectory = driver {
|
||||
val baseDirectory = driver(DriverParameters(notarySpecs = listOf(NotarySpec(DUMMY_NOTARY_NAME, startInProcess = false)))) {
|
||||
val baseDirectory = defaultNotaryNode.getOrThrow().baseDirectory
|
||||
assertThat(baseDirectory / "process-id").exists()
|
||||
baseDirectory
|
||||
|
@ -13,24 +13,55 @@ import net.corda.testing.driver.VerifierType
|
||||
* @property rpcUsers A list of users able to instigate RPC for this node or cluster of nodes.
|
||||
* @property verifierType How the notary will verify transactions.
|
||||
* @property cluster [ClusterSpec] if this is a distributed cluster notary. If null then this is a single-node notary.
|
||||
* @property startInProcess Should the notary be started in process.
|
||||
*/
|
||||
data class NotarySpec(
|
||||
val name: CordaX500Name,
|
||||
val validating: Boolean = true,
|
||||
val rpcUsers: List<User> = emptyList(),
|
||||
val verifierType: VerifierType = VerifierType.InMemory,
|
||||
val cluster: ClusterSpec? = null
|
||||
val cluster: ClusterSpec? = null,
|
||||
val startInProcess: Boolean = true
|
||||
) {
|
||||
constructor(name: CordaX500Name,
|
||||
validating: Boolean = true,
|
||||
rpcUsers: List<User> = emptyList(),
|
||||
verifierType: VerifierType = VerifierType.InMemory,
|
||||
cluster: ClusterSpec? = null): this(name, validating, rpcUsers, verifierType, cluster, "512m", true)
|
||||
|
||||
constructor(name: CordaX500Name,
|
||||
validating: Boolean = true,
|
||||
rpcUsers: List<User> = emptyList(),
|
||||
verifierType: VerifierType = VerifierType.InMemory,
|
||||
cluster: ClusterSpec? = null,
|
||||
maximumHeapSize: String): this(name, validating, rpcUsers, verifierType, cluster, maximumHeapSize, true)
|
||||
|
||||
// These extra fields are handled this way to preserve Kotlin wire compatibility wrt additional parameters with default values.
|
||||
constructor(name: CordaX500Name,
|
||||
validating: Boolean = true,
|
||||
rpcUsers: List<User> = emptyList(),
|
||||
verifierType: VerifierType = VerifierType.InMemory,
|
||||
cluster: ClusterSpec? = null,
|
||||
maximumHeapSize: String = "512m"): this(name, validating, rpcUsers, verifierType, cluster) {
|
||||
maximumHeapSize: String = "512m",
|
||||
startInProcess: Boolean = true): this(name, validating, rpcUsers, verifierType, cluster, startInProcess) {
|
||||
this.maximumHeapSize = maximumHeapSize
|
||||
}
|
||||
|
||||
fun copy(
|
||||
name: CordaX500Name,
|
||||
validating: Boolean = true,
|
||||
rpcUsers: List<User> = emptyList(),
|
||||
verifierType: VerifierType = VerifierType.InMemory,
|
||||
cluster: ClusterSpec? = null
|
||||
) = this.copy(
|
||||
name = name,
|
||||
validating = validating,
|
||||
rpcUsers = rpcUsers,
|
||||
verifierType = verifierType,
|
||||
cluster = cluster,
|
||||
startInProcess = true
|
||||
)
|
||||
|
||||
var maximumHeapSize: String = "512m"
|
||||
}
|
||||
|
||||
|
@ -571,9 +571,13 @@ class DriverDSLImpl(
|
||||
private fun startSingleNotary(spec: NotarySpec, localNetworkMap: LocalNetworkMap?, customOverrides: Map<String, Any?>): CordaFuture<List<NodeHandle>> {
|
||||
val notaryConfig = mapOf("notary" to mapOf("validating" to spec.validating))
|
||||
return startRegisteredNode(
|
||||
spec.name,
|
||||
localNetworkMap,
|
||||
NodeParameters(rpcUsers = spec.rpcUsers, verifierType = spec.verifierType, customOverrides = notaryConfig + customOverrides, maximumHeapSize = spec.maximumHeapSize)
|
||||
spec.name,
|
||||
localNetworkMap,
|
||||
NodeParameters(rpcUsers = spec.rpcUsers,
|
||||
verifierType = spec.verifierType,
|
||||
startInSameProcess = spec.startInProcess,
|
||||
customOverrides = notaryConfig + customOverrides,
|
||||
maximumHeapSize = spec.maximumHeapSize)
|
||||
).map { listOf(it) }
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user