NOTICK Reformat DriverDSLImpl.kt (#6685)

Reformat DriverDSLImpl to standard IntelliJ style
This commit is contained in:
Ross Nicoll 2020-09-01 19:40:39 +01:00 committed by GitHub
parent b895a976a7
commit b1e2d6a48c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,4 +1,5 @@
@file:Suppress("TooManyFunctions", "Deprecation")
package net.corda.testing.node.internal
import co.paralleluniverse.fibers.instrument.JavaAgent
@ -156,8 +157,10 @@ class DriverDSLImpl(
private var _shutdownManager: ShutdownManager? = null
override val shutdownManager get() = _shutdownManager!!
private lateinit var extraCustomCordapps: Set<CustomCordapp>
// Map from a nodes legal name to an observable emitting the number of nodes in its network map.
private val networkVisibilityController = NetworkVisibilityController()
/**
* 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]
@ -455,7 +458,8 @@ class DriverDSLImpl(
}
}
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)
.forEach { future -> future.getOrThrow(notaryHandleTimeout) }
} catch (e: NodeListenProcessDeathException) {
val message = if (e.causeFromStdError.isNotBlank()) {
"Unable to start notaries. Failed with the following error: ${e.causeFromStdError}"
@ -544,7 +548,8 @@ class DriverDSLImpl(
): CordaFuture<Pair<NodeConfig, NotaryInfo>> {
val parameters = NodeParameters(rpcUsers = spec.rpcUsers, verifierType = spec.verifierType, customOverrides = notaryCustomOverrides, maximumHeapSize = spec.maximumHeapSize)
return createSchema(createConfig(spec.name, parameters), false).flatMap { config ->
startNodeRegistration(config, rootCert, compatibilityZone.config())}.flatMap { config ->
startNodeRegistration(config, rootCert, compatibilityZone.config())
}.flatMap { config ->
// Node registration only gives us the node CA cert, not the identity cert. That is only created on first
// startup or when the node is told to just generate its node info file. We do that here.
if (startNodesInProcess) {
@ -566,7 +571,6 @@ class DriverDSLImpl(
}
}
}
}
private fun generateNodeNames(spec: NotarySpec): List<CordaX500Name> {
@ -808,6 +812,7 @@ class DriverDSLImpl(
*/
inner class LocalNetworkMap(notaryInfos: List<NotaryInfo>) {
val networkParametersCopier = NetworkParametersCopier(networkParameters.copy(notaries = notaryInfos))
// 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.
// Investigate whether we can avoid that.
@ -836,6 +841,7 @@ class DriverDSLImpl(
private val notaryHandleTimeout = Duration.ofMinutes(1)
private val defaultRpcUserList = listOf(InternalUser("default", "default", setOf("ALL")).toConfig().root().unwrapped())
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
* in demo application like NodeExplorer.
@ -983,7 +989,6 @@ class DriverDSLImpl(
else -> "DEBUG"
}
val arguments = mutableListOf(
"--base-directory=${config.corda.baseDirectory}",
"--logging-level=$loggingLevel",
@ -1050,7 +1055,8 @@ class DriverDSLImpl(
|| (manifest[TARGET_PLATFORM_VERSION] != null && manifest[MIN_PLATFORM_VERSION] != null)
}
private val Path.isExcludedJar: Boolean get() {
private val Path.isExcludedJar: Boolean
get() {
return JarInputStream(Files.newInputStream(this).buffered()).use { jar ->
val manifest = jar.manifest ?: return false
isCordapp(manifest) || isTestArtifact(manifest)