Fixes for Network Visualiser (#618)

* Restore Zurich and Cairo to cities.txt
* Only display each node's common name in Network Visualiser.
This commit is contained in:
Chris Rankin 2017-05-03 10:52:39 +01:00
parent c172ab3e1e
commit 676d775eaa
3 changed files with 17 additions and 6 deletions

View File

@ -997,3 +997,6 @@ Bristol (GB) -2.57 51.45
Yokosuka (JP) 139.67 35.28
Akola (IN) 77 20.72
Belgaum (IN) 74.5 15.87
# These have been added back by hand
Cairo (EG) 31.25 30.06
Zurich (CH) 8.55 47.36

View File

@ -2,7 +2,6 @@ package net.corda.simulation
import com.google.common.util.concurrent.Futures
import com.google.common.util.concurrent.ListenableFuture
import net.corda.core.crypto.X509Utilities
import net.corda.core.flatMap
import net.corda.core.flows.FlowLogic
import net.corda.core.messaging.SingleMessageRecipient
@ -123,7 +122,7 @@ abstract class Simulation(val networkSendManuallyPumped: Boolean,
val cfg = TestNodeConfiguration(
baseDirectory = config.baseDirectory,
// TODO: Make a more realistic legal name
myLegalName = "CN=Rates Service Provider,O=R3,OU=corda,L=London,C=UK",
myLegalName = "CN=Rates Service Provider,O=R3,OU=corda,L=Madrid,C=ES",
nearestCity = "Madrid",
networkMapService = null)
return object : SimulatedNode(cfg, network, networkMapAddr, advertisedServices, id, overrideServices, entropyRoot) {
@ -147,7 +146,7 @@ abstract class Simulation(val networkSendManuallyPumped: Boolean,
val cfg = TestNodeConfiguration(
baseDirectory = config.baseDirectory,
// TODO: Make a more realistic legal name
myLegalName = "Regulator A,O=R3,OU=corda,L=London,C=UK",
myLegalName = "CN=Regulator A,O=R3,OU=corda,L=Paris,C=FR",
nearestCity = "Paris",
networkMapService = null)
return object : SimulatedNode(cfg, network, networkMapAddr, advertisedServices, id, overrideServices, entropyRoot) {

View File

@ -7,9 +7,12 @@ import javafx.scene.layout.StackPane
import javafx.scene.shape.Circle
import javafx.scene.shape.Line
import javafx.util.Duration
import net.corda.core.crypto.commonName
import net.corda.core.utilities.ProgressTracker
import net.corda.node.services.config.NodeConfiguration
import net.corda.simulation.IRSSimulation
import net.corda.testing.node.MockNetwork
import org.bouncycastle.asn1.x500.X500Name
import java.util.*
class VisualiserViewModel {
@ -114,13 +117,13 @@ class VisualiserViewModel {
bankCount = simulation.banks.size
serviceCount = simulation.serviceProviders.size + simulation.regulators.size
for ((index, bank) in simulation.banks.withIndex()) {
nodesToWidgets[bank] = makeNodeWidget(bank, "bank", bank.configuration.myLegalName, NetworkMapVisualiser.NodeType.BANK, index)
nodesToWidgets[bank] = makeNodeWidget(bank, "bank", bank.configuration.displayName, NetworkMapVisualiser.NodeType.BANK, index)
}
for ((index, service) in simulation.serviceProviders.withIndex()) {
nodesToWidgets[service] = makeNodeWidget(service, "network-service", service.configuration.myLegalName, NetworkMapVisualiser.NodeType.SERVICE, index)
nodesToWidgets[service] = makeNodeWidget(service, "network-service", service.configuration.displayName, NetworkMapVisualiser.NodeType.SERVICE, index)
}
for ((index, service) in simulation.regulators.withIndex()) {
nodesToWidgets[service] = makeNodeWidget(service, "regulator", service.configuration.myLegalName, NetworkMapVisualiser.NodeType.SERVICE, index + simulation.serviceProviders.size)
nodesToWidgets[service] = makeNodeWidget(service, "regulator", service.configuration.displayName, NetworkMapVisualiser.NodeType.SERVICE, index + simulation.serviceProviders.size)
}
}
@ -219,3 +222,9 @@ class VisualiserViewModel {
}
}
private val NodeConfiguration.displayName: String get() = try {
X500Name(myLegalName).commonName
} catch(ex: IllegalArgumentException) {
myLegalName
}