mirror of
https://github.com/corda/corda.git
synced 2024-12-19 04:57:58 +00:00
Fixed Demobench. (#2548)
This commit is contained in:
parent
fe7c129ae7
commit
9711ea88c0
@ -1,6 +1,9 @@
|
|||||||
package net.corda.demobench.model
|
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.ConfigRenderOptions
|
||||||
|
import com.typesafe.config.ConfigValueFactory
|
||||||
import net.corda.core.identity.CordaX500Name
|
import net.corda.core.identity.CordaX500Name
|
||||||
import net.corda.core.internal.copyToDirectory
|
import net.corda.core.internal.copyToDirectory
|
||||||
import net.corda.core.internal.createDirectories
|
import net.corda.core.internal.createDirectories
|
||||||
@ -19,6 +22,7 @@ data class NodeConfig(
|
|||||||
val myLegalName: CordaX500Name,
|
val myLegalName: CordaX500Name,
|
||||||
val p2pAddress: NetworkHostAndPort,
|
val p2pAddress: NetworkHostAndPort,
|
||||||
val rpcAddress: NetworkHostAndPort,
|
val rpcAddress: NetworkHostAndPort,
|
||||||
|
val rpcAdminAddress: NetworkHostAndPort,
|
||||||
/** This is not used by the node but by the webserver which looks at node.conf. */
|
/** This is not used by the node but by the webserver which looks at node.conf. */
|
||||||
val webAddress: NetworkHostAndPort,
|
val webAddress: NetworkHostAndPort,
|
||||||
val notary: NotaryService?,
|
val notary: NotaryService?,
|
||||||
@ -38,7 +42,17 @@ data class NodeConfig(
|
|||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
private val useTestClock = true
|
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)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -75,6 +75,7 @@ class NodeController(check: atRuntime = ::checkExists) : Controller() {
|
|||||||
),
|
),
|
||||||
p2pAddress = nodeData.p2pPort.toLocalAddress(),
|
p2pAddress = nodeData.p2pPort.toLocalAddress(),
|
||||||
rpcAddress = nodeData.rpcPort.toLocalAddress(),
|
rpcAddress = nodeData.rpcPort.toLocalAddress(),
|
||||||
|
rpcAdminAddress = nodeData.rpcAdminPort.toLocalAddress(),
|
||||||
webAddress = nodeData.webPort.toLocalAddress(),
|
webAddress = nodeData.webPort.toLocalAddress(),
|
||||||
notary = notary,
|
notary = notary,
|
||||||
h2port = nodeData.h2Port.value,
|
h2port = nodeData.h2Port.value,
|
||||||
|
@ -35,6 +35,7 @@ class NodeData {
|
|||||||
val nearestCity = SimpleObjectProperty(CityDatabase["London"]!!)
|
val nearestCity = SimpleObjectProperty(CityDatabase["London"]!!)
|
||||||
val p2pPort = SimpleIntegerProperty()
|
val p2pPort = SimpleIntegerProperty()
|
||||||
val rpcPort = SimpleIntegerProperty()
|
val rpcPort = SimpleIntegerProperty()
|
||||||
|
val rpcAdminPort = SimpleIntegerProperty()
|
||||||
val webPort = SimpleIntegerProperty()
|
val webPort = SimpleIntegerProperty()
|
||||||
val h2Port = SimpleIntegerProperty()
|
val h2Port = SimpleIntegerProperty()
|
||||||
val extraServices = SimpleListProperty(observableArrayList<ExtraService>())
|
val extraServices = SimpleListProperty(observableArrayList<ExtraService>())
|
||||||
@ -45,6 +46,7 @@ class NodeDataModel : ItemViewModel<NodeData>(NodeData()) {
|
|||||||
val nearestCity = bind { item?.nearestCity }
|
val nearestCity = bind { item?.nearestCity }
|
||||||
val p2pPort = bind { item?.p2pPort }
|
val p2pPort = bind { item?.p2pPort }
|
||||||
val rpcPort = bind { item?.rpcPort }
|
val rpcPort = bind { item?.rpcPort }
|
||||||
|
val rpcAdminPort = bind { item?.rpcAdminPort }
|
||||||
val webPort = bind { item?.webPort }
|
val webPort = bind { item?.webPort }
|
||||||
val h2Port = bind { item?.h2Port }
|
val h2Port = bind { item?.h2Port }
|
||||||
}
|
}
|
||||||
|
@ -188,6 +188,7 @@ class NodeTabView : Fragment() {
|
|||||||
|
|
||||||
model.p2pPort.value = nodeController.nextPort
|
model.p2pPort.value = nodeController.nextPort
|
||||||
model.rpcPort.value = nodeController.nextPort
|
model.rpcPort.value = nodeController.nextPort
|
||||||
|
model.rpcAdminPort.value = nodeController.nextPort
|
||||||
model.webPort.value = nodeController.nextPort
|
model.webPort.value = nodeController.nextPort
|
||||||
model.h2Port.value = nodeController.nextPort
|
model.h2Port.value = nodeController.nextPort
|
||||||
|
|
||||||
|
@ -28,6 +28,7 @@ class NodeConfigTest {
|
|||||||
legalName = myLegalName,
|
legalName = myLegalName,
|
||||||
p2pPort = 10001,
|
p2pPort = 10001,
|
||||||
rpcPort = 40002,
|
rpcPort = 40002,
|
||||||
|
rpcAdminPort = 40003,
|
||||||
webPort = 20001,
|
webPort = 20001,
|
||||||
h2port = 30001,
|
h2port = 30001,
|
||||||
notary = NotaryService(validating = false),
|
notary = NotaryService(validating = false),
|
||||||
@ -55,6 +56,7 @@ class NodeConfigTest {
|
|||||||
legalName = myLegalName,
|
legalName = myLegalName,
|
||||||
p2pPort = 10001,
|
p2pPort = 10001,
|
||||||
rpcPort = 40002,
|
rpcPort = 40002,
|
||||||
|
rpcAdminPort = 40003,
|
||||||
webPort = 20001,
|
webPort = 20001,
|
||||||
h2port = 30001,
|
h2port = 30001,
|
||||||
notary = NotaryService(validating = false),
|
notary = NotaryService(validating = false),
|
||||||
@ -77,6 +79,7 @@ class NodeConfigTest {
|
|||||||
legalName: CordaX500Name = CordaX500Name(organisation = "Unknown", locality = "Nowhere", country = "GB"),
|
legalName: CordaX500Name = CordaX500Name(organisation = "Unknown", locality = "Nowhere", country = "GB"),
|
||||||
p2pPort: Int = -1,
|
p2pPort: Int = -1,
|
||||||
rpcPort: Int = -1,
|
rpcPort: Int = -1,
|
||||||
|
rpcAdminPort: Int = -1,
|
||||||
webPort: Int = -1,
|
webPort: Int = -1,
|
||||||
h2port: Int = -1,
|
h2port: Int = -1,
|
||||||
notary: NotaryService?,
|
notary: NotaryService?,
|
||||||
@ -86,6 +89,7 @@ class NodeConfigTest {
|
|||||||
myLegalName = legalName,
|
myLegalName = legalName,
|
||||||
p2pAddress = localPort(p2pPort),
|
p2pAddress = localPort(p2pPort),
|
||||||
rpcAddress = localPort(rpcPort),
|
rpcAddress = localPort(rpcPort),
|
||||||
|
rpcAdminAddress = localPort(rpcAdminPort),
|
||||||
webAddress = localPort(webPort),
|
webAddress = localPort(webPort),
|
||||||
h2port = h2port,
|
h2port = h2port,
|
||||||
notary = notary,
|
notary = notary,
|
||||||
|
@ -150,6 +150,7 @@ class NodeControllerTest {
|
|||||||
organisation: String = "Unknown",
|
organisation: String = "Unknown",
|
||||||
p2pPort: Int = 0,
|
p2pPort: Int = 0,
|
||||||
rpcPort: Int = 0,
|
rpcPort: Int = 0,
|
||||||
|
rpcAdminPort: Int = 0,
|
||||||
webPort: Int = 0,
|
webPort: Int = 0,
|
||||||
h2port: Int = 0,
|
h2port: Int = 0,
|
||||||
notary: NotaryService? = null,
|
notary: NotaryService? = null,
|
||||||
@ -163,6 +164,7 @@ class NodeControllerTest {
|
|||||||
),
|
),
|
||||||
p2pAddress = localPort(p2pPort),
|
p2pAddress = localPort(p2pPort),
|
||||||
rpcAddress = localPort(rpcPort),
|
rpcAddress = localPort(rpcPort),
|
||||||
|
rpcAdminAddress = localPort(rpcAdminPort),
|
||||||
webAddress = localPort(webPort),
|
webAddress = localPort(webPort),
|
||||||
h2port = h2port,
|
h2port = h2port,
|
||||||
notary = notary,
|
notary = notary,
|
||||||
|
Loading…
Reference in New Issue
Block a user