[CORDA-1089]: Correctly display an error message on node startup if RPC settings are invalid (#2592)

* [CORDA-1089]: Correctly produce an error message on node startup if rpc options are invalid.

* [CORDA-1089]: Made RPC settings validation only trigger if address is specified.

* [CORDA-1089]: Fixed outdated deployNodes task in build.gradle.

* [CORDA-1089]: Fixed outdated deployNodes task in build.gradle.
This commit is contained in:
Michele Sollecito 2018-02-21 17:09:13 +00:00 committed by Katelyn Baker
parent 7358e902a5
commit d97a579a2e
3 changed files with 20 additions and 8 deletions

View File

@ -266,14 +266,20 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) {
node {
name "O=Bank A,OU=corda,L=London,C=GB"
p2pPort 10012
rpcPort 10013
rpcSettings {
address "localhost:10013"
adminAddress "localhost:10023"
}
webPort 10014
cordapps = []
}
node {
name "O=Bank B,OU=corda,L=London,C=GB"
p2pAddress "localhost:10007"
rpcAddress "localhost:10008"
rpcSettings {
address "localhost:10008"
adminAddress "localhost:10018"
}
webAddress "localhost:10009"
cordapps = []
}

View File

@ -77,14 +77,20 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) {
name "O=Notary Service,OU=corda,L=London,C=GB"
notary = [validating : true]
p2pPort 10002
rpcPort 10003
rpcSettings {
address "localhost:10003"
adminAddress "localhost:10013"
}
webPort 10004
cordapps = []
}
node {
name "O=Alice Corp,L=London,C=GB"
p2pPort 10005
rpcPort 10006
rpcSettings {
address "localhost:10006"
adminAddress "localhost:10016"
}
webPort 10007
cordapps = []
rpcUsers = [

View File

@ -164,15 +164,15 @@ data class NodeConfigurationImpl(
override fun validate(): List<String> {
val errors = mutableListOf<String>()
errors + validateRpcOptions(rpcOptions)
errors += validateRpcOptions(rpcOptions)
return errors
}
private fun validateRpcOptions(options: NodeRpcOptions): List<String> {
val errors = mutableListOf<String>()
if (!options.useSsl) {
if (options.adminAddress == null) {
errors + "'rpcSettings.adminAddress': missing. Property is mandatory when 'rpcSettings.useSsl' is false (default)."
if (options.address != null) {
if (!options.useSsl && options.adminAddress == null) {
errors += "'rpcSettings.adminAddress': missing. Property is mandatory when 'rpcSettings.useSsl' is false (default)."
}
}
return errors