diff --git a/.idea/compiler.xml b/.idea/compiler.xml
index 27f4989aa7..a48663d049 100644
--- a/.idea/compiler.xml
+++ b/.idea/compiler.xml
@@ -59,6 +59,8 @@
+
+
diff --git a/core/src/main/kotlin/net/corda/core/crypto/Crypto.kt b/core/src/main/kotlin/net/corda/core/crypto/Crypto.kt
index f2c0a45918..ccae80d47e 100644
--- a/core/src/main/kotlin/net/corda/core/crypto/Crypto.kt
+++ b/core/src/main/kotlin/net/corda/core/crypto/Crypto.kt
@@ -63,21 +63,21 @@ import javax.crypto.spec.SecretKeySpec
*/
object Crypto {
/**
- * RSA_SHA256 signature scheme using SHA256 as hash algorithm and MGF1 (with SHA256) as mask generation function.
+ * RSA_SHA256 signature scheme using SHA256 as hash algorithm.
* Note: Recommended key size >= 3072 bits.
*/
@JvmField
val RSA_SHA256 = SignatureScheme(
1,
"RSA_SHA256",
- AlgorithmIdentifier(PKCSObjectIdentifiers.rsaEncryption, null),
- emptyList(),
+ AlgorithmIdentifier(PKCSObjectIdentifiers.sha256WithRSAEncryption, null),
+ listOf(AlgorithmIdentifier(PKCSObjectIdentifiers.rsaEncryption, null)),
BouncyCastleProvider.PROVIDER_NAME,
"RSA",
- "SHA256WITHRSAANDMGF1",
+ "SHA256WITHRSAEncryption",
null,
3072,
- "RSA_SHA256 signature scheme using SHA256 as hash algorithm and MGF1 (with SHA256) as mask generation function."
+ "RSA_SHA256 signature scheme using SHA256 as hash algorithm."
)
/** ECDSA signature scheme using the secp256k1 Koblitz curve. */
@@ -117,7 +117,7 @@ object Crypto {
"EDDSA_ED25519_SHA512",
// OID taken from https://tools.ietf.org/html/draft-ietf-curdle-pkix-00
AlgorithmIdentifier(ASN1ObjectIdentifier("1.3.101.112"), null),
- emptyList(),
+ emptyList(), // Both keys and the signature scheme use the same OID in i2p library.
// We added EdDSA to bouncy castle for certificate signing.
BouncyCastleProvider.PROVIDER_NAME,
"1.3.101.112",
diff --git a/core/src/main/kotlin/net/corda/core/flows/FlowLogic.kt b/core/src/main/kotlin/net/corda/core/flows/FlowLogic.kt
index 8c9fba60de..a10a3d3fe2 100644
--- a/core/src/main/kotlin/net/corda/core/flows/FlowLogic.kt
+++ b/core/src/main/kotlin/net/corda/core/flows/FlowLogic.kt
@@ -348,6 +348,12 @@ abstract class FlowLogic {
}
}
+ /**
+ * Returns a pair of the current progress step index (as integer) in steps tree of current [progressTracker], and an observable
+ * of its upcoming changes.
+ *
+ * @return Returns null if this flow has no progress tracker.
+ */
fun trackStepsTreeIndex(): DataFeed? {
// TODO this is not threadsafe, needs an atomic get-step-and-subscribe
return progressTracker?.let {
@@ -355,6 +361,12 @@ abstract class FlowLogic {
}
}
+ /**
+ * Returns a pair of the current steps tree of current [progressTracker] as pairs of zero-based depth and stringified step
+ * label and observable of upcoming changes to the structure.
+ *
+ * @return Returns null if this flow has no progress tracker.
+ */
fun trackStepsTree(): DataFeed>, List>>? {
// TODO this is not threadsafe, needs an atomic get-step-and-subscribe
return progressTracker?.let {
diff --git a/core/src/main/kotlin/net/corda/core/identity/CordaX500Name.kt b/core/src/main/kotlin/net/corda/core/identity/CordaX500Name.kt
index 37e872d562..ee8baa8733 100644
--- a/core/src/main/kotlin/net/corda/core/identity/CordaX500Name.kt
+++ b/core/src/main/kotlin/net/corda/core/identity/CordaX500Name.kt
@@ -9,7 +9,7 @@ import org.bouncycastle.asn1.ASN1ObjectIdentifier
import org.bouncycastle.asn1.x500.AttributeTypeAndValue
import org.bouncycastle.asn1.x500.X500Name
import org.bouncycastle.asn1.x500.style.BCStyle
-import java.util.Locale
+import java.util.*
import javax.security.auth.x500.X500Principal
/**
@@ -45,7 +45,7 @@ data class CordaX500Name(val commonName: String?,
init {
// Legal name checks.
- LegalNameValidator.validateLegalName(organisation)
+ LegalNameValidator.validateOrganization(organisation)
// Attribute data width checks.
require(country.length == LENGTH_COUNTRY) { "Invalid country '$country' Country code must be $LENGTH_COUNTRY letters ISO code " }
diff --git a/core/src/main/kotlin/net/corda/core/internal/InternalUtils.kt b/core/src/main/kotlin/net/corda/core/internal/InternalUtils.kt
index 562c3f916d..63582c164b 100644
--- a/core/src/main/kotlin/net/corda/core/internal/InternalUtils.kt
+++ b/core/src/main/kotlin/net/corda/core/internal/InternalUtils.kt
@@ -304,6 +304,6 @@ fun TransactionBuilder.toWireTransaction(services: ServicesForResolution, serial
fun TransactionBuilder.toLedgerTransaction(services: ServiceHub, serializationContext: SerializationContext) = toLedgerTransactionWithContext(services, serializationContext)
/** Convenience method to get the package name of a class literal. */
-val KClass<*>.packageName get() = java.`package`.name
+val KClass<*>.packageName: String get() = java.`package`.name
fun URL.openHttpConnection(): HttpURLConnection = openConnection() as HttpURLConnection
diff --git a/core/src/main/kotlin/net/corda/core/internal/LegalNameValidator.kt b/core/src/main/kotlin/net/corda/core/internal/LegalNameValidator.kt
index 967afc5e7a..892f83b224 100644
--- a/core/src/main/kotlin/net/corda/core/internal/LegalNameValidator.kt
+++ b/core/src/main/kotlin/net/corda/core/internal/LegalNameValidator.kt
@@ -6,8 +6,27 @@ import java.util.regex.Pattern
import javax.security.auth.x500.X500Principal
object LegalNameValidator {
+ @Deprecated("Use validateOrganization instead", replaceWith = ReplaceWith("validateOrganization(normalizedLegalName)"))
+ fun validateLegalName(normalizedLegalName: String) = validateOrganization(normalizedLegalName)
+
/**
- * The validation function will validate the input string using the following rules:
+ * The validation function validates a string for use as part of a legal name. It applies the following rules:
+ *
+ * - No blacklisted words like "node", "server".
+ * - Restrict names to Latin scripts for now to avoid right-to-left issues, debugging issues when we can't pronounce
+ * names over the phone, and character confusability attacks.
+ * - No commas or equals signs.
+ * - No dollars or quote marks, we might need to relax the quote mark constraint in future to handle Irish company names.
+ *
+ * @throws IllegalArgumentException if the name does not meet the required rules. The message indicates why not.
+ */
+ fun validateNameAttribute(normalizedNameAttribute: String) {
+ Rule.baseNameRules.forEach { it.validate(normalizedNameAttribute) }
+ }
+
+ /**
+ * The validation function validates a string for use as the organization attribute of a name, which includes additional
+ * constraints over basic name attribute checks. It applies the following rules:
*
* - No blacklisted words like "node", "server".
* - Restrict names to Latin scripts for now to avoid right-to-left issues, debugging issues when we can't pronounce
@@ -18,16 +37,19 @@ object LegalNameValidator {
*
* @throws IllegalArgumentException if the name does not meet the required rules. The message indicates why not.
*/
- fun validateLegalName(normalizedLegalName: String) {
- Rule.legalNameRules.forEach { it.validate(normalizedLegalName) }
+ fun validateOrganization(normalizedOrganization: String) {
+ Rule.legalNameRules.forEach { it.validate(normalizedOrganization) }
}
+ @Deprecated("Use normalize instead", replaceWith = ReplaceWith("normalize(legalName)"))
+ fun normalizeLegalName(legalName: String): String = normalize(legalName)
+
/**
* The normalize function will trim the input string, replace any multiple spaces with a single space,
* and normalize the string according to NFKC normalization form.
*/
- fun normaliseLegalName(legalName: String): String {
- val trimmedLegalName = legalName.trim().replace(WHITESPACE, " ")
+ fun normalize(nameAttribute: String): String {
+ val trimmedLegalName = nameAttribute.trim().replace(WHITESPACE, " ")
return Normalizer.normalize(trimmedLegalName, Normalizer.Form.NFKC)
}
@@ -35,15 +57,17 @@ object LegalNameValidator {
sealed class Rule {
companion object {
- val legalNameRules: List> = listOf(
+ val baseNameRules: List> = listOf(
UnicodeNormalizationRule(),
CharacterRule(',', '=', '$', '"', '\'', '\\'),
WordRule("node", "server"),
LengthRule(maxLength = 255),
// TODO: Implement confusable character detection if we add more scripts.
UnicodeRangeRule(LATIN, COMMON, INHERITED),
+ X500NameRule()
+ )
+ val legalNameRules: List> = baseNameRules + listOf(
CapitalLetterRule(),
- X500NameRule(),
MustHaveAtLeastTwoLettersRule()
)
}
@@ -52,7 +76,7 @@ object LegalNameValidator {
private class UnicodeNormalizationRule : Rule() {
override fun validate(legalName: String) {
- require(legalName == normaliseLegalName(legalName)) { "Legal name must be normalized. Please use 'normaliseLegalName' to normalize the legal name before validation." }
+ require(legalName == normalize(legalName)) { "Legal name must be normalized. Please use 'normalize' to normalize the legal name before validation." }
}
}
diff --git a/core/src/main/kotlin/net/corda/core/internal/schemas/NodeInfoSchema.kt b/core/src/main/kotlin/net/corda/core/internal/schemas/NodeInfoSchema.kt
index 525180ed60..19d4a74255 100644
--- a/core/src/main/kotlin/net/corda/core/internal/schemas/NodeInfoSchema.kt
+++ b/core/src/main/kotlin/net/corda/core/internal/schemas/NodeInfoSchema.kt
@@ -37,7 +37,7 @@ object NodeInfoSchemaV1 : MappedSchema(
@Column(name = "legal_identities_certs")
@ManyToMany(cascade = arrayOf(CascadeType.ALL))
- @JoinTable(name = "link_nodeinfo_party",
+ @JoinTable(name = "node_link_nodeinfo_party",
joinColumns = arrayOf(JoinColumn(name = "node_info_id")),
inverseJoinColumns = arrayOf(JoinColumn(name = "party_name")))
val legalIdentitiesAndCerts: List,
diff --git a/core/src/main/kotlin/net/corda/core/messaging/FlowHandle.kt b/core/src/main/kotlin/net/corda/core/messaging/FlowHandle.kt
index 90ba7e2596..84d734db29 100644
--- a/core/src/main/kotlin/net/corda/core/messaging/FlowHandle.kt
+++ b/core/src/main/kotlin/net/corda/core/messaging/FlowHandle.kt
@@ -8,13 +8,17 @@ import rx.Observable
/**
* [FlowHandle] is a serialisable handle for the started flow, parameterised by the type of the flow's return value.
- *
- * @property id The started state machine's ID.
- * @property returnValue A [CordaFuture] of the flow's return value.
*/
@DoNotImplement
interface FlowHandle : AutoCloseable {
+ /**
+ * The started state machine's ID.
+ */
val id: StateMachineRunId
+
+ /**
+ * A [CordaFuture] of the flow's return value.
+ */
val returnValue: CordaFuture
/**
@@ -25,15 +29,23 @@ interface FlowHandle : AutoCloseable {
/**
* [FlowProgressHandle] is a serialisable handle for the started flow, parameterised by the type of the flow's return value.
- *
- * @property progress The stream of progress tracker events.
*/
interface FlowProgressHandle : FlowHandle {
+ /**
+ * The stream of progress tracker events.
+ */
val progress: Observable
+ /**
+ * [DataFeed] of current step in the steps tree, see [ProgressTracker]
+ */
val stepsTreeIndexFeed: DataFeed?
+ /**
+ * [DataFeed] of current steps tree, see [ProgressTracker]
+ */
val stepsTreeFeed: DataFeed>, List>>?
+
/**
* Use this function for flows whose returnValue and progress are not going to be used or tracked, so as to free up
* server resources.
diff --git a/core/src/main/kotlin/net/corda/core/utilities/ProgressTracker.kt b/core/src/main/kotlin/net/corda/core/utilities/ProgressTracker.kt
index 22661eeb7b..8ce440ead3 100644
--- a/core/src/main/kotlin/net/corda/core/utilities/ProgressTracker.kt
+++ b/core/src/main/kotlin/net/corda/core/utilities/ProgressTracker.kt
@@ -99,6 +99,7 @@ class ProgressTracker(vararg steps: Step) {
field = value
}
+ /** The zero-bases index of the current step in a [allStepsLabels] list */
var stepsTreeIndex: Int = -1
private set(value) {
field = value
@@ -226,6 +227,10 @@ class ProgressTracker(vararg steps: Step) {
*/
val allSteps: List> get() = _allStepsCache
+ /**
+ * A list of all steps label in this ProgressTracker and the children, with the indent level provided starting at zero.
+ * Note that UNSTARTED is never counted, and DONE is only counted at the calling level.
+ */
val allStepsLabels: List> get() = _allStepsLabels()
private var curChangeSubscription: Subscription? = null
@@ -245,8 +250,14 @@ class ProgressTracker(vararg steps: Step) {
*/
val changes: Observable get() = _changes
+ /**
+ * An observable stream of changes to the [allStepsLabels]
+ */
val stepsTreeChanges: Observable>> get() = _stepsTreeChanges
+ /**
+ * An observable stream of changes to the [stepsTreeIndex]
+ */
val stepsTreeIndexChanges: Observable get() = _stepsTreeIndexChanges
/** Returns true if the progress tracker has ended, either by reaching the [DONE] step or prematurely with an error */
diff --git a/core/src/test/kotlin/net/corda/core/internal/LegalNameValidatorTest.kt b/core/src/test/kotlin/net/corda/core/internal/LegalNameValidatorTest.kt
index 0f96141922..fa854b42e4 100644
--- a/core/src/test/kotlin/net/corda/core/internal/LegalNameValidatorTest.kt
+++ b/core/src/test/kotlin/net/corda/core/internal/LegalNameValidatorTest.kt
@@ -8,55 +8,55 @@ class LegalNameValidatorTest {
@Test
fun `no double spaces`() {
assertFailsWith(IllegalArgumentException::class) {
- LegalNameValidator.validateLegalName("Test Legal Name")
+ LegalNameValidator.validateOrganization("Test Legal Name")
}
- LegalNameValidator.validateLegalName(LegalNameValidator.normaliseLegalName("Test Legal Name"))
+ LegalNameValidator.validateOrganization(LegalNameValidator.normalize("Test Legal Name"))
}
@Test
fun `no trailing white space`() {
assertFailsWith(IllegalArgumentException::class) {
- LegalNameValidator.validateLegalName("Test ")
+ LegalNameValidator.validateOrganization("Test ")
}
}
@Test
fun `no prefixed white space`() {
assertFailsWith(IllegalArgumentException::class) {
- LegalNameValidator.validateLegalName(" Test")
+ LegalNameValidator.validateOrganization(" Test")
}
}
@Test
fun `blacklisted words`() {
assertFailsWith(IllegalArgumentException::class) {
- LegalNameValidator.validateLegalName("Test Server")
+ LegalNameValidator.validateOrganization("Test Server")
}
}
@Test
fun `blacklisted characters`() {
- LegalNameValidator.validateLegalName("Test")
+ LegalNameValidator.validateOrganization("Test")
assertFailsWith(IllegalArgumentException::class) {
- LegalNameValidator.validateLegalName("\$Test")
+ LegalNameValidator.validateOrganization("\$Test")
}
assertFailsWith(IllegalArgumentException::class) {
- LegalNameValidator.validateLegalName("\"Test")
+ LegalNameValidator.validateOrganization("\"Test")
}
assertFailsWith(IllegalArgumentException::class) {
- LegalNameValidator.validateLegalName("\'Test")
+ LegalNameValidator.validateOrganization("\'Test")
}
assertFailsWith(IllegalArgumentException::class) {
- LegalNameValidator.validateLegalName("=Test")
+ LegalNameValidator.validateOrganization("=Test")
}
}
@Test
fun `unicode range`() {
- LegalNameValidator.validateLegalName("Test A")
+ LegalNameValidator.validateOrganization("Test A")
assertFailsWith(IllegalArgumentException::class) {
// Greek letter A.
- LegalNameValidator.validateLegalName("Test Α")
+ LegalNameValidator.validateOrganization("Test Α")
}
}
@@ -66,37 +66,37 @@ class LegalNameValidatorTest {
while (longLegalName.length < 255) {
longLegalName.append("A")
}
- LegalNameValidator.validateLegalName(longLegalName.toString())
+ LegalNameValidator.validateOrganization(longLegalName.toString())
assertFailsWith(IllegalArgumentException::class) {
- LegalNameValidator.validateLegalName(longLegalName.append("A").toString())
+ LegalNameValidator.validateOrganization(longLegalName.append("A").toString())
}
}
@Test
fun `legal name should be capitalized`() {
- LegalNameValidator.validateLegalName("Good legal name")
+ LegalNameValidator.validateOrganization("Good legal name")
assertFailsWith(IllegalArgumentException::class) {
- LegalNameValidator.validateLegalName("bad name")
+ LegalNameValidator.validateOrganization("bad name")
}
assertFailsWith(IllegalArgumentException::class) {
- LegalNameValidator.validateLegalName("bad Name")
+ LegalNameValidator.validateOrganization("bad Name")
}
}
@Test
fun `correctly handle whitespaces`() {
- assertEquals("Legal Name With Tab", LegalNameValidator.normaliseLegalName("Legal Name With\tTab"))
- assertEquals("Legal Name With Unicode Whitespaces", LegalNameValidator.normaliseLegalName("Legal Name\u2004With\u0009Unicode\u0020Whitespaces"))
- assertEquals("Legal Name With Line Breaks", LegalNameValidator.normaliseLegalName("Legal Name With\n\rLine\nBreaks"))
+ assertEquals("Legal Name With Tab", LegalNameValidator.normalize("Legal Name With\tTab"))
+ assertEquals("Legal Name With Unicode Whitespaces", LegalNameValidator.normalize("Legal Name\u2004With\u0009Unicode\u0020Whitespaces"))
+ assertEquals("Legal Name With Line Breaks", LegalNameValidator.normalize("Legal Name With\n\rLine\nBreaks"))
assertFailsWith(IllegalArgumentException::class) {
- LegalNameValidator.validateLegalName("Legal Name With\tTab")
+ LegalNameValidator.validateOrganization("Legal Name With\tTab")
}
assertFailsWith(IllegalArgumentException::class) {
- LegalNameValidator.validateLegalName("Legal Name\u2004With\u0009Unicode\u0020Whitespaces")
+ LegalNameValidator.validateOrganization("Legal Name\u2004With\u0009Unicode\u0020Whitespaces")
}
assertFailsWith(IllegalArgumentException::class) {
- LegalNameValidator.validateLegalName("Legal Name With\n\rLine\nBreaks")
+ LegalNameValidator.validateOrganization("Legal Name With\n\rLine\nBreaks")
}
}
}
\ No newline at end of file
diff --git a/core/src/test/kotlin/net/corda/core/utilities/ProgressTrackerTest.kt b/core/src/test/kotlin/net/corda/core/utilities/ProgressTrackerTest.kt
index 9bcf5c0fb5..4e15f122d9 100644
--- a/core/src/test/kotlin/net/corda/core/utilities/ProgressTrackerTest.kt
+++ b/core/src/test/kotlin/net/corda/core/utilities/ProgressTrackerTest.kt
@@ -98,7 +98,7 @@ class ProgressTrackerTest {
val allSteps = pt.allSteps
- //capture notifications
+ // Capture notifications.
val stepsIndexNotifications = LinkedList()
pt.stepsTreeIndexChanges.subscribe {
stepsIndexNotifications += it
@@ -113,7 +113,7 @@ class ProgressTrackerTest {
assertEquals(step, allSteps[pt.stepsTreeIndex].second)
}
- //travel tree
+ // Travel tree.
pt.currentStep = SimpleSteps.ONE
assertCurrentStepsTree(0, SimpleSteps.ONE)
@@ -126,7 +126,7 @@ class ProgressTrackerTest {
pt.currentStep = SimpleSteps.THREE
assertCurrentStepsTree(5, SimpleSteps.THREE)
- //assert no structure changes and proper steps propagation
+ // Assert no structure changes and proper steps propagation.
assertThat(stepsIndexNotifications).containsExactlyElementsOf(listOf(0, 1, 3, 5))
assertThat(stepsTreeNotification).isEmpty()
}
@@ -135,13 +135,13 @@ class ProgressTrackerTest {
fun `structure changes are pushed down when progress trackers are added`() {
pt.setChildProgressTracker(SimpleSteps.TWO, pt2)
- //capture notifications
+ // Capture notifications.
val stepsIndexNotifications = LinkedList()
pt.stepsTreeIndexChanges.subscribe {
stepsIndexNotifications += it
}
- //put current state as a first change for simplicity when asserting
+ // Put current state as a first change for simplicity when asserting.
val stepsTreeNotification = mutableListOf(pt.allStepsLabels)
println(pt.allStepsLabels)
pt.stepsTreeChanges.subscribe {
@@ -164,7 +164,7 @@ class ProgressTrackerTest {
assertCurrentStepsTree(9, SimpleSteps.FOUR)
- //assert no structure changes and proper steps propagation
+ // Assert no structure changes and proper steps propagation.
assertThat(stepsIndexNotifications).containsExactlyElementsOf(listOf(1, 6, 9))
assertThat(stepsTreeNotification).hasSize(2) // 1 change + 1 our initial state
}
@@ -173,13 +173,13 @@ class ProgressTrackerTest {
fun `structure changes are pushed down when progress trackers are removed`() {
pt.setChildProgressTracker(SimpleSteps.TWO, pt2)
- //capture notifications
+ // Capture notifications.
val stepsIndexNotifications = LinkedList()
pt.stepsTreeIndexChanges.subscribe {
stepsIndexNotifications += it
}
- //put current state as a first change for simplicity when asserting
+ // Put current state as a first change for simplicity when asserting.
val stepsTreeNotification = mutableListOf(pt.allStepsLabels)
pt.stepsTreeChanges.subscribe {
stepsTreeNotification += it
@@ -199,9 +199,9 @@ class ProgressTrackerTest {
assertCurrentStepsTree(2, BabySteps.UNOS)
- //assert no structure changes and proper steps propagation
+ // Assert no structure changes and proper steps propagation.
assertThat(stepsIndexNotifications).containsExactlyElementsOf(listOf(1, 4, 2))
- assertThat(stepsTreeNotification).hasSize(2) // 1 change + 1 our initial state
+ assertThat(stepsTreeNotification).hasSize(2) // 1 change + 1 our initial state.
}
@Test
diff --git a/docs/source/building-a-cordapp-index.rst b/docs/source/building-a-cordapp-index.rst
index b3b4bd8eb6..a1373f9849 100644
--- a/docs/source/building-a-cordapp-index.rst
+++ b/docs/source/building-a-cordapp-index.rst
@@ -10,4 +10,5 @@ CorDapps
building-against-master
corda-api
flow-cookbook
- cheat-sheet
\ No newline at end of file
+ cheat-sheet
+ building-a-cordapp-samples
diff --git a/docs/source/building-a-cordapp-samples.rst b/docs/source/building-a-cordapp-samples.rst
new file mode 100644
index 0000000000..40affe1a26
--- /dev/null
+++ b/docs/source/building-a-cordapp-samples.rst
@@ -0,0 +1,21 @@
+CorDapp samples
+===============
+
+There are two distinct sets of samples provided with Corda, one introducing new developers to how to write CorDapps, and
+more complex worked examples of how solutions to a number of common designs could be implemented in a CorDapp.
+The former can be found on `the Corda website `_. In particular, new developers
+should start with the :doc:`example CorDapp `.
+
+The advanced samples are contained within the `samples/` folder of the Corda repository. The most generally useful of
+these samples are:
+
+1. The `trader-demo`, which shows a delivery-vs-payment atomic swap of commercial paper for cash
+2. The `attachment-demo`, which demonstrates uploading attachments to nodes
+3. The `bank-of-corda-demo`, which shows a node acting as an issuer of assets (the Bank of Corda) while remote client
+ applications request issuance of some cash on behalf of a node called Big Corporation
+
+Documentation on running the samples can be found inside the sample directories themselves, in the `README.md` file.
+
+.. note:: If you would like to see flow activity on the nodes type in the node terminal ``flow watch``.
+
+Please report any bugs with the samples on `GitHub `_.
diff --git a/docs/source/changelog.rst b/docs/source/changelog.rst
index f7cd7bc4ec..0d011b1891 100644
--- a/docs/source/changelog.rst
+++ b/docs/source/changelog.rst
@@ -93,6 +93,9 @@ UNRELEASED
* ``waitForAllNodesToFinish()`` method in ``DriverDSLExposedInterface`` has instead become a parameter on driver creation.
+* ``database.transactionIsolationLevel`` values now follow the ``java.sql.Connection`` int constants but without the
+ "TRANSACTION_" prefix, i.e. "NONE", "READ_UNCOMMITTED", etc.
+
* Enterprise Corda only: Compatibility with SQL Server 2017 and SQL Azure databases.
* Enterprise Corda only: node configuration property ``database.schema`` and documented existing database properties.
diff --git a/docs/source/corda-configuration-file.rst b/docs/source/corda-configuration-file.rst
index 08f0b6285d..3300d2fd79 100644
--- a/docs/source/corda-configuration-file.rst
+++ b/docs/source/corda-configuration-file.rst
@@ -68,6 +68,13 @@ path to the node's base directory.
.. note:: Longer term these keys will be managed in secure hardware devices.
+:database: Database configuration:
+
+ :initDatabase: Boolean on whether to initialise the database or just validate the schema. Defaults to true.
+ :serverNameTablePrefix: Prefix string to apply to all the database tables. The default is no prefix.
+ :transactionIsolationLevel: Transaction isolation level as defined by the ``TRANSACTION_`` constants in
+ ``java.sql.Connection``, but without the "TRANSACTION_" prefix. Defaults to REPEATABLE_READ.
+
:dataSourceProperties: This section is used to configure the jdbc connection and database driver used for the nodes persistence.
Currently the defaults in ``/node/src/main/resources/reference.conf`` are as shown in the first example. This is currently
the only configuration that has been tested, although in the future full support for other storage layers will be validated.
diff --git a/docs/source/corda-networks-index.rst b/docs/source/corda-networks-index.rst
index abdcf7c0b5..9315a2de09 100644
--- a/docs/source/corda-networks-index.rst
+++ b/docs/source/corda-networks-index.rst
@@ -6,4 +6,5 @@ Corda networks
setting-up-a-corda-network
permissioning
- versioning
\ No newline at end of file
+ network-map
+ versioning
diff --git a/docs/source/key-concepts-identity.rst b/docs/source/key-concepts-identity.rst
index 7f1f9bbcc2..de01ee8295 100644
--- a/docs/source/key-concepts-identity.rst
+++ b/docs/source/key-concepts-identity.rst
@@ -49,8 +49,17 @@ the minimum supported set for X.509 certificates (specified in RFC 3280), plus t
* common name (CN) - used only for service identities
The organisation, locality and country attributes are required, while state, organisational-unit and common name are
-optional. Attributes cannot be be present more than once in the name. The "country" code is strictly restricted to valid
-ISO 3166-1 two letter codes.
+optional. Attributes cannot be be present more than once in the name.
+
+All of these attributes have the following set of constraints applied for security reasons:
+
+ - No blacklisted words (currently "node" and "server").
+ - Restrict names to Latin scripts for now to avoid right-to-left issues, debugging issues when we can't pronounce names over the phone, and character confusability attacks.
+ - No commas or equals signs.
+ - No dollars or quote marks.
+
+Additionally the "organisation" attribute must consist of at least three letters and starting with a capital letter,
+and "country code" is strictly restricted to valid ISO 3166-1 two letter codes.
Certificates
------------
diff --git a/docs/source/network-map.rst b/docs/source/network-map.rst
index d8ee82a2cf..34356bad4f 100644
--- a/docs/source/network-map.rst
+++ b/docs/source/network-map.rst
@@ -1,6 +1,14 @@
Network Map
===========
+The network map stores a collection of ``NodeInfo`` objects, each representing another node with which the node can interact.
+There two sources from which a Corda node can retrieve ``NodeInfo`` objects:
+
+1. the REST protocol with the network map service, which also provides a publishing API,
+
+2. the ``additional-node-infos`` directory.
+
+
Protocol Design
---------------
The node info publishing protocol:
@@ -35,4 +43,15 @@ Network Map service REST API:
| GET | /api/network-map/parameters/{hash}| Retrieve ``NetworkParameters`` object with the same hash. |
+----------------+-----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+
-TODO: Access control of the network map will be added in the future.
\ No newline at end of file
+TODO: Access control of the network map will be added in the future.
+
+
+The ``additional-node-infos`` directory
+---------------------------------------
+Each Corda node reads, and continuously polls, the files contained in a directory named ``additional-node-infos`` inside the node base directory.
+
+Nodes expect to find a serialized ``SignedData`` object, the same object which is sent to network map server.
+
+Whenever a node starts it writes on disk a file containing its own ``NodeInfo``, this file is called ``nodeInfo-XXX`` where ``XXX`` is a long string.
+
+Hence if an operator wants node A to see node B they can pick B's ``NodeInfo`` file from B base directory and drop it into A's ``additional-node-infos`` directory.
diff --git a/docs/source/permissioning.rst b/docs/source/permissioning.rst
index 637b78ab50..dcffd0bb49 100644
--- a/docs/source/permissioning.rst
+++ b/docs/source/permissioning.rst
@@ -1,104 +1,124 @@
-Network permissioning (Doorman)
-===============================
+Network Permissioning
+=====================
-The keystore located in ``/certificates/sslkeystore.jks`` is required to connect to the Corda network securely.
-In development mode (when ``devMode = true``, see ":doc:`corda-configuration-file`" for more information) a pre-configured
-keystore will be used if the keystore does not exist. This is to ensure developers can get the nodes working as quickly
-as possible.
+.. contents::
-However this is not secure for the real network. This documentation will explain the procedure of obtaining a signed
-certificate for TestNet.
+Corda networks are *permissioned*. To connect to a network, a node needs three keystores in its
+``/certificates/`` folder:
-Initial Registration
---------------------
+* ``truststore.jks``, which stores trusted public keys and certificates (in our case, those of the network root CA)
+* ``nodekeystore.jks``, which stores the node’s identity keypairs and certificates
+* ``sslkeystore.jks``, which stores the node’s TLS keypairs and certificates
-The certificate signing request will be created based on node information obtained from the node configuration.
-The following information from the node configuration file is needed to generate the request.
+In development mode (i.e. when ``devMode = true``, see :doc:`corda-configuration-file` for more information),
+pre-configured keystores are used if the required keystores do not exist. This ensures that developers can get the
+nodes working as quickly as possible.
-:myLegalName: Your company's legal name as an X.500 string. X.500 allows differentiation between entities with the same
- name as the legal name needs to be unique on the network. If another node has already been permissioned with this
- name then the permissioning server will automatically reject the request. The request will also be rejected if it
- violates legal name rules, see `Legal Name Constraints`_ for more information.
+However, these pre-configured keystores are not secure. Production deployments require a secure certificate authority.
+Most production deployments will use an existing certificate authority or construct one using software that will be
+made available in the coming months. Until then, the documentation below can be used to create your own certificate
+authority.
-:emailAddress: e.g. "admin@company.com"
+Network structure
+-----------------
+A Corda network has three types of certificate authorities (CAs):
-:compatibilityZoneURL: Corda compatibility zone network management service root URL.
+* The **root network CA**
+* The **intermediate network CA**
-A new pair of private and public keys generated by the Corda node will be used to create the request.
+ * The intermediate network CA is used instead of the root network CA for day-to-day
+ key signing to reduce the risk of the root network CA's private key being compromised
-The utility will submit the request to the doorman server and poll for a result periodically to retrieve the certificates.
-Once the request has been approved and the certificates downloaded from the server, the node will create the keystore and trust store using the certificates and the generated private key.
+* The **node CAs**
-.. note:: You can exit the utility at any time if the approval process is taking longer than expected. The request process will resume on restart.
+ * Each node serves as its own CA in issuing the child certificates that it uses to sign its identity
+ keys, anonymous keys and TLS certificates
-This process only is needed when the node connects to the network for the first time, or when the certificate expires.
+Keypair and certificate formats
+-------------------------------
+You can use any standard key tools or Corda's ``X509Utilities`` (which uses Bouncy Castle) to create the required
+public/private keypairs and certificates. The keypairs and certificates should obey the following restrictions:
-Legal Name Constraints
-----------------------
-The legal name is the unique identifier in the Corda network, so constraints have been set out to prevent encoding attacks and visual spoofing.
+* The certificates must follow the `X.509 standard `_
-The legal name validator (see ``LegalNameValidator.kt``) is used to enforce rules on Corda's legal names, it is intended to be used by the network operator and Corda node during the node registration process.
-It has two functions, a function to normalize legal names, and a function to validate legal names.
+ * We recommend X.509 v3 for forward compatibility
-The normalize function performs the following transformations:
+* The TLS certificates must follow the `TLS v1.2 standard `_
-* Remove leading and trailing whitespaces.
+Creating the root and intermediate network CAs
+----------------------------------------------
-* Replace multiple whitespaces with a single space.
+Creating the root network CA's keystore and truststore
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-* Normalize the string according to `NFKC normalization form `_.
+1. Create a new keypair
-The validation function will validate the input string using the following rules:
+ * This will be used as the root network CA's keypair
-* No blacklisted words like "node", "server".
+2. Create a self-signed certificate for the keypair. The basic constraints extension must be set to ``true``
-* Restrict names to Latin scripts for now to avoid right-to-left issues, debugging issues when we can't pronounce names over the phone, and character confusability attacks.
+ * This will be used as the root network CA's certificate
-* Should start with a capital letter.
+3. Create a new keystore and store the root network CA's keypair and certificate in it for later use
-* No commas or equals signs.
+ * This keystore will be used by the root network CA to sign the intermediate network CA's certificate
-* No dollars or quote marks, although we may relax the quote mark constraint in future to handle Irish company names.
+4. Create a new Java keystore named ``truststore.jks`` and store the root network CA's certificate in it using the
+ alias ``cordarootca``
-Starting the Registration
--------------------------
+ * This keystore will be provisioned to the individual nodes later
-You will need to specify the working directory of your Corda node using ``--base-dir`` flag. This is defaulted to current directory if left blank.
-You can also specify the location of ``node.conf`` with ``--config-file`` flag if it's not in the working directory.
+.. warning:: The root network CA's private key should be protected and kept safe.
-**To start the registration**::
+Creating the intermediate network CA's keystore
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- java -jar corda.jar --initial-registration --base-dir <> --config-file <>
+1. Create a new keypair
-A ``certificates`` folder containing the keystore and trust store will be created in the base directory when the process is completed.
+ * This will be used as the intermediate network CA's keypair
-.. warning:: The keystore is protected by the keystore password from the node configuration file. The password should kept safe to protect the private key and certificate.
+2. Obtain a certificate for the keypair signed with the root network CA key. The basic constraints extension must be
+ set to ``true``
+ * This will be used as the intermediate network CA's certificate
-Protocol Design
----------------
-.. note:: This section is intended for developers who want to implement their own doorman service.
+3. Create a new keystore and store the intermediate network CA's keypair and certificate chain
+ (i.e. the intermediate network CA certificate *and* the root network CA certificate) in it for later use
-The certificate signing protocol:
+ * This keystore will be used by the intermediate network CA to sign the nodes' identity certificates
-* Generate a keypair, save it to disk.
+Creating the node CA keystores and TLS keystores
+------------------------------------------------
-* Generate a CSR using Bouncy Castle or the java crypto APIs containing myLegalName from the config file. We should also have an admin email address in the config file and CSR so we know who to email if anything goes wrong. Sign it with the private key.
+Creating the node CA keystores
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-* HTTPS POST the CSR to the doorman. It creates the server-side records of this request, allocates an ID for it, and then sends back an HTTP redirect to another URL that contains that request ID (which should be sufficiently large that it's not predictable or brute forceable).
+1. For each node, create a new keypair
-* Store that URL to disk.
+2. Obtain a certificate for the keypair signed with the intermediate network CA key. The basic constraints extension must be
+ set to ``true``
-* Server goes into a slow polling loop, in which every 10 minutes or so it fetches the URL it was given in the redirect. Mostly it will get 204 No Content. Eventually it will get 200 OK and download the signed certificate in binary form, which it can then stash in its local keystore file.
+3. Create a new Java keystore named ``nodekeystore.jks`` and store the keypair in it using the alias ``cordaclientca``
-The initial registration process uses the following web api to communicate with the doorman service:
+ * The node will store this keystore locally to sign its identity keys and anonymous keys
-+----------------+------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+
-| Request method | Path | Description |
-+================+==============================+========================================================================================================================================================+
-| POST | /api/certificate | Create new certificate request record and stored for further approval process, server will response with a request ID if the request has been accepted.|
-+----------------+------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+
-| GET | /api/certificate/{requestId} | Retrieve certificates for requestId, the server will return HTTP 204 if request is not yet approved or HTTP 401 if it has been rejected. |
-+----------------+------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+
+Creating the node TLS keystores
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-See ``NetworkRegistrationHelper`` and ``X509Utilities`` for examples of certificate signing request creation and certificate signing using Bouncy Castle.
+1. For each node, create a new keypair
+
+2. Create a certificate for the keypair signed with the node CA key. The basic constraints extension must be set to
+ ``false``
+
+3. Create a new Java keystore named ``sslkeystore.jks`` and store the key and certificates in it using the alias
+ ``cordaclienttls``
+
+ * The node will store this keystore locally to sign its TLS certificates
+
+Installing the certificates on the nodes
+----------------------------------------
+For each node, copy the following files to the node's certificate directory (``/certificates/``):
+
+1. The node's ``nodekeystore.jks`` keystore
+2. The node's ``sslkeystore.jks`` keystore
+3. The root network CA's ``truststore.jks`` keystore
diff --git a/docs/source/quickstart-index.rst b/docs/source/quickstart-index.rst
index a42b469e95..02e9045ac9 100644
--- a/docs/source/quickstart-index.rst
+++ b/docs/source/quickstart-index.rst
@@ -7,4 +7,5 @@ Quickstart
getting-set-up
tutorial-cordapp
Sample CorDapps
+ building-against-master
CLI-vs-IDE
\ No newline at end of file
diff --git a/docs/source/running-the-demos.rst b/docs/source/running-the-demos.rst
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/docs/source/setting-up-a-corda-network.rst b/docs/source/setting-up-a-corda-network.rst
index 41a44d300f..c5e43e01fd 100644
--- a/docs/source/setting-up-a-corda-network.rst
+++ b/docs/source/setting-up-a-corda-network.rst
@@ -3,15 +3,20 @@
Creating a Corda network
========================
-A Corda network consists of a number of machines running nodes. These nodes communicate using persistent protocols in order to create and validate transactions.
+A Corda network consists of a number of machines running nodes. These nodes communicate using persistent protocols in
+order to create and validate transactions.
-There are four broader categories of functionality one such node may have. These pieces of functionality are provided as
-services, and one node may run several of them.
+There are four broader categories of functionality one such node may have. These pieces of functionality are provided
+as services, and one node may run several of them.
-* Network map: The node running the network map provides a way to resolve identities to physical node addresses and associated public keys.
-* Notary: Nodes running a notary service witness state spends and have the final say in whether a transaction is a double-spend or not.
-* Oracle: Network services that link the ledger to the outside world by providing facts that affect the validity of transactions.
-* Regular node: All nodes have a vault and may start protocols communicating with other nodes, notaries and oracles and evolve their private ledger.
+* Network map: The node running the network map provides a way to resolve identities to physical node addresses and
+ associated public keys
+* Notary: Nodes running a notary service witness state spends and have the final say in whether a transaction is a
+ double-spend or not
+* Oracle: Network services that link the ledger to the outside world by providing facts that affect the validity of
+ transactions
+* Regular node: All nodes have a vault and may start protocols communicating with other nodes, notaries and oracles and
+ evolve their private ledger
Setting up your own network
---------------------------
@@ -19,15 +24,8 @@ Setting up your own network
Certificates
~~~~~~~~~~~~
-All nodes belonging to the same Corda network must have the same root CA. For testing purposes you can
-use ``certSigningRequestUtility.jar`` to generate a node certificate with a fixed test root:
-
-.. sourcecode:: bash
-
- # Build the jars
- ./gradlew buildCordaJAR
- # Generate certificate
- java -jar build/libs/certSigningRequestUtility.jar --base-dir NODE_DIRECTORY/
+Every node in a given Corda network must have an identity certificate signed by the network's root CA. See
+:doc:`permissioning` for more information.
Configuration
~~~~~~~~~~~~~
diff --git a/docs/source/shell.rst b/docs/source/shell.rst
index fe74e44f29..2fc11829b2 100644
--- a/docs/source/shell.rst
+++ b/docs/source/shell.rst
@@ -35,9 +35,9 @@ Shell can also be accessible via SSH. By default SSH server is *disabled*. To en
Authentication and authorization
--------------------------------
-SSH require user to login first - using the same users as RPC system. In fact, shell serves as a proxy to RPC and communicates
-with node using RPC calls. This also means that RPC permissions are enforced. No permissions are required to allow the connection
-and login in.
+SSH requires users to login first - using the same users as RPC system. In fact, the shell serves as a proxy to RPC and communicates
+with the node using RPC calls. This also means that RPC permissions are enforced. No permissions are required to allow the connection
+and log in.
Watching flows (``flow watch``) requires ``InvokeRpc.stateMachinesFeed`` while starting flows requires
``InvokeRpc.startTrackedFlowDynamic`` and ``InvokeRpc.registeredFlows`` in addition to a permission for a particular flow.
@@ -51,7 +51,7 @@ errors.
Connecting
----------
-Linux and MacOS computers usually come with SSH client preinstalled. On Windows it usually require extra download.
+Linux and MacOS computers usually come with SSH client preinstalled. On Windows it usually requires extra download.
Usual connection syntax is ``ssh user@host -p 2222`` - where ``user`` is a RPC username, and ``-p`` specifies a port parameters -
it's the same as setup in ``node.conf`` file. ``host`` should point to a node hostname, usually ``localhost`` if connecting and
running node on the same computer. Password will be asked after establishing connection.
diff --git a/docs/source/tutorial-test-dsl.rst b/docs/source/tutorial-test-dsl.rst
index ce66251a5c..6771f077cb 100644
--- a/docs/source/tutorial-test-dsl.rst
+++ b/docs/source/tutorial-test-dsl.rst
@@ -35,14 +35,17 @@ We start with the empty ledger:
.. sourcecode:: java
- import static net.corda.core.testing.JavaTestHelpers.*;
- import static net.corda.core.contracts.JavaTestHelpers.*;
+ import org.junit.Test;
- @Test
- public void emptyLedger() {
- ledger(l -> {
- return Unit.INSTANCE; // We need to return this explicitly
- });
+ import static net.corda.testing.NodeTestUtils.ledger;
+
+ public class CommercialPaperTest {
+ @Test
+ public void emptyLedger() {
+ ledger(l -> {
+ return null;
+ });
+ }
}
The DSL keyword ``ledger`` takes a closure that can build up several transactions and may verify their overall
diff --git a/docs/source/upgrade-notes.rst b/docs/source/upgrade-notes.rst
index 1dcb0d72b4..7ddbd362f1 100644
--- a/docs/source/upgrade-notes.rst
+++ b/docs/source/upgrade-notes.rst
@@ -1,11 +1,14 @@
Upgrade notes
=============
-These notes provide helpful instructions to upgrade your Corda Applications (CorDapps) from previous versions, starting
-from our first public Beta (:ref:`Milestone 12 `), to :ref:`V1.0 `
+These notes provide instructions for upgrading your CorDapps from previous versions, starting with the upgrade from our
+first public Beta (:ref:`Milestone 12 `), to :ref:`V1.0 `.
-General
--------
+.. contents::
+ :depth: 3
+
+General rules
+-------------
Always remember to update the version identifiers in your project gradle file:
.. sourcecode:: shell
@@ -29,7 +32,7 @@ UNRELEASED
----------
Testing
-^^^^^^^
+~~~~~~~
* The registration mechanism for CorDapps in ``MockNetwork`` unit tests has changed.
@@ -38,10 +41,24 @@ Testing
package names of the CorDapps containing the contract verification code you wish to load.
The ``unsetCordappPackages`` method is now redundant and has been removed.
-:ref:`Milestone 14 `
+V1.0 to V2.0
------------
-Build
+You only need to update the ``corda_release_version`` identifier in your project gradle file. The
+corda_gradle_plugins_version should remain at 1.0.0:
+
+.. sourcecode:: shell
+
+ ext.corda_release_version = '2.0.0'
+ ext.corda_gradle_plugins_version = '1.0.0'
+
+Public Beta (M12) to V1.0
+-------------------------
+
+:ref:`From Milestone 14 `
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Build
^^^^^
* MockNetwork has moved.
@@ -151,7 +168,7 @@ Flow framework
Note that ``SwapIdentitiesFlow`` must be imported from the *confidential-identities** package ''net.corda.confidential''
Node services (ServiceHub)
-^^^^^^^^^^^^^^
+^^^^^^^^^^^^^^^^^^^^^^^^^^
* VaultQueryService: unresolved reference to `vaultQueryService`.
@@ -243,8 +260,8 @@ Gotchas
The 3rd parameter to ``CashIssueFlow`` should be the ** notary ** (not the ** node identity **)
-:ref:`Milestone 13 `
-------------
+:ref:`From Milestone 13 `
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Core data structures
^^^^^^^^^^^^^^^^^^^^
@@ -266,7 +283,7 @@ Core data structures
* No longer need to override Contract ``contract()`` function.
Node services (ServiceHub)
-^^^^^^^^^^^^^
+^^^^^^^^^^^^^^^^^^^^^^^^^^
* ServiceHub API method changes.
@@ -311,8 +328,8 @@ Testing
``CordaX500Name``, instead of using ``getX509Name``
-:ref:`Milestone 12 ` (First Public Beta)
------------------------------------
+:ref:`From Milestone 12 (First Public Beta) `
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Core data structures
^^^^^^^^^^^^^^^^^^^^
@@ -338,7 +355,7 @@ Build
compile "net.corda:rpc:$corda_release_version" -> compile "net.corda:corda-rpc:$corda_release_version"
Node services (ServiceHub)
-^^^^^^^^^^^^^
+^^^^^^^^^^^^^^^^^^^^^^^^^^
* ServiceHub API changes.
diff --git a/node-api/src/main/kotlin/net/corda/nodeapi/config/ConfigUtilities.kt b/node-api/src/main/kotlin/net/corda/nodeapi/config/ConfigUtilities.kt
index cd1118928c..19987de81c 100644
--- a/node-api/src/main/kotlin/net/corda/nodeapi/config/ConfigUtilities.kt
+++ b/node-api/src/main/kotlin/net/corda/nodeapi/config/ConfigUtilities.kt
@@ -131,7 +131,13 @@ private fun Config.defaultToOldPath(property: KProperty<*>): String {
private fun parseEnum(enumType: Class<*>, name: String): Enum<*> = enumBridge(uncheckedCast(enumType), name) // Any enum will do
-private fun > enumBridge(clazz: Class, name: String): T = java.lang.Enum.valueOf(clazz, name)
+private fun > enumBridge(clazz: Class, name: String): T {
+ try {
+ return java.lang.Enum.valueOf(clazz, name)
+ } catch (e: IllegalArgumentException) {
+ throw IllegalArgumentException("$name is not one of { ${clazz.enumConstants.joinToString()} }")
+ }
+}
/**
* Convert the receiver object into a [Config]. This does the inverse action of [parseAs].
diff --git a/node-api/src/test/kotlin/net/corda/nodeapi/config/ConfigParsingTest.kt b/node-api/src/test/kotlin/net/corda/nodeapi/config/ConfigParsingTest.kt
index 452e25ce78..5efdeaf439 100644
--- a/node-api/src/test/kotlin/net/corda/nodeapi/config/ConfigParsingTest.kt
+++ b/node-api/src/test/kotlin/net/corda/nodeapi/config/ConfigParsingTest.kt
@@ -8,6 +8,7 @@ import net.corda.core.identity.CordaX500Name
import net.corda.core.internal.div
import net.corda.core.utilities.NetworkHostAndPort
import org.assertj.core.api.Assertions.assertThat
+import org.assertj.core.api.Assertions.assertThatThrownBy
import org.junit.Test
import java.net.URL
import java.nio.file.Path
@@ -47,6 +48,14 @@ class ConfigParsingTest {
testPropertyType(TestEnum.Value2, TestEnum.Value1, valuesToString = true)
}
+ @Test
+ fun `unknown Enum`() {
+ val config = config("value" to "UnknownValue")
+ assertThatThrownBy { config.parseAs() }
+ .hasMessageContaining(TestEnum.Value1.name)
+ .hasMessageContaining(TestEnum.Value2.name)
+ }
+
@Test
fun `LocalDate`() {
testPropertyType(LocalDate.now(), LocalDate.now().plusDays(1), valuesToString = true)
diff --git a/node/src/integration-test/kotlin/net/corda/node/SSHServerTest.kt b/node/src/integration-test/kotlin/net/corda/node/SSHServerTest.kt
index e7346a1932..96c701f761 100644
--- a/node/src/integration-test/kotlin/net/corda/node/SSHServerTest.kt
+++ b/node/src/integration-test/kotlin/net/corda/node/SSHServerTest.kt
@@ -139,8 +139,8 @@ class SSHServerTest {
val response = String(Streams.readAll(channel.inputStream))
- //There are ANSI control characters involved, so we want to avoid direct byte to byte matching
- assertThat(response.lines()).filteredOn( { it.contains("✓") && it.contains("Done")}).hasSize(1)
+ // There are ANSI control characters involved, so we want to avoid direct byte to byte matching.
+ assertThat(response.lines()).filteredOn( { it.contains("Done")}).hasSize(1)
}
}
diff --git a/node/src/main/java/net/corda/node/shell/FlowShellCommand.java b/node/src/main/java/net/corda/node/shell/FlowShellCommand.java
index d3ed752531..f857a7eb62 100644
--- a/node/src/main/java/net/corda/node/shell/FlowShellCommand.java
+++ b/node/src/main/java/net/corda/node/shell/FlowShellCommand.java
@@ -4,7 +4,7 @@ package net.corda.node.shell;
import net.corda.core.messaging.CordaRPCOps;
import net.corda.node.utilities.ANSIProgressRenderer;
-import net.corda.node.utilities.CRaSHNSIProgressRenderer;
+import net.corda.node.utilities.CRaSHANSIProgressRenderer;
import org.crsh.cli.*;
import org.crsh.command.*;
import org.crsh.text.*;
@@ -12,7 +12,6 @@ import org.crsh.text.ui.TableElement;
import java.util.*;
-import static net.corda.node.services.messaging.RPCServerKt.CURRENT_RPC_CONTEXT;
import static net.corda.node.shell.InteractiveShell.*;
@Man(
@@ -49,7 +48,7 @@ public class FlowShellCommand extends InteractiveShellCommand {
return;
}
String inp = input == null ? "" : String.join(" ", input).trim();
- runFlowByNameFragment(name, inp, out, rpcOps, ansiProgressRenderer != null ? ansiProgressRenderer : new CRaSHNSIProgressRenderer(out) );
+ runFlowByNameFragment(name, inp, out, rpcOps, ansiProgressRenderer != null ? ansiProgressRenderer : new CRaSHANSIProgressRenderer(out) );
}
@Command
diff --git a/node/src/main/java/net/corda/node/shell/RunShellCommand.java b/node/src/main/java/net/corda/node/shell/RunShellCommand.java
index 108b567a9b..6875a5cdb8 100644
--- a/node/src/main/java/net/corda/node/shell/RunShellCommand.java
+++ b/node/src/main/java/net/corda/node/shell/RunShellCommand.java
@@ -30,7 +30,7 @@ public class RunShellCommand extends InteractiveShellCommand {
return null;
}
- return InteractiveShell.runRPCFromString(command, out, context);
+ return InteractiveShell.runRPCFromString(command, out, context, ops());
}
private void emitHelp(InvocationContext