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 ae5b6deeb1..b251955d5c 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 @@ -1,6 +1,9 @@ package net.corda.demobench.model +import com.typesafe.config.Config +import com.typesafe.config.ConfigFactory.empty import com.typesafe.config.ConfigRenderOptions +import com.typesafe.config.ConfigValueFactory import net.corda.core.identity.CordaX500Name import net.corda.core.internal.copyToDirectory import net.corda.core.internal.createDirectories @@ -19,6 +22,7 @@ data class NodeConfig( val myLegalName: CordaX500Name, val p2pAddress: NetworkHostAndPort, val rpcAddress: NetworkHostAndPort, + val rpcAdminAddress: NetworkHostAndPort, /** This is not used by the node but by the webserver which looks at node.conf. */ val webAddress: NetworkHostAndPort, val notary: NotaryService?, @@ -38,7 +42,17 @@ data class NodeConfig( @Suppress("unused") private val useTestClock = true - fun toText(): String = toConfig().root().render(renderOptions) + private fun asConfig(): Config { + + val config = toConfig() + val rpcSettings = empty() + .withValue("address", ConfigValueFactory.fromAnyRef(rpcAddress.toString())) + .withValue("adminAddress", ConfigValueFactory.fromAnyRef(rpcAdminAddress.toString())) + .root() + return config.withoutPath("rpcAddress").withoutPath("rpcAdminAddress").withValue("rpcSettings", rpcSettings) + } + + fun toText(): String = asConfig().root().render(renderOptions) } /** 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 1c53fdd82f..bae600a2e0 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 @@ -75,6 +75,7 @@ class NodeController(check: atRuntime = ::checkExists) : Controller() { ), p2pAddress = nodeData.p2pPort.toLocalAddress(), rpcAddress = nodeData.rpcPort.toLocalAddress(), + rpcAdminAddress = nodeData.rpcAdminPort.toLocalAddress(), webAddress = nodeData.webPort.toLocalAddress(), notary = notary, h2port = nodeData.h2Port.value, 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 7abdd09775..b8af55e5ff 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 @@ -35,6 +35,7 @@ class NodeData { val nearestCity = SimpleObjectProperty(CityDatabase["London"]!!) val p2pPort = SimpleIntegerProperty() val rpcPort = SimpleIntegerProperty() + val rpcAdminPort = SimpleIntegerProperty() val webPort = SimpleIntegerProperty() val h2Port = SimpleIntegerProperty() val extraServices = SimpleListProperty(observableArrayList()) @@ -45,6 +46,7 @@ class NodeDataModel : ItemViewModel(NodeData()) { val nearestCity = bind { item?.nearestCity } val p2pPort = bind { item?.p2pPort } val rpcPort = bind { item?.rpcPort } + val rpcAdminPort = bind { item?.rpcAdminPort } val webPort = bind { item?.webPort } val h2Port = bind { item?.h2Port } } 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 5fb32aa9e6..8cded0186d 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 @@ -188,6 +188,7 @@ class NodeTabView : Fragment() { model.p2pPort.value = nodeController.nextPort model.rpcPort.value = nodeController.nextPort + model.rpcAdminPort.value = nodeController.nextPort model.webPort.value = nodeController.nextPort model.h2Port.value = nodeController.nextPort diff --git a/tools/demobench/src/test/kotlin/net/corda/demobench/model/NodeConfigTest.kt b/tools/demobench/src/test/kotlin/net/corda/demobench/model/NodeConfigTest.kt index 1c82a08654..cbe6f54a18 100644 --- a/tools/demobench/src/test/kotlin/net/corda/demobench/model/NodeConfigTest.kt +++ b/tools/demobench/src/test/kotlin/net/corda/demobench/model/NodeConfigTest.kt @@ -28,6 +28,7 @@ class NodeConfigTest { legalName = myLegalName, p2pPort = 10001, rpcPort = 40002, + rpcAdminPort = 40003, webPort = 20001, h2port = 30001, notary = NotaryService(validating = false), @@ -55,6 +56,7 @@ class NodeConfigTest { legalName = myLegalName, p2pPort = 10001, rpcPort = 40002, + rpcAdminPort = 40003, webPort = 20001, h2port = 30001, notary = NotaryService(validating = false), @@ -77,6 +79,7 @@ class NodeConfigTest { legalName: CordaX500Name = CordaX500Name(organisation = "Unknown", locality = "Nowhere", country = "GB"), p2pPort: Int = -1, rpcPort: Int = -1, + rpcAdminPort: Int = -1, webPort: Int = -1, h2port: Int = -1, notary: NotaryService?, @@ -86,6 +89,7 @@ class NodeConfigTest { myLegalName = legalName, p2pAddress = localPort(p2pPort), rpcAddress = localPort(rpcPort), + rpcAdminAddress = localPort(rpcAdminPort), webAddress = localPort(webPort), h2port = h2port, notary = notary, diff --git a/tools/demobench/src/test/kotlin/net/corda/demobench/model/NodeControllerTest.kt b/tools/demobench/src/test/kotlin/net/corda/demobench/model/NodeControllerTest.kt index 18db310a5b..e6b5454144 100644 --- a/tools/demobench/src/test/kotlin/net/corda/demobench/model/NodeControllerTest.kt +++ b/tools/demobench/src/test/kotlin/net/corda/demobench/model/NodeControllerTest.kt @@ -150,6 +150,7 @@ class NodeControllerTest { organisation: String = "Unknown", p2pPort: Int = 0, rpcPort: Int = 0, + rpcAdminPort: Int = 0, webPort: Int = 0, h2port: Int = 0, notary: NotaryService? = null, @@ -163,6 +164,7 @@ class NodeControllerTest { ), p2pAddress = localPort(p2pPort), rpcAddress = localPort(rpcPort), + rpcAdminAddress = localPort(rpcAdminPort), webAddress = localPort(webPort), h2port = h2port, notary = notary,