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:
Stefano Franz 2018-06-12 11:03:32 +01:00 committed by GitHub
parent dc220ef18e
commit 0f3453d1c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 34 additions and 18 deletions

View File

@ -7,6 +7,8 @@ release, see :doc:`upgrade-notes`.
Unreleased
==========
* Add ``devModeOptions.allowCompatibilityZone`` to re-enable the use of a compatibility zone and ``devMode``
* Fixed an issue where ``trackBy`` was returning ``ContractStates`` from a transaction that were not being tracked. The
unrelated ``ContractStates`` will now be filtered out from the returned ``Vault.Update``.
@ -151,7 +153,7 @@ Version 3.1
* Update the fast-classpath-scanner dependent library version from 2.0.21 to 2.12.3
.. note:: Whilst this is not the latest version of this library, that being 2.18.1 at time of writing, versions
later than 2.12.3 (including 2.12.4) exhibit a different issue.
later than 2.12.3 (including 2.12.4) exhibit a different issue.
* Updated the api scanner gradle plugin to work the same way as the version in master. These changes make the api scanner more
accurate and fix a couple of bugs, and change the format of the api-current.txt file slightly. Backporting these changes
@ -969,15 +971,15 @@ Special thank you to `Qian Hong <https://github.com/fracting>`_, `Marek Skocovsk
to Corda in M10.
.. warning:: Due to incompatibility between older version of IntelliJ and gradle 3.4, you will need to upgrade Intellij
to 2017.1 (with kotlin-plugin v1.1.1) in order to run Corda demos in IntelliJ. You can download the latest IntelliJ
to 2017.1 (with kotlin-plugin v1.1.1) in order to run Corda demos in IntelliJ. You can download the latest IntelliJ
from `JetBrains <https://www.jetbrains.com/idea/download/>`_.
.. warning:: The Kapt-generated models are no longer included in our codebase. If you experience ``unresolved references``
errors when building in IntelliJ, please rebuild the schema model by running ``gradlew kaptKotlin`` in Windows or
errors when building in IntelliJ, please rebuild the schema model by running ``gradlew kaptKotlin`` in Windows or
``./gradlew kaptKotlin`` in other systems. Alternatively, perform a full gradle build or install.
.. note:: Kapt is used to generate schema model and entity code (from annotations in the codebase) using the Kotlin Annotation
processor.
processor.
* Corda DemoBench:
* DemoBench is a new tool to make it easy to configure and launch local Corda nodes. A very useful tool to demonstrate

View File

@ -185,7 +185,13 @@ absolute path to the node's base directory.
:doormanURL: Root address of the network registration service.
:networkMapURL: Root address of the network map service.
.. note:: Only one of ``compatibilityZoneURL`` or ``networkServices`` should be used.
.. note:: Only one of ``compatibilityZoneURL`` or ``networkServices`` should be used.
:devModeOptions: Allows modification of certain ``devMode`` features
:allowCompatibilityZone: Allows a node configured to operate in development mode to connect to a compatibility zone.
.. note:: This is an unsupported configuration.
:jvmArgs: An optional list of JVM args, as strings, which replace those inherited from the command line when launching via ``corda.jar``
only. e.g. ``jvmArgs = [ "-Xmx220m", "-Xms220m", "-XX:+UseG1GC" ]``

View File

@ -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()
}

View File

@ -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))