mirror of
https://github.com/corda/corda.git
synced 2025-06-01 23:20:54 +00:00
NOTICK Reformat DriverDSLImpl.kt (#6685)
Reformat DriverDSLImpl to standard IntelliJ style
This commit is contained in:
parent
b895a976a7
commit
b1e2d6a48c
@ -1,4 +1,5 @@
|
|||||||
@file:Suppress("TooManyFunctions", "Deprecation")
|
@file:Suppress("TooManyFunctions", "Deprecation")
|
||||||
|
|
||||||
package net.corda.testing.node.internal
|
package net.corda.testing.node.internal
|
||||||
|
|
||||||
import co.paralleluniverse.fibers.instrument.JavaAgent
|
import co.paralleluniverse.fibers.instrument.JavaAgent
|
||||||
@ -147,7 +148,7 @@ class DriverDSLImpl(
|
|||||||
val cordappsForAllNodes: Collection<TestCordappInternal>?,
|
val cordappsForAllNodes: Collection<TestCordappInternal>?,
|
||||||
val djvmBootstrapSource: Path?,
|
val djvmBootstrapSource: Path?,
|
||||||
val djvmCordaSource: List<Path>,
|
val djvmCordaSource: List<Path>,
|
||||||
val environmentVariables : Map<String, String>,
|
val environmentVariables: Map<String, String>,
|
||||||
val allowHibernateToManageAppSchema: Boolean = true
|
val allowHibernateToManageAppSchema: Boolean = true
|
||||||
) : InternalDriverDSL {
|
) : InternalDriverDSL {
|
||||||
|
|
||||||
@ -156,8 +157,10 @@ class DriverDSLImpl(
|
|||||||
private var _shutdownManager: ShutdownManager? = null
|
private var _shutdownManager: ShutdownManager? = null
|
||||||
override val shutdownManager get() = _shutdownManager!!
|
override val shutdownManager get() = _shutdownManager!!
|
||||||
private lateinit var extraCustomCordapps: Set<CustomCordapp>
|
private lateinit var extraCustomCordapps: Set<CustomCordapp>
|
||||||
|
|
||||||
// Map from a nodes legal name to an observable emitting the number of nodes in its network map.
|
// Map from a nodes legal name to an observable emitting the number of nodes in its network map.
|
||||||
private val networkVisibilityController = NetworkVisibilityController()
|
private val networkVisibilityController = NetworkVisibilityController()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Future which completes when the network map infrastructure is available, whether a local one or one from the CZ.
|
* Future which completes when the network map infrastructure is available, whether a local one or one from the CZ.
|
||||||
* This future acts as a gate to prevent nodes from starting too early. The value of the future is a [LocalNetworkMap]
|
* This future acts as a gate to prevent nodes from starting too early. The value of the future is a [LocalNetworkMap]
|
||||||
@ -274,7 +277,7 @@ class DriverDSLImpl(
|
|||||||
}
|
}
|
||||||
|
|
||||||
return registrationFuture.flatMap { conf ->
|
return registrationFuture.flatMap { conf ->
|
||||||
networkMapAvailability.flatMap {networkMap ->
|
networkMapAvailability.flatMap { networkMap ->
|
||||||
// But starting the node proper does require the network map
|
// But starting the node proper does require the network map
|
||||||
startRegisteredNode(conf, networkMap, parameters, bytemanPort)
|
startRegisteredNode(conf, networkMap, parameters, bytemanPort)
|
||||||
}
|
}
|
||||||
@ -380,9 +383,9 @@ class DriverDSLImpl(
|
|||||||
startOutOfProcessMiniNode(
|
startOutOfProcessMiniNode(
|
||||||
config,
|
config,
|
||||||
arrayOf(
|
arrayOf(
|
||||||
"initial-registration",
|
"initial-registration",
|
||||||
"--network-root-truststore=${rootTruststorePath.toAbsolutePath()}",
|
"--network-root-truststore=${rootTruststorePath.toAbsolutePath()}",
|
||||||
"--network-root-truststore-password=$rootTruststorePassword"
|
"--network-root-truststore-password=$rootTruststorePassword"
|
||||||
)
|
)
|
||||||
).map { config }
|
).map { config }
|
||||||
}
|
}
|
||||||
@ -424,13 +427,13 @@ class DriverDSLImpl(
|
|||||||
_shutdownManager = ShutdownManager(executorService)
|
_shutdownManager = ShutdownManager(executorService)
|
||||||
|
|
||||||
val callerPackage = getCallerPackage().toMutableList()
|
val callerPackage = getCallerPackage().toMutableList()
|
||||||
if(callerPackage.firstOrNull()?.startsWith("net.corda.node") == true) callerPackage.add("net.corda.testing")
|
if (callerPackage.firstOrNull()?.startsWith("net.corda.node") == true) callerPackage.add("net.corda.testing")
|
||||||
extraCustomCordapps = cordappsForPackages(extraCordappPackagesToScan + callerPackage)
|
extraCustomCordapps = cordappsForPackages(extraCordappPackagesToScan + callerPackage)
|
||||||
|
|
||||||
val notaryInfosFuture = if (compatibilityZone == null) {
|
val notaryInfosFuture = if (compatibilityZone == null) {
|
||||||
// If no CZ is specified then the driver does the generation of the network parameters and the copying of the
|
// If no CZ is specified then the driver does the generation of the network parameters and the copying of the
|
||||||
// node info files.
|
// node info files.
|
||||||
startNotaryIdentityGeneration().map { notaryInfos -> Pair(notaryInfos, LocalNetworkMap(notaryInfos.map{it.second})) }
|
startNotaryIdentityGeneration().map { notaryInfos -> Pair(notaryInfos, LocalNetworkMap(notaryInfos.map { it.second })) }
|
||||||
} else {
|
} else {
|
||||||
// Otherwise it's the CZ's job to distribute thse via the HTTP network map, as that is what the nodes will be expecting.
|
// Otherwise it's the CZ's job to distribute thse via the HTTP network map, as that is what the nodes will be expecting.
|
||||||
val notaryInfosFuture = if (compatibilityZone.rootCert == null) {
|
val notaryInfosFuture = if (compatibilityZone.rootCert == null) {
|
||||||
@ -441,7 +444,7 @@ class DriverDSLImpl(
|
|||||||
startAllNotaryRegistrations(compatibilityZone.rootCert, compatibilityZone)
|
startAllNotaryRegistrations(compatibilityZone.rootCert, compatibilityZone)
|
||||||
}
|
}
|
||||||
notaryInfosFuture.map { notaryInfos ->
|
notaryInfosFuture.map { notaryInfos ->
|
||||||
compatibilityZone.publishNotaries(notaryInfos.map{it.second})
|
compatibilityZone.publishNotaries(notaryInfos.map { it.second })
|
||||||
Pair(notaryInfos, null)
|
Pair(notaryInfos, null)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -449,14 +452,15 @@ class DriverDSLImpl(
|
|||||||
networkMapAvailability = notaryInfosFuture.map { it.second }
|
networkMapAvailability = notaryInfosFuture.map { it.second }
|
||||||
|
|
||||||
_notaries = notaryInfosFuture.map { (notaryInfos, localNetworkMap) ->
|
_notaries = notaryInfosFuture.map { (notaryInfos, localNetworkMap) ->
|
||||||
val listOfFutureNodeHandles = startNotaries(notaryInfos.map{it.first}, localNetworkMap, notaryCustomOverrides)
|
val listOfFutureNodeHandles = startNotaries(notaryInfos.map { it.first }, localNetworkMap, notaryCustomOverrides)
|
||||||
notaryInfos.zip(listOfFutureNodeHandles) { (_, notaryInfo), nodeHandlesFuture ->
|
notaryInfos.zip(listOfFutureNodeHandles) { (_, notaryInfo), nodeHandlesFuture ->
|
||||||
NotaryHandle(notaryInfo.identity, notaryInfo.validating, nodeHandlesFuture)
|
NotaryHandle(notaryInfo.identity, notaryInfo.validating, nodeHandlesFuture)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
_notaries.map { notary -> notary.map { handle -> handle.nodeHandles } }.getOrThrow(notaryHandleTimeout).forEach { future -> future.getOrThrow(notaryHandleTimeout) }
|
_notaries.map { notary -> notary.map { handle -> handle.nodeHandles } }.getOrThrow(notaryHandleTimeout)
|
||||||
} catch(e: NodeListenProcessDeathException) {
|
.forEach { future -> future.getOrThrow(notaryHandleTimeout) }
|
||||||
|
} catch (e: NodeListenProcessDeathException) {
|
||||||
val message = if (e.causeFromStdError.isNotBlank()) {
|
val message = if (e.causeFromStdError.isNotBlank()) {
|
||||||
"Unable to start notaries. Failed with the following error: ${e.causeFromStdError}"
|
"Unable to start notaries. Failed with the following error: ${e.causeFromStdError}"
|
||||||
} else {
|
} else {
|
||||||
@ -491,7 +495,7 @@ class DriverDSLImpl(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun startNotaryIdentityGeneration(): CordaFuture<List<Pair<NodeConfig,NotaryInfo>>> {
|
private fun startNotaryIdentityGeneration(): CordaFuture<List<Pair<NodeConfig, NotaryInfo>>> {
|
||||||
return executorService.fork {
|
return executorService.fork {
|
||||||
notarySpecs.map { spec ->
|
notarySpecs.map { spec ->
|
||||||
val notaryConfig = mapOf("notary" to mapOf("validating" to spec.validating))
|
val notaryConfig = mapOf("notary" to mapOf("validating" to spec.validating))
|
||||||
@ -541,32 +545,32 @@ class DriverDSLImpl(
|
|||||||
spec: NotarySpec,
|
spec: NotarySpec,
|
||||||
rootCert: X509Certificate,
|
rootCert: X509Certificate,
|
||||||
compatibilityZone: CompatibilityZoneParams
|
compatibilityZone: CompatibilityZoneParams
|
||||||
): CordaFuture<Pair<NodeConfig,NotaryInfo>> {
|
): CordaFuture<Pair<NodeConfig, NotaryInfo>> {
|
||||||
val parameters = NodeParameters(rpcUsers = spec.rpcUsers, verifierType = spec.verifierType, customOverrides = notaryCustomOverrides, maximumHeapSize = spec.maximumHeapSize)
|
val parameters = NodeParameters(rpcUsers = spec.rpcUsers, verifierType = spec.verifierType, customOverrides = notaryCustomOverrides, maximumHeapSize = spec.maximumHeapSize)
|
||||||
return createSchema(createConfig(spec.name, parameters), false).flatMap { config ->
|
return createSchema(createConfig(spec.name, parameters), false).flatMap { config ->
|
||||||
startNodeRegistration(config, rootCert, compatibilityZone.config())}.flatMap { config ->
|
startNodeRegistration(config, rootCert, compatibilityZone.config())
|
||||||
// Node registration only gives us the node CA cert, not the identity cert. That is only created on first
|
}.flatMap { config ->
|
||||||
// startup or when the node is told to just generate its node info file. We do that here.
|
// Node registration only gives us the node CA cert, not the identity cert. That is only created on first
|
||||||
if (startNodesInProcess) {
|
// startup or when the node is told to just generate its node info file. We do that here.
|
||||||
executorService.fork {
|
if (startNodesInProcess) {
|
||||||
val nodeInfo = Node(config.corda, MOCK_VERSION_INFO, initialiseSerialization = false).generateAndSaveNodeInfo()
|
executorService.fork {
|
||||||
Pair(config.withNotaryDefinition(spec.validating), NotaryInfo(nodeInfo.legalIdentities[0], spec.validating))
|
val nodeInfo = Node(config.corda, MOCK_VERSION_INFO, initialiseSerialization = false).generateAndSaveNodeInfo()
|
||||||
}
|
Pair(config.withNotaryDefinition(spec.validating), NotaryInfo(nodeInfo.legalIdentities[0], spec.validating))
|
||||||
} else {
|
}
|
||||||
// TODO The config we use here is uses a hardocded p2p port which changes when the node is run proper
|
} else {
|
||||||
// This causes two node info files to be generated.
|
// TODO The config we use here is uses a hardocded p2p port which changes when the node is run proper
|
||||||
startOutOfProcessMiniNode(config, arrayOf("generate-node-info")).map {
|
// This causes two node info files to be generated.
|
||||||
// Once done we have to read the signed node info file that's been generated
|
startOutOfProcessMiniNode(config, arrayOf("generate-node-info")).map {
|
||||||
val nodeInfoFile = config.corda.baseDirectory.list { paths ->
|
// Once done we have to read the signed node info file that's been generated
|
||||||
paths.filter { it.fileName.toString().startsWith(NodeInfoFilesCopier.NODE_INFO_FILE_NAME_PREFIX) }.findFirst()
|
val nodeInfoFile = config.corda.baseDirectory.list { paths ->
|
||||||
.get()
|
paths.filter { it.fileName.toString().startsWith(NodeInfoFilesCopier.NODE_INFO_FILE_NAME_PREFIX) }.findFirst()
|
||||||
}
|
.get()
|
||||||
val nodeInfo = nodeInfoFile.readObject<SignedNodeInfo>().verified()
|
|
||||||
Pair(config.withNotaryDefinition(spec.validating), NotaryInfo(nodeInfo.legalIdentities[0], spec.validating))
|
|
||||||
}
|
}
|
||||||
|
val nodeInfo = nodeInfoFile.readObject<SignedNodeInfo>().verified()
|
||||||
|
Pair(config.withNotaryDefinition(spec.validating), NotaryInfo(nodeInfo.legalIdentities[0], spec.validating))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun generateNodeNames(spec: NotarySpec): List<CordaX500Name> {
|
private fun generateNodeNames(spec: NotarySpec): List<CordaX500Name> {
|
||||||
@ -575,7 +579,7 @@ class DriverDSLImpl(
|
|||||||
|
|
||||||
private fun startNotaries(configs: List<NodeConfig>, localNetworkMap: LocalNetworkMap?, customOverrides: Map<String, Any?>): List<CordaFuture<List<NodeHandle>>> {
|
private fun startNotaries(configs: List<NodeConfig>, localNetworkMap: LocalNetworkMap?, customOverrides: Map<String, Any?>): List<CordaFuture<List<NodeHandle>>> {
|
||||||
return notarySpecs.zip(configs).map { (spec, config) ->
|
return notarySpecs.zip(configs).map { (spec, config) ->
|
||||||
when (spec.cluster) {
|
when (spec.cluster) {
|
||||||
null -> startSingleNotary(config, spec, localNetworkMap, customOverrides)
|
null -> startSingleNotary(config, spec, localNetworkMap, customOverrides)
|
||||||
is ClusterSpec.Raft,
|
is ClusterSpec.Raft,
|
||||||
// DummyCluster is used for testing the notary communication path, and it does not matter
|
// DummyCluster is used for testing the notary communication path, and it does not matter
|
||||||
@ -589,13 +593,13 @@ class DriverDSLImpl(
|
|||||||
private fun startSingleNotary(config: NodeConfig, spec: NotarySpec, localNetworkMap: LocalNetworkMap?, customOverrides: Map<String, Any?>): CordaFuture<List<NodeHandle>> {
|
private fun startSingleNotary(config: NodeConfig, spec: NotarySpec, localNetworkMap: LocalNetworkMap?, customOverrides: Map<String, Any?>): CordaFuture<List<NodeHandle>> {
|
||||||
val notaryConfig = mapOf("notary" to mapOf("validating" to spec.validating))
|
val notaryConfig = mapOf("notary" to mapOf("validating" to spec.validating))
|
||||||
return startRegisteredNode(
|
return startRegisteredNode(
|
||||||
config,
|
config,
|
||||||
localNetworkMap,
|
localNetworkMap,
|
||||||
NodeParameters(rpcUsers = spec.rpcUsers,
|
NodeParameters(rpcUsers = spec.rpcUsers,
|
||||||
verifierType = spec.verifierType,
|
verifierType = spec.verifierType,
|
||||||
startInSameProcess = spec.startInProcess,
|
startInSameProcess = spec.startInProcess,
|
||||||
customOverrides = notaryConfig + customOverrides,
|
customOverrides = notaryConfig + customOverrides,
|
||||||
maximumHeapSize = spec.maximumHeapSize)
|
maximumHeapSize = spec.maximumHeapSize)
|
||||||
).map { listOf(it) }
|
).map { listOf(it) }
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -762,14 +766,14 @@ class DriverDSLImpl(
|
|||||||
}
|
}
|
||||||
val effectiveP2PAddress = config.corda.messagingServerAddress ?: config.corda.p2pAddress
|
val effectiveP2PAddress = config.corda.messagingServerAddress ?: config.corda.p2pAddress
|
||||||
val p2pReadyFuture = nodeMustBeStartedFuture(
|
val p2pReadyFuture = nodeMustBeStartedFuture(
|
||||||
executorService,
|
executorService,
|
||||||
config.corda.baseDirectory / "net.corda.node.Corda.${identifier}.stdout.log",
|
config.corda.baseDirectory / "net.corda.node.Corda.${identifier}.stdout.log",
|
||||||
process
|
process
|
||||||
) {
|
) {
|
||||||
NodeListenProcessDeathException(
|
NodeListenProcessDeathException(
|
||||||
effectiveP2PAddress,
|
effectiveP2PAddress,
|
||||||
process,
|
process,
|
||||||
(config.corda.baseDirectory / "net.corda.node.Corda.$identifier.stderr.log").readText()
|
(config.corda.baseDirectory / "net.corda.node.Corda.$identifier.stderr.log").readText()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -808,6 +812,7 @@ class DriverDSLImpl(
|
|||||||
*/
|
*/
|
||||||
inner class LocalNetworkMap(notaryInfos: List<NotaryInfo>) {
|
inner class LocalNetworkMap(notaryInfos: List<NotaryInfo>) {
|
||||||
val networkParametersCopier = NetworkParametersCopier(networkParameters.copy(notaries = notaryInfos))
|
val networkParametersCopier = NetworkParametersCopier(networkParameters.copy(notaries = notaryInfos))
|
||||||
|
|
||||||
// TODO: this object will copy NodeInfo files from started nodes to other nodes additional-node-infos/
|
// TODO: this object will copy NodeInfo files from started nodes to other nodes additional-node-infos/
|
||||||
// This uses the FileSystem and adds a delay (~5 seconds) given by the time we wait before polling the file system.
|
// This uses the FileSystem and adds a delay (~5 seconds) given by the time we wait before polling the file system.
|
||||||
// Investigate whether we can avoid that.
|
// Investigate whether we can avoid that.
|
||||||
@ -836,6 +841,7 @@ class DriverDSLImpl(
|
|||||||
private val notaryHandleTimeout = Duration.ofMinutes(1)
|
private val notaryHandleTimeout = Duration.ofMinutes(1)
|
||||||
private val defaultRpcUserList = listOf(InternalUser("default", "default", setOf("ALL")).toConfig().root().unwrapped())
|
private val defaultRpcUserList = listOf(InternalUser("default", "default", setOf("ALL")).toConfig().root().unwrapped())
|
||||||
private val names = arrayOf(ALICE_NAME, BOB_NAME, DUMMY_BANK_A_NAME)
|
private val names = arrayOf(ALICE_NAME, BOB_NAME, DUMMY_BANK_A_NAME)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A sub-set of permissions that grant most of the essential operations used in the unit/integration tests as well as
|
* A sub-set of permissions that grant most of the essential operations used in the unit/integration tests as well as
|
||||||
* in demo application like NodeExplorer.
|
* in demo application like NodeExplorer.
|
||||||
@ -860,14 +866,14 @@ class DriverDSLImpl(
|
|||||||
private const val CORDA_TESTING_ATTRIBUTE = "Corda-Testing"
|
private const val CORDA_TESTING_ATTRIBUTE = "Corda-Testing"
|
||||||
|
|
||||||
private val CORDAPP_MANIFEST_ATTRIBUTES: List<String> = unmodifiableList(listOf(
|
private val CORDAPP_MANIFEST_ATTRIBUTES: List<String> = unmodifiableList(listOf(
|
||||||
CORDAPP_CONTRACT_NAME,
|
CORDAPP_CONTRACT_NAME,
|
||||||
CORDAPP_CONTRACT_LICENCE,
|
CORDAPP_CONTRACT_LICENCE,
|
||||||
CORDAPP_CONTRACT_VENDOR,
|
CORDAPP_CONTRACT_VENDOR,
|
||||||
CORDAPP_CONTRACT_VERSION,
|
CORDAPP_CONTRACT_VERSION,
|
||||||
CORDAPP_WORKFLOW_NAME,
|
CORDAPP_WORKFLOW_NAME,
|
||||||
CORDAPP_WORKFLOW_LICENCE,
|
CORDAPP_WORKFLOW_LICENCE,
|
||||||
CORDAPP_WORKFLOW_VENDOR,
|
CORDAPP_WORKFLOW_VENDOR,
|
||||||
CORDAPP_WORKFLOW_VERSION
|
CORDAPP_WORKFLOW_VERSION
|
||||||
))
|
))
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -942,7 +948,7 @@ class DriverDSLImpl(
|
|||||||
maximumHeapSize: String,
|
maximumHeapSize: String,
|
||||||
logLevelOverride: String?,
|
logLevelOverride: String?,
|
||||||
identifier: String,
|
identifier: String,
|
||||||
environmentVariables : Map<String,String>,
|
environmentVariables: Map<String, String>,
|
||||||
extraCmdLineFlag: Array<String> = emptyArray()
|
extraCmdLineFlag: Array<String> = emptyArray()
|
||||||
): Process {
|
): Process {
|
||||||
log.info("Starting out-of-process Node ${config.corda.myLegalName.organisation}, " +
|
log.info("Starting out-of-process Node ${config.corda.myLegalName.organisation}, " +
|
||||||
@ -983,7 +989,6 @@ class DriverDSLImpl(
|
|||||||
else -> "DEBUG"
|
else -> "DEBUG"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
val arguments = mutableListOf(
|
val arguments = mutableListOf(
|
||||||
"--base-directory=${config.corda.baseDirectory}",
|
"--base-directory=${config.corda.baseDirectory}",
|
||||||
"--logging-level=$loggingLevel",
|
"--logging-level=$loggingLevel",
|
||||||
@ -1007,11 +1012,11 @@ class DriverDSLImpl(
|
|||||||
|
|
||||||
// The following dependencies are excluded from the classpath of the created JVM,
|
// The following dependencies are excluded from the classpath of the created JVM,
|
||||||
// so that the environment resembles a real one as close as possible.
|
// so that the environment resembles a real one as close as possible.
|
||||||
val cp = ProcessUtilities.defaultClassPath.filter { cpEntry ->
|
val cp = ProcessUtilities.defaultClassPath.filter { cpEntry ->
|
||||||
val cpPathEntry = Paths.get(cpEntry)
|
val cpPathEntry = Paths.get(cpEntry)
|
||||||
cpPathEntry.isRegularFile()
|
cpPathEntry.isRegularFile()
|
||||||
&& !isTestArtifact(cpPathEntry.fileName.toString())
|
&& !isTestArtifact(cpPathEntry.fileName.toString())
|
||||||
&& !cpPathEntry.isExcludedJar
|
&& !cpPathEntry.isExcludedJar
|
||||||
}
|
}
|
||||||
|
|
||||||
return ProcessUtilities.startJavaProcess(
|
return ProcessUtilities.startJavaProcess(
|
||||||
@ -1050,12 +1055,13 @@ class DriverDSLImpl(
|
|||||||
|| (manifest[TARGET_PLATFORM_VERSION] != null && manifest[MIN_PLATFORM_VERSION] != null)
|
|| (manifest[TARGET_PLATFORM_VERSION] != null && manifest[MIN_PLATFORM_VERSION] != null)
|
||||||
}
|
}
|
||||||
|
|
||||||
private val Path.isExcludedJar: Boolean get() {
|
private val Path.isExcludedJar: Boolean
|
||||||
return JarInputStream(Files.newInputStream(this).buffered()).use { jar ->
|
get() {
|
||||||
val manifest = jar.manifest ?: return false
|
return JarInputStream(Files.newInputStream(this).buffered()).use { jar ->
|
||||||
isCordapp(manifest) || isTestArtifact(manifest)
|
val manifest = jar.manifest ?: return false
|
||||||
|
isCordapp(manifest) || isTestArtifact(manifest)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private fun startWebserver(handle: NodeHandleInternal, debugPort: Int?, maximumHeapSize: String): Process {
|
private fun startWebserver(handle: NodeHandleInternal, debugPort: Int?, maximumHeapSize: String): Process {
|
||||||
val className = "net.corda.webserver.WebServer"
|
val className = "net.corda.webserver.WebServer"
|
||||||
@ -1224,8 +1230,8 @@ interface InternalDriverDSL : DriverDSL {
|
|||||||
fun shutdown()
|
fun shutdown()
|
||||||
|
|
||||||
fun startNode(
|
fun startNode(
|
||||||
parameters: NodeParameters = NodeParameters(),
|
parameters: NodeParameters = NodeParameters(),
|
||||||
bytemanPort: Int? = null
|
bytemanPort: Int? = null
|
||||||
): CordaFuture<NodeHandle>
|
): CordaFuture<NodeHandle>
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1272,28 +1278,28 @@ fun <DI : DriverDSL, D : InternalDriverDSL, A> genericDriver(
|
|||||||
): A {
|
): A {
|
||||||
setDriverSerialization().use { _ ->
|
setDriverSerialization().use { _ ->
|
||||||
val driverDsl = driverDslWrapper(
|
val driverDsl = driverDslWrapper(
|
||||||
DriverDSLImpl(
|
DriverDSLImpl(
|
||||||
portAllocation = defaultParameters.portAllocation,
|
portAllocation = defaultParameters.portAllocation,
|
||||||
debugPortAllocation = defaultParameters.debugPortAllocation,
|
debugPortAllocation = defaultParameters.debugPortAllocation,
|
||||||
systemProperties = defaultParameters.systemProperties,
|
systemProperties = defaultParameters.systemProperties,
|
||||||
driverDirectory = defaultParameters.driverDirectory.toAbsolutePath(),
|
driverDirectory = defaultParameters.driverDirectory.toAbsolutePath(),
|
||||||
useTestClock = defaultParameters.useTestClock,
|
useTestClock = defaultParameters.useTestClock,
|
||||||
isDebug = defaultParameters.isDebug,
|
isDebug = defaultParameters.isDebug,
|
||||||
startNodesInProcess = defaultParameters.startNodesInProcess,
|
startNodesInProcess = defaultParameters.startNodesInProcess,
|
||||||
waitForAllNodesToFinish = defaultParameters.waitForAllNodesToFinish,
|
waitForAllNodesToFinish = defaultParameters.waitForAllNodesToFinish,
|
||||||
extraCordappPackagesToScan = @Suppress("DEPRECATION") defaultParameters.extraCordappPackagesToScan,
|
extraCordappPackagesToScan = @Suppress("DEPRECATION") defaultParameters.extraCordappPackagesToScan,
|
||||||
jmxPolicy = defaultParameters.jmxPolicy,
|
jmxPolicy = defaultParameters.jmxPolicy,
|
||||||
notarySpecs = defaultParameters.notarySpecs,
|
notarySpecs = defaultParameters.notarySpecs,
|
||||||
compatibilityZone = null,
|
compatibilityZone = null,
|
||||||
networkParameters = defaultParameters.networkParameters,
|
networkParameters = defaultParameters.networkParameters,
|
||||||
notaryCustomOverrides = defaultParameters.notaryCustomOverrides,
|
notaryCustomOverrides = defaultParameters.notaryCustomOverrides,
|
||||||
inMemoryDB = defaultParameters.inMemoryDB,
|
inMemoryDB = defaultParameters.inMemoryDB,
|
||||||
cordappsForAllNodes = uncheckedCast(defaultParameters.cordappsForAllNodes),
|
cordappsForAllNodes = uncheckedCast(defaultParameters.cordappsForAllNodes),
|
||||||
djvmBootstrapSource = defaultParameters.djvmBootstrapSource,
|
djvmBootstrapSource = defaultParameters.djvmBootstrapSource,
|
||||||
djvmCordaSource = defaultParameters.djvmCordaSource,
|
djvmCordaSource = defaultParameters.djvmCordaSource,
|
||||||
environmentVariables = defaultParameters.environmentVariables,
|
environmentVariables = defaultParameters.environmentVariables,
|
||||||
allowHibernateToManageAppSchema = defaultParameters.allowHibernateToManageAppSchema
|
allowHibernateToManageAppSchema = defaultParameters.allowHibernateToManageAppSchema
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
val shutdownHook = addShutdownHook(driverDsl::shutdown)
|
val shutdownHook = addShutdownHook(driverDsl::shutdown)
|
||||||
try {
|
try {
|
||||||
@ -1328,7 +1334,7 @@ sealed class CompatibilityZoneParams(
|
|||||||
) {
|
) {
|
||||||
abstract fun networkMapURL(): URL
|
abstract fun networkMapURL(): URL
|
||||||
abstract fun doormanURL(): URL
|
abstract fun doormanURL(): URL
|
||||||
abstract fun config() : NetworkServicesConfig
|
abstract fun config(): NetworkServicesConfig
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1336,18 +1342,18 @@ sealed class CompatibilityZoneParams(
|
|||||||
*/
|
*/
|
||||||
class SharedCompatibilityZoneParams(
|
class SharedCompatibilityZoneParams(
|
||||||
private val url: URL,
|
private val url: URL,
|
||||||
private val pnm : UUID?,
|
private val pnm: UUID?,
|
||||||
publishNotaries: (List<NotaryInfo>) -> Unit,
|
publishNotaries: (List<NotaryInfo>) -> Unit,
|
||||||
rootCert: X509Certificate? = null
|
rootCert: X509Certificate? = null
|
||||||
) : CompatibilityZoneParams(publishNotaries, rootCert) {
|
) : CompatibilityZoneParams(publishNotaries, rootCert) {
|
||||||
|
|
||||||
val config : NetworkServicesConfig by lazy {
|
val config: NetworkServicesConfig by lazy {
|
||||||
NetworkServicesConfig(url, url, pnm, false)
|
NetworkServicesConfig(url, url, pnm, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun doormanURL() = url
|
override fun doormanURL() = url
|
||||||
override fun networkMapURL() = url
|
override fun networkMapURL() = url
|
||||||
override fun config() : NetworkServicesConfig = config
|
override fun config(): NetworkServicesConfig = config
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1356,17 +1362,17 @@ class SharedCompatibilityZoneParams(
|
|||||||
class SplitCompatibilityZoneParams(
|
class SplitCompatibilityZoneParams(
|
||||||
private val doormanURL: URL,
|
private val doormanURL: URL,
|
||||||
private val networkMapURL: URL,
|
private val networkMapURL: URL,
|
||||||
private val pnm : UUID?,
|
private val pnm: UUID?,
|
||||||
publishNotaries: (List<NotaryInfo>) -> Unit,
|
publishNotaries: (List<NotaryInfo>) -> Unit,
|
||||||
rootCert: X509Certificate? = null
|
rootCert: X509Certificate? = null
|
||||||
) : CompatibilityZoneParams(publishNotaries, rootCert) {
|
) : CompatibilityZoneParams(publishNotaries, rootCert) {
|
||||||
val config : NetworkServicesConfig by lazy {
|
val config: NetworkServicesConfig by lazy {
|
||||||
NetworkServicesConfig(doormanURL, networkMapURL, pnm, false)
|
NetworkServicesConfig(doormanURL, networkMapURL, pnm, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun doormanURL() = doormanURL
|
override fun doormanURL() = doormanURL
|
||||||
override fun networkMapURL() = networkMapURL
|
override fun networkMapURL() = networkMapURL
|
||||||
override fun config() : NetworkServicesConfig = config
|
override fun config(): NetworkServicesConfig = config
|
||||||
}
|
}
|
||||||
|
|
||||||
@Suppress("LongParameterList")
|
@Suppress("LongParameterList")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user