diff --git a/docs/source/changelog.rst b/docs/source/changelog.rst index 62541eeb50..dba020402e 100644 --- a/docs/source/changelog.rst +++ b/docs/source/changelog.rst @@ -314,6 +314,9 @@ Version 4.0 * Finance CorDapp was split into two separate apps: ``corda-finance-contracts`` and ``corda-finance-workflows``, ``corda-finance`` is kept for backward compatibility, it is recommended to use separated jars. +* All sample CorDapps were split into separate apps: workflows and contracts to reflect new convention. It is recommended to structure your CorDapps + this way, see :doc:`app-upgrade-notes` on upgrading your CorDapp. + * The format of the shell commands' output can now be customized via the node shell, using the ``output-format`` command. * The ``node_transaction_mapping`` database table has been folded into the ``node_transactions`` database table as an additional column. diff --git a/samples/attachment-demo/build.gradle b/samples/attachment-demo/build.gradle index 956920019f..f558c2619a 100644 --- a/samples/attachment-demo/build.gradle +++ b/samples/attachment-demo/build.gradle @@ -1,50 +1,41 @@ apply plugin: 'kotlin' apply plugin: 'idea' apply plugin: 'net.corda.plugins.quasar-utils' -apply plugin: 'net.corda.plugins.cordapp' apply plugin: 'net.corda.plugins.cordformation' -sourceSets { - integrationTest { - kotlin { - compileClasspath += main.output + test.output - runtimeClasspath += main.output + test.output - srcDir file('src/integration-test/kotlin') - } - } -} - -configurations { - integrationTestCompile.extendsFrom testCompile - integrationTestRuntime.extendsFrom testRuntime -} +description 'Corda attachment demo' dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" - testCompile "junit:junit:$junit_version" - // Corda integration dependencies cordaRuntime project(path: ":node:capsule", configuration: 'runtimeArtifacts') cordaRuntime project(path: ":webserver:webcapsule", configuration: 'runtimeArtifacts') - cordaCompile project(':core') - cordaCompile project(':webserver') - cordaCompile project(':node-driver') + + cordapp project(':samples:attachment-demo:contracts') + cordapp project(':samples:attachment-demo:workflows') } 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]) { ext.rpcUsers = [['username': "demo", 'password': "demo", 'permissions': ["StartFlow.net.corda.attachmentdemo.AttachmentDemoFlow", - "InvokeRpc.wellKnownPartyFromX500Name", + "InvokeRpc.partiesFromName", "InvokeRpc.attachmentExists", "InvokeRpc.openAttachment", "InvokeRpc.uploadAttachment", - "InvokeRpc.internalVerifiedTransactionsFeed"]]] + "InvokeRpc.internalVerifiedTransactionsFeed", + "InvokeRpc.startTrackedFlowDynamic"]]] directory "./build/nodes" + nodeDefaults { + projectCordapp { + deploy = false + } + cordapp project(':samples:attachment-demo:contracts') + cordapp project(':samples:attachment-demo:workflows') + } node { name "O=Notary Service,L=Zurich,C=CH" - notary = [validating : true] + notary = [validating: true] p2pPort 10002 cordapps = [] rpcUsers = ext.rpcUsers @@ -52,7 +43,7 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar', nodeTask, address "localhost:10003" adminAddress "localhost:10004" } - extraConfig = ['h2Settings.address' : 'localhost:10012'] + extraConfig = ['h2Settings.address': 'localhost:10012'] } node { name "O=Bank A,L=London,C=GB" @@ -63,7 +54,7 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar', nodeTask, address "localhost:10006" adminAddress "localhost:10007" } - extraConfig = ['h2Settings.address' : 'localhost:10013'] + extraConfig = ['h2Settings.address': 'localhost:10013'] } node { name "O=Bank B,L=New York,C=US" @@ -75,51 +66,20 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar', nodeTask, webPort 10010 cordapps = [] rpcUsers = ext.rpcUsers - extraConfig = ['h2Settings.address' : 'localhost:10014'] - } -} - -task integrationTest(type: Test, dependsOn: []) { - testClassesDirs = sourceSets.integrationTest.output.classesDirs - classpath = sourceSets.integrationTest.runtimeClasspath -} - -idea { - module { - downloadJavadoc = true // defaults to false - downloadSources = true + extraConfig = ['h2Settings.address': 'localhost:10014'] } } task runSender(type: JavaExec) { classpath = sourceSets.main.runtimeClasspath - main = 'net.corda.attachmentdemo.AttachmentDemoKt' + main = 'net.corda.attachmentdemo.workflows.AttachmentDemoKt' args '--role' args 'SENDER' } task runRecipient(type: JavaExec) { classpath = sourceSets.main.runtimeClasspath - main = 'net.corda.attachmentdemo.AttachmentDemoKt' + main = 'net.corda.attachmentdemo.workflows.AttachmentDemoKt' args '--role' args 'RECIPIENT' } - -jar { - manifest { - attributes( - 'Automatic-Module-Name': 'net.corda.samples.demos.attachment' - ) - } -} - -cordapp { - targetPlatformVersion corda_platform_version.toInteger() - minimumPlatformVersion 1 - workflow { - name "net/corda/samples/attachment-demo" - versionId 1 - vendor "R3" - licence "Open Source (Apache 2)" - } -} diff --git a/samples/attachment-demo/contracts/build.gradle b/samples/attachment-demo/contracts/build.gradle new file mode 100644 index 0000000000..c34d232331 --- /dev/null +++ b/samples/attachment-demo/contracts/build.gradle @@ -0,0 +1,24 @@ +apply plugin: 'kotlin' +apply plugin: 'net.corda.plugins.cordapp' + +description 'Corda attachment demo - contracts' + +dependencies { + compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" + cordaCompile project(':core') +} + +cordapp { + targetPlatformVersion corda_platform_version.toInteger() + minimumPlatformVersion 1 + contract { + name "Corda Attachment Demo" + versionId 1 + vendor "R3" + licence "Open Source (Apache 2)" + } +} + +jar { + baseName 'corda-attachment-demo-contracts' +} \ No newline at end of file diff --git a/samples/attachment-demo/contracts/src/main/kotlin/net/corda/attachmentdemo/contracts/AttachmentContract.kt b/samples/attachment-demo/contracts/src/main/kotlin/net/corda/attachmentdemo/contracts/AttachmentContract.kt new file mode 100644 index 0000000000..0ba3c8c0ef --- /dev/null +++ b/samples/attachment-demo/contracts/src/main/kotlin/net/corda/attachmentdemo/contracts/AttachmentContract.kt @@ -0,0 +1,24 @@ +package net.corda.attachmentdemo.contracts + +import net.corda.core.contracts.Contract +import net.corda.core.contracts.ContractState +import net.corda.core.contracts.TypeOnlyCommandData +import net.corda.core.crypto.SecureHash +import net.corda.core.identity.AbstractParty +import net.corda.core.transactions.LedgerTransaction + +class AttachmentContract : Contract { + override fun verify(tx: LedgerTransaction) { + val state = tx.outputsOfType().single() + // we check that at least one has the matching hash, the other will be the contract + require(tx.attachments.any { it.id == state.hash }) {"At least one attachment in transaction must match hash ${state.hash}"} + } + + object Command : TypeOnlyCommandData() + + data class State(val hash: SecureHash.SHA256) : ContractState { + override val participants: List = emptyList() + } +} + +const val ATTACHMENT_PROGRAM_ID = "net.corda.attachmentdemo.contracts.AttachmentContract" diff --git a/samples/attachment-demo/lib/README.txt b/samples/attachment-demo/lib/README.txt deleted file mode 100644 index b0592c95f7..0000000000 --- a/samples/attachment-demo/lib/README.txt +++ /dev/null @@ -1,8 +0,0 @@ -The Quasar.jar in this directory is for runtime instrumentation of classes by Quasar. - -When running corda outside of the given gradle building you must add the following flag with the -correct path to your call to Java: - - java -javaagent:path-to-quasar-jar.jar ... - -See the Quasar docs for more information: http://docs.paralleluniverse.co/quasar/ \ No newline at end of file diff --git a/samples/attachment-demo/lib/quasar.jar b/samples/attachment-demo/lib/quasar.jar deleted file mode 100644 index 286f065e43..0000000000 Binary files a/samples/attachment-demo/lib/quasar.jar and /dev/null differ diff --git a/samples/attachment-demo/src/main/kotlin/net/corda/attachmentdemo/Main.kt b/samples/attachment-demo/src/main/kotlin/net/corda/attachmentdemo/Main.kt deleted file mode 100644 index ef87d0dbde..0000000000 --- a/samples/attachment-demo/src/main/kotlin/net/corda/attachmentdemo/Main.kt +++ /dev/null @@ -1,20 +0,0 @@ -package net.corda.attachmentdemo - -import net.corda.core.internal.div -import net.corda.testing.core.DUMMY_BANK_A_NAME -import net.corda.testing.core.DUMMY_BANK_B_NAME -import net.corda.testing.driver.DriverParameters -import net.corda.testing.driver.driver -import net.corda.testing.node.User - -/** - * This file is exclusively for being able to run your nodes through an IDE (as opposed to running deployNodes) - * Do not use in a production environment. - */ -fun main(args: Array) { - val demoUser = listOf(User("demo", "demo", setOf("StartFlow.net.corda.flows.FinalityFlow"))) - driver(DriverParameters(driverDirectory = "build" / "attachment-demo-nodes", waitForAllNodesToFinish = true)) { - startNode(providedName = DUMMY_BANK_A_NAME, rpcUsers = demoUser) - startNode(providedName = DUMMY_BANK_B_NAME, rpcUsers = demoUser) - } -} diff --git a/samples/attachment-demo/workflows/build.gradle b/samples/attachment-demo/workflows/build.gradle new file mode 100644 index 0000000000..132c345fbd --- /dev/null +++ b/samples/attachment-demo/workflows/build.gradle @@ -0,0 +1,58 @@ +apply plugin: 'kotlin' +apply plugin: 'idea' +apply plugin: 'net.corda.plugins.quasar-utils' +apply plugin: 'net.corda.plugins.cordapp' + +description 'Corda attachment demo - workflows' + +sourceSets { + integrationTest { + kotlin { + compileClasspath += main.output + test.output + runtimeClasspath += main.output + test.output + srcDir file('src/integration-test/kotlin') + } + } +} + +configurations { + integrationTestCompile.extendsFrom testCompile + integrationTestRuntime.extendsFrom testRuntime +} + +dependencies { + compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" + // Corda integration dependencies + cordaCompile project(':core') + cordaCompile project(':webserver') + cordapp project(':samples:attachment-demo:contracts') + testCompile project(':node-driver') + testCompile "junit:junit:$junit_version" +} + +task integrationTest(type: Test, dependsOn: []) { + testClassesDirs = sourceSets.integrationTest.output.classesDirs + classpath = sourceSets.integrationTest.runtimeClasspath +} + +idea { + module { + downloadJavadoc = true // defaults to false + downloadSources = true + } +} + +cordapp { + targetPlatformVersion corda_platform_version.toInteger() + minimumPlatformVersion 1 + workflow { + name "Corda Attachment Demo" + versionId 1 + vendor "R3" + licence "Open Source (Apache 2)" + } +} + +jar { + baseName 'corda-attachment-demo-workflows' +} \ No newline at end of file diff --git a/samples/attachment-demo/src/integration-test/kotlin/net/corda/attachmentdemo/AttachmentDemoTest.kt b/samples/attachment-demo/workflows/src/integration-test/kotlin/net/corda/attachmentdemo/AttachmentDemoTest.kt similarity index 80% rename from samples/attachment-demo/src/integration-test/kotlin/net/corda/attachmentdemo/AttachmentDemoTest.kt rename to samples/attachment-demo/workflows/src/integration-test/kotlin/net/corda/attachmentdemo/AttachmentDemoTest.kt index 053957b81d..4bbdef6e77 100644 --- a/samples/attachment-demo/src/integration-test/kotlin/net/corda/attachmentdemo/AttachmentDemoTest.kt +++ b/samples/attachment-demo/workflows/src/integration-test/kotlin/net/corda/attachmentdemo/AttachmentDemoTest.kt @@ -1,5 +1,7 @@ package net.corda.attachmentdemo +import net.corda.attachmentdemo.workflows.recipient +import net.corda.attachmentdemo.workflows.sender import net.corda.client.rpc.CordaRPCClient import net.corda.core.utilities.getOrThrow import net.corda.node.services.Permissions.Companion.all @@ -9,6 +11,7 @@ import net.corda.testing.driver.DriverParameters import net.corda.testing.driver.driver import net.corda.testing.driver.internal.incrementalPortAllocation import net.corda.testing.node.User +import net.corda.testing.node.internal.findCordapp import org.junit.Test import java.util.concurrent.CompletableFuture.supplyAsync @@ -17,7 +20,11 @@ class AttachmentDemoTest { @Test fun `attachment demo using a 10MB zip file`() { val numOfExpectedBytes = 10_000_000 - driver(DriverParameters(portAllocation = incrementalPortAllocation(20000), startNodesInProcess = true)) { + driver(DriverParameters( + portAllocation = incrementalPortAllocation(20000), + startNodesInProcess = true, + cordappsForAllNodes = listOf(findCordapp("net.corda.attachmentdemo.contracts"), findCordapp("net.corda.attachmentdemo.workflows"))) + ) { val demoUser = listOf(User("demo", "demo", setOf(all()))) val (nodeA, nodeB) = listOf( startNode(providedName = DUMMY_BANK_A_NAME, rpcUsers = demoUser, maximumHeapSize = "1g"), diff --git a/samples/attachment-demo/src/main/kotlin/net/corda/attachmentdemo/AttachmentDemo.kt b/samples/attachment-demo/workflows/src/main/kotlin/net/corda/attachmentdemo/workflows/AttachmentDemo.kt similarity index 77% rename from samples/attachment-demo/src/main/kotlin/net/corda/attachmentdemo/AttachmentDemo.kt rename to samples/attachment-demo/workflows/src/main/kotlin/net/corda/attachmentdemo/workflows/AttachmentDemo.kt index c32217c429..2c47a3cafe 100644 --- a/samples/attachment-demo/src/main/kotlin/net/corda/attachmentdemo/AttachmentDemo.kt +++ b/samples/attachment-demo/workflows/src/main/kotlin/net/corda/attachmentdemo/workflows/AttachmentDemo.kt @@ -1,30 +1,23 @@ -package net.corda.attachmentdemo +package net.corda.attachmentdemo.workflows import co.paralleluniverse.fibers.Suspendable import joptsimple.OptionParser +import net.corda.attachmentdemo.contracts.ATTACHMENT_PROGRAM_ID +import net.corda.attachmentdemo.contracts.AttachmentContract import net.corda.client.rpc.CordaRPCClient -import net.corda.core.concurrent.CordaFuture -import net.corda.core.contracts.Contract -import net.corda.core.contracts.ContractState -import net.corda.core.contracts.TypeOnlyCommandData import net.corda.core.crypto.SecureHash import net.corda.core.flows.* -import net.corda.core.identity.AbstractParty import net.corda.core.identity.Party import net.corda.core.internal.Emoji import net.corda.core.internal.InputStreamAndHash import net.corda.core.messaging.CordaRPCOps import net.corda.core.messaging.startTrackedFlow import net.corda.core.node.StatesToRecord -import net.corda.core.transactions.LedgerTransaction import net.corda.core.transactions.SignedTransaction import net.corda.core.transactions.TransactionBuilder import net.corda.core.utilities.NetworkHostAndPort import net.corda.core.utilities.ProgressTracker import net.corda.core.utilities.getOrThrow -import net.corda.testing.core.DUMMY_BANK_B_NAME -import net.corda.testing.core.DUMMY_NOTARY_NAME -import net.corda.testing.node.internal.poll import java.io.InputStream import java.net.HttpURLConnection import java.net.URL @@ -76,28 +69,23 @@ fun main(args: Array) { // DOCSTART 2 fun sender(rpc: CordaRPCOps, numOfClearBytes: Int = 1024) { // default size 1K. val (inputStream, hash) = InputStreamAndHash.createInMemoryTestZip(numOfClearBytes, 0) - val executor = Executors.newScheduledThreadPool(2) - try { - sender(rpc, inputStream, hash, executor) - } finally { - executor.shutdown() - } + sender(rpc, inputStream, hash) } -private fun sender(rpc: CordaRPCOps, inputStream: InputStream, hash: SecureHash.SHA256, executor: ScheduledExecutorService) { +private fun sender(rpc: CordaRPCOps, inputStream: InputStream, hash: SecureHash.SHA256) { // Get the identity key of the other side (the recipient). - val notaryFuture: CordaFuture = poll(executor, DUMMY_NOTARY_NAME.toString()) { rpc.wellKnownPartyFromX500Name(DUMMY_NOTARY_NAME) } - val otherSideFuture: CordaFuture = poll(executor, DUMMY_BANK_B_NAME.toString()) { rpc.wellKnownPartyFromX500Name(DUMMY_BANK_B_NAME) } + val notaryParty = rpc.partiesFromName("Notary", false).firstOrNull() ?: throw IllegalArgumentException("Couldn't find notary party") + val bankBParty = rpc.partiesFromName("Bank B", false).firstOrNull() ?: throw IllegalArgumentException("Couldn't find Bank B party") // Make sure we have the file in storage if (!rpc.attachmentExists(hash)) { inputStream.use { val id = rpc.uploadAttachment(it) require(hash == id) { "Id was '$id' instead of '$hash'" } } - require(rpc.attachmentExists(hash)){"Attachment matching hash: $hash does not exist"} + require(rpc.attachmentExists(hash)) { "Attachment matching hash: $hash does not exist" } } - val flowHandle = rpc.startTrackedFlow(::AttachmentDemoFlow, otherSideFuture.get(), notaryFuture.get(), hash) + val flowHandle = rpc.startTrackedFlow(::AttachmentDemoFlow, bankBParty, notaryParty, hash) flowHandle.progress.subscribe(::println) val stx = flowHandle.returnValue.getOrThrow() println("Sent ${stx.id}") @@ -149,7 +137,6 @@ class NoProgressTrackerShellDemo : FlowLogic() { } } - @Suppress("DEPRECATION") // DOCSTART 1 fun recipient(rpc: CordaRPCOps, webPort: Int) { @@ -159,7 +146,7 @@ fun recipient(rpc: CordaRPCOps, webPort: Int) { if (wtx.attachments.isNotEmpty()) { if (wtx.outputs.isNotEmpty()) { val state = wtx.outputsOfType().single() - require(rpc.attachmentExists(state.hash)) {"attachment matching hash: ${state.hash} does not exist"} + require(rpc.attachmentExists(state.hash)) { "attachment matching hash: ${state.hash} does not exist" } // Download the attachment via the Web endpoint. val connection = URL("http://localhost:$webPort/attachments/${state.hash}").openConnection() as HttpURLConnection @@ -200,19 +187,3 @@ private fun printHelp(parser: OptionParser) { """.trimIndent()) parser.printHelpOn(System.out) } - -const val ATTACHMENT_PROGRAM_ID = "net.corda.attachmentdemo.AttachmentContract" - -class AttachmentContract : Contract { - override fun verify(tx: LedgerTransaction) { - val state = tx.outputsOfType().single() - // we check that at least one has the matching hash, the other will be the contract - require(tx.attachments.any { it.id == state.hash }) {"At least one attachment in transaction must match hash ${state.hash}"} - } - - object Command : TypeOnlyCommandData() - - data class State(val hash: SecureHash.SHA256) : ContractState { - override val participants: List = emptyList() - } -} diff --git a/samples/attachment-demo/src/main/resources/bank-of-london-cp.jar b/samples/attachment-demo/workflows/src/main/resources/bank-of-london-cp.jar similarity index 100% rename from samples/attachment-demo/src/main/resources/bank-of-london-cp.jar rename to samples/attachment-demo/workflows/src/main/resources/bank-of-london-cp.jar diff --git a/samples/attachment-demo/src/main/resources/certificates/readme.txt b/samples/attachment-demo/workflows/src/main/resources/certificates/readme.txt similarity index 100% rename from samples/attachment-demo/src/main/resources/certificates/readme.txt rename to samples/attachment-demo/workflows/src/main/resources/certificates/readme.txt diff --git a/samples/attachment-demo/src/main/resources/certificates/sslkeystore.jks b/samples/attachment-demo/workflows/src/main/resources/certificates/sslkeystore.jks similarity index 100% rename from samples/attachment-demo/src/main/resources/certificates/sslkeystore.jks rename to samples/attachment-demo/workflows/src/main/resources/certificates/sslkeystore.jks diff --git a/samples/attachment-demo/src/main/resources/certificates/truststore.jks b/samples/attachment-demo/workflows/src/main/resources/certificates/truststore.jks similarity index 100% rename from samples/attachment-demo/src/main/resources/certificates/truststore.jks rename to samples/attachment-demo/workflows/src/main/resources/certificates/truststore.jks diff --git a/samples/bank-of-corda-demo/build.gradle b/samples/bank-of-corda-demo/build.gradle index 52bc2be8e2..dec78d082b 100644 --- a/samples/bank-of-corda-demo/build.gradle +++ b/samples/bank-of-corda-demo/build.gradle @@ -25,9 +25,6 @@ dependencies { // Javax is required for webapis compile "org.glassfish.jersey.core:jersey-server:${jersey_version}" - // Cordapp dependencies - // Specify your cordapp's dependencies below, including dependent cordapps - // Test dependencies testCompile "junit:junit:$junit_version" } @@ -121,10 +118,9 @@ jar { cordapp { targetPlatformVersion corda_platform_version.toInteger() minimumPlatformVersion 1 - workflow { - name "net/corda/samples/bank-of-corda-demo" - versionId 1 + info { + name "Bank of Corda Demo" + version "1" vendor "R3" - licence "Open Source (Apache 2)" } -} +} \ No newline at end of file diff --git a/samples/cordapp-configuration/build.gradle b/samples/cordapp-configuration/build.gradle index d7e34631da..bbdaca4a0f 100644 --- a/samples/cordapp-configuration/build.gradle +++ b/samples/cordapp-configuration/build.gradle @@ -1,15 +1,15 @@ apply plugin: 'kotlin' apply plugin: 'idea' -apply plugin: 'net.corda.plugins.cordapp' apply plugin: 'net.corda.plugins.cordformation' dependencies { - cordaCompile project(':core') - cordaCompile project(':node-api') + compile project(':node-api') runtimeOnly "org.apache.logging.log4j:log4j-slf4j-impl:$log4j_version" // Corda integration dependencies - cordaRuntime project(path: ":node:capsule", configuration: 'runtimeArtifacts') + runtime project(path: ":node:capsule", configuration: 'runtimeArtifacts') + + cordapp project(':samples:cordapp-configuration:workflows') } def nodeTask = tasks.getByPath(':node:capsule:assemble') @@ -17,8 +17,11 @@ def webTask = tasks.getByPath(':webserver:webcapsule:assemble') task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar', nodeTask, webTask]) { directory file("$buildDir/nodes") nodeDefaults { - cordapps = [] + projectCordapp { + deploy = false // TODO This is a bug, project cordapp should be disabled if no cordapp plugin is applied. + } rpcUsers = [['username': "default", 'password': "default", 'permissions': [ 'ALL' ]]] + cordapp project(':samples:cordapp-configuration:workflows') } node { name "O=Notary Service,L=Zurich,C=CH" @@ -34,7 +37,7 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar', nodeTask, name "O=Bank A,L=London,C=GB" p2pPort 10006 // This configures the default cordapp for this node - projectCordapp { + cordapp (project(':samples:cordapp-configuration:workflows')) { config "someStringValue=test" } rpcSettings { @@ -47,7 +50,7 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar', nodeTask, name "O=Bank B,L=New York,C=US" p2pPort 10010 // This configures the default cordapp for this node - projectCordapp { + cordapp (project(':samples:cordapp-configuration:workflows')){ config project.file("src/config.conf") } rpcSettings { @@ -57,14 +60,3 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar', nodeTask, extraConfig = ['h2Settings.address' : 'localhost:10013'] } } - -cordapp { - targetPlatformVersion corda_platform_version.toInteger() - minimumPlatformVersion 1 - workflow { - name "net/corda/samples/cordapp-configuration" - versionId 1 - vendor "R3" - licence "Open Source (Apache 2)" - } -} diff --git a/samples/cordapp-configuration/workflows/build.gradle b/samples/cordapp-configuration/workflows/build.gradle new file mode 100644 index 0000000000..01addff34c --- /dev/null +++ b/samples/cordapp-configuration/workflows/build.gradle @@ -0,0 +1,19 @@ +apply plugin: 'kotlin' +apply plugin: 'idea' +apply plugin: 'net.corda.plugins.cordapp' +apply plugin: 'net.corda.plugins.cordformation' + +dependencies { + cordaCompile project(':core') +} + +cordapp { + targetPlatformVersion corda_platform_version.toInteger() + minimumPlatformVersion 1 + workflow { + name "Cordapp Configuration Sample" + versionId 1 + vendor "R3" + licence "Open Source (Apache 2)" + } +} \ No newline at end of file diff --git a/samples/cordapp-configuration/src/config.conf b/samples/cordapp-configuration/workflows/src/config.conf similarity index 100% rename from samples/cordapp-configuration/src/config.conf rename to samples/cordapp-configuration/workflows/src/config.conf diff --git a/samples/cordapp-configuration/src/main/kotlin/net/corda/configsample/GetStringConfigFlow.kt b/samples/cordapp-configuration/workflows/src/main/kotlin/net/corda/configsample/GetStringConfigFlow.kt similarity index 70% rename from samples/cordapp-configuration/src/main/kotlin/net/corda/configsample/GetStringConfigFlow.kt rename to samples/cordapp-configuration/workflows/src/main/kotlin/net/corda/configsample/GetStringConfigFlow.kt index 87cafce820..07ac2ce414 100644 --- a/samples/cordapp-configuration/src/main/kotlin/net/corda/configsample/GetStringConfigFlow.kt +++ b/samples/cordapp-configuration/workflows/src/main/kotlin/net/corda/configsample/GetStringConfigFlow.kt @@ -22,23 +22,4 @@ class GetStringConfigFlow(private val configKey: String) : FlowLogic() { val config = serviceHub.getAppContext().config return config.getString(configKey) } -} - - - -@CordaSerializable -data class GetStringTestState(val responses: List, val issuer: AbstractParty) : ContractState { - override val participants: List - get() = listOf(issuer) - -} - - -@CordaSerializable -object GetStringTestCommand : CommandData - - -class GetStringTestContract : Contract { - override fun verify(tx: LedgerTransaction) { - } } \ No newline at end of file diff --git a/samples/cordapp-configuration/src/main/resources/log4j2.xml b/samples/cordapp-configuration/workflows/src/main/resources/log4j2.xml similarity index 100% rename from samples/cordapp-configuration/src/main/resources/log4j2.xml rename to samples/cordapp-configuration/workflows/src/main/resources/log4j2.xml diff --git a/samples/irs-demo/build.gradle b/samples/irs-demo/build.gradle index 74bb3241a3..9a299ed5f1 100644 --- a/samples/irs-demo/build.gradle +++ b/samples/irs-demo/build.gradle @@ -62,7 +62,6 @@ repositories { dependencies { compile group: 'commons-io', name: 'commons-io', version: '2.5' - compile project(path: ":samples:irs-demo:cordapp", configuration: "demoArtifacts") compile project(":samples:irs-demo:web") compile('org.springframework.boot:spring-boot-starter-web') { exclude module: "spring-boot-starter-logging" diff --git a/samples/irs-demo/cordapp/build.gradle b/samples/irs-demo/cordapp/build.gradle index 0230897346..2891083335 100644 --- a/samples/irs-demo/cordapp/build.gradle +++ b/samples/irs-demo/cordapp/build.gradle @@ -17,29 +17,17 @@ sourceSets { } } -configurations { - integrationTestCompile.extendsFrom testCompile - integrationTestRuntime.extendsFrom testRuntime - demoArtifacts.extendsFrom integrationTestRuntime -} - dependencies { - // The irs demo CorDapp depends upon Cash CorDapp features cordapp project(':finance:contracts') cordapp project(':finance:workflows') - + cordapp project(':confidential-identities') // Corda integration dependencies cordaRuntime project(path: ":node:capsule", configuration: 'runtimeArtifacts') cordaCompile project(':core') cordaRuntime project(':node-api') - // Cordapp dependencies - // Specify your cordapp's dependencies below, including dependent cordapps - compile group: 'commons-io', name: 'commons-io', version: '2.5' - - testCompile project(':node-driver') - testCompile "junit:junit:$junit_version" - testCompile "org.assertj:assertj-core:${assertj_version}" + cordapp project(':samples:irs-demo:cordapp:contracts-irs') + cordapp project(':samples:irs-demo:cordapp:workflows-irs') } def rpcUsersList = [ @@ -58,7 +46,14 @@ def rpcUsersList = [ def nodeTask = tasks.getByPath(':node:capsule:assemble') task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar', nodeTask]) { - + nodeDefaults{ + projectCordapp { + deploy = false + } + cordapp project(':samples:irs-demo:cordapp:contracts-irs') + cordapp project(':samples:irs-demo:cordapp:workflows-irs') + cordapp project(':confidential-identities') + } node { name "O=Notary Service,L=Zurich,C=CH" notary = [validating : true] @@ -113,7 +108,11 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar', nodeTask]) } task prepareDockerNodes(type: net.corda.plugins.Dockerform, dependsOn: ['jar', nodeTask]) { - + nodeDefaults{ + cordapp project(':samples:irs-demo:cordapp:contracts-irs') + cordapp project(':samples:irs-demo:cordapp:workflows-irs') + cordapp project(':confidential-identities') + } node { name "O=Notary Service,L=Zurich,C=CH" notary = [validating : true] @@ -163,35 +162,3 @@ idea { downloadSources = true } } - -jar { - from sourceSets.main.output - duplicatesStrategy = DuplicatesStrategy.EXCLUDE -} - -task testJar(type: Jar) { - classifier "test" - from sourceSets.main.output - from sourceSets.test.output -} - -artifacts { - demoArtifacts testJar -} - -cordapp { - targetPlatformVersion corda_platform_version.toInteger() - minimumPlatformVersion 1 - contract { - name "net/corda/irs-demo/contract" - versionId 1 - vendor "R3" - licence "Open Source (Apache 2)" - } - workflow { - name "net/corda/irs-demo/flows" - versionId 1 - vendor "R3" - licence "Open Source (Apache 2)" - } -} diff --git a/samples/irs-demo/cordapp/contracts-irs/build.gradle b/samples/irs-demo/cordapp/contracts-irs/build.gradle new file mode 100644 index 0000000000..270a90b29c --- /dev/null +++ b/samples/irs-demo/cordapp/contracts-irs/build.gradle @@ -0,0 +1,28 @@ +apply plugin: 'kotlin' +apply plugin: 'idea' +apply plugin: 'net.corda.plugins.cordapp' + +dependencies { + // The irs demo CorDapp depends upon Cash CorDapp features + cordaCompile project(':core') + cordaRuntime project(':node-api') + + testCompile project(':node-driver') + testCompile "junit:junit:$junit_version" + cordapp project(':finance:contracts') +} + +cordapp { + targetPlatformVersion corda_platform_version.toInteger() + minimumPlatformVersion 1 + contract { + name "Corda IRS Demo" + versionId 1 + vendor "R3" + licence "Open Source (Apache 2)" + } +} + +jar { + baseName 'corda-irs-demo-contracts' +} \ No newline at end of file diff --git a/samples/irs-demo/cordapp/src/main/kotlin/net/corda/irs/contract/IRS.kt b/samples/irs-demo/cordapp/contracts-irs/src/main/kotlin/net.corda.irs/contract/IRS.kt similarity index 100% rename from samples/irs-demo/cordapp/src/main/kotlin/net/corda/irs/contract/IRS.kt rename to samples/irs-demo/cordapp/contracts-irs/src/main/kotlin/net.corda.irs/contract/IRS.kt diff --git a/samples/irs-demo/cordapp/src/main/kotlin/net/corda/irs/contract/IRSExport.kt b/samples/irs-demo/cordapp/contracts-irs/src/main/kotlin/net.corda.irs/contract/IRSExport.kt similarity index 100% rename from samples/irs-demo/cordapp/src/main/kotlin/net/corda/irs/contract/IRSExport.kt rename to samples/irs-demo/cordapp/contracts-irs/src/main/kotlin/net.corda.irs/contract/IRSExport.kt diff --git a/samples/irs-demo/cordapp/src/main/kotlin/net/corda/irs/contract/IRSUtils.kt b/samples/irs-demo/cordapp/contracts-irs/src/main/kotlin/net.corda.irs/contract/IRSUtils.kt similarity index 100% rename from samples/irs-demo/cordapp/src/main/kotlin/net/corda/irs/contract/IRSUtils.kt rename to samples/irs-demo/cordapp/contracts-irs/src/main/kotlin/net.corda.irs/contract/IRSUtils.kt diff --git a/samples/irs-demo/cordapp/src/main/kotlin/net/corda/irs/utilities/OracleUtils.kt b/samples/irs-demo/cordapp/contracts-irs/src/main/kotlin/net.corda.irs/utilities/OracleUtils.kt similarity index 100% rename from samples/irs-demo/cordapp/src/main/kotlin/net/corda/irs/utilities/OracleUtils.kt rename to samples/irs-demo/cordapp/contracts-irs/src/main/kotlin/net.corda.irs/utilities/OracleUtils.kt diff --git a/samples/irs-demo/cordapp/src/test/kotlin/net/corda/irs/contract/IRSTests.kt b/samples/irs-demo/cordapp/contracts-irs/src/test/kotlin/net.corda.irs/contract/IRSTests.kt similarity index 100% rename from samples/irs-demo/cordapp/src/test/kotlin/net/corda/irs/contract/IRSTests.kt rename to samples/irs-demo/cordapp/contracts-irs/src/test/kotlin/net.corda.irs/contract/IRSTests.kt diff --git a/samples/irs-demo/cordapp/workflows-irs/build.gradle b/samples/irs-demo/cordapp/workflows-irs/build.gradle new file mode 100644 index 0000000000..1d4dde4086 --- /dev/null +++ b/samples/irs-demo/cordapp/workflows-irs/build.gradle @@ -0,0 +1,52 @@ +apply plugin: 'kotlin' +apply plugin: 'idea' +apply plugin: 'net.corda.plugins.quasar-utils' +apply plugin: 'net.corda.plugins.cordapp' + +configurations { + demoArtifacts.extendsFrom testRuntime +} + +dependencies { + // The irs demo CorDapp depends upon Cash CorDapp features + cordapp project(':finance:contracts') + cordapp project(':finance:workflows') + + // Corda integration dependencies + cordaCompile project(':core') + + // Cordapp dependencies + // Specify your cordapp's dependencies below, including dependent cordapps + compile group: 'commons-io', name: 'commons-io', version: '2.5' + + testCompile project(':node-driver') + testCompile "junit:junit:$junit_version" + testCompile "org.assertj:assertj-core:${assertj_version}" + + cordapp project(':samples:irs-demo:cordapp:contracts-irs') +} + +cordapp { + targetPlatformVersion corda_platform_version.toInteger() + minimumPlatformVersion 1 + workflow { + name "Corda IRS Demo" + versionId 1 + vendor "R3" + licence "Open Source (Apache 2)" + } +} + +jar { + baseName 'corda-irs-demo-workflows' +} + +task testJar(type: Jar) { + classifier "test" + from sourceSets.main.output + from sourceSets.test.output +} + +artifacts { + demoArtifacts testJar +} \ No newline at end of file diff --git a/samples/irs-demo/cordapp/src/main/kotlin/net/corda/irs/api/NodeInterestRates.kt b/samples/irs-demo/cordapp/workflows-irs/src/main/kotlin/net.corda.irs/api/NodeInterestRates.kt similarity index 100% rename from samples/irs-demo/cordapp/src/main/kotlin/net/corda/irs/api/NodeInterestRates.kt rename to samples/irs-demo/cordapp/workflows-irs/src/main/kotlin/net.corda.irs/api/NodeInterestRates.kt diff --git a/samples/irs-demo/cordapp/src/main/kotlin/net/corda/irs/flows/AutoOfferFlow.kt b/samples/irs-demo/cordapp/workflows-irs/src/main/kotlin/net.corda.irs/flows/AutoOfferFlow.kt similarity index 100% rename from samples/irs-demo/cordapp/src/main/kotlin/net/corda/irs/flows/AutoOfferFlow.kt rename to samples/irs-demo/cordapp/workflows-irs/src/main/kotlin/net.corda.irs/flows/AutoOfferFlow.kt diff --git a/samples/irs-demo/cordapp/src/main/kotlin/net/corda/irs/flows/FixingFlow.kt b/samples/irs-demo/cordapp/workflows-irs/src/main/kotlin/net.corda.irs/flows/FixingFlow.kt similarity index 100% rename from samples/irs-demo/cordapp/src/main/kotlin/net/corda/irs/flows/FixingFlow.kt rename to samples/irs-demo/cordapp/workflows-irs/src/main/kotlin/net.corda.irs/flows/FixingFlow.kt diff --git a/samples/irs-demo/cordapp/src/main/kotlin/net/corda/irs/flows/RatesFixFlow.kt b/samples/irs-demo/cordapp/workflows-irs/src/main/kotlin/net.corda.irs/flows/RatesFixFlow.kt similarity index 100% rename from samples/irs-demo/cordapp/src/main/kotlin/net/corda/irs/flows/RatesFixFlow.kt rename to samples/irs-demo/cordapp/workflows-irs/src/main/kotlin/net.corda.irs/flows/RatesFixFlow.kt diff --git a/samples/irs-demo/cordapp/src/main/resources/net/corda/irs/simulation/example.rates.txt b/samples/irs-demo/cordapp/workflows-irs/src/main/resources/net/corda/irs/simulation/example.rates.txt similarity index 100% rename from samples/irs-demo/cordapp/src/main/resources/net/corda/irs/simulation/example.rates.txt rename to samples/irs-demo/cordapp/workflows-irs/src/main/resources/net/corda/irs/simulation/example.rates.txt diff --git a/samples/irs-demo/cordapp/src/test/kotlin/net/corda/irs/Main.kt b/samples/irs-demo/cordapp/workflows-irs/src/test/kotlin/net.corda.irs/Main.kt similarity index 100% rename from samples/irs-demo/cordapp/src/test/kotlin/net/corda/irs/Main.kt rename to samples/irs-demo/cordapp/workflows-irs/src/test/kotlin/net.corda.irs/Main.kt diff --git a/samples/irs-demo/cordapp/src/test/kotlin/net/corda/irs/api/NodeInterestRatesTest.kt b/samples/irs-demo/cordapp/workflows-irs/src/test/kotlin/net.corda.irs/api/NodeInterestRatesTest.kt similarity index 100% rename from samples/irs-demo/cordapp/src/test/kotlin/net/corda/irs/api/NodeInterestRatesTest.kt rename to samples/irs-demo/cordapp/workflows-irs/src/test/kotlin/net.corda.irs/api/NodeInterestRatesTest.kt diff --git a/samples/irs-demo/cordapp/src/test/kotlin/net/corda/irs/api/OracleNodeTearOffTests.kt b/samples/irs-demo/cordapp/workflows-irs/src/test/kotlin/net.corda.irs/api/OracleNodeTearOffTests.kt similarity index 100% rename from samples/irs-demo/cordapp/src/test/kotlin/net/corda/irs/api/OracleNodeTearOffTests.kt rename to samples/irs-demo/cordapp/workflows-irs/src/test/kotlin/net.corda.irs/api/OracleNodeTearOffTests.kt diff --git a/samples/irs-demo/cordapp/src/test/kotlin/net/corda/irs/flows/UpdateBusinessDayFlow.kt b/samples/irs-demo/cordapp/workflows-irs/src/test/kotlin/net.corda.irs/flows/UpdateBusinessDayFlow.kt similarity index 100% rename from samples/irs-demo/cordapp/src/test/kotlin/net/corda/irs/flows/UpdateBusinessDayFlow.kt rename to samples/irs-demo/cordapp/workflows-irs/src/test/kotlin/net.corda.irs/flows/UpdateBusinessDayFlow.kt diff --git a/samples/irs-demo/src/integration-test/kotlin/net/corda/irs/IRSDemoTest.kt b/samples/irs-demo/src/integration-test/kotlin/net/corda/irs/IRSDemoTest.kt index 08a62e2ca1..cce8b0b41a 100644 --- a/samples/irs-demo/src/integration-test/kotlin/net/corda/irs/IRSDemoTest.kt +++ b/samples/irs-demo/src/integration-test/kotlin/net/corda/irs/IRSDemoTest.kt @@ -33,7 +33,6 @@ import net.corda.testing.node.NotarySpec import net.corda.testing.node.User import org.apache.commons.io.IOUtils import org.assertj.core.api.Assertions.assertThat -import org.junit.Ignore import org.junit.Test import rx.Observable import java.time.Duration diff --git a/samples/irs-demo/web/build.gradle b/samples/irs-demo/web/build.gradle index 475d148ee8..562278d819 100644 --- a/samples/irs-demo/web/build.gradle +++ b/samples/irs-demo/web/build.gradle @@ -70,10 +70,12 @@ dependencies { compile("com.fasterxml.jackson.module:jackson-module-kotlin:$jackson_version") compile project(":client:rpc") compile project(":client:jackson") - compile project(":samples:irs-demo:cordapp") + compile project(":finance:workflows") + // TODO In the future remove -irs bit from the directory name. Currently it clashes with :finance:workflows (same for contracts). + compile project(":samples:irs-demo:cordapp:workflows-irs") testCompile project(":test-utils") - testCompile project(path: ":samples:irs-demo:cordapp", configuration: "demoArtifacts") + testCompile project(path: ":samples:irs-demo:cordapp:workflows-irs", configuration: "demoArtifacts") // JOpt: for command line flags. compile "net.sf.jopt-simple:jopt-simple:$jopt_simple_version" diff --git a/samples/network-verifier/build.gradle b/samples/network-verifier/build.gradle index e96ba9490f..51ecd18e05 100644 --- a/samples/network-verifier/build.gradle +++ b/samples/network-verifier/build.gradle @@ -6,17 +6,23 @@ dependencies { cordaCompile project(':core') cordaCompile project(':node-api') - testCompile project(":test-utils") - testCompile "junit:junit:$junit_version" - // Corda integration dependencies cordaRuntime project(path: ":node:capsule", configuration: 'runtimeArtifacts') + + cordapp project(':samples:network-verifier:contracts') + cordapp project(':samples:network-verifier:workflows') } def nodeTask = tasks.getByPath(':node:capsule:assemble') task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar', nodeTask]) { ext.rpcUsers = [['username': "default", 'password': "default", 'permissions': [ 'ALL' ]]] - + nodeDefaults{ + projectCordapp { + deploy = false + } + cordapp project(':samples:network-verifier:contracts') + cordapp project(':samples:network-verifier:workflows') + } directory "./build/nodes" node { name "O=Notary Service,L=Zurich,C=CH" @@ -51,14 +57,3 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar', nodeTask]) extraConfig = ['h2Settings.address' : 'localhost:0'] } } - -cordapp { - targetPlatformVersion corda_platform_version.toInteger() - minimumPlatformVersion 1 - workflow { - name "net/corda/samples/network-verifier" - versionId 1 - vendor "R3" - licence "Open Source (Apache 2)" - } -} diff --git a/samples/network-verifier/contracts/build.gradle b/samples/network-verifier/contracts/build.gradle new file mode 100644 index 0000000000..5a4013e8dd --- /dev/null +++ b/samples/network-verifier/contracts/build.gradle @@ -0,0 +1,23 @@ +apply plugin: 'kotlin' +apply plugin: 'net.corda.plugins.cordapp' + +description 'Corda Network Verifier - Contracts' + +dependencies { + cordaCompile project(':core') +} + +cordapp { + targetPlatformVersion corda_platform_version.toInteger() + minimumPlatformVersion 1 + contract { + name "Corda Network Verifier" + versionId 1 + vendor "R3" + licence "Open Source (Apache 2)" + } +} + +jar { + baseName 'corda-network-verifier-contracts' +} \ No newline at end of file diff --git a/samples/network-verifier/contracts/src/main/kotlin/net/corda/verification/CommsContracts.kt b/samples/network-verifier/contracts/src/main/kotlin/net/corda/verification/CommsContracts.kt new file mode 100644 index 0000000000..00a21da9cc --- /dev/null +++ b/samples/network-verifier/contracts/src/main/kotlin/net/corda/verification/CommsContracts.kt @@ -0,0 +1,24 @@ +package net.corda.verification + +import net.corda.core.contracts.BelongsToContract +import net.corda.core.contracts.CommandData +import net.corda.core.contracts.Contract +import net.corda.core.contracts.ContractState +import net.corda.core.identity.AbstractParty +import net.corda.core.serialization.CordaSerializable +import net.corda.core.transactions.LedgerTransaction + +@CordaSerializable +@BelongsToContract(CommsTestContract::class) +data class CommsTestState(val responses: List, val issuer: AbstractParty) : ContractState { + override val participants: List + get() = listOf(issuer) +} + +@CordaSerializable +object CommsTestCommand : CommandData + +class CommsTestContract : Contract { + override fun verify(tx: LedgerTransaction) { + } +} diff --git a/samples/network-verifier/contracts/src/main/kotlin/net/corda/verification/NotaryTestContracts.kt b/samples/network-verifier/contracts/src/main/kotlin/net/corda/verification/NotaryTestContracts.kt new file mode 100644 index 0000000000..c00eff9a4d --- /dev/null +++ b/samples/network-verifier/contracts/src/main/kotlin/net/corda/verification/NotaryTestContracts.kt @@ -0,0 +1,22 @@ +package net.corda.verification + +import net.corda.core.contracts.CommandData +import net.corda.core.contracts.Contract +import net.corda.core.contracts.ContractState +import net.corda.core.identity.AbstractParty +import net.corda.core.serialization.CordaSerializable +import net.corda.core.transactions.LedgerTransaction + +@CordaSerializable +data class NotaryTestState(val id: String, val issuer: AbstractParty) : ContractState { + override val participants: List + get() = listOf(issuer) +} + +@CordaSerializable +object NotaryTestCommand : CommandData + +class NotaryTestContract : Contract { + override fun verify(tx: LedgerTransaction) { + } +} \ No newline at end of file diff --git a/samples/network-verifier/workflows/build.gradle b/samples/network-verifier/workflows/build.gradle new file mode 100644 index 0000000000..0f0c1c5bff --- /dev/null +++ b/samples/network-verifier/workflows/build.gradle @@ -0,0 +1,27 @@ +apply plugin: 'kotlin' +apply plugin: 'net.corda.plugins.cordapp' + +description 'Corda Network Verifier - Workflows' + +dependencies { + cordaCompile project(':core') + cordapp project(':samples:network-verifier:contracts') + + testCompile project(":test-utils") + testCompile "junit:junit:$junit_version" +} + +cordapp { + targetPlatformVersion corda_platform_version.toInteger() + minimumPlatformVersion 1 + workflow { + name "Corda Network Verifier" + versionId 1 + vendor "R3" + licence "Open Source (Apache 2)" + } +} + +jar { + baseName 'corda-network-verifier-workflows' +} \ No newline at end of file diff --git a/samples/network-verifier/src/main/kotlin/net/corda/verification/TestCommsFlow.kt b/samples/network-verifier/workflows/src/main/kotlin/net/corda/verification/TestCommsFlow.kt similarity index 75% rename from samples/network-verifier/src/main/kotlin/net/corda/verification/TestCommsFlow.kt rename to samples/network-verifier/workflows/src/main/kotlin/net/corda/verification/TestCommsFlow.kt index d8a70d73eb..9d5da0f3e1 100644 --- a/samples/network-verifier/src/main/kotlin/net/corda/verification/TestCommsFlow.kt +++ b/samples/network-verifier/workflows/src/main/kotlin/net/corda/verification/TestCommsFlow.kt @@ -1,16 +1,9 @@ package net.corda.verification import co.paralleluniverse.fibers.Suspendable -import net.corda.core.contracts.BelongsToContract -import net.corda.core.contracts.CommandData -import net.corda.core.contracts.Contract -import net.corda.core.contracts.ContractState import net.corda.core.flows.* -import net.corda.core.identity.AbstractParty import net.corda.core.identity.CordaX500Name import net.corda.core.identity.Party -import net.corda.core.serialization.CordaSerializable -import net.corda.core.transactions.LedgerTransaction import net.corda.core.transactions.TransactionBuilder import net.corda.core.utilities.ProgressTracker import net.corda.core.utilities.unwrap @@ -61,18 +54,3 @@ class TestCommsFlowResponder(private val otherSideSession: FlowSession) : FlowLo otherSideSession.send("Hello from: " + serviceHub.myInfo.legalIdentities.first().name.toString()) } } - -@CordaSerializable -@BelongsToContract(CommsTestContract::class) -data class CommsTestState(val responses: List, val issuer: AbstractParty) : ContractState { - override val participants: List - get() = listOf(issuer) -} - -@CordaSerializable -object CommsTestCommand : CommandData - -class CommsTestContract : Contract { - override fun verify(tx: LedgerTransaction) { - } -} diff --git a/samples/network-verifier/src/main/kotlin/net/corda/verification/TestNotaryFlow.kt b/samples/network-verifier/workflows/src/main/kotlin/net/corda/verification/TestNotaryFlow.kt similarity index 75% rename from samples/network-verifier/src/main/kotlin/net/corda/verification/TestNotaryFlow.kt rename to samples/network-verifier/workflows/src/main/kotlin/net/corda/verification/TestNotaryFlow.kt index 8cb5526be4..a1f23ea240 100644 --- a/samples/network-verifier/src/main/kotlin/net/corda/verification/TestNotaryFlow.kt +++ b/samples/network-verifier/workflows/src/main/kotlin/net/corda/verification/TestNotaryFlow.kt @@ -1,14 +1,8 @@ package net.corda.verification -import net.corda.core.contracts.CommandData -import net.corda.core.contracts.Contract -import net.corda.core.contracts.ContractState import net.corda.core.flows.FinalityFlow import net.corda.core.flows.FlowLogic import net.corda.core.flows.StartableByRPC -import net.corda.core.identity.AbstractParty -import net.corda.core.serialization.CordaSerializable -import net.corda.core.transactions.LedgerTransaction import net.corda.core.transactions.TransactionBuilder import net.corda.core.utilities.ProgressTracker import co.paralleluniverse.fibers.Suspendable @@ -45,17 +39,3 @@ class TestNotaryFlow : FlowLogic() { return "notarised: ${result.notary}::${result.tx.id}" } } - -@CordaSerializable -data class NotaryTestState(val id: String, val issuer: AbstractParty) : ContractState { - override val participants: List - get() = listOf(issuer) -} - -@CordaSerializable -object NotaryTestCommand : CommandData - -class NotaryTestContract : Contract { - override fun verify(tx: LedgerTransaction) { - } -} diff --git a/samples/network-verifier/src/test/kotlin/net/corda/configsample/TestCommsFlowInitiatorTest.kt b/samples/network-verifier/workflows/src/test/kotlin/net/corda/configsample/TestCommsFlowInitiatorTest.kt similarity index 100% rename from samples/network-verifier/src/test/kotlin/net/corda/configsample/TestCommsFlowInitiatorTest.kt rename to samples/network-verifier/workflows/src/test/kotlin/net/corda/configsample/TestCommsFlowInitiatorTest.kt diff --git a/samples/notary-demo/build.gradle b/samples/notary-demo/build.gradle index 15447cf4d0..51409be9c5 100644 --- a/samples/notary-demo/build.gradle +++ b/samples/notary-demo/build.gradle @@ -7,21 +7,15 @@ apply plugin: 'net.corda.plugins.quasar-utils' apply plugin: 'net.corda.plugins.cordapp' apply plugin: 'net.corda.plugins.cordformation' -configurations { - integrationTestCompile.extendsFrom testCompile - integrationTestRuntime.extendsFrom testRuntime -} - dependencies { compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" - // Corda integration dependencies cordaRuntime project(path: ":node:capsule", configuration: 'runtimeArtifacts') - cordaRuntime project(path: ":webserver:webcapsule", configuration: 'runtimeArtifacts') cordaCompile project(':core') - cordaCompile project(':client:jfx') - cordaCompile project(':client:rpc') - cordaCompile project(':test-utils') + + // Notary implementations + cordapp project(':samples:notary-demo:contracts') + cordapp project(':samples:notary-demo:workflows') } def nodeTask = tasks.getByPath(':node:capsule:assemble') @@ -32,7 +26,12 @@ task deployNodes(dependsOn: ['deployNodesSingle', 'deployNodesRaft', 'deployNode task deployNodesSingle(type: Cordform, dependsOn: ['jar', nodeTask, webTask]) { directory file("$buildDir/nodes/nodesSingle") nodeDefaults { + projectCordapp { + deploy = false + } extraConfig = [h2Settings: [address: "localhost:0"]] + cordapp project(':samples:notary-demo:contracts') + cordapp project(':samples:notary-demo:workflows') } node { name "O=Alice Corp,L=Madrid,C=ES" @@ -57,7 +56,12 @@ task deployNodesSingle(type: Cordform, dependsOn: ['jar', nodeTask, webTask]) { task deployNodesCustom(type: Cordform, dependsOn: ['jar', nodeTask, webTask]) { directory file("$buildDir/nodes/nodesCustom") nodeDefaults { + projectCordapp { + deploy = false + } extraConfig = [h2Settings: [address: "localhost:0"]] + cordapp project(':samples:notary-demo:contracts') + cordapp project(':samples:notary-demo:workflows') } node { name "O=Alice Corp,L=Madrid,C=ES" @@ -83,10 +87,14 @@ task deployNodesCustom(type: Cordform, dependsOn: ['jar', nodeTask, webTask]) { } task deployNodesRaft(type: Cordform, dependsOn: ['jar', nodeTask, webTask]) { - def className = "" directory file("$buildDir/nodes/nodesRaft") nodeDefaults { + projectCordapp { + deploy = false + } extraConfig = [h2Settings: [address: "localhost:0"]] + cordapp project(':samples:notary-demo:contracts') + cordapp project(':samples:notary-demo:workflows') } node { name "O=Alice Corp,L=Madrid,C=ES" @@ -150,7 +158,12 @@ task deployNodesBFT(type: Cordform, dependsOn: ['jar', nodeTask, webTask]) { def clusterAddresses = ["localhost:11000", "localhost:11010", "localhost:11020", "localhost:11030"] directory file("$buildDir/nodes/nodesBFT") nodeDefaults { + projectCordapp { + deploy = false + } extraConfig = [h2Settings: [address: "localhost:0"]] + cordapp project(':samples:notary-demo:contracts') + cordapp project(':samples:notary-demo:workflows') } node { name "O=Alice Corp,L=Madrid,C=ES" @@ -231,22 +244,3 @@ task notarise(type: JavaExec) { classpath = sourceSets.main.runtimeClasspath main = 'net.corda.notarydemo.NotariseKt' } - -jar { - manifest { - attributes( - 'Automatic-Module-Name': 'net.corda.samples.demos.notary' - ) - } -} - -cordapp { - targetPlatformVersion corda_platform_version.toInteger() - minimumPlatformVersion 1 - workflow { - name "net/corda/samples/notary-demo" - versionId 1 - vendor "R3" - licence "Open Source (Apache 2)" - } -} diff --git a/samples/notary-demo/contracts/build.gradle b/samples/notary-demo/contracts/build.gradle new file mode 100644 index 0000000000..584ed6fee5 --- /dev/null +++ b/samples/notary-demo/contracts/build.gradle @@ -0,0 +1,23 @@ +apply plugin: 'kotlin' +apply plugin: 'net.corda.plugins.cordapp' + +description 'Corda Notary Demo - Contracts' + +dependencies { + cordaCompile project(':core') +} + +cordapp { + targetPlatformVersion corda_platform_version.toInteger() + minimumPlatformVersion 1 + contract { + name "Corda Notary Demo" + versionId 1 + vendor "R3" + licence "Open Source (Apache 2)" + } +} + +jar { + baseName 'corda-notary-demo-contracts' +} \ No newline at end of file diff --git a/samples/notary-demo/contracts/src/main/kotlin/net/corda/notarydemo/contracts/DummyStates.kt b/samples/notary-demo/contracts/src/main/kotlin/net/corda/notarydemo/contracts/DummyStates.kt new file mode 100644 index 0000000000..dcf8e4ce3c --- /dev/null +++ b/samples/notary-demo/contracts/src/main/kotlin/net/corda/notarydemo/contracts/DummyStates.kt @@ -0,0 +1,19 @@ +package net.corda.notarydemo.contracts + +import net.corda.core.contracts.BelongsToContract +import net.corda.core.contracts.CommandData +import net.corda.core.contracts.Contract +import net.corda.core.contracts.ContractState +import net.corda.core.identity.AbstractParty +import net.corda.core.transactions.LedgerTransaction + +const val DO_NOTHING_PROGRAM_ID = "net.corda.notarydemo.contracts.DoNothingContract" + +class DoNothingContract : Contract { + override fun verify(tx: LedgerTransaction) {} +} + +data class DummyCommand(val dummy: Int = 0) : CommandData + +@BelongsToContract(DoNothingContract::class) +data class DummyState(override val participants: List, val discriminator: Int) : ContractState diff --git a/samples/notary-demo/workflows/build.gradle b/samples/notary-demo/workflows/build.gradle new file mode 100644 index 0000000000..85ea6160df --- /dev/null +++ b/samples/notary-demo/workflows/build.gradle @@ -0,0 +1,27 @@ +apply plugin: 'kotlin' +apply plugin: 'net.corda.plugins.cordapp' + +description 'Corda Notary Demo - Workflows' + +dependencies { + cordaCompile project(':core') + cordaCompile project(':client:rpc') + cordaCompile project(':node') + + cordapp project(':samples:notary-demo:contracts') +} + +cordapp { + targetPlatformVersion corda_platform_version.toInteger() + minimumPlatformVersion 1 + workflow { + name "Corda Notary Demo" + versionId 1 + vendor "R3" + licence "Open Source (Apache 2)" + } +} + +jar { + baseName 'corda-notary-demo-workflows' +} \ No newline at end of file diff --git a/samples/notary-demo/src/main/kotlin/net/corda/notarydemo/MyCustomNotaryService.kt b/samples/notary-demo/workflows/src/main/kotlin/net/corda/notarydemo/MyCustomNotaryService.kt similarity index 100% rename from samples/notary-demo/src/main/kotlin/net/corda/notarydemo/MyCustomNotaryService.kt rename to samples/notary-demo/workflows/src/main/kotlin/net/corda/notarydemo/MyCustomNotaryService.kt diff --git a/samples/notary-demo/src/main/kotlin/net/corda/notarydemo/Notarise.kt b/samples/notary-demo/workflows/src/main/kotlin/net/corda/notarydemo/Notarise.kt similarity index 90% rename from samples/notary-demo/src/main/kotlin/net/corda/notarydemo/Notarise.kt rename to samples/notary-demo/workflows/src/main/kotlin/net/corda/notarydemo/Notarise.kt index ee994cf5bc..93d71a8106 100644 --- a/samples/notary-demo/src/main/kotlin/net/corda/notarydemo/Notarise.kt +++ b/samples/notary-demo/workflows/src/main/kotlin/net/corda/notarydemo/Notarise.kt @@ -2,7 +2,10 @@ package net.corda.notarydemo import net.corda.client.rpc.CordaRPCClient import net.corda.core.crypto.CompositeKey +import net.corda.core.crypto.Crypto import net.corda.core.crypto.toStringShort +import net.corda.core.identity.CordaX500Name +import net.corda.core.identity.Party import net.corda.core.messaging.CordaRPCOps import net.corda.core.messaging.startFlow import net.corda.core.transactions.SignedTransaction @@ -10,8 +13,6 @@ import net.corda.core.utilities.NetworkHostAndPort import net.corda.core.utilities.getOrThrow import net.corda.notarydemo.flows.DummyIssueAndMove import net.corda.notarydemo.flows.RPCStartableNotaryFlowClient -import net.corda.testing.core.BOB_NAME -import net.corda.testing.core.TestIdentity import java.util.concurrent.Future fun main(args: Array) { @@ -30,7 +31,8 @@ private class NotaryDemoClientApi(val rpc: CordaRPCOps) { } /** A dummy identity. */ - private val counterparty = TestIdentity(BOB_NAME).party + private val BOB_NAME = CordaX500Name("Bob Plc", "Rome", "IT") + private val counterparty = Party(BOB_NAME, Crypto.generateKeyPair(Crypto.DEFAULT_SIGNATURE_SCHEME).public) /** Makes calls to the node rpc to start transaction notarisation. */ fun notarise(count: Int) { diff --git a/samples/notary-demo/src/main/kotlin/net/corda/notarydemo/flows/DummyIssueAndMove.kt b/samples/notary-demo/workflows/src/main/kotlin/net/corda/notarydemo/flows/DummyIssueAndMove.kt similarity index 64% rename from samples/notary-demo/src/main/kotlin/net/corda/notarydemo/flows/DummyIssueAndMove.kt rename to samples/notary-demo/workflows/src/main/kotlin/net/corda/notarydemo/flows/DummyIssueAndMove.kt index a14d5c0768..dfa7c02ae0 100644 --- a/samples/notary-demo/src/main/kotlin/net/corda/notarydemo/flows/DummyIssueAndMove.kt +++ b/samples/notary-demo/workflows/src/main/kotlin/net/corda/notarydemo/flows/DummyIssueAndMove.kt @@ -1,37 +1,22 @@ package net.corda.notarydemo.flows import co.paralleluniverse.fibers.Suspendable -import net.corda.core.contracts.BelongsToContract -import net.corda.core.contracts.CommandData -import net.corda.core.contracts.Contract import net.corda.core.contracts.ContractState import net.corda.core.flows.FlowLogic import net.corda.core.flows.StartableByRPC -import net.corda.core.identity.AbstractParty import net.corda.core.identity.Party -import net.corda.core.transactions.LedgerTransaction import net.corda.core.transactions.SignedTransaction import net.corda.core.transactions.TransactionBuilder +import net.corda.notarydemo.contracts.DO_NOTHING_PROGRAM_ID +import net.corda.notarydemo.contracts.DummyCommand +import net.corda.notarydemo.contracts.DummyState @StartableByRPC class DummyIssueAndMove(private val notary: Party, private val counterpartyNode: Party, private val discriminator: Int) : FlowLogic() { - companion object { - private const val DO_NOTHING_PROGRAM_ID = "net.corda.notarydemo.flows.DummyIssueAndMove\$DoNothingContract" - } - - class DoNothingContract : Contract { - override fun verify(tx: LedgerTransaction) {} - } - - data class DummyCommand(val dummy: Int = 0) : CommandData - - @BelongsToContract(DoNothingContract::class) - data class State(override val participants: List, val discriminator: Int) : ContractState - @Suspendable override fun call(): SignedTransaction { // Self issue an asset - val state = State(listOf(ourIdentity), discriminator) + val state = DummyState(listOf(ourIdentity), discriminator) val issueTx = serviceHub.signInitialTransaction(TransactionBuilder(notary).apply { addOutputState(state, DO_NOTHING_PROGRAM_ID) addCommand(DummyCommand(), listOf(ourIdentity.owningKey)) diff --git a/samples/notary-demo/src/main/kotlin/net/corda/notarydemo/flows/RPCStartableNotaryFlowClient.kt b/samples/notary-demo/workflows/src/main/kotlin/net/corda/notarydemo/flows/RPCStartableNotaryFlowClient.kt similarity index 100% rename from samples/notary-demo/src/main/kotlin/net/corda/notarydemo/flows/RPCStartableNotaryFlowClient.kt rename to samples/notary-demo/workflows/src/main/kotlin/net/corda/notarydemo/flows/RPCStartableNotaryFlowClient.kt diff --git a/samples/trader-demo/build.gradle b/samples/trader-demo/build.gradle index 37a775edd5..4fa7d94e2d 100644 --- a/samples/trader-demo/build.gradle +++ b/samples/trader-demo/build.gradle @@ -1,24 +1,8 @@ apply plugin: 'kotlin' apply plugin: 'idea' apply plugin: 'net.corda.plugins.quasar-utils' -apply plugin: 'net.corda.plugins.cordapp' apply plugin: 'net.corda.plugins.cordformation' -sourceSets { - integrationTest { - kotlin { - compileClasspath += main.output + test.output - runtimeClasspath += main.output + test.output - srcDir file('src/integration-test/kotlin') - } - } -} - -configurations { - integrationTestCompile.extendsFrom testCompile - integrationTestRuntime.extendsFrom testRuntime -} - dependencies { compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" @@ -27,11 +11,11 @@ dependencies { cordapp project(':finance:workflows') cordapp project(':confidential-identities') cordapp project(':samples:bank-of-corda-demo') + cordapp project(':samples:trader-demo:workflows-trader') // Corda integration dependencies cordaRuntime project(path: ":node:capsule", configuration: 'runtimeArtifacts') cordaRuntime project(path: ":webserver:webcapsule", configuration: 'runtimeArtifacts') - cordaCompile project(':core') testCompile project(':test-utils') testCompile "junit:junit:$junit_version" @@ -43,9 +27,13 @@ def webTask = tasks.getByPath(':webserver:webcapsule:assemble') task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar', nodeTask, webTask]) { ext.rpcUsers = [['username': "demo", 'password': "demo", 'permissions': ["ALL"]]] nodeDefaults { + projectCordapp { + deploy = false // TODO This is a bug, project cordapp should be disabled if no cordapp plugin is applied. + } cordapp project(':finance:workflows') cordapp project(':finance:contracts') cordapp project(':confidential-identities') + cordapp project(':samples:trader-demo:workflows-trader') } directory "./build/nodes" node { @@ -103,11 +91,6 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar', nodeTask, } } -task integrationTest(type: Test, dependsOn: []) { - testClassesDirs = sourceSets.integrationTest.output.classesDirs - classpath = sourceSets.integrationTest.runtimeClasspath -} - idea { module { downloadJavadoc = true // defaults to false @@ -128,22 +111,3 @@ task runSeller(type: JavaExec) { args '--role' args 'SELLER' } - -jar { - manifest { - attributes( - 'Automatic-Module-Name': 'net.corda.samples.demos.trader' - ) - } -} - -cordapp { - targetPlatformVersion corda_platform_version.toInteger() - minimumPlatformVersion 1 - workflow { - name "net/corda/samples/trader-demo" - versionId 1 - vendor "R3" - licence "Open Source (Apache 2)" - } -} diff --git a/samples/trader-demo/workflows-trader/build.gradle b/samples/trader-demo/workflows-trader/build.gradle new file mode 100644 index 0000000000..614a817ea1 --- /dev/null +++ b/samples/trader-demo/workflows-trader/build.gradle @@ -0,0 +1,59 @@ +apply plugin: 'kotlin' +apply plugin: 'idea' +apply plugin: 'net.corda.plugins.quasar-utils' +apply plugin: 'net.corda.plugins.cordapp' + +sourceSets { + integrationTest { + kotlin { + compileClasspath += main.output + test.output + runtimeClasspath += main.output + test.output + srcDir file('src/integration-test/kotlin') + } + } +} + +configurations { + integrationTestCompile.extendsFrom testCompile + integrationTestRuntime.extendsFrom testRuntime +} + +dependencies { + compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" + + // The trader demo CorDapp depends upon Cash CorDapp features + cordapp project(':finance:contracts') + cordapp project(':finance:workflows') + cordapp project(':confidential-identities') + cordapp project(':samples:bank-of-corda-demo') + + // Corda integration dependencies + cordaCompile project(':core') + + testCompile project(':test-utils') + testCompile "junit:junit:$junit_version" + testCompile "org.assertj:assertj-core:${assertj_version}" + + integrationTestCompile project(':finance:workflows') + integrationTestCompile project(':finance:contracts') +} + +task integrationTest(type: Test, dependsOn: []) { + testClassesDirs = sourceSets.integrationTest.output.classesDirs + classpath = sourceSets.integrationTest.runtimeClasspath +} + +jar { + baseName 'corda-trader-demo-workflows' +} + +cordapp { + targetPlatformVersion corda_platform_version.toInteger() + minimumPlatformVersion 1 + workflow { + name "Trader Demo" + versionId 1 + vendor "R3" + licence "Open Source (Apache 2)" + } +} \ No newline at end of file diff --git a/samples/trader-demo/src/integration-test/kotlin/net/corda/traderdemo/TraderDemoTest.kt b/samples/trader-demo/workflows-trader/src/integration-test/kotlin/net/corda/traderdemo/TraderDemoTest.kt similarity index 99% rename from samples/trader-demo/src/integration-test/kotlin/net/corda/traderdemo/TraderDemoTest.kt rename to samples/trader-demo/workflows-trader/src/integration-test/kotlin/net/corda/traderdemo/TraderDemoTest.kt index e5c75ccf76..5ebd6c6797 100644 --- a/samples/trader-demo/src/integration-test/kotlin/net/corda/traderdemo/TraderDemoTest.kt +++ b/samples/trader-demo/workflows-trader/src/integration-test/kotlin/net/corda/traderdemo/TraderDemoTest.kt @@ -14,7 +14,6 @@ import net.corda.testing.driver.DriverParameters import net.corda.testing.driver.InProcess import net.corda.testing.driver.OutOfProcess import net.corda.testing.driver.driver -import net.corda.testing.node.NotarySpec import net.corda.testing.node.TestCordapp import net.corda.testing.node.User import net.corda.testing.node.internal.FINANCE_CORDAPPS diff --git a/samples/trader-demo/src/main/kotlin/net/corda/traderdemo/TraderDemo.kt b/samples/trader-demo/workflows-trader/src/main/kotlin/net/corda/traderdemo/TraderDemo.kt similarity index 100% rename from samples/trader-demo/src/main/kotlin/net/corda/traderdemo/TraderDemo.kt rename to samples/trader-demo/workflows-trader/src/main/kotlin/net/corda/traderdemo/TraderDemo.kt diff --git a/samples/trader-demo/src/main/kotlin/net/corda/traderdemo/TraderDemoClientApi.kt b/samples/trader-demo/workflows-trader/src/main/kotlin/net/corda/traderdemo/TraderDemoClientApi.kt similarity index 100% rename from samples/trader-demo/src/main/kotlin/net/corda/traderdemo/TraderDemoClientApi.kt rename to samples/trader-demo/workflows-trader/src/main/kotlin/net/corda/traderdemo/TraderDemoClientApi.kt diff --git a/samples/trader-demo/src/main/kotlin/net/corda/traderdemo/TransactionGraphSearch.kt b/samples/trader-demo/workflows-trader/src/main/kotlin/net/corda/traderdemo/TransactionGraphSearch.kt similarity index 100% rename from samples/trader-demo/src/main/kotlin/net/corda/traderdemo/TransactionGraphSearch.kt rename to samples/trader-demo/workflows-trader/src/main/kotlin/net/corda/traderdemo/TransactionGraphSearch.kt diff --git a/samples/trader-demo/src/main/kotlin/net/corda/traderdemo/flow/BuyerFlow.kt b/samples/trader-demo/workflows-trader/src/main/kotlin/net/corda/traderdemo/flow/BuyerFlow.kt similarity index 100% rename from samples/trader-demo/src/main/kotlin/net/corda/traderdemo/flow/BuyerFlow.kt rename to samples/trader-demo/workflows-trader/src/main/kotlin/net/corda/traderdemo/flow/BuyerFlow.kt diff --git a/samples/trader-demo/src/main/kotlin/net/corda/traderdemo/flow/CommercialPaperIssueFlow.kt b/samples/trader-demo/workflows-trader/src/main/kotlin/net/corda/traderdemo/flow/CommercialPaperIssueFlow.kt similarity index 100% rename from samples/trader-demo/src/main/kotlin/net/corda/traderdemo/flow/CommercialPaperIssueFlow.kt rename to samples/trader-demo/workflows-trader/src/main/kotlin/net/corda/traderdemo/flow/CommercialPaperIssueFlow.kt diff --git a/samples/trader-demo/src/main/kotlin/net/corda/traderdemo/flow/LoggingBuyerFlow.kt b/samples/trader-demo/workflows-trader/src/main/kotlin/net/corda/traderdemo/flow/LoggingBuyerFlow.kt similarity index 100% rename from samples/trader-demo/src/main/kotlin/net/corda/traderdemo/flow/LoggingBuyerFlow.kt rename to samples/trader-demo/workflows-trader/src/main/kotlin/net/corda/traderdemo/flow/LoggingBuyerFlow.kt diff --git a/samples/trader-demo/src/main/kotlin/net/corda/traderdemo/flow/SellerFlow.kt b/samples/trader-demo/workflows-trader/src/main/kotlin/net/corda/traderdemo/flow/SellerFlow.kt similarity index 100% rename from samples/trader-demo/src/main/kotlin/net/corda/traderdemo/flow/SellerFlow.kt rename to samples/trader-demo/workflows-trader/src/main/kotlin/net/corda/traderdemo/flow/SellerFlow.kt diff --git a/samples/trader-demo/src/main/resources/bank-of-london-cp.jar b/samples/trader-demo/workflows-trader/src/main/resources/bank-of-london-cp.jar similarity index 100% rename from samples/trader-demo/src/main/resources/bank-of-london-cp.jar rename to samples/trader-demo/workflows-trader/src/main/resources/bank-of-london-cp.jar diff --git a/samples/trader-demo/src/main/resources/certificates/readme.txt b/samples/trader-demo/workflows-trader/src/main/resources/certificates/readme.txt similarity index 100% rename from samples/trader-demo/src/main/resources/certificates/readme.txt rename to samples/trader-demo/workflows-trader/src/main/resources/certificates/readme.txt diff --git a/samples/trader-demo/src/main/resources/certificates/sslkeystore.jks b/samples/trader-demo/workflows-trader/src/main/resources/certificates/sslkeystore.jks similarity index 100% rename from samples/trader-demo/src/main/resources/certificates/sslkeystore.jks rename to samples/trader-demo/workflows-trader/src/main/resources/certificates/sslkeystore.jks diff --git a/samples/trader-demo/src/main/resources/certificates/truststore.jks b/samples/trader-demo/workflows-trader/src/main/resources/certificates/truststore.jks similarity index 100% rename from samples/trader-demo/src/main/resources/certificates/truststore.jks rename to samples/trader-demo/workflows-trader/src/main/resources/certificates/truststore.jks diff --git a/samples/trader-demo/src/test/kotlin/net/corda/traderdemo/Main.kt b/samples/trader-demo/workflows-trader/src/test/kotlin/net/corda/traderdemo/Main.kt similarity index 100% rename from samples/trader-demo/src/test/kotlin/net/corda/traderdemo/Main.kt rename to samples/trader-demo/workflows-trader/src/test/kotlin/net/corda/traderdemo/Main.kt diff --git a/samples/trader-demo/src/test/kotlin/net/corda/traderdemo/TransactionGraphSearchTests.kt b/samples/trader-demo/workflows-trader/src/test/kotlin/net/corda/traderdemo/TransactionGraphSearchTests.kt similarity index 100% rename from samples/trader-demo/src/test/kotlin/net/corda/traderdemo/TransactionGraphSearchTests.kt rename to samples/trader-demo/workflows-trader/src/test/kotlin/net/corda/traderdemo/TransactionGraphSearchTests.kt diff --git a/settings.gradle b/settings.gradle index 035c71f0f3..25dda61655 100644 --- a/settings.gradle +++ b/settings.gradle @@ -48,18 +48,22 @@ include 'tools:network-bootstrapper' include 'tools:cliutils' include 'example-code' project(':example-code').projectDir = file("$settingsDir/docs/source/example-code") -include 'samples:attachment-demo' -include 'samples:trader-demo' +include 'samples:attachment-demo:contracts' +include 'samples:attachment-demo:workflows' +include 'samples:trader-demo:workflows-trader' include 'samples:irs-demo' -include 'samples:irs-demo:cordapp' +include 'samples:irs-demo:cordapp:contracts-irs' +include 'samples:irs-demo:cordapp:workflows-irs' include 'samples:irs-demo:web' include 'samples:simm-valuation-demo' include 'samples:simm-valuation-demo:flows' include 'samples:simm-valuation-demo:contracts-states' -include 'samples:notary-demo' +include 'samples:notary-demo:contracts' +include 'samples:notary-demo:workflows' include 'samples:bank-of-corda-demo' -include 'samples:cordapp-configuration' -include 'samples:network-verifier' +include 'samples:cordapp-configuration:workflows' +include 'samples:network-verifier:contracts' +include 'samples:network-verifier:workflows' include 'serialization' // Common libraries - start