mirror of
https://github.com/corda/corda.git
synced 2025-06-15 13:48:14 +00:00
CORDA-2331 Split Workflow and contracts of Finance App into separate Cordapps (#4422)
* Split Workflow and contracts of Finance App into separate Cordapps, part 1 - content which is different between OS and ENT is still in contract Cordapp. * Move CashSelection implementations to workflow module. * Move CashSelection implmentations to workflow module. * Move finance module to finance-flows, top level finance module is empty. * Move finance module to finance-flows, top level finance module is empty. * Updated build comment. * Revert publication of combined (contracts and flows) corda-finance.jar (to maintain backwards compatibility with 3rd party cordapps dependent on finance) * Added backwards compatibility clarification comment. * Re-instate new cordapp metadata. * Global rename of `finance-flows` to `finance-workflows` to follow adopted naming conventions. * Addressed final review comments. * Rename application to "Corda Finance Demo" * Generation of original corda-finance jar from new sub-modules. * Fixed and tested demobench with new split finance contract and workflow jars. * Renamed finance sub-modules to contracts and workflows. * Remove Michele!!! * Minor fix to filtering logic. * Align CorDapp configuration filename with workflows jar. * Fix breaks caused by finance module naming changes. * Final alignment between OS/ENT of finance contract code.
This commit is contained in:
2
.idea/codeStyles/codeStyleConfig.xml
generated
2
.idea/codeStyles/codeStyleConfig.xml
generated
@ -2,4 +2,4 @@
|
|||||||
<state>
|
<state>
|
||||||
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
|
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
|
||||||
</state>
|
</state>
|
||||||
</component>
|
</component>
|
||||||
|
20
.idea/compiler.xml
generated
20
.idea/compiler.xml
generated
@ -42,6 +42,10 @@
|
|||||||
<module name="corda-core_integrationTest" target="1.8" />
|
<module name="corda-core_integrationTest" target="1.8" />
|
||||||
<module name="corda-core_smokeTest" target="1.8" />
|
<module name="corda-core_smokeTest" target="1.8" />
|
||||||
<module name="corda-finance_integrationTest" target="1.8" />
|
<module name="corda-finance_integrationTest" target="1.8" />
|
||||||
|
<module name="corda-project_buildSrc_main" target="1.8" />
|
||||||
|
<module name="corda-project_buildSrc_test" target="1.8" />
|
||||||
|
<module name="corda-project_canonicalizer_main" target="1.8" />
|
||||||
|
<module name="corda-project_canonicalizer_test" target="1.8" />
|
||||||
<module name="corda-project_main" target="1.8" />
|
<module name="corda-project_main" target="1.8" />
|
||||||
<module name="corda-project_test" target="1.8" />
|
<module name="corda-project_test" target="1.8" />
|
||||||
<module name="corda-smoke-test-utils_main" target="1.8" />
|
<module name="corda-smoke-test-utils_main" target="1.8" />
|
||||||
@ -100,6 +104,16 @@
|
|||||||
<module name="explorer-capsule_test" target="1.6" />
|
<module name="explorer-capsule_test" target="1.6" />
|
||||||
<module name="explorer_main" target="1.8" />
|
<module name="explorer_main" target="1.8" />
|
||||||
<module name="explorer_test" target="1.8" />
|
<module name="explorer_test" target="1.8" />
|
||||||
|
<module name="finance-contracts-states_main" target="1.8" />
|
||||||
|
<module name="finance-contracts-states_test" target="1.8" />
|
||||||
|
<module name="finance-contracts_main" target="1.8" />
|
||||||
|
<module name="finance-contracts_test" target="1.8" />
|
||||||
|
<module name="finance-flows_integrationTest" target="1.8" />
|
||||||
|
<module name="finance-flows_main" target="1.8" />
|
||||||
|
<module name="finance-flows_test" target="1.8" />
|
||||||
|
<module name="finance-workflows_integrationTest" target="1.8" />
|
||||||
|
<module name="finance-workflows_main" target="1.8" />
|
||||||
|
<module name="finance-workflows_test" target="1.8" />
|
||||||
<module name="finance_integrationTest" target="1.8" />
|
<module name="finance_integrationTest" target="1.8" />
|
||||||
<module name="finance_main" target="1.8" />
|
<module name="finance_main" target="1.8" />
|
||||||
<module name="finance_test" target="1.8" />
|
<module name="finance_test" target="1.8" />
|
||||||
@ -138,6 +152,10 @@
|
|||||||
<module name="loadtest_test" target="1.8" />
|
<module name="loadtest_test" target="1.8" />
|
||||||
<module name="mock_main" target="1.8" />
|
<module name="mock_main" target="1.8" />
|
||||||
<module name="mock_test" target="1.8" />
|
<module name="mock_test" target="1.8" />
|
||||||
|
<module name="net.corda-blobinspector_main" target="1.8" />
|
||||||
|
<module name="net.corda-blobinspector_test" target="1.8" />
|
||||||
|
<module name="net.corda-finance-contracts-states_main" target="1.8" />
|
||||||
|
<module name="net.corda-finance-contracts-states_test" target="1.8" />
|
||||||
<module name="net.corda-verifier_main" target="1.8" />
|
<module name="net.corda-verifier_main" target="1.8" />
|
||||||
<module name="net.corda-verifier_test" target="1.8" />
|
<module name="net.corda-verifier_test" target="1.8" />
|
||||||
<module name="net.corda_buildSrc_main" target="1.8" />
|
<module name="net.corda_buildSrc_main" target="1.8" />
|
||||||
@ -193,6 +211,8 @@
|
|||||||
<module name="shell_integrationTest" target="1.8" />
|
<module name="shell_integrationTest" target="1.8" />
|
||||||
<module name="shell_main" target="1.8" />
|
<module name="shell_main" target="1.8" />
|
||||||
<module name="shell_test" target="1.8" />
|
<module name="shell_test" target="1.8" />
|
||||||
|
<module name="simm-valuation-demo-contracts-states_main" target="1.8" />
|
||||||
|
<module name="simm-valuation-demo-contracts-states_test" target="1.8" />
|
||||||
<module name="simm-valuation-demo_integrationTest" target="1.8" />
|
<module name="simm-valuation-demo_integrationTest" target="1.8" />
|
||||||
<module name="simm-valuation-demo_main" target="1.8" />
|
<module name="simm-valuation-demo_main" target="1.8" />
|
||||||
<module name="simm-valuation-demo_test" target="1.8" />
|
<module name="simm-valuation-demo_test" target="1.8" />
|
||||||
|
@ -302,7 +302,8 @@ dependencies {
|
|||||||
runtime project(':client:rpc')
|
runtime project(':client:rpc')
|
||||||
runtime project(':core')
|
runtime project(':core')
|
||||||
runtime project(':confidential-identities')
|
runtime project(':confidential-identities')
|
||||||
runtime project(':finance')
|
runtime project(':finance:workflows')
|
||||||
|
runtime project(':finance:contracts')
|
||||||
runtime project(':webserver')
|
runtime project(':webserver')
|
||||||
testCompile project(':test-utils')
|
testCompile project(':test-utils')
|
||||||
}
|
}
|
||||||
@ -362,7 +363,9 @@ bintrayConfig {
|
|||||||
'corda-deterministic-verifier',
|
'corda-deterministic-verifier',
|
||||||
'corda-djvm',
|
'corda-djvm',
|
||||||
'corda',
|
'corda',
|
||||||
'corda-finance',
|
'corda-finance', // maintained for backwards compatibility only
|
||||||
|
'corda-finance-workflows',
|
||||||
|
'corda-finance-contracts',
|
||||||
'corda-node',
|
'corda-node',
|
||||||
'corda-node-api',
|
'corda-node-api',
|
||||||
'corda-test-common',
|
'corda-test-common',
|
||||||
|
@ -26,7 +26,8 @@ sourceSets {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile project(':core')
|
compile project(':core')
|
||||||
compile project(':finance')
|
compile project(':finance:contracts')
|
||||||
|
compile project(':finance:workflows')
|
||||||
compile project(':client:rpc')
|
compile project(':client:rpc')
|
||||||
|
|
||||||
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
||||||
|
@ -10,7 +10,8 @@ description 'Corda client mock modules'
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile project(":core")
|
compile project(":core")
|
||||||
compile project(':finance')
|
compile project(':finance:workflows')
|
||||||
|
compile project(':finance:contracts')
|
||||||
|
|
||||||
// Unit testing helpers.
|
// Unit testing helpers.
|
||||||
testCompile "junit:junit:$junit_version"
|
testCompile "junit:junit:$junit_version"
|
||||||
|
@ -56,8 +56,11 @@ processSmokeTestResources {
|
|||||||
from(project(':node:capsule').tasks['buildCordaJAR']) {
|
from(project(':node:capsule').tasks['buildCordaJAR']) {
|
||||||
rename 'corda-(.*)', 'corda.jar'
|
rename 'corda-(.*)', 'corda.jar'
|
||||||
}
|
}
|
||||||
from(project(':finance').tasks['jar']) {
|
from(project(':finance:workflows').tasks['jar']) {
|
||||||
rename 'finance-(.*)', 'finance.jar'
|
rename 'finance-workflows-(.*)', 'finance-workflows.jar'
|
||||||
|
}
|
||||||
|
from(project(':finance:contracts').tasks['jar']) {
|
||||||
|
rename 'finance-contracts-(.*)', 'finance-contracts.jar'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -82,7 +85,8 @@ dependencies {
|
|||||||
|
|
||||||
// Smoke tests do NOT have any Node code on the classpath!
|
// Smoke tests do NOT have any Node code on the classpath!
|
||||||
smokeTestCompile project(':smoke-test-utils')
|
smokeTestCompile project(':smoke-test-utils')
|
||||||
smokeTestCompile project(':finance')
|
smokeTestCompile project(':finance:contracts')
|
||||||
|
smokeTestCompile project(':finance:workflows')
|
||||||
smokeTestCompile "org.apache.logging.log4j:log4j-slf4j-impl:$log4j_version"
|
smokeTestCompile "org.apache.logging.log4j:log4j-slf4j-impl:$log4j_version"
|
||||||
smokeTestCompile "org.apache.logging.log4j:log4j-core:$log4j_version"
|
smokeTestCompile "org.apache.logging.log4j:log4j-core:$log4j_version"
|
||||||
smokeTestCompile "org.jetbrains.kotlin:kotlin-test:$kotlin_version"
|
smokeTestCompile "org.jetbrains.kotlin:kotlin-test:$kotlin_version"
|
||||||
|
@ -89,10 +89,10 @@ class StandaloneCordaRPClientTest {
|
|||||||
private fun copyFinanceCordapp() {
|
private fun copyFinanceCordapp() {
|
||||||
val cordappsDir = (factory.baseDirectory(notaryConfig) / NodeProcess.CORDAPPS_DIR_NAME).createDirectories()
|
val cordappsDir = (factory.baseDirectory(notaryConfig) / NodeProcess.CORDAPPS_DIR_NAME).createDirectories()
|
||||||
// Find the finance jar file for the smoke tests of this module
|
// Find the finance jar file for the smoke tests of this module
|
||||||
val financeJar = Paths.get("build", "resources", "smokeTest").list {
|
val financeJars = Paths.get("build", "resources", "smokeTest").list {
|
||||||
it.filter { "corda-finance" in it.toString() }.toList().single()
|
it.filter { "corda-finance" in it.toString() }.toList()
|
||||||
}
|
}
|
||||||
financeJar.copyToDirectory(cordappsDir)
|
financeJars.forEach { it.copyToDirectory(cordappsDir) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -5,7 +5,10 @@ dependencies {
|
|||||||
testCompile project(path: ':serialization-deterministic', configuration: 'deterministicArtifacts')
|
testCompile project(path: ':serialization-deterministic', configuration: 'deterministicArtifacts')
|
||||||
testCompile project(path: ':core-deterministic:testing:verifier', configuration: 'deterministicArtifacts')
|
testCompile project(path: ':core-deterministic:testing:verifier', configuration: 'deterministicArtifacts')
|
||||||
testCompile project(path: ':core-deterministic:testing:data', configuration: 'testData')
|
testCompile project(path: ':core-deterministic:testing:data', configuration: 'testData')
|
||||||
testCompile(project(':finance')) {
|
testCompile(project(':finance:contracts')) {
|
||||||
|
transitive = false
|
||||||
|
}
|
||||||
|
testCompile(project(':finance:workflows')) {
|
||||||
transitive = false
|
transitive = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ configurations {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
testCompile project(':core')
|
testCompile project(':core')
|
||||||
testCompile project(':finance')
|
testCompile project(':finance:workflows')
|
||||||
testCompile project(':node-driver')
|
testCompile project(':node-driver')
|
||||||
testCompile project(path: ':core-deterministic:testing:verifier', configuration: 'runtimeArtifacts')
|
testCompile project(path: ':core-deterministic:testing:verifier', configuration: 'runtimeArtifacts')
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ def internalPackagePrefixes(sourceDirs) {
|
|||||||
|
|
||||||
ext {
|
ext {
|
||||||
// TODO: Add '../client/jfx/src/main/kotlin' and '../client/mock/src/main/kotlin' if we decide to make them into public API
|
// TODO: Add '../client/jfx/src/main/kotlin' and '../client/mock/src/main/kotlin' if we decide to make them into public API
|
||||||
dokkaSourceDirs = files('../core/src/main/kotlin', '../client/rpc/src/main/kotlin', '../finance/src/main/kotlin', '../client/jackson/src/main/kotlin',
|
dokkaSourceDirs = files('../core/src/main/kotlin', '../client/rpc/src/main/kotlin', '../finance/workflows/src/main/kotlin', '../finance/contracts/src/main/kotlin', '../client/jackson/src/main/kotlin',
|
||||||
'../testing/test-utils/src/main/kotlin', '../testing/node-driver/src/main/kotlin')
|
'../testing/test-utils/src/main/kotlin', '../testing/node-driver/src/main/kotlin')
|
||||||
internalPackagePrefixes = internalPackagePrefixes(dokkaSourceDirs)
|
internalPackagePrefixes = internalPackagePrefixes(dokkaSourceDirs)
|
||||||
}
|
}
|
||||||
|
@ -41,8 +41,9 @@ dependencies {
|
|||||||
compile project(path: ":node:capsule", configuration: 'runtimeArtifacts')
|
compile project(path: ":node:capsule", configuration: 'runtimeArtifacts')
|
||||||
compile project(path: ":webserver:webcapsule", configuration: 'runtimeArtifacts')
|
compile project(path: ":webserver:webcapsule", configuration: 'runtimeArtifacts')
|
||||||
|
|
||||||
// Corda Plugins: dependent flows and services
|
// CorDapps: dependent flows and services
|
||||||
compile project(':finance')
|
compile project(':finance:contracts')
|
||||||
|
compile project(':finance:workflows')
|
||||||
}
|
}
|
||||||
|
|
||||||
mainClassName = "net.corda.docs.ClientRpcTutorialKt"
|
mainClassName = "net.corda.docs.ClientRpcTutorialKt"
|
||||||
|
@ -58,7 +58,8 @@ dependencies {
|
|||||||
compile "com.spotify:docker-client:$docker_client_version"
|
compile "com.spotify:docker-client:$docker_client_version"
|
||||||
compile "io.reactivex:rxjava:$rxjava_version"
|
compile "io.reactivex:rxjava:$rxjava_version"
|
||||||
|
|
||||||
compile project(':finance')
|
compile project(':finance:contracts')
|
||||||
|
compile project(':finance:workflows')
|
||||||
compile project(':node-api')
|
compile project(':node-api')
|
||||||
compile project(':client:rpc')
|
compile project(':client:rpc')
|
||||||
|
|
||||||
|
@ -12,7 +12,8 @@ compileTestKotlin {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile project(':core')
|
compile project(':core')
|
||||||
compile project(':finance')
|
compile project(':finance:contracts')
|
||||||
|
compile project(':finance:workflows')
|
||||||
|
|
||||||
// ObjectWeb Asm: a library for synthesising and working with JVM bytecode.
|
// ObjectWeb Asm: a library for synthesising and working with JVM bytecode.
|
||||||
compile "org.ow2.asm:asm:$asm_version"
|
compile "org.ow2.asm:asm:$asm_version"
|
||||||
|
@ -10,77 +10,45 @@ apply plugin: 'com.jfrog.artifactory'
|
|||||||
|
|
||||||
description 'Corda finance modules'
|
description 'Corda finance modules'
|
||||||
|
|
||||||
sourceSets {
|
/**
|
||||||
integrationTest {
|
* NOTE: this build.gradle file is maintained for backwards compatibility purposes.
|
||||||
kotlin {
|
* It will build a `corda-finance.jar` including all Contracts and Flows.
|
||||||
compileClasspath += main.output + test.output
|
* From Corda 4 it is strongly recommended that CorDapps dependent on the `corda-finance.jar`
|
||||||
runtimeClasspath += main.output + test.output
|
* explicitly declare dependencies on either/both of the corda finance sub-modules:
|
||||||
srcDir file('src/integration-test/kotlin')
|
* corda-finance-contract => generates `corda-finance-contract.jar`
|
||||||
}
|
* corda-finance-workflows => generates `corda-finance-workflows.jar`
|
||||||
resources {
|
* Third party CorDapps should remember to include these sub-module dependencies using the `cordapp` Corda Gradle plug-in
|
||||||
srcDir file('src/integration-test/resources')
|
* cordapp project(':finance:workflows')
|
||||||
}
|
* cordapp project(':finance:contracts')
|
||||||
}
|
*/
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
def mainProjects = [':finance:contracts',':finance:workflows', ':confidential-identities']
|
||||||
// Note the :finance module is a CorDapp in its own right
|
|
||||||
// and CorDapps using :finance features should use 'cordapp' not 'compile' linkage.
|
|
||||||
cordaCompile project(':core')
|
|
||||||
compile project(':confidential-identities')
|
|
||||||
|
|
||||||
// For JSON
|
|
||||||
compile "com.fasterxml.jackson.core:jackson-databind:${jackson_version}"
|
|
||||||
|
|
||||||
testCompile project(':test-utils')
|
|
||||||
testCompile project(path: ':core', configuration: 'testArtifacts')
|
|
||||||
testCompile "junit:junit:$junit_version"
|
|
||||||
|
|
||||||
// AssertJ: for fluent assertions for testing
|
|
||||||
testCompile "org.assertj:assertj-core:$assertj_version"
|
|
||||||
}
|
|
||||||
|
|
||||||
configurations {
|
|
||||||
testArtifacts.extendsFrom testRuntime
|
|
||||||
integrationTestCompile.extendsFrom testCompile
|
|
||||||
integrationTestRuntime.extendsFrom testRuntime
|
|
||||||
}
|
|
||||||
|
|
||||||
task testJar(type: Jar) {
|
|
||||||
classifier "tests"
|
|
||||||
from sourceSets.test.output
|
|
||||||
}
|
|
||||||
|
|
||||||
task integrationTest(type: Test, dependsOn: []) {
|
|
||||||
testClassesDirs = sourceSets.integrationTest.output.classesDirs
|
|
||||||
classpath = sourceSets.integrationTest.runtimeClasspath
|
|
||||||
}
|
|
||||||
|
|
||||||
artifacts {
|
|
||||||
testArtifacts testJar
|
|
||||||
}
|
|
||||||
|
|
||||||
|
jar.dependsOn mainProjects.collect{ it+":compileJava"}
|
||||||
jar {
|
jar {
|
||||||
baseName 'corda-finance'
|
baseName 'corda-finance'
|
||||||
|
from files(mainProjects.collect{ project(it).sourceSets.main.output })
|
||||||
|
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||||
}
|
}
|
||||||
|
|
||||||
cordapp {
|
cordapp {
|
||||||
|
signing {
|
||||||
|
enabled false
|
||||||
|
}
|
||||||
targetPlatformVersion corda_platform_version.toInteger()
|
targetPlatformVersion corda_platform_version.toInteger()
|
||||||
minimumPlatformVersion 1
|
minimumPlatformVersion 1
|
||||||
contract {
|
contract {
|
||||||
name "net/corda/finance/contracts"
|
name "Corda Finance Demo"
|
||||||
versionId 1
|
versionId 1
|
||||||
vendor "R3"
|
vendor "R3"
|
||||||
licence "Open Source (Apache 2)"
|
licence "Open Source (Apache 2)"
|
||||||
}
|
}
|
||||||
workflow {
|
workflow {
|
||||||
name "net/corda/finance/flows"
|
name "Corda Finance Demo"
|
||||||
versionId 1
|
versionId 1
|
||||||
vendor "R3"
|
vendor "R3"
|
||||||
licence "Open Source (Apache 2)"
|
licence "Open Source (Apache 2)"
|
||||||
}
|
}
|
||||||
// By default the Cordapp is signed by Corda development certificate, for production build pass the following system properties to Gradle to use specific keystore e.g:
|
|
||||||
// ./gradlew -Dsigning.enabled="true" -Dsigning.keystore="/path/to/keystore.jks" -Dsigning.alias="alias" -Dsigning.storepass="password" -Dsigning.keypass="password"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
publish {
|
publish {
|
||||||
|
62
finance/contracts/build.gradle
Normal file
62
finance/contracts/build.gradle
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
apply plugin: 'kotlin'
|
||||||
|
// Java Persistence API support: create no-arg constructor
|
||||||
|
// see: http://stackoverflow.com/questions/32038177/kotlin-with-jpa-default-constructor-hell
|
||||||
|
apply plugin: 'kotlin-jpa'
|
||||||
|
apply plugin: CanonicalizerPlugin
|
||||||
|
apply plugin: 'net.corda.plugins.publish-utils'
|
||||||
|
apply plugin: 'net.corda.plugins.quasar-utils'
|
||||||
|
apply plugin: 'net.corda.plugins.cordapp'
|
||||||
|
apply plugin: 'com.jfrog.artifactory'
|
||||||
|
|
||||||
|
description 'Corda finance module - contracts'
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
// Note: 3rd party CorDapps should remember to include the relevant Finance CorDapp dependencies using `cordapp`
|
||||||
|
// cordapp project(':finance:workflows')
|
||||||
|
// cordapp project(':finance:contracts')
|
||||||
|
cordaCompile project(':core')
|
||||||
|
compile project(':confidential-identities')
|
||||||
|
|
||||||
|
// For JSON
|
||||||
|
compile "com.fasterxml.jackson.core:jackson-databind:${jackson_version}"
|
||||||
|
|
||||||
|
testCompile project(':test-utils')
|
||||||
|
testCompile project(path: ':core', configuration: 'testArtifacts')
|
||||||
|
testCompile "junit:junit:$junit_version"
|
||||||
|
|
||||||
|
// AssertJ: for fluent assertions for testing
|
||||||
|
testCompile "org.assertj:assertj-core:$assertj_version"
|
||||||
|
}
|
||||||
|
|
||||||
|
configurations {
|
||||||
|
testArtifacts.extendsFrom testRuntime
|
||||||
|
}
|
||||||
|
|
||||||
|
task testJar(type: Jar) {
|
||||||
|
classifier "tests"
|
||||||
|
from sourceSets.test.output
|
||||||
|
}
|
||||||
|
|
||||||
|
jar {
|
||||||
|
baseName 'corda-finance-contracts'
|
||||||
|
}
|
||||||
|
|
||||||
|
artifacts {
|
||||||
|
testArtifacts testJar
|
||||||
|
}
|
||||||
|
cordapp {
|
||||||
|
targetPlatformVersion corda_platform_version.toInteger()
|
||||||
|
minimumPlatformVersion 1
|
||||||
|
contract {
|
||||||
|
name "Corda Finance Demo"
|
||||||
|
versionId 1
|
||||||
|
vendor "R3"
|
||||||
|
licence "Open Source (Apache 2)"
|
||||||
|
}
|
||||||
|
// By default the Cordapp is signed by Corda development certificate, for production build pass the following system properties to Gradle to use specific keystore e.g:
|
||||||
|
// ./gradlew -Dsigning.enabled="true" -Dsigning.keystore="/path/to/keystore.jks" -Dsigning.alias="alias" -Dsigning.storepass="password" -Dsigning.keypass="password"
|
||||||
|
}
|
||||||
|
|
||||||
|
publish {
|
||||||
|
name jar.baseName
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package net.corda.finance.contracts.asset.cash.selection
|
package net.corda.finance.contracts.asset
|
||||||
|
|
||||||
import co.paralleluniverse.fibers.Suspendable
|
import co.paralleluniverse.fibers.Suspendable
|
||||||
import net.corda.core.contracts.Amount
|
import net.corda.core.contracts.Amount
|
||||||
@ -12,7 +12,6 @@ import net.corda.core.internal.uncheckedCast
|
|||||||
import net.corda.core.node.ServiceHub
|
import net.corda.core.node.ServiceHub
|
||||||
import net.corda.core.node.services.StatesNotAvailableException
|
import net.corda.core.node.services.StatesNotAvailableException
|
||||||
import net.corda.core.utilities.*
|
import net.corda.core.utilities.*
|
||||||
import net.corda.finance.contracts.asset.Cash
|
|
||||||
import java.sql.Connection
|
import java.sql.Connection
|
||||||
import java.sql.DatabaseMetaData
|
import java.sql.DatabaseMetaData
|
||||||
import java.sql.ResultSet
|
import java.sql.ResultSet
|
||||||
@ -21,11 +20,13 @@ import java.util.concurrent.atomic.AtomicReference
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Pluggable interface to allow for different cash selection provider implementations
|
* Pluggable interface to allow for different cash selection provider implementations
|
||||||
* Default implementation [CashSelectionH2Impl] uses H2 database and a custom function within H2 to perform aggregation.
|
* Default implementation in finance workflow module uses H2 database and a custom function within H2 to perform aggregation.
|
||||||
* Custom implementations must implement this interface and declare their implementation in
|
* Custom implementations must implement this interface and declare their implementation in
|
||||||
* META-INF/services/net.corda.contracts.asset.CashSelection
|
* META-INF/services/net.corda.contracts.asset.CashSelection
|
||||||
*/
|
*/
|
||||||
abstract class AbstractCashSelection {
|
// TODO: make parameters configurable when we get CorDapp configuration.
|
||||||
|
abstract class AbstractCashSelection(private val maxRetries : Int = 8, private val retrySleep : Int = 100,
|
||||||
|
private val retryCap : Int = 2000) {
|
||||||
companion object {
|
companion object {
|
||||||
val instance = AtomicReference<AbstractCashSelection>()
|
val instance = AtomicReference<AbstractCashSelection>()
|
||||||
|
|
||||||
@ -46,12 +47,6 @@ abstract class AbstractCashSelection {
|
|||||||
private val log = contextLogger()
|
private val log = contextLogger()
|
||||||
}
|
}
|
||||||
|
|
||||||
// coin selection retry loop counter, sleep (msecs) and lock for selecting states
|
|
||||||
// TODO: make parameters configurable when we get CorDapp configuration.
|
|
||||||
private val MAX_RETRIES = 8
|
|
||||||
private val RETRY_SLEEP = 100
|
|
||||||
private val RETRY_CAP = 2000
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Upon dynamically loading configured Cash Selection algorithms declared in META-INF/services
|
* Upon dynamically loading configured Cash Selection algorithms declared in META-INF/services
|
||||||
* this method determines whether the loaded implementation is compatible and usable with the currently
|
* this method determines whether the loaded implementation is compatible and usable with the currently
|
||||||
@ -102,13 +97,13 @@ abstract class AbstractCashSelection {
|
|||||||
val stateAndRefs = mutableListOf<StateAndRef<Cash.State>>()
|
val stateAndRefs = mutableListOf<StateAndRef<Cash.State>>()
|
||||||
|
|
||||||
// DOCSTART CASHSELECT 1
|
// DOCSTART CASHSELECT 1
|
||||||
for (retryCount in 1..MAX_RETRIES) {
|
for (retryCount in 1..maxRetries) {
|
||||||
if (!attemptSpend(services, amount, lockId, notary, onlyFromIssuerParties, withIssuerRefs, stateAndRefs)) {
|
if (!attemptSpend(services, amount, lockId, notary, onlyFromIssuerParties, withIssuerRefs, stateAndRefs)) {
|
||||||
log.warn("Coin selection failed on attempt $retryCount")
|
log.warn("Coin selection failed on attempt $retryCount")
|
||||||
// TODO: revisit the back off strategy for contended spending.
|
// TODO: revisit the back off strategy for contended spending.
|
||||||
if (retryCount != MAX_RETRIES) {
|
if (retryCount != maxRetries) {
|
||||||
stateAndRefs.clear()
|
stateAndRefs.clear()
|
||||||
val durationMillis = (minOf(RETRY_SLEEP.shl(retryCount), RETRY_CAP / 2) * (1.0 + Math.random())).toInt()
|
val durationMillis = (minOf(retrySleep.shl(retryCount), retryCap / 2) * (1.0 + Math.random())).toInt()
|
||||||
FlowLogic.sleep(durationMillis.millis)
|
FlowLogic.sleep(durationMillis.millis)
|
||||||
} else {
|
} else {
|
||||||
log.warn("Insufficient spendable states identified for $amount")
|
log.warn("Insufficient spendable states identified for $amount")
|
||||||
@ -167,4 +162,4 @@ abstract class AbstractCashSelection {
|
|||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -16,10 +16,8 @@ import net.corda.core.node.ServiceHub
|
|||||||
import net.corda.core.schemas.MappedSchema
|
import net.corda.core.schemas.MappedSchema
|
||||||
import net.corda.core.schemas.PersistentState
|
import net.corda.core.schemas.PersistentState
|
||||||
import net.corda.core.schemas.QueryableState
|
import net.corda.core.schemas.QueryableState
|
||||||
import net.corda.core.serialization.SerializableCalculatedProperty
|
|
||||||
import net.corda.core.transactions.LedgerTransaction
|
import net.corda.core.transactions.LedgerTransaction
|
||||||
import net.corda.core.transactions.TransactionBuilder
|
import net.corda.core.transactions.TransactionBuilder
|
||||||
import net.corda.finance.contracts.asset.cash.selection.AbstractCashSelection
|
|
||||||
import net.corda.finance.schemas.CashSchemaV1
|
import net.corda.finance.schemas.CashSchemaV1
|
||||||
import net.corda.finance.utils.sumCash
|
import net.corda.finance.utils.sumCash
|
||||||
import net.corda.finance.utils.sumCashOrNull
|
import net.corda.finance.utils.sumCashOrNull
|
88
finance/workflows/build.gradle
Normal file
88
finance/workflows/build.gradle
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
apply plugin: 'kotlin'
|
||||||
|
// Java Persistence API support: create no-arg constructor
|
||||||
|
// see: http://stackoverflow.com/questions/32038177/kotlin-with-jpa-default-constructor-hell
|
||||||
|
apply plugin: 'kotlin-jpa'
|
||||||
|
apply plugin: CanonicalizerPlugin
|
||||||
|
apply plugin: 'net.corda.plugins.publish-utils'
|
||||||
|
apply plugin: 'net.corda.plugins.quasar-utils'
|
||||||
|
apply plugin: 'net.corda.plugins.cordapp'
|
||||||
|
apply plugin: 'com.jfrog.artifactory'
|
||||||
|
|
||||||
|
description 'Corda finance module - flows'
|
||||||
|
|
||||||
|
sourceSets {
|
||||||
|
integrationTest {
|
||||||
|
kotlin {
|
||||||
|
compileClasspath += main.output + test.output
|
||||||
|
runtimeClasspath += main.output + test.output
|
||||||
|
srcDir file('src/integration-test/kotlin')
|
||||||
|
}
|
||||||
|
resources {
|
||||||
|
srcDir file('src/integration-test/resources')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
// Note: 3rd party CorDapps should remember to include the relevant Finance CorDapp dependencies using `cordapp`
|
||||||
|
// cordapp project(':finance:workflows')
|
||||||
|
// cordapp project(':finance:contracts')
|
||||||
|
cordaCompile project(':core')
|
||||||
|
compile project(':confidential-identities')
|
||||||
|
|
||||||
|
cordapp project(':finance:contracts')
|
||||||
|
|
||||||
|
testCompile project(':test-utils')
|
||||||
|
testCompile project(path: ':core', configuration: 'testArtifacts')
|
||||||
|
testCompile "junit:junit:$junit_version"
|
||||||
|
|
||||||
|
// AssertJ: for fluent assertions for testing
|
||||||
|
testCompile "org.assertj:assertj-core:$assertj_version"
|
||||||
|
}
|
||||||
|
|
||||||
|
configurations {
|
||||||
|
testArtifacts.extendsFrom testRuntime
|
||||||
|
integrationTestCompile.extendsFrom testCompile
|
||||||
|
integrationTestRuntime.extendsFrom testRuntime
|
||||||
|
}
|
||||||
|
|
||||||
|
task testJar(type: Jar) {
|
||||||
|
classifier "tests"
|
||||||
|
from sourceSets.test.output
|
||||||
|
}
|
||||||
|
|
||||||
|
task integrationTest(type: Test, dependsOn: []) {
|
||||||
|
testClassesDirs = sourceSets.integrationTest.output.classesDirs
|
||||||
|
classpath = sourceSets.integrationTest.runtimeClasspath
|
||||||
|
}
|
||||||
|
|
||||||
|
artifacts {
|
||||||
|
testArtifacts testJar
|
||||||
|
}
|
||||||
|
|
||||||
|
jar {
|
||||||
|
baseName 'corda-finance-workflows'
|
||||||
|
}
|
||||||
|
|
||||||
|
configurations {
|
||||||
|
testArtifacts.extendsFrom testRuntime
|
||||||
|
integrationTestCompile.extendsFrom testCompile
|
||||||
|
integrationTestRuntime.extendsFrom testRuntime
|
||||||
|
}
|
||||||
|
|
||||||
|
cordapp {
|
||||||
|
targetPlatformVersion corda_platform_version.toInteger()
|
||||||
|
minimumPlatformVersion 1
|
||||||
|
workflow {
|
||||||
|
name "Corda Finance Demo"
|
||||||
|
versionId 1
|
||||||
|
vendor "R3"
|
||||||
|
licence "Open Source (Apache 2)"
|
||||||
|
}
|
||||||
|
// By default the Cordapp is signed by Corda development certificate, for production build pass the following system properties to Gradle to use specific keystore e.g:
|
||||||
|
// ./gradlew -Dsigning.enabled="true" -Dsigning.keystore="/path/to/keystore.jks" -Dsigning.alias="alias" -Dsigning.storepass="password" -Dsigning.keypass="password"
|
||||||
|
}
|
||||||
|
|
||||||
|
publish {
|
||||||
|
name jar.baseName
|
||||||
|
}
|
@ -7,6 +7,7 @@ import net.corda.core.identity.Party
|
|||||||
import net.corda.core.utilities.OpaqueBytes
|
import net.corda.core.utilities.OpaqueBytes
|
||||||
import net.corda.core.utilities.contextLogger
|
import net.corda.core.utilities.contextLogger
|
||||||
import net.corda.core.utilities.debug
|
import net.corda.core.utilities.debug
|
||||||
|
import net.corda.finance.contracts.asset.AbstractCashSelection
|
||||||
import java.sql.Connection
|
import java.sql.Connection
|
||||||
import java.sql.DatabaseMetaData
|
import java.sql.DatabaseMetaData
|
||||||
import java.sql.ResultSet
|
import java.sql.ResultSet
|
@ -7,6 +7,7 @@ import net.corda.core.identity.Party
|
|||||||
import net.corda.core.utilities.OpaqueBytes
|
import net.corda.core.utilities.OpaqueBytes
|
||||||
import net.corda.core.utilities.contextLogger
|
import net.corda.core.utilities.contextLogger
|
||||||
import net.corda.core.utilities.debug
|
import net.corda.core.utilities.debug
|
||||||
|
import net.corda.finance.contracts.asset.AbstractCashSelection
|
||||||
import java.sql.Connection
|
import java.sql.Connection
|
||||||
import java.sql.DatabaseMetaData
|
import java.sql.DatabaseMetaData
|
||||||
import java.sql.ResultSet
|
import java.sql.ResultSet
|
@ -7,6 +7,7 @@ import net.corda.core.identity.Party
|
|||||||
import net.corda.core.utilities.OpaqueBytes
|
import net.corda.core.utilities.OpaqueBytes
|
||||||
import net.corda.core.utilities.contextLogger
|
import net.corda.core.utilities.contextLogger
|
||||||
import net.corda.core.utilities.debug
|
import net.corda.core.utilities.debug
|
||||||
|
import net.corda.finance.contracts.asset.AbstractCashSelection
|
||||||
import java.sql.Connection
|
import java.sql.Connection
|
||||||
import java.sql.DatabaseMetaData
|
import java.sql.DatabaseMetaData
|
||||||
import java.sql.ResultSet
|
import java.sql.ResultSet
|
@ -13,7 +13,7 @@ import net.corda.core.transactions.TransactionBuilder
|
|||||||
import net.corda.core.utilities.OpaqueBytes
|
import net.corda.core.utilities.OpaqueBytes
|
||||||
import net.corda.core.utilities.ProgressTracker
|
import net.corda.core.utilities.ProgressTracker
|
||||||
import net.corda.finance.contracts.asset.Cash
|
import net.corda.finance.contracts.asset.Cash
|
||||||
import net.corda.finance.contracts.asset.cash.selection.AbstractCashSelection
|
import net.corda.finance.contracts.asset.AbstractCashSelection
|
||||||
import net.corda.finance.flows.AbstractCashFlow.Companion.FINALISING_TX
|
import net.corda.finance.flows.AbstractCashFlow.Companion.FINALISING_TX
|
||||||
import net.corda.finance.flows.AbstractCashFlow.Companion.GENERATING_TX
|
import net.corda.finance.flows.AbstractCashFlow.Companion.GENERATING_TX
|
||||||
import net.corda.finance.flows.AbstractCashFlow.Companion.SIGNING_TX
|
import net.corda.finance.flows.AbstractCashFlow.Companion.SIGNING_TX
|
@ -1,4 +1,4 @@
|
|||||||
package net.corda.finance.contracts.asset.cash.selection
|
package net.corda.finance.contracts.asset.selection
|
||||||
|
|
||||||
import net.corda.core.internal.concurrent.transpose
|
import net.corda.core.internal.concurrent.transpose
|
||||||
import net.corda.core.utilities.OpaqueBytes
|
import net.corda.core.utilities.OpaqueBytes
|
@ -8,7 +8,7 @@ import net.corda.core.utilities.OpaqueBytes
|
|||||||
import net.corda.core.utilities.getOrThrow
|
import net.corda.core.utilities.getOrThrow
|
||||||
import net.corda.finance.DOLLARS
|
import net.corda.finance.DOLLARS
|
||||||
import net.corda.finance.contracts.asset.Cash
|
import net.corda.finance.contracts.asset.Cash
|
||||||
import net.corda.finance.contracts.asset.cash.selection.AbstractCashSelection
|
import net.corda.finance.contracts.asset.AbstractCashSelection
|
||||||
import net.corda.finance.contracts.getCashBalance
|
import net.corda.finance.contracts.getCashBalance
|
||||||
import net.corda.finance.issuedBy
|
import net.corda.finance.issuedBy
|
||||||
import net.corda.testing.core.singleIdentity
|
import net.corda.testing.core.singleIdentity
|
@ -128,11 +128,12 @@ dependencies {
|
|||||||
testCompile "org.assertj:assertj-core:${assertj_version}"
|
testCompile "org.assertj:assertj-core:${assertj_version}"
|
||||||
testCompile project(':test-utils')
|
testCompile project(':test-utils')
|
||||||
testCompile project(':client:jfx')
|
testCompile project(':client:jfx')
|
||||||
testCompile project(':finance')
|
testCompile project(':finance:contracts')
|
||||||
|
testCompile project(':finance:workflows')
|
||||||
testCompile project(':finance:isolated')
|
testCompile project(':finance:isolated')
|
||||||
|
|
||||||
// sample test schemas
|
// sample test schemas
|
||||||
testCompile project(path: ':finance', configuration: 'testArtifacts')
|
testCompile project(path: ':finance:contracts', configuration: 'testArtifacts')
|
||||||
|
|
||||||
// For H2 database support in persistence
|
// For H2 database support in persistence
|
||||||
compile "com.h2database:h2:$h2_version"
|
compile "com.h2database:h2:$h2_version"
|
||||||
|
@ -18,7 +18,7 @@ import net.corda.finance.contracts.CommercialPaper
|
|||||||
import net.corda.finance.contracts.Commodity
|
import net.corda.finance.contracts.Commodity
|
||||||
import net.corda.finance.contracts.DealState
|
import net.corda.finance.contracts.DealState
|
||||||
import net.corda.finance.contracts.asset.Cash
|
import net.corda.finance.contracts.asset.Cash
|
||||||
import net.corda.finance.contracts.asset.cash.selection.AbstractCashSelection
|
import net.corda.finance.contracts.asset.AbstractCashSelection
|
||||||
import net.corda.finance.schemas.CashSchemaV1
|
import net.corda.finance.schemas.CashSchemaV1
|
||||||
import net.corda.finance.schemas.CashSchemaV1.PersistentCashState
|
import net.corda.finance.schemas.CashSchemaV1.PersistentCashState
|
||||||
import net.corda.finance.schemas.CommercialPaperSchemaV1
|
import net.corda.finance.schemas.CommercialPaperSchemaV1
|
||||||
|
@ -9,7 +9,8 @@ dependencies {
|
|||||||
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
||||||
|
|
||||||
// The bank of corda CorDapp depends upon Cash CorDapp features
|
// The bank of corda CorDapp depends upon Cash CorDapp features
|
||||||
cordapp project(':finance')
|
cordapp project(':finance:contracts')
|
||||||
|
cordapp project(':finance:workflows')
|
||||||
|
|
||||||
// Corda integration dependencies
|
// Corda integration dependencies
|
||||||
cordaRuntime project(path: ":node:capsule", configuration: 'runtimeArtifacts')
|
cordaRuntime project(path: ":node:capsule", configuration: 'runtimeArtifacts')
|
||||||
@ -34,7 +35,8 @@ def nodeTask = tasks.getByPath(':node:capsule:assemble')
|
|||||||
def webTask = tasks.getByPath(':webserver:webcapsule:assemble')
|
def webTask = tasks.getByPath(':webserver:webcapsule:assemble')
|
||||||
task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar', nodeTask, webTask]) {
|
task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar', nodeTask, webTask]) {
|
||||||
nodeDefaults {
|
nodeDefaults {
|
||||||
cordapp project(':finance')
|
cordapp project(':finance:workflows')
|
||||||
|
cordapp project(':finance:contracts')
|
||||||
}
|
}
|
||||||
node {
|
node {
|
||||||
name "O=Notary Service,L=Zurich,C=CH"
|
name "O=Notary Service,L=Zurich,C=CH"
|
||||||
@ -58,7 +60,7 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar', nodeTask,
|
|||||||
extraConfig = [
|
extraConfig = [
|
||||||
h2Settings: [address: "localhost:10017"]
|
h2Settings: [address: "localhost:10017"]
|
||||||
]
|
]
|
||||||
cordapp(project(':finance')) {
|
cordapp(project(':finance:workflows')) {
|
||||||
config "issuableCurrencies = [ USD ]"
|
config "issuableCurrencies = [ USD ]"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,8 @@ configurations {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
// The irs demo CorDapp depends upon Cash CorDapp features
|
// The irs demo CorDapp depends upon Cash CorDapp features
|
||||||
cordapp project(':finance')
|
cordapp project(':finance:contracts')
|
||||||
|
cordapp project(':finance:workflows')
|
||||||
|
|
||||||
// Corda integration dependencies
|
// Corda integration dependencies
|
||||||
cordaRuntime project(path: ":node:capsule", configuration: 'runtimeArtifacts')
|
cordaRuntime project(path: ":node:capsule", configuration: 'runtimeArtifacts')
|
||||||
@ -65,7 +66,7 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar', nodeTask])
|
|||||||
address("localhost:10003")
|
address("localhost:10003")
|
||||||
adminAddress("localhost:10023")
|
adminAddress("localhost:10023")
|
||||||
}
|
}
|
||||||
cordapps = ["${project(":finance").group}:finance:$corda_release_version"]
|
cordapps = ["${project(":finance").group}:contracts:$corda_release_version", "${project(":finance").group}:workflows:$corda_release_version"]
|
||||||
rpcUsers = rpcUsersList
|
rpcUsers = rpcUsersList
|
||||||
useTestClock true
|
useTestClock true
|
||||||
extraConfig = ['h2Settings.address' : 'localhost:10024']
|
extraConfig = ['h2Settings.address' : 'localhost:10024']
|
||||||
@ -77,7 +78,7 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar', nodeTask])
|
|||||||
address("localhost:10006")
|
address("localhost:10006")
|
||||||
adminAddress("localhost:10026")
|
adminAddress("localhost:10026")
|
||||||
}
|
}
|
||||||
cordapps = ["${project(":finance").group}:finance:$corda_release_version"]
|
cordapps = ["${project(":finance").group}:contracts:$corda_release_version", "${project(":finance").group}:workflows:$corda_release_version"]
|
||||||
rpcUsers = rpcUsersList
|
rpcUsers = rpcUsersList
|
||||||
useTestClock true
|
useTestClock true
|
||||||
extraConfig = ['h2Settings.address' : 'localhost:10027']
|
extraConfig = ['h2Settings.address' : 'localhost:10027']
|
||||||
@ -89,7 +90,7 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar', nodeTask])
|
|||||||
address("localhost:10009")
|
address("localhost:10009")
|
||||||
adminAddress("localhost:10029")
|
adminAddress("localhost:10029")
|
||||||
}
|
}
|
||||||
cordapps = ["${project.group}:finance:$corda_release_version"]
|
cordapps = ["${project.group}:contracts:$corda_release_version", "${project.group}:workflows:$corda_release_version"]
|
||||||
rpcUsers = rpcUsersList
|
rpcUsers = rpcUsersList
|
||||||
useTestClock true
|
useTestClock true
|
||||||
extraConfig = ['h2Settings.address' : 'localhost:10030']
|
extraConfig = ['h2Settings.address' : 'localhost:10030']
|
||||||
@ -101,8 +102,8 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar', nodeTask])
|
|||||||
address("localhost:10012")
|
address("localhost:10012")
|
||||||
adminAddress("localhost:10032")
|
adminAddress("localhost:10032")
|
||||||
}
|
}
|
||||||
cordapps = ["${project.group}:finance:$corda_release_version"]
|
cordapps = ["${project.group}:contracts:$corda_release_version", "${project.group}:workflows:$corda_release_version"]
|
||||||
cordapps = ["${project(":finance").group}:finance:$corda_release_version"]
|
cordapps = ["${project(":finance").group}:contracts:$corda_release_version", "${project(":finance").group}:workflows:$corda_release_version"]
|
||||||
rpcUsers = rpcUsersList
|
rpcUsers = rpcUsersList
|
||||||
useTestClock true
|
useTestClock true
|
||||||
extraConfig = ['h2Settings.address' : 'localhost:10033']
|
extraConfig = ['h2Settings.address' : 'localhost:10033']
|
||||||
@ -115,25 +116,25 @@ task prepareDockerNodes(type: net.corda.plugins.Dockerform, dependsOn: ['jar', n
|
|||||||
node {
|
node {
|
||||||
name "O=Notary Service,L=Zurich,C=CH"
|
name "O=Notary Service,L=Zurich,C=CH"
|
||||||
notary = [validating : true]
|
notary = [validating : true]
|
||||||
cordapps = ["${project(":finance").group}:finance:$corda_release_version"]
|
cordapps = ["${project(":finance").group}:contracts:$corda_release_version", "${project(":finance").group}:workflows:$corda_release_version"]
|
||||||
rpcUsers = rpcUsersList
|
rpcUsers = rpcUsersList
|
||||||
useTestClock true
|
useTestClock true
|
||||||
}
|
}
|
||||||
node {
|
node {
|
||||||
name "O=Bank A,L=London,C=GB"
|
name "O=Bank A,L=London,C=GB"
|
||||||
cordapps = ["${project(":finance").group}:finance:$corda_release_version"]
|
cordapps = ["${project(":finance").group}:contracts:$corda_release_version", "${project(":finance").group}:workflows:$corda_release_version"]
|
||||||
rpcUsers = rpcUsersList
|
rpcUsers = rpcUsersList
|
||||||
useTestClock true
|
useTestClock true
|
||||||
}
|
}
|
||||||
node {
|
node {
|
||||||
name "O=Bank B,L=New York,C=US"
|
name "O=Bank B,L=New York,C=US"
|
||||||
cordapps = ["${project(":finance").group}:finance:$corda_release_version"]
|
cordapps = ["${project(":finance").group}:contracts:$corda_release_version", "${project(":finance").group}:workflows:$corda_release_version"]
|
||||||
rpcUsers = rpcUsersList
|
rpcUsers = rpcUsersList
|
||||||
useTestClock true
|
useTestClock true
|
||||||
}
|
}
|
||||||
node {
|
node {
|
||||||
name "O=Regulator,L=Moscow,C=RU"
|
name "O=Regulator,L=Moscow,C=RU"
|
||||||
cordapps = ["${project.group}:finance:$corda_release_version"]
|
cordapps = ["${project.group}:contracts:$corda_release_version", "${project.group}:workflows:$corda_release_version"]
|
||||||
rpcUsers = rpcUsersList
|
rpcUsers = rpcUsersList
|
||||||
useTestClock true
|
useTestClock true
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,8 @@ dependencies {
|
|||||||
cordaCompile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
cordaCompile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
||||||
|
|
||||||
// The SIMM demo CorDapp depends upon Cash CorDapp features
|
// The SIMM demo CorDapp depends upon Cash CorDapp features
|
||||||
cordapp project(':finance')
|
cordapp project(':finance:contracts')
|
||||||
|
cordapp project(':finance:workflows')
|
||||||
cordapp project(path: ':samples:simm-valuation-demo:contracts-states', configuration: 'shrinkArtifacts')
|
cordapp project(path: ':samples:simm-valuation-demo:contracts-states', configuration: 'shrinkArtifacts')
|
||||||
cordapp project(':samples:simm-valuation-demo:flows')
|
cordapp project(':samples:simm-valuation-demo:flows')
|
||||||
|
|
||||||
@ -66,7 +67,8 @@ def webTask = tasks.getByPath(':webserver:webcapsule:assemble')
|
|||||||
task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar', nodeTask, webTask]) {
|
task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar', nodeTask, webTask]) {
|
||||||
directory file("$buildDir/nodes")
|
directory file("$buildDir/nodes")
|
||||||
nodeDefaults {
|
nodeDefaults {
|
||||||
cordapp project(':finance')
|
cordapp project(':finance:contracts')
|
||||||
|
cordapp project(':finance:workflows')
|
||||||
cordapp project(':samples:simm-valuation-demo:contracts-states')
|
cordapp project(':samples:simm-valuation-demo:contracts-states')
|
||||||
cordapp project(':samples:simm-valuation-demo:flows')
|
cordapp project(':samples:simm-valuation-demo:flows')
|
||||||
rpcUsers = [['username': "default", 'password': "default", 'permissions': [ 'ALL' ]]]
|
rpcUsers = [['username': "default", 'password': "default", 'permissions': [ 'ALL' ]]]
|
||||||
|
@ -30,7 +30,7 @@ dependencies {
|
|||||||
cordaCompile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
cordaCompile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
||||||
|
|
||||||
// The SIMM demo CorDapp depends upon Cash CorDapp features
|
// The SIMM demo CorDapp depends upon Cash CorDapp features
|
||||||
cordapp project(':finance')
|
cordapp project(':finance:contracts')
|
||||||
|
|
||||||
// Corda integration dependencies
|
// Corda integration dependencies
|
||||||
cordaCompile project(':core')
|
cordaCompile project(':core')
|
||||||
|
@ -20,7 +20,8 @@ dependencies {
|
|||||||
cordaCompile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
cordaCompile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
||||||
|
|
||||||
// The SIMM demo CorDapp depends upon Cash CorDapp features
|
// The SIMM demo CorDapp depends upon Cash CorDapp features
|
||||||
cordapp project(':finance')
|
cordapp project(':finance:workflows')
|
||||||
|
cordapp project(':finance:contracts')
|
||||||
cordapp project(path: ':samples:simm-valuation-demo:contracts-states', configuration: 'shrinkArtifacts')
|
cordapp project(path: ':samples:simm-valuation-demo:contracts-states', configuration: 'shrinkArtifacts')
|
||||||
|
|
||||||
// Corda integration dependencies
|
// Corda integration dependencies
|
||||||
|
@ -23,7 +23,8 @@ dependencies {
|
|||||||
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
||||||
|
|
||||||
// The trader demo CorDapp depends upon Cash CorDapp features
|
// The trader demo CorDapp depends upon Cash CorDapp features
|
||||||
cordapp project(':finance')
|
cordapp project(':finance:contracts')
|
||||||
|
cordapp project(':finance:workflows')
|
||||||
|
|
||||||
// Corda integration dependencies
|
// Corda integration dependencies
|
||||||
cordaRuntime project(path: ":node:capsule", configuration: 'runtimeArtifacts')
|
cordaRuntime project(path: ":node:capsule", configuration: 'runtimeArtifacts')
|
||||||
@ -54,12 +55,12 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar', nodeTask,
|
|||||||
adminAddress "localhost:10004"
|
adminAddress "localhost:10004"
|
||||||
}
|
}
|
||||||
extraConfig = ['h2Settings.address' : 'localhost:10014']
|
extraConfig = ['h2Settings.address' : 'localhost:10014']
|
||||||
cordapps = ["$project.group:finance:$corda_release_version"]
|
cordapps = ["$project.group:workflows:$corda_release_version", "$project.group:contracts:$corda_release_version"]
|
||||||
}
|
}
|
||||||
node {
|
node {
|
||||||
name "O=Bank A,L=London,C=GB"
|
name "O=Bank A,L=London,C=GB"
|
||||||
p2pPort 10005
|
p2pPort 10005
|
||||||
cordapps = ["$project.group:finance:$corda_release_version"]
|
cordapps = ["$project.group:workflows:$corda_release_version", "$project.group:contracts:$corda_release_version"]
|
||||||
rpcUsers = ext.rpcUsers
|
rpcUsers = ext.rpcUsers
|
||||||
rpcSettings {
|
rpcSettings {
|
||||||
address "localhost:10006"
|
address "localhost:10006"
|
||||||
@ -70,7 +71,7 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar', nodeTask,
|
|||||||
node {
|
node {
|
||||||
name "O=Bank B,L=New York,C=US"
|
name "O=Bank B,L=New York,C=US"
|
||||||
p2pPort 10008
|
p2pPort 10008
|
||||||
cordapps = ["$project.group:finance:$corda_release_version"]
|
cordapps = ["$project.group:workflows:$corda_release_version", "$project.group:contracts:$corda_release_version"]
|
||||||
rpcUsers = ext.rpcUsers
|
rpcUsers = ext.rpcUsers
|
||||||
rpcSettings {
|
rpcSettings {
|
||||||
address "localhost:10009"
|
address "localhost:10009"
|
||||||
@ -81,7 +82,7 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar', nodeTask,
|
|||||||
node {
|
node {
|
||||||
name "O=BankOfCorda,L=New York,C=US"
|
name "O=BankOfCorda,L=New York,C=US"
|
||||||
p2pPort 10011
|
p2pPort 10011
|
||||||
cordapps = ["$project.group:finance:$corda_release_version"]
|
cordapps = ["$project.group:workflows:$corda_release_version", "$project.group:contracts:$corda_release_version"]
|
||||||
rpcUsers = ext.rpcUsers
|
rpcUsers = ext.rpcUsers
|
||||||
rpcSettings {
|
rpcSettings {
|
||||||
address "localhost:10012"
|
address "localhost:10012"
|
||||||
@ -94,7 +95,7 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar', nodeTask,
|
|||||||
node {
|
node {
|
||||||
name "O=LoggingBank,L=London,C=GB"
|
name "O=LoggingBank,L=London,C=GB"
|
||||||
p2pPort 10025
|
p2pPort 10025
|
||||||
cordapps = ["$project.group:finance:$corda_release_version"]
|
cordapps = ["$project.group:workflows:$corda_release_version", "$project.group:contracts:$corda_release_version"]
|
||||||
rpcUsers = ext.rpcUsers
|
rpcUsers = ext.rpcUsers
|
||||||
rpcSettings {
|
rpcSettings {
|
||||||
address "localhost:10026"
|
address "localhost:10026"
|
||||||
|
@ -2,7 +2,9 @@
|
|||||||
// output JAR from the capsule then the buildCordaJAR task goes into an infinite loop.
|
// output JAR from the capsule then the buildCordaJAR task goes into an infinite loop.
|
||||||
rootProject.name = 'corda-project'
|
rootProject.name = 'corda-project'
|
||||||
include 'confidential-identities'
|
include 'confidential-identities'
|
||||||
include 'finance'
|
include 'finance' // maintained for backwards compatibility only
|
||||||
|
include 'finance:contracts'
|
||||||
|
include 'finance:workflows'
|
||||||
include 'finance:isolated'
|
include 'finance:isolated'
|
||||||
include 'core'
|
include 'core'
|
||||||
include 'docs'
|
include 'docs'
|
||||||
|
@ -12,7 +12,7 @@ dependencies {
|
|||||||
|
|
||||||
testCompile(project(':test-utils')) {
|
testCompile(project(':test-utils')) {
|
||||||
exclude module: 'node-api'
|
exclude module: 'node-api'
|
||||||
exclude module: 'finance'
|
exclude module: 'contracts'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,7 +50,8 @@ dependencies {
|
|||||||
compile "org.controlsfx:controlsfx:$controlsfx_version"
|
compile "org.controlsfx:controlsfx:$controlsfx_version"
|
||||||
|
|
||||||
compile project(':client:rpc')
|
compile project(':client:rpc')
|
||||||
compile project(':finance')
|
compile project(':finance:contracts')
|
||||||
|
compile project(':finance:workflows')
|
||||||
|
|
||||||
compile "com.h2database:h2:$h2_version"
|
compile "com.h2database:h2:$h2_version"
|
||||||
compile "net.java.dev.jna:jna-platform:$jna_version"
|
compile "net.java.dev.jna:jna-platform:$jna_version"
|
||||||
@ -126,8 +127,13 @@ distributions {
|
|||||||
into 'corda'
|
into 'corda'
|
||||||
fileMode = 0444
|
fileMode = 0444
|
||||||
}
|
}
|
||||||
from(project(':finance').tasks.jar) {
|
from(project(':finance:contracts').tasks.jar) {
|
||||||
rename 'corda-finance-(.*)', 'corda-finance.jar'
|
rename 'corda-finance-contracts(.*)', 'corda-finance-contracts.jar'
|
||||||
|
into 'cordapps'
|
||||||
|
fileMode = 0444
|
||||||
|
}
|
||||||
|
from(project(':finance:workflows').tasks.jar) {
|
||||||
|
rename 'corda-finance-workflows(.*)', 'corda-finance-workflows.jar'
|
||||||
into 'cordapps'
|
into 'cordapps'
|
||||||
fileMode = 0444
|
fileMode = 0444
|
||||||
}
|
}
|
||||||
|
@ -119,7 +119,7 @@ class NodeController(check: atRuntime = ::checkExists) : Controller() {
|
|||||||
|
|
||||||
(config.nodeDir / "node.conf").writeText(config.nodeConfig.toNodeConfText())
|
(config.nodeDir / "node.conf").writeText(config.nodeConfig.toNodeConfText())
|
||||||
(config.nodeDir / "web-server.conf").writeText(config.nodeConfig.toWebServerConfText())
|
(config.nodeDir / "web-server.conf").writeText(config.nodeConfig.toWebServerConfText())
|
||||||
(cordappConfigDir / "${CordappController.FINANCE_CORDAPP_FILENAME}.conf").writeText(config.nodeConfig.toFinanceConfText())
|
(cordappConfigDir / "${CordappController.FINANCE_WORKFLOWS_CORDAPP_FILENAME}.conf").writeText(config.nodeConfig.toFinanceConfText())
|
||||||
|
|
||||||
// Execute the Corda node
|
// Execute the Corda node
|
||||||
val cordaEnv = System.getenv().toMutableMap().apply {
|
val cordaEnv = System.getenv().toMutableMap().apply {
|
||||||
|
@ -13,12 +13,13 @@ import kotlin.streams.toList
|
|||||||
|
|
||||||
class CordappController : Controller() {
|
class CordappController : Controller() {
|
||||||
companion object {
|
companion object {
|
||||||
const val FINANCE_CORDAPP_FILENAME = "corda-finance"
|
const val FINANCE_CONTRACTS_CORDAPP_FILENAME = "corda-finance-contracts"
|
||||||
|
const val FINANCE_WORKFLOWS_CORDAPP_FILENAME = "corda-finance-workflows"
|
||||||
}
|
}
|
||||||
|
|
||||||
private val jvm by inject<JVMConfig>()
|
private val jvm by inject<JVMConfig>()
|
||||||
private val cordappDir: Path = jvm.applicationDir / NodeConfig.CORDAPP_DIR_NAME
|
private val cordappDir: Path = jvm.applicationDir / NodeConfig.CORDAPP_DIR_NAME
|
||||||
private val financeCordappJar: Path = cordappDir / "$FINANCE_CORDAPP_FILENAME.jar"
|
private val financeCordappJars = setOf(cordappDir / "$FINANCE_CONTRACTS_CORDAPP_FILENAME.jar", cordappDir / "$FINANCE_WORKFLOWS_CORDAPP_FILENAME.jar")
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Install any built-in cordapps that this node requires.
|
* Install any built-in cordapps that this node requires.
|
||||||
@ -28,9 +29,11 @@ class CordappController : Controller() {
|
|||||||
if (!config.cordappsDir.exists()) {
|
if (!config.cordappsDir.exists()) {
|
||||||
config.cordappsDir.createDirectories()
|
config.cordappsDir.createDirectories()
|
||||||
}
|
}
|
||||||
if (financeCordappJar.exists()) {
|
financeCordappJars.forEach {financeCordappJar ->
|
||||||
financeCordappJar.copyToDirectory(config.cordappsDir, StandardCopyOption.REPLACE_EXISTING)
|
if (financeCordappJar.exists()) {
|
||||||
log.info("Installed 'Finance' cordapp")
|
financeCordappJar.copyToDirectory(config.cordappsDir, StandardCopyOption.REPLACE_EXISTING)
|
||||||
|
log.info("Installed 'Finance' cordapp: $financeCordappJar")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -42,7 +45,7 @@ class CordappController : Controller() {
|
|||||||
if (!config.cordappsDir.isDirectory()) return emptyList()
|
if (!config.cordappsDir.isDirectory()) return emptyList()
|
||||||
return config.cordappsDir.walk(1) { paths ->
|
return config.cordappsDir.walk(1) { paths ->
|
||||||
paths.filter(Path::isCordapp)
|
paths.filter(Path::isCordapp)
|
||||||
.filter { !financeCordappJar.endsWith(it.fileName) }
|
.filter { financeCordappJars.any { !it.endsWith(it.fileName) } }
|
||||||
.toList()
|
.toList()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,8 @@ dependencies {
|
|||||||
compile project(':client:jfx')
|
compile project(':client:jfx')
|
||||||
compile project(':client:mock')
|
compile project(':client:mock')
|
||||||
compile project(':node-driver')
|
compile project(':node-driver')
|
||||||
compile project(':finance')
|
compile project(':finance:contracts')
|
||||||
|
compile project(':finance:workflows')
|
||||||
|
|
||||||
// Capsule is a library for building independently executable fat JARs.
|
// Capsule is a library for building independently executable fat JARs.
|
||||||
// We only need this dependency to compile our Caplet against.
|
// We only need this dependency to compile our Caplet against.
|
||||||
|
@ -63,7 +63,8 @@ dependencies {
|
|||||||
testCompile "junit:junit:$junit_version"
|
testCompile "junit:junit:$junit_version"
|
||||||
testCompile "org.assertj:assertj-core:$assertj_version"
|
testCompile "org.assertj:assertj-core:$assertj_version"
|
||||||
testCompile project(':test-utils')
|
testCompile project(':test-utils')
|
||||||
testCompile project(':finance')
|
testCompile project(':finance:contracts')
|
||||||
|
testCompile project(':finance:workflows')
|
||||||
|
|
||||||
// Jsh: Testing SSH server.
|
// Jsh: Testing SSH server.
|
||||||
integrationTestCompile "com.jcraft:jsch:$jsch_version"
|
integrationTestCompile "com.jcraft:jsch:$jsch_version"
|
||||||
|
Reference in New Issue
Block a user