From 4d6d4c167ec7cb46ec86ed8160640d4521be5848 Mon Sep 17 00:00:00 2001 From: Mike Hearn Date: Tue, 11 Apr 2017 12:54:17 +0200 Subject: [PATCH] Minor: auto-format of module: tools, verifier --- tools/demobench/build.gradle | 16 +-- .../corda/demobench/config/LoggingConfig.java | 9 +- .../kotlin/net/corda/demobench/DemoBench.kt | 7 +- .../net/corda/demobench/explorer/Explorer.kt | 6 +- .../demobench/explorer/ExplorerController.kt | 2 +- .../corda/demobench/model/InstallFactory.kt | 35 +++--- .../net/corda/demobench/model/JVMConfig.kt | 6 +- .../net/corda/demobench/model/NodeConfig.kt | 9 +- .../corda/demobench/model/NodeController.kt | 22 ++-- .../net/corda/demobench/model/NodeData.kt | 2 +- .../corda/demobench/model/NodeDataModel.kt | 2 +- .../demobench/model/ServiceController.kt | 2 +- .../kotlin/net/corda/demobench/model/User.kt | 13 ++- .../demobench/plugin/PluginController.kt | 10 +- .../demobench/profile/ProfileController.kt | 73 ++++++------ .../demobench/pty/PtyProcessTtyConnector.kt | 14 +-- .../kotlin/net/corda/demobench/pty/R3Pty.kt | 6 +- .../kotlin/net/corda/demobench/rpc/NodeRPC.kt | 8 +- .../net/corda/demobench/ui/PropertyLabel.kt | 2 +- .../corda/demobench/views/DemoBenchView.kt | 2 +- .../net/corda/demobench/views/NodeTabView.kt | 6 +- .../corda/demobench/views/NodeTerminalView.kt | 14 ++- .../net/corda/demobench/web/DBViewer.kt | 14 +-- .../net/corda/demobench/web/WebServer.kt | 6 +- .../demobench/web/WebServerController.kt | 2 +- tools/demobench/src/main/resources/log4j2.xml | 2 +- .../src/main/resources/logging.properties | 2 +- .../resources/net/corda/demobench/style.css | 2 +- .../corda/demobench/views/DemoBenchView.fxml | 20 ++-- .../demobench/views/NodeTerminalView.fxml | 34 +++--- .../net/corda/demobench/LoggingTestSuite.kt | 6 +- .../corda/demobench/model/JVMConfigTest.kt | 11 +- .../demobench/model/NetworkMapConfigTest.kt | 2 +- .../corda/demobench/model/NodeConfigTest.kt | 108 +++++++++--------- .../demobench/model/NodeControllerTest.kt | 4 +- .../demobench/model/ServiceControllerTest.kt | 4 +- .../net/corda/demobench/model/UserTest.kt | 6 +- .../src/test/resources/log4j2-test.xml | 2 +- .../src/main/java/ExplorerCaplet.java | 7 +- .../kotlin/net/corda/explorer/AmountDiff.kt | 4 +- .../corda/explorer/model/CordaViewModel.kt | 4 +- .../net/corda/explorer/model/IssuerModel.kt | 6 +- .../explorer/model/ReportingCurrencyModel.kt | 4 +- .../net/corda/explorer/model/SettingsModel.kt | 2 +- .../corda/explorer/plugin/ExplorerPlugin.kt | 6 +- .../net/corda/explorer/views/GuiUtilities.kt | 1 + .../net/corda/explorer/views/SearchField.kt | 3 +- .../corda/explorer/views/TransactionViewer.kt | 4 +- .../net/corda/explorer/css/corda.css | 7 +- .../net/corda/explorer/views/LoginView.fxml | 5 +- tools/loadtest/build.gradle | 6 +- .../net/corda/loadtest/ConnectionManager.kt | 2 +- .../kotlin/net/corda/loadtest/LoadTest.kt | 1 - .../net/corda/verifier/GeneratedLedger.kt | 1 + .../net/corda/verifier/VerifierDriver.kt | 5 + 55 files changed, 283 insertions(+), 276 deletions(-) diff --git a/tools/demobench/build.gradle b/tools/demobench/build.gradle index 53529745e4..84e154a21a 100644 --- a/tools/demobench/build.gradle +++ b/tools/demobench/build.gradle @@ -24,8 +24,8 @@ evaluationDependsOn(':tools:explorer:capsule') mainClassName = 'net.corda.demobench.DemoBench' applicationDefaultJvmArgs = [ - '-Djava.util.logging.config.class=net.corda.demobench.config.LoggingConfig', - '-Dorg.jboss.logging.provider=slf4j' + '-Djava.util.logging.config.class=net.corda.demobench.config.LoggingConfig', + '-Dorg.jboss.logging.provider=slf4j' ] repositories { @@ -76,9 +76,9 @@ dependencies { jar { manifest { attributes( - 'Corda-Version': corda_version, - 'Main-Class': mainClassName, - 'Class-Path': configurations.compile.collect { it.getName() }.join(' ') + 'Corda-Version': corda_version, + 'Main-Class': mainClassName, + 'Class-Path': configurations.compile.collect { it.getName() }.join(' ') ) } } @@ -116,7 +116,7 @@ distributions { rename 'bank-of-corda-demo-(.*)', 'bank-of-corda.jar' into 'plugins' } - } + } } } @@ -164,8 +164,8 @@ task javapackage(dependsOn: 'distZip') { } ant.taskdef( - resource: 'com/sun/javafx/tools/ant/antlib.xml', - classpath: "$pkg_source:$java_home/../lib/ant-javafx.jar" + resource: 'com/sun/javafx/tools/ant/antlib.xml', + classpath: "$pkg_source:$java_home/../lib/ant-javafx.jar" ) ant.deploy(nativeBundles: packageType, outdir: pkg_outDir, outfile: 'DemoBench', verbose: 'true') { diff --git a/tools/demobench/src/main/java/net/corda/demobench/config/LoggingConfig.java b/tools/demobench/src/main/java/net/corda/demobench/config/LoggingConfig.java index 44e4c4b251..55e8369df1 100644 --- a/tools/demobench/src/main/java/net/corda/demobench/config/LoggingConfig.java +++ b/tools/demobench/src/main/java/net/corda/demobench/config/LoggingConfig.java @@ -1,11 +1,8 @@ package net.corda.demobench.config; -import java.io.IOException; -import java.io.InputStream; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.logging.LogManager; +import java.io.*; +import java.nio.file.*; +import java.util.logging.*; /** * Configuration class for JUL / TornadoFX. diff --git a/tools/demobench/src/main/kotlin/net/corda/demobench/DemoBench.kt b/tools/demobench/src/main/kotlin/net/corda/demobench/DemoBench.kt index f2a977737a..dcfa62ecce 100644 --- a/tools/demobench/src/main/kotlin/net/corda/demobench/DemoBench.kt +++ b/tools/demobench/src/main/kotlin/net/corda/demobench/DemoBench.kt @@ -1,11 +1,10 @@ package net.corda.demobench -import java.io.InputStreamReader -import java.nio.charset.StandardCharsets.UTF_8 import javafx.scene.image.Image import net.corda.demobench.views.DemoBenchView -import tornadofx.App -import tornadofx.addStageIcon +import tornadofx.* +import java.io.InputStreamReader +import java.nio.charset.StandardCharsets.UTF_8 /** * README! diff --git a/tools/demobench/src/main/kotlin/net/corda/demobench/explorer/Explorer.kt b/tools/demobench/src/main/kotlin/net/corda/demobench/explorer/Explorer.kt index f30d300c51..44f74cbfdd 100644 --- a/tools/demobench/src/main/kotlin/net/corda/demobench/explorer/Explorer.kt +++ b/tools/demobench/src/main/kotlin/net/corda/demobench/explorer/Explorer.kt @@ -1,11 +1,11 @@ package net.corda.demobench.explorer -import java.io.IOException -import java.util.concurrent.Executors import net.corda.core.utilities.loggerFor -import net.corda.demobench.readErrorLines import net.corda.demobench.model.NodeConfig import net.corda.demobench.model.forceDirectory +import net.corda.demobench.readErrorLines +import java.io.IOException +import java.util.concurrent.Executors class Explorer internal constructor(private val explorerController: ExplorerController) : AutoCloseable { private companion object { diff --git a/tools/demobench/src/main/kotlin/net/corda/demobench/explorer/ExplorerController.kt b/tools/demobench/src/main/kotlin/net/corda/demobench/explorer/ExplorerController.kt index 32813e627b..80351ed4f1 100644 --- a/tools/demobench/src/main/kotlin/net/corda/demobench/explorer/ExplorerController.kt +++ b/tools/demobench/src/main/kotlin/net/corda/demobench/explorer/ExplorerController.kt @@ -1,7 +1,7 @@ package net.corda.demobench.explorer import net.corda.demobench.model.JVMConfig -import tornadofx.Controller +import tornadofx.* class ExplorerController : Controller() { diff --git a/tools/demobench/src/main/kotlin/net/corda/demobench/model/InstallFactory.kt b/tools/demobench/src/main/kotlin/net/corda/demobench/model/InstallFactory.kt index 76aed4ae8c..42589e194b 100644 --- a/tools/demobench/src/main/kotlin/net/corda/demobench/model/InstallFactory.kt +++ b/tools/demobench/src/main/kotlin/net/corda/demobench/model/InstallFactory.kt @@ -2,9 +2,10 @@ package net.corda.demobench.model import com.google.common.net.HostAndPort import com.typesafe.config.Config +import tornadofx.* import java.io.IOException -import java.nio.file.* -import tornadofx.Controller +import java.nio.file.Files +import java.nio.file.Path class InstallFactory : Controller() { @@ -21,15 +22,15 @@ class InstallFactory : Controller() { val tempDir = Files.createTempDirectory(baseDir, ".node") val nodeConfig = NodeConfig( - tempDir, - config.getString("myLegalName"), - p2pPort, - rpcPort, - config.getString("nearestCity"), - webPort, - h2Port, - extraServices, - config.getObjectList("rpcUsers").map { toUser(it.unwrapped()) }.toList() + tempDir, + config.getString("myLegalName"), + p2pPort, + rpcPort, + config.getString("nearestCity"), + webPort, + h2Port, + extraServices, + config.getObjectList("rpcUsers").map { toUser(it.unwrapped()) }.toList() ) if (config.hasPath("networkMapService")) { @@ -38,7 +39,7 @@ class InstallFactory : Controller() { } else { log.info("Node '${nodeConfig.legalName}' is the network map") } - + return InstallConfig(tempDir, nodeConfig) } @@ -52,11 +53,11 @@ class InstallFactory : Controller() { private fun Config.parseExtraServices(path: String): List { val services = serviceController.services.toSortedSet() return this.getStringList(path) - .filter { !it.isNullOrEmpty() } - .map { svc -> - require(svc in services, { "Unknown service '$svc'." } ) - svc - }.toList() + .filter { !it.isNullOrEmpty() } + .map { svc -> + require(svc in services, { "Unknown service '$svc'." }) + svc + }.toList() } } diff --git a/tools/demobench/src/main/kotlin/net/corda/demobench/model/JVMConfig.kt b/tools/demobench/src/main/kotlin/net/corda/demobench/model/JVMConfig.kt index 5be963a0a9..3e4c3d1652 100644 --- a/tools/demobench/src/main/kotlin/net/corda/demobench/model/JVMConfig.kt +++ b/tools/demobench/src/main/kotlin/net/corda/demobench/model/JVMConfig.kt @@ -1,11 +1,11 @@ package net.corda.demobench.model -import java.nio.file.Path -import java.nio.file.Paths import javafx.scene.control.Alert import javafx.scene.control.Alert.AlertType.ERROR import javafx.stage.Stage -import tornadofx.Controller +import tornadofx.* +import java.nio.file.Path +import java.nio.file.Paths class JVMConfig : Controller() { diff --git a/tools/demobench/src/main/kotlin/net/corda/demobench/model/NodeConfig.kt b/tools/demobench/src/main/kotlin/net/corda/demobench/model/NodeConfig.kt index af6463e830..ea2bf4ecfe 100644 --- a/tools/demobench/src/main/kotlin/net/corda/demobench/model/NodeConfig.kt +++ b/tools/demobench/src/main/kotlin/net/corda/demobench/model/NodeConfig.kt @@ -47,9 +47,10 @@ class NodeConfig( .withValue("nearestCity", valueFor(nearestCity)) .withValue("extraAdvertisedServiceIds", valueFor(extraServices)) .withFallback(optional("networkMapService", networkMap, { - c, n -> c.withValue("address", addressValueFor(n.p2pPort)) - .withValue("legalName", valueFor(n.legalName)) - } )) + c, n -> + c.withValue("address", addressValueFor(n.p2pPort)) + .withValue("legalName", valueFor(n.legalName)) + })) .withValue("webAddress", addressValueFor(webPort)) .withValue("rpcAddress", addressValueFor(rpcPort)) .withValue("rpcUsers", valueFor(users.map(User::toMap).toList())) @@ -59,7 +60,7 @@ class NodeConfig( fun toText(): String = toFileConfig().root().render(renderOptions) fun moveTo(baseDir: Path) = NodeConfig( - baseDir, legalName, p2pPort, rpcPort, nearestCity, webPort, h2Port, extraServices, users, networkMap + baseDir, legalName, p2pPort, rpcPort, nearestCity, webPort, h2Port, extraServices, users, networkMap ) fun install(plugins: Collection) { diff --git a/tools/demobench/src/main/kotlin/net/corda/demobench/model/NodeController.kt b/tools/demobench/src/main/kotlin/net/corda/demobench/model/NodeController.kt index 4d869cbe31..45deefcf97 100644 --- a/tools/demobench/src/main/kotlin/net/corda/demobench/model/NodeController.kt +++ b/tools/demobench/src/main/kotlin/net/corda/demobench/model/NodeController.kt @@ -1,5 +1,8 @@ package net.corda.demobench.model +import net.corda.demobench.plugin.PluginController +import net.corda.demobench.pty.R3Pty +import tornadofx.* import java.io.IOException import java.lang.management.ManagementFactory import java.net.ServerSocket @@ -9,9 +12,6 @@ import java.text.SimpleDateFormat import java.util.* import java.util.concurrent.atomic.AtomicInteger import java.util.logging.Level -import net.corda.demobench.plugin.PluginController -import net.corda.demobench.pty.R3Pty -import tornadofx.Controller class NodeController(check: atRuntime = ::checkExists) : Controller() { companion object { @@ -50,14 +50,14 @@ class NodeController(check: atRuntime = ::checkExists) : Controller() { */ fun validate(nodeData: NodeData): NodeConfig? { val config = NodeConfig( - baseDir, - nodeData.legalName.value.trim(), - nodeData.p2pPort.value, - nodeData.rpcPort.value, - nodeData.nearestCity.value.trim(), - nodeData.webPort.value, - nodeData.h2Port.value, - nodeData.extraServices.value + baseDir, + nodeData.legalName.value.trim(), + nodeData.p2pPort.value, + nodeData.rpcPort.value, + nodeData.nearestCity.value.trim(), + nodeData.webPort.value, + nodeData.h2Port.value, + nodeData.extraServices.value ) if (nodes.putIfAbsent(config.key, config) != null) { diff --git a/tools/demobench/src/main/kotlin/net/corda/demobench/model/NodeData.kt b/tools/demobench/src/main/kotlin/net/corda/demobench/model/NodeData.kt index c69e9c54fa..68c2d1336a 100644 --- a/tools/demobench/src/main/kotlin/net/corda/demobench/model/NodeData.kt +++ b/tools/demobench/src/main/kotlin/net/corda/demobench/model/NodeData.kt @@ -1,9 +1,9 @@ package net.corda.demobench.model -import tornadofx.observable import javafx.beans.property.SimpleIntegerProperty import javafx.beans.property.SimpleListProperty import javafx.beans.property.SimpleStringProperty +import tornadofx.* class NodeData { diff --git a/tools/demobench/src/main/kotlin/net/corda/demobench/model/NodeDataModel.kt b/tools/demobench/src/main/kotlin/net/corda/demobench/model/NodeDataModel.kt index d6b5165b5f..04b76021b8 100644 --- a/tools/demobench/src/main/kotlin/net/corda/demobench/model/NodeDataModel.kt +++ b/tools/demobench/src/main/kotlin/net/corda/demobench/model/NodeDataModel.kt @@ -1,6 +1,6 @@ package net.corda.demobench.model -import tornadofx.ItemViewModel +import tornadofx.* class NodeDataModel : ItemViewModel(NodeData()) { diff --git a/tools/demobench/src/main/kotlin/net/corda/demobench/model/ServiceController.kt b/tools/demobench/src/main/kotlin/net/corda/demobench/model/ServiceController.kt index 62c4ee76ed..0974a4f6df 100644 --- a/tools/demobench/src/main/kotlin/net/corda/demobench/model/ServiceController.kt +++ b/tools/demobench/src/main/kotlin/net/corda/demobench/model/ServiceController.kt @@ -1,11 +1,11 @@ package net.corda.demobench.model +import tornadofx.* import java.io.IOException import java.io.InputStreamReader import java.net.URL import java.util.* import java.util.logging.Level -import tornadofx.Controller class ServiceController(resourceName: String = "/services.conf") : Controller() { diff --git a/tools/demobench/src/main/kotlin/net/corda/demobench/model/User.kt b/tools/demobench/src/main/kotlin/net/corda/demobench/model/User.kt index 231d5d5b7c..7c821b65b0 100644 --- a/tools/demobench/src/main/kotlin/net/corda/demobench/model/User.kt +++ b/tools/demobench/src/main/kotlin/net/corda/demobench/model/User.kt @@ -1,20 +1,21 @@ @file:JvmName("User") + package net.corda.demobench.model import net.corda.nodeapi.User import java.util.* fun User.toMap(): Map = mapOf( - "username" to username, - "password" to password, - "permissions" to permissions + "username" to username, + "password" to password, + "permissions" to permissions ) @Suppress("UNCHECKED_CAST") fun toUser(map: Map) = User( - map.getOrElse("username", { "none" }) as String, - map.getOrElse("password", { "none" }) as String, - LinkedHashSet(map.getOrElse("permissions", { emptyList() }) as Collection) + map.getOrElse("username", { "none" }) as String, + map.getOrElse("password", { "none" }) as String, + LinkedHashSet(map.getOrElse("permissions", { emptyList() }) as Collection) ) fun user(name: String) = User(name, "letmein", setOf("ALL")) diff --git a/tools/demobench/src/main/kotlin/net/corda/demobench/plugin/PluginController.kt b/tools/demobench/src/main/kotlin/net/corda/demobench/plugin/PluginController.kt index 6c69585f5a..9aa78d2381 100644 --- a/tools/demobench/src/main/kotlin/net/corda/demobench/plugin/PluginController.kt +++ b/tools/demobench/src/main/kotlin/net/corda/demobench/plugin/PluginController.kt @@ -1,13 +1,13 @@ package net.corda.demobench.plugin -import java.io.IOException -import java.nio.file.Files -import java.nio.file.Path -import java.util.stream.Stream import net.corda.demobench.model.HasPlugins import net.corda.demobench.model.JVMConfig import net.corda.demobench.model.NodeConfig import tornadofx.* +import java.io.IOException +import java.nio.file.Files +import java.nio.file.Path +import java.util.stream.Stream class PluginController : Controller() { @@ -22,7 +22,7 @@ class PluginController : Controller() { fun populate(config: NodeConfig) { // Nodes cannot issue cash unless they contain the "Bank of Corda" plugin. if (config.isCashIssuer && bankOfCorda.isFile) { - bankOfCorda.copyTo(config.pluginDir.resolve(bankOfCorda.name).toFile(), overwrite=true) + bankOfCorda.copyTo(config.pluginDir.resolve(bankOfCorda.name).toFile(), overwrite = true) log.info("Installed 'Bank of Corda' plugin") } } diff --git a/tools/demobench/src/main/kotlin/net/corda/demobench/profile/ProfileController.kt b/tools/demobench/src/main/kotlin/net/corda/demobench/profile/ProfileController.kt index 74f4e44b15..5d9a773466 100644 --- a/tools/demobench/src/main/kotlin/net/corda/demobench/profile/ProfileController.kt +++ b/tools/demobench/src/main/kotlin/net/corda/demobench/profile/ProfileController.kt @@ -2,22 +2,27 @@ package net.corda.demobench.profile import com.typesafe.config.Config import com.typesafe.config.ConfigFactory +import javafx.stage.FileChooser +import javafx.stage.FileChooser.ExtensionFilter +import net.corda.demobench.model.InstallConfig +import net.corda.demobench.model.InstallFactory +import net.corda.demobench.model.JVMConfig +import net.corda.demobench.model.NodeController +import net.corda.demobench.plugin.PluginController +import net.corda.demobench.plugin.inPluginsDir +import net.corda.demobench.plugin.isPlugin +import tornadofx.* import java.io.File import java.io.IOException import java.net.URI import java.nio.charset.StandardCharsets.UTF_8 -import java.nio.file.* +import java.nio.file.FileSystems +import java.nio.file.Files +import java.nio.file.Path import java.util.* import java.util.function.BiPredicate import java.util.logging.Level import java.util.stream.StreamSupport -import javafx.stage.FileChooser -import javafx.stage.FileChooser.ExtensionFilter -import net.corda.demobench.model.* -import net.corda.demobench.plugin.PluginController -import net.corda.demobench.plugin.inPluginsDir -import net.corda.demobench.plugin.isPlugin -import tornadofx.Controller class ProfileController : Controller() { @@ -93,40 +98,40 @@ class ProfileController : Controller() { FileSystems.newFileSystem(chosen.toPath(), null).use { fs -> // Identify the nodes first... StreamSupport.stream(fs.rootDirectories.spliterator(), false) - .flatMap { Files.find(it, 2, BiPredicate { p, attr -> "node.conf" == p?.fileName.toString() && attr.isRegularFile }) } - .map { file -> - try { - val config = installFactory.toInstallConfig(parse(file), baseDir) - log.info("Loaded: $file") - config - } catch (e: Exception) { - log.log(Level.SEVERE, "Failed to parse '$file': ${e.message}", e) - throw e - } - // Java seems to "walk" through the ZIP file backwards. - // So add new config to the front of the list, so that - // our final list is ordered to match the file. - }.forEach { configs.addFirst(it) } + .flatMap { Files.find(it, 2, BiPredicate { p, attr -> "node.conf" == p?.fileName.toString() && attr.isRegularFile }) } + .map { file -> + try { + val config = installFactory.toInstallConfig(parse(file), baseDir) + log.info("Loaded: $file") + config + } catch (e: Exception) { + log.log(Level.SEVERE, "Failed to parse '$file': ${e.message}", e) + throw e + } + // Java seems to "walk" through the ZIP file backwards. + // So add new config to the front of the list, so that + // our final list is ordered to match the file. + }.forEach { configs.addFirst(it) } val nodeIndex = configs.map { it.key to it }.toMap() // Now extract all of the plugins from the ZIP file, // and copy them to a temporary location. StreamSupport.stream(fs.rootDirectories.spliterator(), false) - .flatMap { Files.find(it, 3, BiPredicate { p, attr -> p.inPluginsDir() && p.isPlugin() && attr.isRegularFile }) } - .forEach { plugin -> - val config = nodeIndex[plugin.getName(0).toString()] ?: return@forEach + .flatMap { Files.find(it, 3, BiPredicate { p, attr -> p.inPluginsDir() && p.isPlugin() && attr.isRegularFile }) } + .forEach { plugin -> + val config = nodeIndex[plugin.getName(0).toString()] ?: return@forEach - try { - val pluginDir = Files.createDirectories(config.pluginDir) - Files.copy(plugin, pluginDir.resolve(plugin.fileName.toString())) - log.info("Loaded: $plugin") - } catch (e: Exception) { - log.log(Level.SEVERE, "Failed to extract '$plugin': ${e.message}", e) - configs.forEach { c -> c.deleteBaseDir() } - throw e + try { + val pluginDir = Files.createDirectories(config.pluginDir) + Files.copy(plugin, pluginDir.resolve(plugin.fileName.toString())) + log.info("Loaded: $plugin") + } catch (e: Exception) { + log.log(Level.SEVERE, "Failed to extract '$plugin': ${e.message}", e) + configs.forEach { c -> c.deleteBaseDir() } + throw e + } } - } } return configs diff --git a/tools/demobench/src/main/kotlin/net/corda/demobench/pty/PtyProcessTtyConnector.kt b/tools/demobench/src/main/kotlin/net/corda/demobench/pty/PtyProcessTtyConnector.kt index b3e23c35e2..0294ff170c 100644 --- a/tools/demobench/src/main/kotlin/net/corda/demobench/pty/PtyProcessTtyConnector.kt +++ b/tools/demobench/src/main/kotlin/net/corda/demobench/pty/PtyProcessTtyConnector.kt @@ -11,9 +11,9 @@ import java.nio.charset.Charset * @author traff */ class PtyProcessTtyConnector( - private val name: String, - private val process: PtyProcess, - charset: Charset + private val name: String, + private val process: PtyProcess, + charset: Charset ) : ProcessTtyConnector(process.zeroFiltered(), charset) { override fun getName() = name @@ -23,10 +23,10 @@ class PtyProcessTtyConnector( override fun resizeImmediately() { if (pendingTermSize != null && pendingPixelSize != null) { process.winSize = WinSize( - pendingTermSize.width, - pendingTermSize.height, - pendingPixelSize.width, - pendingPixelSize.height + pendingTermSize.width, + pendingTermSize.height, + pendingPixelSize.width, + pendingPixelSize.height ) } } diff --git a/tools/demobench/src/main/kotlin/net/corda/demobench/pty/R3Pty.kt b/tools/demobench/src/main/kotlin/net/corda/demobench/pty/R3Pty.kt index 6e6e9efbb8..a1ac7f40fb 100644 --- a/tools/demobench/src/main/kotlin/net/corda/demobench/pty/R3Pty.kt +++ b/tools/demobench/src/main/kotlin/net/corda/demobench/pty/R3Pty.kt @@ -1,11 +1,11 @@ package net.corda.demobench.pty -import com.jediterm.terminal.ui.* +import com.jediterm.terminal.ui.JediTermWidget +import com.jediterm.terminal.ui.UIUtil import com.jediterm.terminal.ui.settings.SettingsProvider import com.pty4j.PtyProcess import net.corda.core.utilities.loggerFor - -import java.awt.* +import java.awt.Dimension import java.io.IOException import java.nio.charset.StandardCharsets.UTF_8 import java.util.concurrent.Executors diff --git a/tools/demobench/src/main/kotlin/net/corda/demobench/rpc/NodeRPC.kt b/tools/demobench/src/main/kotlin/net/corda/demobench/rpc/NodeRPC.kt index 5ccdcefa2a..115adf68b2 100644 --- a/tools/demobench/src/main/kotlin/net/corda/demobench/rpc/NodeRPC.kt +++ b/tools/demobench/src/main/kotlin/net/corda/demobench/rpc/NodeRPC.kt @@ -1,14 +1,14 @@ package net.corda.demobench.rpc import com.google.common.net.HostAndPort -import java.util.* -import java.util.concurrent.TimeUnit.SECONDS import net.corda.client.rpc.CordaRPCClient import net.corda.core.messaging.CordaRPCOps import net.corda.core.utilities.loggerFor import net.corda.demobench.model.NodeConfig +import java.util.* +import java.util.concurrent.TimeUnit.SECONDS -class NodeRPC(config: NodeConfig, start: () -> Unit, invoke: (CordaRPCOps) -> Unit): AutoCloseable { +class NodeRPC(config: NodeConfig, start: () -> Unit, invoke: (CordaRPCOps) -> Unit) : AutoCloseable { private companion object { val log = loggerFor() @@ -33,7 +33,7 @@ class NodeRPC(config: NodeConfig, start: () -> Unit, invoke: (CordaRPCOps) -> Un start() // Schedule a new task that will refresh the display once per second. - timer.schedule(object: TimerTask() { + timer.schedule(object : TimerTask() { override fun run() { invoke(ops) } diff --git a/tools/demobench/src/main/kotlin/net/corda/demobench/ui/PropertyLabel.kt b/tools/demobench/src/main/kotlin/net/corda/demobench/ui/PropertyLabel.kt index 25cfb953ac..1336072344 100644 --- a/tools/demobench/src/main/kotlin/net/corda/demobench/ui/PropertyLabel.kt +++ b/tools/demobench/src/main/kotlin/net/corda/demobench/ui/PropertyLabel.kt @@ -8,7 +8,7 @@ class PropertyLabel() : HBox() { val nameLabel = Label() val valueLabel = Label() - var name : String + var name: String get() = nameLabel.text set(value) { nameLabel.text = value diff --git a/tools/demobench/src/main/kotlin/net/corda/demobench/views/DemoBenchView.kt b/tools/demobench/src/main/kotlin/net/corda/demobench/views/DemoBenchView.kt index 04bb900925..6f67ef87b9 100644 --- a/tools/demobench/src/main/kotlin/net/corda/demobench/views/DemoBenchView.kt +++ b/tools/demobench/src/main/kotlin/net/corda/demobench/views/DemoBenchView.kt @@ -1,6 +1,5 @@ package net.corda.demobench.views -import java.util.* import javafx.application.Platform import javafx.scene.Parent import javafx.scene.control.Button @@ -13,6 +12,7 @@ import net.corda.demobench.profile.ProfileController import net.corda.demobench.ui.CloseableTab import org.controlsfx.dialog.ExceptionDialog import tornadofx.* +import java.util.* class DemoBenchView : View("Corda DemoBench") { diff --git a/tools/demobench/src/main/kotlin/net/corda/demobench/views/NodeTabView.kt b/tools/demobench/src/main/kotlin/net/corda/demobench/views/NodeTabView.kt index 5bacf72813..c294d9a4fa 100644 --- a/tools/demobench/src/main/kotlin/net/corda/demobench/views/NodeTabView.kt +++ b/tools/demobench/src/main/kotlin/net/corda/demobench/views/NodeTabView.kt @@ -1,8 +1,5 @@ package net.corda.demobench.views -import java.nio.file.Path -import java.text.DecimalFormat -import java.util.* import javafx.application.Platform import javafx.scene.control.SelectionMode.MULTIPLE import javafx.scene.input.KeyCode @@ -12,6 +9,9 @@ import javafx.util.converter.NumberStringConverter import net.corda.demobench.model.* import net.corda.demobench.ui.CloseableTab import tornadofx.* +import java.nio.file.Path +import java.text.DecimalFormat +import java.util.* class NodeTabView : Fragment() { override val root = stackpane {} diff --git a/tools/demobench/src/main/kotlin/net/corda/demobench/views/NodeTerminalView.kt b/tools/demobench/src/main/kotlin/net/corda/demobench/views/NodeTerminalView.kt index eea4a4e23a..58556076c6 100644 --- a/tools/demobench/src/main/kotlin/net/corda/demobench/views/NodeTerminalView.kt +++ b/tools/demobench/src/main/kotlin/net/corda/demobench/views/NodeTerminalView.kt @@ -3,9 +3,6 @@ package net.corda.demobench.views import com.jediterm.terminal.TerminalColor import com.jediterm.terminal.TextStyle import com.jediterm.terminal.ui.settings.DefaultSettingsProvider -import java.awt.Dimension -import java.util.logging.Level -import javax.swing.SwingUtilities import javafx.application.Platform import javafx.embed.swing.SwingNode import javafx.scene.control.Button @@ -13,13 +10,18 @@ import javafx.scene.control.Label import javafx.scene.layout.VBox import net.corda.client.rpc.notUsed import net.corda.demobench.explorer.ExplorerController -import net.corda.demobench.model.* +import net.corda.demobench.model.NodeConfig +import net.corda.demobench.model.NodeController +import net.corda.demobench.model.NodeState import net.corda.demobench.pty.R3Pty import net.corda.demobench.rpc.NodeRPC import net.corda.demobench.ui.PropertyLabel import net.corda.demobench.web.DBViewer import net.corda.demobench.web.WebServerController import tornadofx.Fragment +import java.awt.Dimension +import java.util.logging.Level +import javax.swing.SwingUtilities class NodeTerminalView : Fragment() { override val root by fxml() @@ -139,8 +141,8 @@ class NodeTerminalView : Fragment() { val verifiedTx = ops.verifiedTransactions() val statesInVault = ops.vaultAndUpdates() val cashBalances = ops.getCashBalances().entries.joinToString( - separator = ", ", - transform = { e -> e.value.toString() } + separator = ", ", + transform = { e -> e.value.toString() } ) Platform.runLater { diff --git a/tools/demobench/src/main/kotlin/net/corda/demobench/web/DBViewer.kt b/tools/demobench/src/main/kotlin/net/corda/demobench/web/DBViewer.kt index f74d9fea7f..01cd406252 100644 --- a/tools/demobench/src/main/kotlin/net/corda/demobench/web/DBViewer.kt +++ b/tools/demobench/src/main/kotlin/net/corda/demobench/web/DBViewer.kt @@ -1,13 +1,13 @@ package net.corda.demobench.web import net.corda.core.utilities.loggerFor -import java.sql.SQLException -import java.util.concurrent.Executors -import kotlin.reflect.jvm.jvmName import org.h2.Driver import org.h2.server.web.LocalWebServer import org.h2.tools.Server import org.h2.util.JdbcUtils +import java.sql.SQLException +import java.util.concurrent.Executors +import kotlin.reflect.jvm.jvmName class DBViewer : AutoCloseable { private companion object { @@ -40,10 +40,10 @@ class DBViewer : AutoCloseable { @Throws(SQLException::class) fun openBrowser(h2Port: Int) { val conn = JdbcUtils.getConnection( - Driver::class.jvmName, - "jdbc:h2:tcp://localhost:$h2Port/node", - "sa", - "" + Driver::class.jvmName, + "jdbc:h2:tcp://localhost:$h2Port/node", + "sa", + "" ) val url = (webServer.service as LocalWebServer).addSession(conn) diff --git a/tools/demobench/src/main/kotlin/net/corda/demobench/web/WebServer.kt b/tools/demobench/src/main/kotlin/net/corda/demobench/web/WebServer.kt index acddceac66..7cd5480204 100644 --- a/tools/demobench/src/main/kotlin/net/corda/demobench/web/WebServer.kt +++ b/tools/demobench/src/main/kotlin/net/corda/demobench/web/WebServer.kt @@ -1,10 +1,10 @@ package net.corda.demobench.web +import net.corda.core.utilities.loggerFor +import net.corda.demobench.model.NodeConfig +import net.corda.demobench.readErrorLines import java.io.IOException import java.util.concurrent.Executors -import net.corda.core.utilities.loggerFor -import net.corda.demobench.readErrorLines -import net.corda.demobench.model.NodeConfig class WebServer internal constructor(private val webServerController: WebServerController) : AutoCloseable { private companion object { diff --git a/tools/demobench/src/main/kotlin/net/corda/demobench/web/WebServerController.kt b/tools/demobench/src/main/kotlin/net/corda/demobench/web/WebServerController.kt index 8c2e897cc9..9af01e60b1 100644 --- a/tools/demobench/src/main/kotlin/net/corda/demobench/web/WebServerController.kt +++ b/tools/demobench/src/main/kotlin/net/corda/demobench/web/WebServerController.kt @@ -1,7 +1,7 @@ package net.corda.demobench.web import net.corda.demobench.model.JVMConfig -import tornadofx.Controller +import tornadofx.* class WebServerController : Controller() { diff --git a/tools/demobench/src/main/resources/log4j2.xml b/tools/demobench/src/main/resources/log4j2.xml index ead7e18ea2..c1a85aa61d 100644 --- a/tools/demobench/src/main/resources/log4j2.xml +++ b/tools/demobench/src/main/resources/log4j2.xml @@ -41,7 +41,7 @@ - + diff --git a/tools/demobench/src/main/resources/logging.properties b/tools/demobench/src/main/resources/logging.properties index 0cdbae4a03..6aada02399 100644 --- a/tools/demobench/src/main/resources/logging.properties +++ b/tools/demobench/src/main/resources/logging.properties @@ -1,3 +1,3 @@ # Register SLF4JBridgeHandler as handler for the j.u.l. root logger # See http://www.slf4j.org/legacy.html#jul-to-slf4j -handlers = org.slf4j.bridge.SLF4JBridgeHandler +handlers=org.slf4j.bridge.SLF4JBridgeHandler diff --git a/tools/demobench/src/main/resources/net/corda/demobench/style.css b/tools/demobench/src/main/resources/net/corda/demobench/style.css index 3db609fef6..fdbb7cf1bc 100644 --- a/tools/demobench/src/main/resources/net/corda/demobench/style.css +++ b/tools/demobench/src/main/resources/net/corda/demobench/style.css @@ -4,7 +4,7 @@ */ .header { - -fx-background-color: #505050; + -fx-background-color: #505050; -fx-padding: 15px; } diff --git a/tools/demobench/src/main/resources/net/corda/demobench/views/DemoBenchView.fxml b/tools/demobench/src/main/resources/net/corda/demobench/views/DemoBenchView.fxml index d068ba9efd..eba71ebddc 100644 --- a/tools/demobench/src/main/resources/net/corda/demobench/views/DemoBenchView.fxml +++ b/tools/demobench/src/main/resources/net/corda/demobench/views/DemoBenchView.fxml @@ -1,14 +1,8 @@ - - - - - - - - - + + + @@ -17,10 +11,12 @@ - - diff --git a/tools/demobench/src/main/resources/net/corda/demobench/views/NodeTerminalView.fxml b/tools/demobench/src/main/resources/net/corda/demobench/views/NodeTerminalView.fxml index ac628de248..46e7415b7c 100644 --- a/tools/demobench/src/main/resources/net/corda/demobench/views/NodeTerminalView.fxml +++ b/tools/demobench/src/main/resources/net/corda/demobench/views/NodeTerminalView.fxml @@ -1,26 +1,26 @@ - - - - - - - - + + + + - - - - + + + - -