Reformat files in tools

This commit is contained in:
Tommy Lillehagen 2017-10-06 15:36:56 +01:00
parent fcc4bdae7e
commit b053449b74
11 changed files with 26 additions and 18 deletions

View File

@ -88,7 +88,7 @@ class Explorer internal constructor(private val explorerController: ExplorerCont
try {
// Try making a symlink to make things faster and use less disk space.
Files.createSymbolicLink(destPath, path)
} catch(e: UnsupportedOperationException) {
} catch (e: UnsupportedOperationException) {
// OS doesn't support symbolic links?
Files.copy(path, destPath, REPLACE_EXISTING)
} catch (e: java.nio.file.FileAlreadyExistsException) {

View File

@ -62,7 +62,7 @@ class NodeConfig constructor(
fun toText(): String = toFileConfig().root().render(renderOptions)
fun moveTo(baseDir: Path) = NodeConfig(
baseDir, legalName, p2pPort, rpcPort, webPort, h2Port, extraServices, users, networkMap
baseDir, legalName, p2pPort, rpcPort, webPort, h2Port, extraServices, users, networkMap
)
fun install(plugins: Collection<Path>) {

View File

@ -33,9 +33,10 @@ class NodeController(check: atRuntime = ::checkExists) : Controller() {
private var networkMapConfig: NetworkMapConfig? = null
val activeNodes: List<NodeConfig> get() = nodes.values.filter {
(it.state == NodeState.RUNNING) || (it.state == NodeState.STARTING)
}
val activeNodes: List<NodeConfig>
get() = nodes.values.filter {
(it.state == NodeState.RUNNING) || (it.state == NodeState.STARTING)
}
init {
log.info("Base directory: $baseDir")

View File

@ -28,8 +28,7 @@ class ServiceController(resourceName: String = "/services.conf") : Controller()
val service = line.split(":").map { it.trim() }
if (service.size != 2) {
log.warning("Encountered corrupted line '$line' while reading services from config: $url")
}
else {
} else {
map[service[1]] = service[0]
log.info("Supports: $service")
}

View File

@ -179,9 +179,9 @@ class NodeTerminalView : Fragment() {
}
private fun launchRPC(config: NodeConfig) = NodeRPC(
config = config,
start = this::initialise,
invoke = this::pollCashBalances
config = config,
start = this::initialise,
invoke = this::pollCashBalances
)
private fun initialise(config: NodeConfig, ops: CordaRPCOps) {
@ -238,7 +238,10 @@ class NodeTerminalView : Fragment() {
header.isDisable = true
subscriptions.forEach {
// Don't allow any exceptions here to halt tab destruction.
try { it.unsubscribe() } catch (e: Exception) {}
try {
it.unsubscribe()
} catch (e: Exception) {
}
}
webServer.close()
explorer.close()

View File

@ -98,7 +98,7 @@ class WebServer internal constructor(private val webServerController: WebServerC
conn.connect()
conn.disconnect()
return url
} catch(e: IOException) {
} catch (e: IOException) {
}
}
throw TimeoutException("Web server did not start within ${timeout.seconds} seconds")

View File

@ -25,7 +25,8 @@ class LoggingTestSuite {
*/
companion object {
@BeforeClass
@JvmStatic fun `setup logging`() {
@JvmStatic
fun `setup logging`() {
LoggingConfig()
}
}

View File

@ -7,10 +7,11 @@ enum class Positivity {
Negative
}
val Positivity.sign: String get() = when (this) {
Positivity.Positive -> ""
Positivity.Negative -> "-"
}
val Positivity.sign: String
get() = when (this) {
Positivity.Positive -> ""
Positivity.Negative -> "-"
}
data class AmountDiff<T : Any>(
val positivity: Positivity,

View File

@ -47,6 +47,7 @@ fun setupJSchWithSshAgent(): JSch {
override fun getSignature(data: ByteArray?) = agentProxy.sign(identity.blob, data)
@Suppress("OverridingDeprecatedMember")
override fun decrypt() = true
override fun getPublicKeyBlob() = identity.blob
override fun setPassphrase(passphrase: ByteArray?) = true
}

View File

@ -45,6 +45,7 @@ val isNotary = { node: NodeConnection ->
val notaries = node.proxy.notaryIdentities()
node.info.legalIdentities.any { it in notaries }
}
fun <A> ((A) -> Boolean).or(other: (A) -> Boolean): (A) -> Boolean = { this(it) || other(it) }
fun hang(hangIntervalRange: LongRange) = Disruption("Hang randomly") { node, random ->

View File

@ -182,7 +182,8 @@ fun runLoadTests(configuration: LoadTestConfiguration, tests: List<Pair<LoadTest
val info = connection.info
log.info("Got node info of ${connection.remoteNode.hostname}: $info!")
val otherInfo = connection.proxy.networkMapSnapshot()
val pubKeysString = otherInfo.map { // TODO Rethink, we loose ability for nice showing of NodeInfos.
val pubKeysString = otherInfo.map {
// TODO Rethink, we loose ability for nice showing of NodeInfos.
"NodeInfo identities set:\n" +
it.legalIdentitiesAndCerts.fold("") { acc, elem -> acc + "\n" + elem.name + ": " + elem.owningKey.toBase58String() }
}.joinToString("\n")