mirror of
https://github.com/corda/corda.git
synced 2025-06-21 00:23:09 +00:00
Extract common name from legal name to determine path in Driver (#613)
Rewrote node name to extract common name to use as the node path for samples, to work around characters being incorrectly treated as separators.
This commit is contained in:
committed by
Chris Rankin
parent
99bf98c0d8
commit
a1fd215863
@ -74,7 +74,7 @@ interface DriverDSLExposedInterface {
|
|||||||
* @return The [NodeInfo] of the started up node retrieved from the network map service.
|
* @return The [NodeInfo] of the started up node retrieved from the network map service.
|
||||||
*/
|
*/
|
||||||
@Deprecated("To be removed once X500Name is used as legal name everywhere")
|
@Deprecated("To be removed once X500Name is used as legal name everywhere")
|
||||||
fun startNode(providedName: String,
|
fun startNode(providedName: String?,
|
||||||
advertisedServices: Set<ServiceInfo> = emptySet(),
|
advertisedServices: Set<ServiceInfo> = emptySet(),
|
||||||
rpcUsers: List<User> = emptyList(),
|
rpcUsers: List<User> = emptyList(),
|
||||||
verifierType: VerifierType = VerifierType.InMemory,
|
verifierType: VerifierType = VerifierType.InMemory,
|
||||||
@ -437,10 +437,6 @@ class DriverDSL(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun startNode(providedName: String, advertisedServices: Set<ServiceInfo>, rpcUsers: List<User>, verifierType: VerifierType, customOverrides: Map<String, Any?>): ListenableFuture<NodeHandle> {
|
|
||||||
return startNode(X500Name(providedName), advertisedServices, rpcUsers, verifierType, customOverrides)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun startNode(
|
override fun startNode(
|
||||||
providedName: X500Name?,
|
providedName: X500Name?,
|
||||||
advertisedServices: Set<ServiceInfo>,
|
advertisedServices: Set<ServiceInfo>,
|
||||||
@ -448,13 +444,25 @@ class DriverDSL(
|
|||||||
verifierType: VerifierType,
|
verifierType: VerifierType,
|
||||||
customOverrides: Map<String, Any?>
|
customOverrides: Map<String, Any?>
|
||||||
): ListenableFuture<NodeHandle> {
|
): ListenableFuture<NodeHandle> {
|
||||||
|
return startNode(providedName?.toString(), advertisedServices, rpcUsers, verifierType, customOverrides)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun startNode(providedName: String?,
|
||||||
|
advertisedServices: Set<ServiceInfo>,
|
||||||
|
rpcUsers: List<User>,
|
||||||
|
verifierType: VerifierType,
|
||||||
|
customOverrides: Map<String, Any?>): ListenableFuture<NodeHandle> {
|
||||||
val p2pAddress = portAllocation.nextHostAndPort()
|
val p2pAddress = portAllocation.nextHostAndPort()
|
||||||
val rpcAddress = portAllocation.nextHostAndPort()
|
val rpcAddress = portAllocation.nextHostAndPort()
|
||||||
val webAddress = portAllocation.nextHostAndPort()
|
val webAddress = portAllocation.nextHostAndPort()
|
||||||
val debugPort = if (isDebug) debugPortAllocation.nextPort() else null
|
val debugPort = if (isDebug) debugPortAllocation.nextPort() else null
|
||||||
val name = providedName ?: X509Utilities.getDevX509Name("${pickA(name).commonName}-${p2pAddress.port}")
|
val name = providedName.toString() ?: X509Utilities.getDevX509Name("${pickA(name).commonName}-${p2pAddress.port}").toString()
|
||||||
|
val commonName = try {
|
||||||
val baseDirectory = driverDirectory / name.toString()
|
X500Name(name).commonName
|
||||||
|
} catch(ex: IllegalArgumentException) {
|
||||||
|
name
|
||||||
|
}
|
||||||
|
val baseDirectory = driverDirectory / commonName
|
||||||
val configOverrides = mapOf(
|
val configOverrides = mapOf(
|
||||||
"myLegalName" to name.toString(),
|
"myLegalName" to name.toString(),
|
||||||
"p2pAddress" to p2pAddress.toString(),
|
"p2pAddress" to p2pAddress.toString(),
|
||||||
@ -501,7 +509,7 @@ class DriverDSL(
|
|||||||
verifierType: VerifierType,
|
verifierType: VerifierType,
|
||||||
rpcUsers: List<User>
|
rpcUsers: List<User>
|
||||||
): ListenableFuture<Pair<Party, List<NodeHandle>>> {
|
): ListenableFuture<Pair<Party, List<NodeHandle>>> {
|
||||||
val nodeNames = (1..clusterSize).map { "${DUMMY_NOTARY.name} $it" }
|
val nodeNames = (1..clusterSize).map { "Notary Node $it" }
|
||||||
val paths = nodeNames.map { driverDirectory / it }
|
val paths = nodeNames.map { driverDirectory / it }
|
||||||
ServiceIdentityGenerator.generateToDisk(paths, type.id, notaryName)
|
ServiceIdentityGenerator.generateToDisk(paths, type.id, notaryName)
|
||||||
|
|
||||||
@ -559,7 +567,12 @@ class DriverDSL(
|
|||||||
override fun startNetworkMapService() {
|
override fun startNetworkMapService() {
|
||||||
val debugPort = if (isDebug) debugPortAllocation.nextPort() else null
|
val debugPort = if (isDebug) debugPortAllocation.nextPort() else null
|
||||||
val apiAddress = portAllocation.nextHostAndPort().toString()
|
val apiAddress = portAllocation.nextHostAndPort().toString()
|
||||||
val baseDirectory = driverDirectory / networkMapLegalName
|
val nodeDirectoryName = try {
|
||||||
|
X500Name(networkMapLegalName).commonName
|
||||||
|
} catch(ex: IllegalArgumentException) {
|
||||||
|
networkMapLegalName
|
||||||
|
}
|
||||||
|
val baseDirectory = driverDirectory / nodeDirectoryName
|
||||||
val config = ConfigHelper.loadConfig(
|
val config = ConfigHelper.loadConfig(
|
||||||
baseDirectory = baseDirectory,
|
baseDirectory = baseDirectory,
|
||||||
allowMissingConfig = true,
|
allowMissingConfig = true,
|
||||||
|
Reference in New Issue
Block a user