diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml index 79ee123c2b..0f7bc519db 100644 --- a/.idea/codeStyles/codeStyleConfig.xml +++ b/.idea/codeStyles/codeStyleConfig.xml @@ -2,4 +2,4 @@ - \ No newline at end of file + diff --git a/.idea/compiler.xml b/.idea/compiler.xml index 2f513af44c..ed8de752b5 100644 --- a/.idea/compiler.xml +++ b/.idea/compiler.xml @@ -42,6 +42,10 @@ + + + + @@ -100,6 +104,16 @@ + + + + + + + + + + @@ -138,6 +152,10 @@ + + + + @@ -193,6 +211,8 @@ + + diff --git a/build.gradle b/build.gradle index 947e44b784..3a20bd5e99 100644 --- a/build.gradle +++ b/build.gradle @@ -302,7 +302,8 @@ dependencies { runtime project(':client:rpc') runtime project(':core') runtime project(':confidential-identities') - runtime project(':finance') + runtime project(':finance:workflows') + runtime project(':finance:contracts') runtime project(':webserver') testCompile project(':test-utils') } @@ -362,7 +363,9 @@ bintrayConfig { 'corda-deterministic-verifier', 'corda-djvm', 'corda', - 'corda-finance', + 'corda-finance', // maintained for backwards compatibility only + 'corda-finance-workflows', + 'corda-finance-contracts', 'corda-node', 'corda-node-api', 'corda-test-common', diff --git a/client/jfx/build.gradle b/client/jfx/build.gradle index f783b0ea1f..1977987329 100644 --- a/client/jfx/build.gradle +++ b/client/jfx/build.gradle @@ -26,7 +26,8 @@ sourceSets { dependencies { compile project(':core') - compile project(':finance') + compile project(':finance:contracts') + compile project(':finance:workflows') compile project(':client:rpc') compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" diff --git a/client/mock/build.gradle b/client/mock/build.gradle index b492455b49..52f9d9943d 100644 --- a/client/mock/build.gradle +++ b/client/mock/build.gradle @@ -10,7 +10,8 @@ description 'Corda client mock modules' dependencies { compile project(":core") - compile project(':finance') + compile project(':finance:workflows') + compile project(':finance:contracts') // Unit testing helpers. testCompile "junit:junit:$junit_version" diff --git a/client/rpc/build.gradle b/client/rpc/build.gradle index 72c6f41ed5..f4d655d966 100644 --- a/client/rpc/build.gradle +++ b/client/rpc/build.gradle @@ -56,8 +56,11 @@ processSmokeTestResources { from(project(':node:capsule').tasks['buildCordaJAR']) { rename 'corda-(.*)', 'corda.jar' } - from(project(':finance').tasks['jar']) { - rename 'finance-(.*)', 'finance.jar' + from(project(':finance:workflows').tasks['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! 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-core:$log4j_version" smokeTestCompile "org.jetbrains.kotlin:kotlin-test:$kotlin_version" diff --git a/client/rpc/src/smoke-test/kotlin/net/corda/kotlin/rpc/StandaloneCordaRPClientTest.kt b/client/rpc/src/smoke-test/kotlin/net/corda/kotlin/rpc/StandaloneCordaRPClientTest.kt index bc0174c4f4..d72b83ea04 100644 --- a/client/rpc/src/smoke-test/kotlin/net/corda/kotlin/rpc/StandaloneCordaRPClientTest.kt +++ b/client/rpc/src/smoke-test/kotlin/net/corda/kotlin/rpc/StandaloneCordaRPClientTest.kt @@ -89,10 +89,10 @@ class StandaloneCordaRPClientTest { private fun copyFinanceCordapp() { val cordappsDir = (factory.baseDirectory(notaryConfig) / NodeProcess.CORDAPPS_DIR_NAME).createDirectories() // Find the finance jar file for the smoke tests of this module - val financeJar = Paths.get("build", "resources", "smokeTest").list { - it.filter { "corda-finance" in it.toString() }.toList().single() + val financeJars = Paths.get("build", "resources", "smokeTest").list { + it.filter { "corda-finance" in it.toString() }.toList() } - financeJar.copyToDirectory(cordappsDir) + financeJars.forEach { it.copyToDirectory(cordappsDir) } } diff --git a/core-deterministic/testing/build.gradle b/core-deterministic/testing/build.gradle index bb007715eb..d3933a91dc 100644 --- a/core-deterministic/testing/build.gradle +++ b/core-deterministic/testing/build.gradle @@ -5,7 +5,10 @@ dependencies { testCompile project(path: ':serialization-deterministic', configuration: 'deterministicArtifacts') testCompile project(path: ':core-deterministic:testing:verifier', configuration: 'deterministicArtifacts') testCompile project(path: ':core-deterministic:testing:data', configuration: 'testData') - testCompile(project(':finance')) { + testCompile(project(':finance:contracts')) { + transitive = false + } + testCompile(project(':finance:workflows')) { transitive = false } diff --git a/core-deterministic/testing/data/build.gradle b/core-deterministic/testing/data/build.gradle index 03da2a8977..9165b83dde 100644 --- a/core-deterministic/testing/data/build.gradle +++ b/core-deterministic/testing/data/build.gradle @@ -6,7 +6,7 @@ configurations { dependencies { testCompile project(':core') - testCompile project(':finance') + testCompile project(':finance:workflows') testCompile project(':node-driver') testCompile project(path: ':core-deterministic:testing:verifier', configuration: 'runtimeArtifacts') diff --git a/docs/build.gradle b/docs/build.gradle index 0da6f2ecca..bea277c0e9 100644 --- a/docs/build.gradle +++ b/docs/build.gradle @@ -20,7 +20,7 @@ def internalPackagePrefixes(sourceDirs) { ext { // 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') internalPackagePrefixes = internalPackagePrefixes(dokkaSourceDirs) } diff --git a/docs/source/example-code/build.gradle b/docs/source/example-code/build.gradle index eeeb489eb4..248f2eeba7 100644 --- a/docs/source/example-code/build.gradle +++ b/docs/source/example-code/build.gradle @@ -41,8 +41,9 @@ dependencies { compile project(path: ":node:capsule", configuration: 'runtimeArtifacts') compile project(path: ":webserver:webcapsule", configuration: 'runtimeArtifacts') - // Corda Plugins: dependent flows and services - compile project(':finance') + // CorDapps: dependent flows and services + compile project(':finance:contracts') + compile project(':finance:workflows') } mainClassName = "net.corda.docs.ClientRpcTutorialKt" diff --git a/experimental/behave/build.gradle b/experimental/behave/build.gradle index 8cf7b06b80..d124b6ac39 100644 --- a/experimental/behave/build.gradle +++ b/experimental/behave/build.gradle @@ -58,7 +58,8 @@ dependencies { compile "com.spotify:docker-client:$docker_client_version" compile "io.reactivex:rxjava:$rxjava_version" - compile project(':finance') + compile project(':finance:contracts') + compile project(':finance:workflows') compile project(':node-api') compile project(':client:rpc') diff --git a/experimental/build.gradle b/experimental/build.gradle index 1be6ecc6c5..482f6e233a 100644 --- a/experimental/build.gradle +++ b/experimental/build.gradle @@ -12,7 +12,8 @@ compileTestKotlin { dependencies { 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. compile "org.ow2.asm:asm:$asm_version" diff --git a/finance/build.gradle b/finance/build.gradle index 78eb6568a0..cf7102534b 100644 --- a/finance/build.gradle +++ b/finance/build.gradle @@ -10,77 +10,45 @@ apply plugin: 'com.jfrog.artifactory' description 'Corda finance modules' -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') - } - } -} +/** + * NOTE: this build.gradle file is maintained for backwards compatibility purposes. + * It will build a `corda-finance.jar` including all Contracts and Flows. + * From Corda 4 it is strongly recommended that CorDapps dependent on the `corda-finance.jar` + * explicitly declare dependencies on either/both of the corda finance sub-modules: + * corda-finance-contract => generates `corda-finance-contract.jar` + * corda-finance-workflows => generates `corda-finance-workflows.jar` + * Third party CorDapps should remember to include these sub-module dependencies using the `cordapp` Corda Gradle plug-in + * cordapp project(':finance:workflows') + * cordapp project(':finance:contracts') + */ -dependencies { - // 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 -} +def mainProjects = [':finance:contracts',':finance:workflows', ':confidential-identities'] +jar.dependsOn mainProjects.collect{ it+":compileJava"} jar { baseName 'corda-finance' + from files(mainProjects.collect{ project(it).sourceSets.main.output }) + duplicatesStrategy = DuplicatesStrategy.EXCLUDE } cordapp { + signing { + enabled false + } targetPlatformVersion corda_platform_version.toInteger() minimumPlatformVersion 1 contract { - name "net/corda/finance/contracts" + name "Corda Finance Demo" versionId 1 vendor "R3" licence "Open Source (Apache 2)" } workflow { - name "net/corda/finance/flows" + 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 { diff --git a/finance/contracts/build.gradle b/finance/contracts/build.gradle new file mode 100644 index 0000000000..89ac236954 --- /dev/null +++ b/finance/contracts/build.gradle @@ -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 +} \ No newline at end of file diff --git a/finance/src/main/java/net/corda/finance/contracts/ICommercialPaperState.java b/finance/contracts/src/main/java/net/corda/finance/contracts/ICommercialPaperState.java similarity index 100% rename from finance/src/main/java/net/corda/finance/contracts/ICommercialPaperState.java rename to finance/contracts/src/main/java/net/corda/finance/contracts/ICommercialPaperState.java diff --git a/finance/src/main/java/net/corda/finance/contracts/JavaCommercialPaper.java b/finance/contracts/src/main/java/net/corda/finance/contracts/JavaCommercialPaper.java similarity index 100% rename from finance/src/main/java/net/corda/finance/contracts/JavaCommercialPaper.java rename to finance/contracts/src/main/java/net/corda/finance/contracts/JavaCommercialPaper.java diff --git a/finance/src/main/kotlin/net/corda/finance/contracts/CommercialPaper.kt b/finance/contracts/src/main/kotlin/net/corda/finance/contracts/CommercialPaper.kt similarity index 100% rename from finance/src/main/kotlin/net/corda/finance/contracts/CommercialPaper.kt rename to finance/contracts/src/main/kotlin/net/corda/finance/contracts/CommercialPaper.kt diff --git a/finance/src/main/kotlin/net/corda/finance/contracts/FinanceTypes.kt b/finance/contracts/src/main/kotlin/net/corda/finance/contracts/FinanceTypes.kt similarity index 100% rename from finance/src/main/kotlin/net/corda/finance/contracts/FinanceTypes.kt rename to finance/contracts/src/main/kotlin/net/corda/finance/contracts/FinanceTypes.kt diff --git a/finance/src/main/kotlin/net/corda/finance/contracts/GetBalances.kt b/finance/contracts/src/main/kotlin/net/corda/finance/contracts/GetBalances.kt similarity index 100% rename from finance/src/main/kotlin/net/corda/finance/contracts/GetBalances.kt rename to finance/contracts/src/main/kotlin/net/corda/finance/contracts/GetBalances.kt diff --git a/finance/src/main/kotlin/net/corda/finance/contracts/asset/cash/selection/AbstractCashSelection.kt b/finance/contracts/src/main/kotlin/net/corda/finance/contracts/asset/AbstractCashSelection.kt similarity index 92% rename from finance/src/main/kotlin/net/corda/finance/contracts/asset/cash/selection/AbstractCashSelection.kt rename to finance/contracts/src/main/kotlin/net/corda/finance/contracts/asset/AbstractCashSelection.kt index 29c65312fd..54fae6eafe 100644 --- a/finance/src/main/kotlin/net/corda/finance/contracts/asset/cash/selection/AbstractCashSelection.kt +++ b/finance/contracts/src/main/kotlin/net/corda/finance/contracts/asset/AbstractCashSelection.kt @@ -1,4 +1,4 @@ -package net.corda.finance.contracts.asset.cash.selection +package net.corda.finance.contracts.asset import co.paralleluniverse.fibers.Suspendable 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.services.StatesNotAvailableException import net.corda.core.utilities.* -import net.corda.finance.contracts.asset.Cash import java.sql.Connection import java.sql.DatabaseMetaData import java.sql.ResultSet @@ -21,11 +20,13 @@ import java.util.concurrent.atomic.AtomicReference /** * 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 * 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 { val instance = AtomicReference() @@ -46,12 +47,6 @@ abstract class AbstractCashSelection { 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 * this method determines whether the loaded implementation is compatible and usable with the currently @@ -102,13 +97,13 @@ abstract class AbstractCashSelection { val stateAndRefs = mutableListOf>() // DOCSTART CASHSELECT 1 - for (retryCount in 1..MAX_RETRIES) { + for (retryCount in 1..maxRetries) { if (!attemptSpend(services, amount, lockId, notary, onlyFromIssuerParties, withIssuerRefs, stateAndRefs)) { log.warn("Coin selection failed on attempt $retryCount") // TODO: revisit the back off strategy for contended spending. - if (retryCount != MAX_RETRIES) { + if (retryCount != maxRetries) { 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) } else { log.warn("Insufficient spendable states identified for $amount") @@ -167,4 +162,4 @@ abstract class AbstractCashSelection { } return false } -} \ No newline at end of file +} diff --git a/finance/src/main/kotlin/net/corda/finance/contracts/asset/Cash.kt b/finance/contracts/src/main/kotlin/net/corda/finance/contracts/asset/Cash.kt similarity index 99% rename from finance/src/main/kotlin/net/corda/finance/contracts/asset/Cash.kt rename to finance/contracts/src/main/kotlin/net/corda/finance/contracts/asset/Cash.kt index 93360e7155..d5754a2b68 100644 --- a/finance/src/main/kotlin/net/corda/finance/contracts/asset/Cash.kt +++ b/finance/contracts/src/main/kotlin/net/corda/finance/contracts/asset/Cash.kt @@ -16,10 +16,8 @@ import net.corda.core.node.ServiceHub import net.corda.core.schemas.MappedSchema import net.corda.core.schemas.PersistentState import net.corda.core.schemas.QueryableState -import net.corda.core.serialization.SerializableCalculatedProperty import net.corda.core.transactions.LedgerTransaction 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.utils.sumCash import net.corda.finance.utils.sumCashOrNull diff --git a/finance/src/main/kotlin/net/corda/finance/contracts/asset/Obligation.kt b/finance/contracts/src/main/kotlin/net/corda/finance/contracts/asset/Obligation.kt similarity index 100% rename from finance/src/main/kotlin/net/corda/finance/contracts/asset/Obligation.kt rename to finance/contracts/src/main/kotlin/net/corda/finance/contracts/asset/Obligation.kt diff --git a/finance/src/main/kotlin/net/corda/finance/contracts/asset/OnLedgerAsset.kt b/finance/contracts/src/main/kotlin/net/corda/finance/contracts/asset/OnLedgerAsset.kt similarity index 100% rename from finance/src/main/kotlin/net/corda/finance/contracts/asset/OnLedgerAsset.kt rename to finance/contracts/src/main/kotlin/net/corda/finance/contracts/asset/OnLedgerAsset.kt diff --git a/finance/src/main/kotlin/net/corda/finance/contracts/math/Interpolators.kt b/finance/contracts/src/main/kotlin/net/corda/finance/contracts/math/Interpolators.kt similarity index 100% rename from finance/src/main/kotlin/net/corda/finance/contracts/math/Interpolators.kt rename to finance/contracts/src/main/kotlin/net/corda/finance/contracts/math/Interpolators.kt diff --git a/finance/src/main/kotlin/net/corda/finance/schemas/CashSchemaV1.kt b/finance/contracts/src/main/kotlin/net/corda/finance/schemas/CashSchemaV1.kt similarity index 100% rename from finance/src/main/kotlin/net/corda/finance/schemas/CashSchemaV1.kt rename to finance/contracts/src/main/kotlin/net/corda/finance/schemas/CashSchemaV1.kt diff --git a/finance/src/main/kotlin/net/corda/finance/schemas/CommercialPaperSchemaV1.kt b/finance/contracts/src/main/kotlin/net/corda/finance/schemas/CommercialPaperSchemaV1.kt similarity index 100% rename from finance/src/main/kotlin/net/corda/finance/schemas/CommercialPaperSchemaV1.kt rename to finance/contracts/src/main/kotlin/net/corda/finance/schemas/CommercialPaperSchemaV1.kt diff --git a/finance/src/main/kotlin/net/corda/finance/utils/PhysicalLocationStructures.kt b/finance/contracts/src/main/kotlin/net/corda/finance/utils/PhysicalLocationStructures.kt similarity index 100% rename from finance/src/main/kotlin/net/corda/finance/utils/PhysicalLocationStructures.kt rename to finance/contracts/src/main/kotlin/net/corda/finance/utils/PhysicalLocationStructures.kt diff --git a/finance/src/main/kotlin/net/corda/finance/utils/StateSummingUtilities.kt b/finance/contracts/src/main/kotlin/net/corda/finance/utils/StateSummingUtilities.kt similarity index 100% rename from finance/src/main/kotlin/net/corda/finance/utils/StateSummingUtilities.kt rename to finance/contracts/src/main/kotlin/net/corda/finance/utils/StateSummingUtilities.kt diff --git a/finance/src/main/resources/net/corda/finance/contracts/LondonHolidayCalendar.txt b/finance/contracts/src/main/resources/net/corda/finance/contracts/LondonHolidayCalendar.txt similarity index 100% rename from finance/src/main/resources/net/corda/finance/contracts/LondonHolidayCalendar.txt rename to finance/contracts/src/main/resources/net/corda/finance/contracts/LondonHolidayCalendar.txt diff --git a/finance/src/main/resources/net/corda/finance/contracts/NewYorkHolidayCalendar.txt b/finance/contracts/src/main/resources/net/corda/finance/contracts/NewYorkHolidayCalendar.txt similarity index 100% rename from finance/src/main/resources/net/corda/finance/contracts/NewYorkHolidayCalendar.txt rename to finance/contracts/src/main/resources/net/corda/finance/contracts/NewYorkHolidayCalendar.txt diff --git a/finance/src/main/resources/net/corda/finance/utils/cities.txt b/finance/contracts/src/main/resources/net/corda/finance/utils/cities.txt similarity index 100% rename from finance/src/main/resources/net/corda/finance/utils/cities.txt rename to finance/contracts/src/main/resources/net/corda/finance/utils/cities.txt diff --git a/finance/src/test/java/net/corda/finance/contracts/asset/CashTestsJava.java b/finance/contracts/src/test/java/net/corda/finance/contracts/asset/CashTestsJava.java similarity index 100% rename from finance/src/test/java/net/corda/finance/contracts/asset/CashTestsJava.java rename to finance/contracts/src/test/java/net/corda/finance/contracts/asset/CashTestsJava.java diff --git a/finance/src/test/kotlin/net/corda/finance/contracts/CommercialPaperTests.kt b/finance/contracts/src/test/kotlin/net/corda/finance/contracts/CommercialPaperTests.kt similarity index 100% rename from finance/src/test/kotlin/net/corda/finance/contracts/CommercialPaperTests.kt rename to finance/contracts/src/test/kotlin/net/corda/finance/contracts/CommercialPaperTests.kt diff --git a/finance/src/test/kotlin/net/corda/finance/contracts/FinanceTypesTest.kt b/finance/contracts/src/test/kotlin/net/corda/finance/contracts/FinanceTypesTest.kt similarity index 100% rename from finance/src/test/kotlin/net/corda/finance/contracts/FinanceTypesTest.kt rename to finance/contracts/src/test/kotlin/net/corda/finance/contracts/FinanceTypesTest.kt diff --git a/finance/src/test/kotlin/net/corda/finance/contracts/asset/CashTests.kt b/finance/contracts/src/test/kotlin/net/corda/finance/contracts/asset/CashTests.kt similarity index 100% rename from finance/src/test/kotlin/net/corda/finance/contracts/asset/CashTests.kt rename to finance/contracts/src/test/kotlin/net/corda/finance/contracts/asset/CashTests.kt diff --git a/finance/src/test/kotlin/net/corda/finance/contracts/asset/ObligationTests.kt b/finance/contracts/src/test/kotlin/net/corda/finance/contracts/asset/ObligationTests.kt similarity index 100% rename from finance/src/test/kotlin/net/corda/finance/contracts/asset/ObligationTests.kt rename to finance/contracts/src/test/kotlin/net/corda/finance/contracts/asset/ObligationTests.kt diff --git a/finance/src/test/kotlin/net/corda/finance/contracts/asset/test/DummyFungibleContract.kt b/finance/contracts/src/test/kotlin/net/corda/finance/contracts/asset/test/DummyFungibleContract.kt similarity index 100% rename from finance/src/test/kotlin/net/corda/finance/contracts/asset/test/DummyFungibleContract.kt rename to finance/contracts/src/test/kotlin/net/corda/finance/contracts/asset/test/DummyFungibleContract.kt diff --git a/finance/src/test/kotlin/net/corda/finance/contracts/math/InterpolatorsTest.kt b/finance/contracts/src/test/kotlin/net/corda/finance/contracts/math/InterpolatorsTest.kt similarity index 100% rename from finance/src/test/kotlin/net/corda/finance/contracts/math/InterpolatorsTest.kt rename to finance/contracts/src/test/kotlin/net/corda/finance/contracts/math/InterpolatorsTest.kt diff --git a/finance/src/test/kotlin/net/corda/finance/schemas/test/SampleCashSchemaV1.kt b/finance/contracts/src/test/kotlin/net/corda/finance/schemas/test/SampleCashSchemaV1.kt similarity index 100% rename from finance/src/test/kotlin/net/corda/finance/schemas/test/SampleCashSchemaV1.kt rename to finance/contracts/src/test/kotlin/net/corda/finance/schemas/test/SampleCashSchemaV1.kt diff --git a/finance/src/test/kotlin/net/corda/finance/schemas/test/SampleCashSchemaV2.kt b/finance/contracts/src/test/kotlin/net/corda/finance/schemas/test/SampleCashSchemaV2.kt similarity index 100% rename from finance/src/test/kotlin/net/corda/finance/schemas/test/SampleCashSchemaV2.kt rename to finance/contracts/src/test/kotlin/net/corda/finance/schemas/test/SampleCashSchemaV2.kt diff --git a/finance/src/test/kotlin/net/corda/finance/schemas/test/SampleCashSchemaV3.kt b/finance/contracts/src/test/kotlin/net/corda/finance/schemas/test/SampleCashSchemaV3.kt similarity index 100% rename from finance/src/test/kotlin/net/corda/finance/schemas/test/SampleCashSchemaV3.kt rename to finance/contracts/src/test/kotlin/net/corda/finance/schemas/test/SampleCashSchemaV3.kt diff --git a/finance/src/test/kotlin/net/corda/finance/schemas/test/SampleCommercialPaperSchemaV1.kt b/finance/contracts/src/test/kotlin/net/corda/finance/schemas/test/SampleCommercialPaperSchemaV1.kt similarity index 100% rename from finance/src/test/kotlin/net/corda/finance/schemas/test/SampleCommercialPaperSchemaV1.kt rename to finance/contracts/src/test/kotlin/net/corda/finance/schemas/test/SampleCommercialPaperSchemaV1.kt diff --git a/finance/src/test/kotlin/net/corda/finance/schemas/test/SampleCommercialPaperSchemaV2.kt b/finance/contracts/src/test/kotlin/net/corda/finance/schemas/test/SampleCommercialPaperSchemaV2.kt similarity index 100% rename from finance/src/test/kotlin/net/corda/finance/schemas/test/SampleCommercialPaperSchemaV2.kt rename to finance/contracts/src/test/kotlin/net/corda/finance/schemas/test/SampleCommercialPaperSchemaV2.kt diff --git a/finance/src/test/kotlin/net/corda/finance/utils/CityDatabaseTest.kt b/finance/contracts/src/test/kotlin/net/corda/finance/utils/CityDatabaseTest.kt similarity index 100% rename from finance/src/test/kotlin/net/corda/finance/utils/CityDatabaseTest.kt rename to finance/contracts/src/test/kotlin/net/corda/finance/utils/CityDatabaseTest.kt diff --git a/finance/workflows/build.gradle b/finance/workflows/build.gradle new file mode 100644 index 0000000000..95c19859c5 --- /dev/null +++ b/finance/workflows/build.gradle @@ -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 +} diff --git a/finance/src/integration-test/kotlin/net/corda/finance/compat/CashExceptionSerialisationTest.kt b/finance/workflows/src/integration-test/kotlin/net/corda/finance/compat/CashExceptionSerialisationTest.kt similarity index 100% rename from finance/src/integration-test/kotlin/net/corda/finance/compat/CashExceptionSerialisationTest.kt rename to finance/workflows/src/integration-test/kotlin/net/corda/finance/compat/CashExceptionSerialisationTest.kt diff --git a/finance/src/main/kotlin/net/corda/finance/Currencies.kt b/finance/workflows/src/main/kotlin/net/corda/finance/Currencies.kt similarity index 100% rename from finance/src/main/kotlin/net/corda/finance/Currencies.kt rename to finance/workflows/src/main/kotlin/net/corda/finance/Currencies.kt diff --git a/finance/src/main/kotlin/net/corda/finance/contracts/asset/cash/selection/CashSelectionH2Impl.kt b/finance/workflows/src/main/kotlin/net/corda/finance/contracts/asset/cash/selection/CashSelectionH2Impl.kt similarity index 98% rename from finance/src/main/kotlin/net/corda/finance/contracts/asset/cash/selection/CashSelectionH2Impl.kt rename to finance/workflows/src/main/kotlin/net/corda/finance/contracts/asset/cash/selection/CashSelectionH2Impl.kt index c02441f2fb..bb8121fe61 100644 --- a/finance/src/main/kotlin/net/corda/finance/contracts/asset/cash/selection/CashSelectionH2Impl.kt +++ b/finance/workflows/src/main/kotlin/net/corda/finance/contracts/asset/cash/selection/CashSelectionH2Impl.kt @@ -7,6 +7,7 @@ import net.corda.core.identity.Party import net.corda.core.utilities.OpaqueBytes import net.corda.core.utilities.contextLogger import net.corda.core.utilities.debug +import net.corda.finance.contracts.asset.AbstractCashSelection import java.sql.Connection import java.sql.DatabaseMetaData import java.sql.ResultSet diff --git a/finance/src/main/kotlin/net/corda/finance/contracts/asset/cash/selection/CashSelectionPostgreSQLImpl.kt b/finance/workflows/src/main/kotlin/net/corda/finance/contracts/asset/cash/selection/CashSelectionPostgreSQLImpl.kt similarity index 98% rename from finance/src/main/kotlin/net/corda/finance/contracts/asset/cash/selection/CashSelectionPostgreSQLImpl.kt rename to finance/workflows/src/main/kotlin/net/corda/finance/contracts/asset/cash/selection/CashSelectionPostgreSQLImpl.kt index 4e5012e07a..69b51c5e54 100644 --- a/finance/src/main/kotlin/net/corda/finance/contracts/asset/cash/selection/CashSelectionPostgreSQLImpl.kt +++ b/finance/workflows/src/main/kotlin/net/corda/finance/contracts/asset/cash/selection/CashSelectionPostgreSQLImpl.kt @@ -7,6 +7,7 @@ import net.corda.core.identity.Party import net.corda.core.utilities.OpaqueBytes import net.corda.core.utilities.contextLogger import net.corda.core.utilities.debug +import net.corda.finance.contracts.asset.AbstractCashSelection import java.sql.Connection import java.sql.DatabaseMetaData import java.sql.ResultSet diff --git a/finance/src/main/kotlin/net/corda/finance/contracts/asset/cash/selection/CashSelectionSQLServerImpl.kt b/finance/workflows/src/main/kotlin/net/corda/finance/contracts/asset/cash/selection/CashSelectionSQLServerImpl.kt similarity index 98% rename from finance/src/main/kotlin/net/corda/finance/contracts/asset/cash/selection/CashSelectionSQLServerImpl.kt rename to finance/workflows/src/main/kotlin/net/corda/finance/contracts/asset/cash/selection/CashSelectionSQLServerImpl.kt index 52779a149c..75a9e03c16 100644 --- a/finance/src/main/kotlin/net/corda/finance/contracts/asset/cash/selection/CashSelectionSQLServerImpl.kt +++ b/finance/workflows/src/main/kotlin/net/corda/finance/contracts/asset/cash/selection/CashSelectionSQLServerImpl.kt @@ -7,6 +7,7 @@ import net.corda.core.identity.Party import net.corda.core.utilities.OpaqueBytes import net.corda.core.utilities.contextLogger import net.corda.core.utilities.debug +import net.corda.finance.contracts.asset.AbstractCashSelection import java.sql.Connection import java.sql.DatabaseMetaData import java.sql.ResultSet diff --git a/finance/src/main/kotlin/net/corda/finance/flows/AbstractCashFlow.kt b/finance/workflows/src/main/kotlin/net/corda/finance/flows/AbstractCashFlow.kt similarity index 100% rename from finance/src/main/kotlin/net/corda/finance/flows/AbstractCashFlow.kt rename to finance/workflows/src/main/kotlin/net/corda/finance/flows/AbstractCashFlow.kt diff --git a/finance/src/main/kotlin/net/corda/finance/flows/CashExitFlow.kt b/finance/workflows/src/main/kotlin/net/corda/finance/flows/CashExitFlow.kt similarity index 98% rename from finance/src/main/kotlin/net/corda/finance/flows/CashExitFlow.kt rename to finance/workflows/src/main/kotlin/net/corda/finance/flows/CashExitFlow.kt index 1b92e51df9..f12e73942d 100644 --- a/finance/src/main/kotlin/net/corda/finance/flows/CashExitFlow.kt +++ b/finance/workflows/src/main/kotlin/net/corda/finance/flows/CashExitFlow.kt @@ -13,7 +13,7 @@ import net.corda.core.transactions.TransactionBuilder import net.corda.core.utilities.OpaqueBytes import net.corda.core.utilities.ProgressTracker 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.GENERATING_TX import net.corda.finance.flows.AbstractCashFlow.Companion.SIGNING_TX diff --git a/finance/src/main/kotlin/net/corda/finance/flows/CashIssueAndPaymentFlow.kt b/finance/workflows/src/main/kotlin/net/corda/finance/flows/CashIssueAndPaymentFlow.kt similarity index 100% rename from finance/src/main/kotlin/net/corda/finance/flows/CashIssueAndPaymentFlow.kt rename to finance/workflows/src/main/kotlin/net/corda/finance/flows/CashIssueAndPaymentFlow.kt diff --git a/finance/src/main/kotlin/net/corda/finance/flows/CashIssueFlow.kt b/finance/workflows/src/main/kotlin/net/corda/finance/flows/CashIssueFlow.kt similarity index 100% rename from finance/src/main/kotlin/net/corda/finance/flows/CashIssueFlow.kt rename to finance/workflows/src/main/kotlin/net/corda/finance/flows/CashIssueFlow.kt diff --git a/finance/src/main/kotlin/net/corda/finance/flows/CashPaymentFlow.kt b/finance/workflows/src/main/kotlin/net/corda/finance/flows/CashPaymentFlow.kt similarity index 100% rename from finance/src/main/kotlin/net/corda/finance/flows/CashPaymentFlow.kt rename to finance/workflows/src/main/kotlin/net/corda/finance/flows/CashPaymentFlow.kt diff --git a/finance/src/main/kotlin/net/corda/finance/flows/TwoPartyDealFlow.kt b/finance/workflows/src/main/kotlin/net/corda/finance/flows/TwoPartyDealFlow.kt similarity index 100% rename from finance/src/main/kotlin/net/corda/finance/flows/TwoPartyDealFlow.kt rename to finance/workflows/src/main/kotlin/net/corda/finance/flows/TwoPartyDealFlow.kt diff --git a/finance/src/main/kotlin/net/corda/finance/flows/TwoPartyTradeFlow.kt b/finance/workflows/src/main/kotlin/net/corda/finance/flows/TwoPartyTradeFlow.kt similarity index 100% rename from finance/src/main/kotlin/net/corda/finance/flows/TwoPartyTradeFlow.kt rename to finance/workflows/src/main/kotlin/net/corda/finance/flows/TwoPartyTradeFlow.kt diff --git a/finance/src/main/kotlin/net/corda/finance/internal/CashConfigDataFlow.kt b/finance/workflows/src/main/kotlin/net/corda/finance/internal/CashConfigDataFlow.kt similarity index 100% rename from finance/src/main/kotlin/net/corda/finance/internal/CashConfigDataFlow.kt rename to finance/workflows/src/main/kotlin/net/corda/finance/internal/CashConfigDataFlow.kt diff --git a/finance/src/main/kotlin/net/corda/finance/plugin/FinanceJSONSupport.kt b/finance/workflows/src/main/kotlin/net/corda/finance/plugin/FinanceJSONSupport.kt similarity index 100% rename from finance/src/main/kotlin/net/corda/finance/plugin/FinanceJSONSupport.kt rename to finance/workflows/src/main/kotlin/net/corda/finance/plugin/FinanceJSONSupport.kt diff --git a/finance/src/main/resources/META-INF/services/net.corda.finance.contracts.asset.cash.selection.AbstractCashSelection b/finance/workflows/src/main/resources/META-INF/services/net.corda.finance.contracts.asset.AbstractCashSelection similarity index 100% rename from finance/src/main/resources/META-INF/services/net.corda.finance.contracts.asset.cash.selection.AbstractCashSelection rename to finance/workflows/src/main/resources/META-INF/services/net.corda.finance.contracts.asset.AbstractCashSelection diff --git a/finance/src/main/resources/migration/cash.changelog-init.xml b/finance/workflows/src/main/resources/migration/cash.changelog-init.xml similarity index 100% rename from finance/src/main/resources/migration/cash.changelog-init.xml rename to finance/workflows/src/main/resources/migration/cash.changelog-init.xml diff --git a/finance/src/main/resources/migration/cash.changelog-master.xml b/finance/workflows/src/main/resources/migration/cash.changelog-master.xml similarity index 100% rename from finance/src/main/resources/migration/cash.changelog-master.xml rename to finance/workflows/src/main/resources/migration/cash.changelog-master.xml diff --git a/finance/src/main/resources/migration/cash.changelog-v1.xml b/finance/workflows/src/main/resources/migration/cash.changelog-v1.xml similarity index 100% rename from finance/src/main/resources/migration/cash.changelog-v1.xml rename to finance/workflows/src/main/resources/migration/cash.changelog-v1.xml diff --git a/finance/src/main/resources/migration/commercial-paper.changelog-init.xml b/finance/workflows/src/main/resources/migration/commercial-paper.changelog-init.xml similarity index 100% rename from finance/src/main/resources/migration/commercial-paper.changelog-init.xml rename to finance/workflows/src/main/resources/migration/commercial-paper.changelog-init.xml diff --git a/finance/src/main/resources/migration/commercial-paper.changelog-master.xml b/finance/workflows/src/main/resources/migration/commercial-paper.changelog-master.xml similarity index 100% rename from finance/src/main/resources/migration/commercial-paper.changelog-master.xml rename to finance/workflows/src/main/resources/migration/commercial-paper.changelog-master.xml diff --git a/finance/src/main/resources/migration/commercial-paper.changelog-v1.xml b/finance/workflows/src/main/resources/migration/commercial-paper.changelog-v1.xml similarity index 100% rename from finance/src/main/resources/migration/commercial-paper.changelog-v1.xml rename to finance/workflows/src/main/resources/migration/commercial-paper.changelog-v1.xml diff --git a/finance/src/test/kotlin/net/corda/finance/CurrenciesTests.kt b/finance/workflows/src/test/kotlin/net/corda/finance/CurrenciesTests.kt similarity index 100% rename from finance/src/test/kotlin/net/corda/finance/CurrenciesTests.kt rename to finance/workflows/src/test/kotlin/net/corda/finance/CurrenciesTests.kt diff --git a/finance/src/test/kotlin/net/corda/finance/compat/CompatibilityTest.kt b/finance/workflows/src/test/kotlin/net/corda/finance/compat/CompatibilityTest.kt similarity index 100% rename from finance/src/test/kotlin/net/corda/finance/compat/CompatibilityTest.kt rename to finance/workflows/src/test/kotlin/net/corda/finance/compat/CompatibilityTest.kt diff --git a/finance/src/test/kotlin/net/corda/finance/contracts/asset/cash/selection/CashSelectionH2ImplTest.kt b/finance/workflows/src/test/kotlin/net/corda/finance/contracts/asset/selection/CashSelectionH2ImplTest.kt similarity index 98% rename from finance/src/test/kotlin/net/corda/finance/contracts/asset/cash/selection/CashSelectionH2ImplTest.kt rename to finance/workflows/src/test/kotlin/net/corda/finance/contracts/asset/selection/CashSelectionH2ImplTest.kt index 8d2e0b9495..2a30e5bc01 100644 --- a/finance/src/test/kotlin/net/corda/finance/contracts/asset/cash/selection/CashSelectionH2ImplTest.kt +++ b/finance/workflows/src/test/kotlin/net/corda/finance/contracts/asset/selection/CashSelectionH2ImplTest.kt @@ -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.utilities.OpaqueBytes diff --git a/finance/src/test/kotlin/net/corda/finance/flows/CashExitFlowTests.kt b/finance/workflows/src/test/kotlin/net/corda/finance/flows/CashExitFlowTests.kt similarity index 100% rename from finance/src/test/kotlin/net/corda/finance/flows/CashExitFlowTests.kt rename to finance/workflows/src/test/kotlin/net/corda/finance/flows/CashExitFlowTests.kt diff --git a/finance/src/test/kotlin/net/corda/finance/flows/CashIssueFlowTests.kt b/finance/workflows/src/test/kotlin/net/corda/finance/flows/CashIssueFlowTests.kt similarity index 100% rename from finance/src/test/kotlin/net/corda/finance/flows/CashIssueFlowTests.kt rename to finance/workflows/src/test/kotlin/net/corda/finance/flows/CashIssueFlowTests.kt diff --git a/finance/src/test/kotlin/net/corda/finance/flows/CashPaymentFlowTests.kt b/finance/workflows/src/test/kotlin/net/corda/finance/flows/CashPaymentFlowTests.kt similarity index 100% rename from finance/src/test/kotlin/net/corda/finance/flows/CashPaymentFlowTests.kt rename to finance/workflows/src/test/kotlin/net/corda/finance/flows/CashPaymentFlowTests.kt diff --git a/finance/src/test/kotlin/net/corda/finance/flows/CashSelectionTest.kt b/finance/workflows/src/test/kotlin/net/corda/finance/flows/CashSelectionTest.kt similarity index 98% rename from finance/src/test/kotlin/net/corda/finance/flows/CashSelectionTest.kt rename to finance/workflows/src/test/kotlin/net/corda/finance/flows/CashSelectionTest.kt index c771111cee..5e379489d8 100644 --- a/finance/src/test/kotlin/net/corda/finance/flows/CashSelectionTest.kt +++ b/finance/workflows/src/test/kotlin/net/corda/finance/flows/CashSelectionTest.kt @@ -8,7 +8,7 @@ import net.corda.core.utilities.OpaqueBytes import net.corda.core.utilities.getOrThrow import net.corda.finance.DOLLARS 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.issuedBy import net.corda.testing.core.singleIdentity diff --git a/finance/src/test/kotlin/net/corda/finance/flows/test/CashExceptionThrowingFlow.kt b/finance/workflows/src/test/kotlin/net/corda/finance/flows/test/CashExceptionThrowingFlow.kt similarity index 100% rename from finance/src/test/kotlin/net/corda/finance/flows/test/CashExceptionThrowingFlow.kt rename to finance/workflows/src/test/kotlin/net/corda/finance/flows/test/CashExceptionThrowingFlow.kt diff --git a/finance/src/test/kotlin/net/corda/finance/internal/CashConfigDataFlowTest.kt b/finance/workflows/src/test/kotlin/net/corda/finance/internal/CashConfigDataFlowTest.kt similarity index 100% rename from finance/src/test/kotlin/net/corda/finance/internal/CashConfigDataFlowTest.kt rename to finance/workflows/src/test/kotlin/net/corda/finance/internal/CashConfigDataFlowTest.kt diff --git a/finance/src/test/resources/compatibilityData/v3/node_transaction.dat b/finance/workflows/src/test/resources/compatibilityData/v3/node_transaction.dat similarity index 100% rename from finance/src/test/resources/compatibilityData/v3/node_transaction.dat rename to finance/workflows/src/test/resources/compatibilityData/v3/node_transaction.dat diff --git a/node/build.gradle b/node/build.gradle index df942c3b35..81e1bb81ea 100644 --- a/node/build.gradle +++ b/node/build.gradle @@ -128,11 +128,12 @@ dependencies { testCompile "org.assertj:assertj-core:${assertj_version}" testCompile project(':test-utils') testCompile project(':client:jfx') - testCompile project(':finance') + testCompile project(':finance:contracts') + testCompile project(':finance:workflows') testCompile project(':finance:isolated') // sample test schemas - testCompile project(path: ':finance', configuration: 'testArtifacts') + testCompile project(path: ':finance:contracts', configuration: 'testArtifacts') // For H2 database support in persistence compile "com.h2database:h2:$h2_version" diff --git a/node/src/test/kotlin/net/corda/node/services/vault/VaultQueryTests.kt b/node/src/test/kotlin/net/corda/node/services/vault/VaultQueryTests.kt index 88deac23cb..19a1cf94ed 100644 --- a/node/src/test/kotlin/net/corda/node/services/vault/VaultQueryTests.kt +++ b/node/src/test/kotlin/net/corda/node/services/vault/VaultQueryTests.kt @@ -18,7 +18,7 @@ import net.corda.finance.contracts.CommercialPaper import net.corda.finance.contracts.Commodity import net.corda.finance.contracts.DealState 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.PersistentCashState import net.corda.finance.schemas.CommercialPaperSchemaV1 diff --git a/samples/bank-of-corda-demo/build.gradle b/samples/bank-of-corda-demo/build.gradle index beddf34a65..e2d1533d01 100644 --- a/samples/bank-of-corda-demo/build.gradle +++ b/samples/bank-of-corda-demo/build.gradle @@ -9,7 +9,8 @@ dependencies { compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" // The bank of corda CorDapp depends upon Cash CorDapp features - cordapp project(':finance') + cordapp project(':finance:contracts') + cordapp project(':finance:workflows') // Corda integration dependencies 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') task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar', nodeTask, webTask]) { nodeDefaults { - cordapp project(':finance') + cordapp project(':finance:workflows') + cordapp project(':finance:contracts') } node { name "O=Notary Service,L=Zurich,C=CH" @@ -58,7 +60,7 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar', nodeTask, extraConfig = [ h2Settings: [address: "localhost:10017"] ] - cordapp(project(':finance')) { + cordapp(project(':finance:workflows')) { config "issuableCurrencies = [ USD ]" } } diff --git a/samples/irs-demo/cordapp/build.gradle b/samples/irs-demo/cordapp/build.gradle index 2653979ea3..35bb49933d 100644 --- a/samples/irs-demo/cordapp/build.gradle +++ b/samples/irs-demo/cordapp/build.gradle @@ -25,7 +25,8 @@ configurations { dependencies { // The irs demo CorDapp depends upon Cash CorDapp features - cordapp project(':finance') + cordapp project(':finance:contracts') + cordapp project(':finance:workflows') // Corda integration dependencies cordaRuntime project(path: ":node:capsule", configuration: 'runtimeArtifacts') @@ -65,7 +66,7 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar', nodeTask]) address("localhost:10003") 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 useTestClock true extraConfig = ['h2Settings.address' : 'localhost:10024'] @@ -77,7 +78,7 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar', nodeTask]) address("localhost:10006") 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 useTestClock true extraConfig = ['h2Settings.address' : 'localhost:10027'] @@ -89,7 +90,7 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar', nodeTask]) address("localhost:10009") 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 useTestClock true extraConfig = ['h2Settings.address' : 'localhost:10030'] @@ -101,8 +102,8 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar', nodeTask]) address("localhost:10012") adminAddress("localhost:10032") } - cordapps = ["${project.group}:finance:$corda_release_version"] - cordapps = ["${project(":finance").group}:finance:$corda_release_version"] + cordapps = ["${project.group}:contracts:$corda_release_version", "${project.group}:workflows:$corda_release_version"] + cordapps = ["${project(":finance").group}:contracts:$corda_release_version", "${project(":finance").group}:workflows:$corda_release_version"] rpcUsers = rpcUsersList useTestClock true extraConfig = ['h2Settings.address' : 'localhost:10033'] @@ -115,25 +116,25 @@ task prepareDockerNodes(type: net.corda.plugins.Dockerform, dependsOn: ['jar', n node { name "O=Notary Service,L=Zurich,C=CH" 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 useTestClock true } node { 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 useTestClock true } node { 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 useTestClock true } node { 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 useTestClock true } diff --git a/samples/simm-valuation-demo/build.gradle b/samples/simm-valuation-demo/build.gradle index a7e1e75972..b7db45d7aa 100644 --- a/samples/simm-valuation-demo/build.gradle +++ b/samples/simm-valuation-demo/build.gradle @@ -29,7 +29,8 @@ dependencies { cordaCompile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" // 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(':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]) { directory file("$buildDir/nodes") 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:flows') rpcUsers = [['username': "default", 'password': "default", 'permissions': [ 'ALL' ]]] diff --git a/samples/simm-valuation-demo/contracts-states/build.gradle b/samples/simm-valuation-demo/contracts-states/build.gradle index fcb1e63cae..7a88d84003 100644 --- a/samples/simm-valuation-demo/contracts-states/build.gradle +++ b/samples/simm-valuation-demo/contracts-states/build.gradle @@ -30,7 +30,7 @@ dependencies { cordaCompile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" // The SIMM demo CorDapp depends upon Cash CorDapp features - cordapp project(':finance') + cordapp project(':finance:contracts') // Corda integration dependencies cordaCompile project(':core') diff --git a/samples/simm-valuation-demo/flows/build.gradle b/samples/simm-valuation-demo/flows/build.gradle index fbb3a4dd58..46036b5b15 100644 --- a/samples/simm-valuation-demo/flows/build.gradle +++ b/samples/simm-valuation-demo/flows/build.gradle @@ -20,7 +20,8 @@ dependencies { cordaCompile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" // 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') // Corda integration dependencies diff --git a/samples/trader-demo/build.gradle b/samples/trader-demo/build.gradle index f5af7a9fc6..b41ae8877a 100644 --- a/samples/trader-demo/build.gradle +++ b/samples/trader-demo/build.gradle @@ -23,7 +23,8 @@ dependencies { compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" // The trader demo CorDapp depends upon Cash CorDapp features - cordapp project(':finance') + cordapp project(':finance:contracts') + cordapp project(':finance:workflows') // Corda integration dependencies cordaRuntime project(path: ":node:capsule", configuration: 'runtimeArtifacts') @@ -54,12 +55,12 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar', nodeTask, adminAddress "localhost:10004" } 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 { name "O=Bank A,L=London,C=GB" 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 rpcSettings { address "localhost:10006" @@ -70,7 +71,7 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar', nodeTask, node { name "O=Bank B,L=New York,C=US" 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 rpcSettings { address "localhost:10009" @@ -81,7 +82,7 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar', nodeTask, node { name "O=BankOfCorda,L=New York,C=US" 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 rpcSettings { address "localhost:10012" @@ -94,7 +95,7 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar', nodeTask, node { name "O=LoggingBank,L=London,C=GB" 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 rpcSettings { address "localhost:10026" diff --git a/settings.gradle b/settings.gradle index 29941fdb67..ed8e05f0e8 100644 --- a/settings.gradle +++ b/settings.gradle @@ -2,7 +2,9 @@ // output JAR from the capsule then the buildCordaJAR task goes into an infinite loop. rootProject.name = 'corda-project' include 'confidential-identities' -include 'finance' +include 'finance' // maintained for backwards compatibility only +include 'finance:contracts' +include 'finance:workflows' include 'finance:isolated' include 'core' include 'docs' diff --git a/tools/blobinspector/build.gradle b/tools/blobinspector/build.gradle index 8c0045035d..eea34a298f 100644 --- a/tools/blobinspector/build.gradle +++ b/tools/blobinspector/build.gradle @@ -12,7 +12,7 @@ dependencies { testCompile(project(':test-utils')) { exclude module: 'node-api' - exclude module: 'finance' + exclude module: 'contracts' } } diff --git a/tools/demobench/build.gradle b/tools/demobench/build.gradle index c22547dbea..6240d7b22a 100644 --- a/tools/demobench/build.gradle +++ b/tools/demobench/build.gradle @@ -50,7 +50,8 @@ dependencies { compile "org.controlsfx:controlsfx:$controlsfx_version" compile project(':client:rpc') - compile project(':finance') + compile project(':finance:contracts') + compile project(':finance:workflows') compile "com.h2database:h2:$h2_version" compile "net.java.dev.jna:jna-platform:$jna_version" @@ -126,8 +127,13 @@ distributions { into 'corda' fileMode = 0444 } - from(project(':finance').tasks.jar) { - rename 'corda-finance-(.*)', 'corda-finance.jar' + from(project(':finance:contracts').tasks.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' fileMode = 0444 } diff --git a/tools/demobench/src/main/kotlin/net/corda/demobench/model/NodeController.kt b/tools/demobench/src/main/kotlin/net/corda/demobench/model/NodeController.kt index bf4ed6ef8b..8c69365022 100644 --- a/tools/demobench/src/main/kotlin/net/corda/demobench/model/NodeController.kt +++ b/tools/demobench/src/main/kotlin/net/corda/demobench/model/NodeController.kt @@ -119,7 +119,7 @@ class NodeController(check: atRuntime = ::checkExists) : Controller() { (config.nodeDir / "node.conf").writeText(config.nodeConfig.toNodeConfText()) (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 val cordaEnv = System.getenv().toMutableMap().apply { diff --git a/tools/demobench/src/main/kotlin/net/corda/demobench/plugin/CordappController.kt b/tools/demobench/src/main/kotlin/net/corda/demobench/plugin/CordappController.kt index b82d9c7779..53a4267acc 100644 --- a/tools/demobench/src/main/kotlin/net/corda/demobench/plugin/CordappController.kt +++ b/tools/demobench/src/main/kotlin/net/corda/demobench/plugin/CordappController.kt @@ -13,12 +13,13 @@ import kotlin.streams.toList class CordappController : Controller() { 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() 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. @@ -28,9 +29,11 @@ class CordappController : Controller() { if (!config.cordappsDir.exists()) { config.cordappsDir.createDirectories() } - if (financeCordappJar.exists()) { - financeCordappJar.copyToDirectory(config.cordappsDir, StandardCopyOption.REPLACE_EXISTING) - log.info("Installed 'Finance' cordapp") + financeCordappJars.forEach {financeCordappJar -> + if (financeCordappJar.exists()) { + 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() return config.cordappsDir.walk(1) { paths -> paths.filter(Path::isCordapp) - .filter { !financeCordappJar.endsWith(it.fileName) } + .filter { financeCordappJars.any { !it.endsWith(it.fileName) } } .toList() } } diff --git a/tools/explorer/build.gradle b/tools/explorer/build.gradle index d489eac55e..959f5b273c 100644 --- a/tools/explorer/build.gradle +++ b/tools/explorer/build.gradle @@ -24,7 +24,8 @@ dependencies { compile project(':client:jfx') compile project(':client:mock') 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. // We only need this dependency to compile our Caplet against. diff --git a/tools/shell/build.gradle b/tools/shell/build.gradle index 1887bdb5fe..36ee942432 100644 --- a/tools/shell/build.gradle +++ b/tools/shell/build.gradle @@ -63,7 +63,8 @@ dependencies { testCompile "junit:junit:$junit_version" testCompile "org.assertj:assertj-core:$assertj_version" testCompile project(':test-utils') - testCompile project(':finance') + testCompile project(':finance:contracts') + testCompile project(':finance:workflows') // Jsh: Testing SSH server. integrationTestCompile "com.jcraft:jsch:$jsch_version"