mirror of
https://github.com/corda/corda.git
synced 2025-06-17 06:38:21 +00:00
add configuration option to enable compatibility zone whilst running devMode
* add configuration option to enable compatibility zone whilst running devMode * add documentation about allowCompatibilityZone * address review comments * remove extra doc lines * add changelog entry * Update changelog.rst
This commit is contained in:
@ -78,7 +78,7 @@ interface NodeConfiguration : NodeSSLConfiguration {
|
||||
}
|
||||
}
|
||||
|
||||
data class DevModeOptions(val disableCheckpointChecker: Boolean = false)
|
||||
data class DevModeOptions(val disableCheckpointChecker: Boolean = false, val allowCompatibilityZone: Boolean = false)
|
||||
|
||||
fun NodeConfiguration.shouldCheckCheckpoints(): Boolean {
|
||||
return this.devMode && this.devModeOptions?.disableCheckpointChecker != true
|
||||
@ -255,16 +255,19 @@ data class NodeConfigurationImpl(
|
||||
private fun validateDevModeOptions(): List<String> {
|
||||
if (devMode) {
|
||||
compatibilityZoneURL?.let {
|
||||
return listOf("'compatibilityZoneURL': present. Property cannot be set when 'devMode' is true.")
|
||||
if (devModeOptions?.allowCompatibilityZone != true) {
|
||||
return listOf("'compatibilityZoneURL': present. Property cannot be set when 'devMode' is true unless devModeOptions.allowCompatibilityZone is also true")
|
||||
}
|
||||
}
|
||||
|
||||
// if compatibiliZoneURL is set then it will be copied into the networkServices field and thus skipping
|
||||
// this check by returning above is fine.
|
||||
networkServices?.let {
|
||||
return listOf("'networkServices': present. Property cannot be set when 'devMode' is true.")
|
||||
if (devModeOptions?.allowCompatibilityZone != true) {
|
||||
return listOf("'networkServices': present. Property cannot be set when 'devMode' is true unless devModeOptions.allowCompatibilityZone is also true")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return emptyList()
|
||||
}
|
||||
|
||||
|
@ -1,21 +1,15 @@
|
||||
package net.corda.node.services.config
|
||||
|
||||
import com.typesafe.config.Config
|
||||
import com.typesafe.config.ConfigException
|
||||
import com.typesafe.config.ConfigFactory
|
||||
import com.typesafe.config.ConfigParseOptions
|
||||
import com.typesafe.config.ConfigValueFactory
|
||||
import com.typesafe.config.*
|
||||
import net.corda.core.internal.toPath
|
||||
import net.corda.core.utilities.NetworkHostAndPort
|
||||
import net.corda.core.utilities.seconds
|
||||
import net.corda.testing.core.ALICE_NAME
|
||||
import net.corda.testing.node.MockServices.Companion.makeTestDataSourceProperties
|
||||
import net.corda.tools.shell.SSHDConfiguration
|
||||
import org.assertj.core.api.Assertions.assertThat
|
||||
import org.assertj.core.api.Assertions.assertThatCode
|
||||
import org.assertj.core.api.Assertions.assertThatThrownBy
|
||||
import org.junit.Assert.assertNotNull
|
||||
import org.assertj.core.api.Assertions.*
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertNotNull
|
||||
import org.junit.Test
|
||||
import java.net.URI
|
||||
import java.net.URL
|
||||
@ -138,6 +132,17 @@ class NodeConfigurationImplTest {
|
||||
assertThat(errors).hasOnlyOneElementSatisfying { error -> error.contains("compatibilityZoneURL") && error.contains("devMode") }
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `validation succeeds when compatibilityZoneURL is present and devMode is true and allowCompatibilityZoneURL is set`() {
|
||||
val configuration = testConfiguration.copy(
|
||||
devMode = true,
|
||||
compatibilityZoneURL = URL("https://r3.com"),
|
||||
devModeOptions = DevModeOptions(allowCompatibilityZone = true))
|
||||
|
||||
val errors = configuration.validate()
|
||||
assertThat(errors).isEmpty()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `errors for nested config keys contain path`() {
|
||||
var rawConfig = ConfigFactory.parseResources("working-config.conf", ConfigParseOptions.defaults().setAllowMissing(false))
|
||||
|
Reference in New Issue
Block a user