mirror of
https://github.com/corda/corda.git
synced 2025-06-23 09:25:36 +00:00
Merge pull request #7820 from corda/merge-release/os/4.9-release/os/4.10-2024-09-25-349
ENT-12033: Merging forward updates from release/os/4.9 to release/os/4.10 - 2024-09-25
This commit is contained in:
@ -140,16 +140,42 @@ class DriverTests {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The uniqueness of nodes by the DSL is checked using the node organisation name and, if specified,
|
||||||
|
* the organisation unit name.
|
||||||
|
* All other X500 components are ignored in this regard.
|
||||||
|
*/
|
||||||
@Test(timeout=300_000)
|
@Test(timeout=300_000)
|
||||||
fun `driver rejects multiple nodes with the same organisation name`() {
|
fun `driver rejects multiple nodes with the same organisation name`() {
|
||||||
driver(DriverParameters(startNodesInProcess = true, notarySpecs = emptyList())) {
|
driver(DriverParameters(startNodesInProcess = true, notarySpecs = emptyList())) {
|
||||||
newNode(CordaX500Name(commonName = "Notary", organisation = "R3CEV", locality = "New York", country = "US"))().getOrThrow()
|
newNode(CordaX500Name(commonName = "Notary", organisation = "R3CEV", locality = "New York", country = "US"))().getOrThrow()
|
||||||
assertThatIllegalArgumentException().isThrownBy {
|
assertThatIllegalArgumentException().isThrownBy {
|
||||||
newNode(CordaX500Name(commonName = "Regulator", organisation = "R3CEV", locality = "New York", country = "US"))().getOrThrow()
|
newNode(CordaX500Name(commonName = "Regulator", organisation = "R3CEV", locality = "Newcastle", country = "GB"))().getOrThrow()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test(timeout=300_000)
|
||||||
|
fun `driver allows multiple nodes with the same organisation name but different organisation unit name`() {
|
||||||
|
driver(DriverParameters(startNodesInProcess = true, notarySpecs = emptyList())) {
|
||||||
|
newNode(CordaX500Name(commonName = "Notary", organisation = "R3CEV", organisationUnit = "Eric", locality = "New York", country = "US", state = null))().getOrThrow()
|
||||||
|
assertThatCode {
|
||||||
|
newNode(CordaX500Name(commonName = "Regulator", organisation = "R3CEV", organisationUnit = "Ernie", locality = "Newcastle", country = "GB", state = null))().getOrThrow()
|
||||||
|
}.doesNotThrowAnyException()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test(timeout=300_000)
|
||||||
|
fun `driver rejects multiple nodes with the same organisation name and organisation unit name`() {
|
||||||
|
driver(DriverParameters(startNodesInProcess = true, notarySpecs = emptyList())) {
|
||||||
|
newNode(CordaX500Name(commonName = "Notary", organisation = "R3CEV", organisationUnit = "Eric", locality = "New York", country = "US", state = null))().getOrThrow()
|
||||||
|
assertThatIllegalArgumentException().isThrownBy {
|
||||||
|
newNode(CordaX500Name(commonName = "Regulator", organisation = "R3CEV", organisationUnit = "Eric", locality = "Newcastle", country = "GB", state = null))().getOrThrow()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/** **** **/
|
||||||
|
|
||||||
@Test(timeout=300_000)
|
@Test(timeout=300_000)
|
||||||
fun `driver allows reusing names of nodes that have been stopped`() {
|
fun `driver allows reusing names of nodes that have been stopped`() {
|
||||||
driver(DriverParameters(startNodesInProcess = true, notarySpecs = emptyList())) {
|
driver(DriverParameters(startNodesInProcess = true, notarySpecs = emptyList())) {
|
||||||
|
@ -666,7 +666,11 @@ class DriverDSLImpl(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun baseDirectory(nodeName: CordaX500Name): Path {
|
override fun baseDirectory(nodeName: CordaX500Name): Path {
|
||||||
val nodeDirectoryName = nodeName.organisation.filter { !it.isWhitespace() }
|
val nodeDirectoryName = if (nodeName.organisationUnit != null) {
|
||||||
|
"${nodeName.organisation}-${nodeName.organisationUnit}"
|
||||||
|
} else {
|
||||||
|
nodeName.organisation
|
||||||
|
}.filter { !it.isWhitespace() }
|
||||||
return driverDirectory / nodeDirectoryName
|
return driverDirectory / nodeDirectoryName
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1169,11 +1173,16 @@ private class NetworkVisibilityController {
|
|||||||
|
|
||||||
fun register(name: CordaX500Name): VisibilityHandle {
|
fun register(name: CordaX500Name): VisibilityHandle {
|
||||||
val handle = VisibilityHandle()
|
val handle = VisibilityHandle()
|
||||||
|
val handleName = if (name.organisationUnit != null) {
|
||||||
|
"${name.organisation}-${name.organisationUnit}"
|
||||||
|
} else {
|
||||||
|
name.organisation
|
||||||
|
}
|
||||||
nodeVisibilityHandles.locked {
|
nodeVisibilityHandles.locked {
|
||||||
require(name.organisation !in keys) {
|
require(handleName !in keys) {
|
||||||
"Node with organisation name ${name.organisation} is already started or starting"
|
"Node with the organisation name (+ unit name) \"$handleName\" is already started or starting"
|
||||||
}
|
}
|
||||||
put(name.organisation, handle)
|
put(handleName, handle)
|
||||||
}
|
}
|
||||||
return handle
|
return handle
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user